aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/jabber_util.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2007-07-02 23:12:03 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2007-07-02 23:12:03 +0100
commit9da0bbfd42609f0f3864b5a16a3c1c378b7217c9 (patch)
tree080ab25a0fd949429c33ba125b9df189807d0d3c /protocols/jabber/jabber_util.c
parent5d7dc007a418be0c897000e888e747047729c756 (diff)
Added (and using) jabber_chat_free() for better memory management, fixed
channel name generation code in root_commands.c and fixed one memory leak in jabber_buddy_remove_bare().
Diffstat (limited to 'protocols/jabber/jabber_util.c')
-rw-r--r--protocols/jabber/jabber_util.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c
index 53f97ff0..5b91c5ed 100644
--- a/protocols/jabber/jabber_util.c
+++ b/protocols/jabber/jabber_util.c
@@ -541,26 +541,31 @@ int jabber_buddy_remove( struct im_connection *ic, char *full_jid_ )
/* Remove a buddy completely; removes all resources that belong to the
specified bare JID. Use this when removing someone from the contact
list, for example. */
-int jabber_buddy_remove_bare( struct im_connection *ic, char *bare_jid_ )
+int jabber_buddy_remove_bare( struct im_connection *ic, char *bare_jid )
{
struct jabber_data *jd = ic->proto_data;
struct jabber_buddy *bud, *next;
- char *bare_jid;
- if( strchr( bare_jid_, '/' ) )
+ if( strchr( bare_jid, '/' ) )
return 0;
- bare_jid = jabber_normalize( bare_jid_ );
-
- if( ( bud = g_hash_table_lookup( jd->buddies, bare_jid ) ) )
+ if( ( bud = jabber_buddy_by_jid( ic, bare_jid, GET_BUDDY_FIRST ) ) )
{
/* Most important: Remove the hash reference. We don't know
this buddy anymore. */
g_hash_table_remove( jd->buddies, bud->bare_jid );
+ g_free( bud->bare_jid );
/* Deallocate the linked list of resources. */
while( bud )
{
+ /* ext_jid && anonymous means that this buddy is
+ specific to one groupchat (the one we're
+ currently cleaning up) so it can be deleted
+ completely. */
+ if( bud->ext_jid && bud->flags & JBFLAG_IS_ANONYMOUS )
+ imcb_remove_buddy( ic, bud->ext_jid, NULL );
+
next = bud->next;
g_free( bud->ext_jid );
g_free( bud->full_jid );
@@ -569,12 +574,10 @@ int jabber_buddy_remove_bare( struct im_connection *ic, char *bare_jid_ )
bud = next;
}
- g_free( bare_jid );
return 1;
}
else
{
- g_free( bare_jid );
return 0;
}
}