1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Refactor resource handling in available handler

This commit is contained in:
James Booth 2013-03-17 21:53:34 +00:00
parent e7202120cb
commit e22970b304

View File

@ -425,22 +425,20 @@ _available_handler(xmpp_conn_t * const conn,
} }
} }
// if not self presence // handle resource, if exists
if (strcmp(my_jid->barejid, from_jid->barejid) !=0) { if (from_jid->resourcepart != NULL) {
// create the resource, if fulljid resource_presence_t presence = resource_presence_from_string(show_str);
if (from_jid->resourcepart != NULL) { Resource *resource = resource_new(from_jid->resourcepart, presence,
resource_presence_t presence = resource_presence_from_string(show_str); status_str, priority, caps_key);
Resource *resource = resource_new(from_jid->resourcepart, presence,
status_str, priority, caps_key); // self presence
prof_handle_contact_online(from_jid->barejid, resource, last_activity); if (strcmp(my_jid->barejid, from_jid->barejid) ==0) {
}
} else {
// handle self presenc, 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,
status_str, priority, caps_key);
connection_add_available_resource(resource); connection_add_available_resource(resource);
// contact presence
} else {
prof_handle_contact_online(from_jid->barejid, resource,
last_activity);
} }
} }