about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-02-24 15:18:15 +0000
committerJames Booth <boothj5@gmail.com>2013-02-24 15:18:15 +0000
commit236895ec96eb65059a0546826b0e5a4dde8c5c97 (patch)
treeff5205147a7593779fac346528a329641082bd33 /src/xmpp
parent9f8a7f52a5e1a43224d9418c1e64463d2affc5b1 (diff)
downloadprofani-tty-236895ec96eb65059a0546826b0e5a4dde8c5c97.tar.gz
Check for resource in unavailable presence handler
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/presence.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c
index b9f2b8d4..498df671 100644
--- a/src/xmpp/presence.c
+++ b/src/xmpp/presence.c
@@ -342,9 +342,13 @@ _unavailable_handler(xmpp_conn_t * const conn,
         status_str = NULL;
 
     if (strcmp(my_jid->barejid, from_jid->barejid) !=0) {
-        prof_handle_contact_offline(from_jid->barejid, from_jid->resourcepart, status_str);
+        if (from_jid->resourcepart != NULL) {
+            prof_handle_contact_offline(from_jid->barejid, from_jid->resourcepart, status_str);
+        }
     } else {
-        connection_remove_available_resource(from_jid->resourcepart);
+        if (from_jid->resourcepart != NULL) {
+            connection_remove_available_resource(from_jid->resourcepart);
+        }
     }
 
     jid_destroy(my_jid);
@@ -422,7 +426,7 @@ _available_handler(xmpp_conn_t * const conn,
 
     // if not self presence
     if (strcmp(my_jid->barejid, from_jid->barejid) !=0) {
-        // create the resource, if fulljid    
+        // create the resource, if fulljid
         if (from_jid->resourcepart != NULL) {
             resource_presence_t presence = resource_presence_from_string(show_str);
             Resource *resource = resource_new(from_jid->resourcepart, presence,