From 08e5bb2bb2fcc7125f837be4f225d3a9ebf320ed Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Thu, 19 Nov 2009 18:50:53 +0000 Subject: Restoring some logic that seemed broken but was important with handling of chatrooms (and likely more things). The restored version is somewhat less confusing. --- protocols/jabber/jabber_util.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'protocols') diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c index ec23919e..120a56b6 100644 --- a/protocols/jabber/jabber_util.c +++ b/protocols/jabber/jabber_util.c @@ -419,9 +419,13 @@ struct jabber_buddy *jabber_buddy_by_jid( struct im_connection *ic, char *jid_, if( ( s = strchr( jid, '/' ) ) ) { + int bare_exists = 0; + *s = 0; if( ( bud = g_hash_table_lookup( jd->buddies, jid ) ) ) { + bare_exists = 1; + if( bud->next ) bud = bud->next; @@ -447,7 +451,8 @@ struct jabber_buddy *jabber_buddy_by_jid( struct im_connection *ic, char *jid_, break; } - if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && imcb_find_buddy( ic, jid ) ) + if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && + ( imcb_find_buddy( ic, jid ) || bare_exists ) ) { *s = '/'; bud = jabber_buddy_add( ic, jid ); -- cgit v1.2.3