about summary refs log tree commit diff stats
path: root/src/jid.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/jid.c')
-rw-r--r--src/jid.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/jid.c b/src/jid.c
index 7955b98c..8f98d211 100644
--- a/src/jid.c
+++ b/src/jid.c
@@ -55,6 +55,7 @@ jid_create(const gchar * const str)
     // has resourcepart
     if (slashp != NULL) {
         result = malloc(sizeof(struct jid_t));
+        result->str = strdup(trimmed);
         result->resourcepart = g_strdup(slashp + 1);
         result->barejid = g_strndup(trimmed, strlen(trimmed) - strlen(result->resourcepart) - 1);
         result->fulljid = g_strdup(trimmed);
@@ -78,6 +79,7 @@ jid_create(const gchar * const str)
     // no resourcepart
     } else {
         result = malloc(sizeof(struct jid_t));
+        result->str = strdup(trimmed);
         result->resourcepart = NULL;
         result->barejid = g_strdup(trimmed);
         result->fulljid = NULL;
@@ -114,6 +116,7 @@ jid_create_room_jid(const char * const room, const char * const nick)
 void
 jid_destroy(Jid *jid)
 {
+    FREE_SET_NULL(jid->str);
     FREE_SET_NULL(jid->localpart);
     FREE_SET_NULL(jid->domainpart);
     FREE_SET_NULL(jid->resourcepart);
@@ -122,6 +125,12 @@ jid_destroy(Jid *jid)
     FREE_SET_NULL(jid);
 }
 
+gboolean
+jid_is_valid_room_form(Jid *jid)
+{
+    return (jid->fulljid != NULL);
+}
+
 /*
  * Given a full room JID of the form
  * room@server/nick