diff options
Diffstat (limited to 'protocols')
| -rw-r--r-- | protocols/jabber/conference.c | 21 | ||||
| -rw-r--r-- | protocols/jabber/jabber.c | 2 | ||||
| -rw-r--r-- | protocols/jabber/jabber.h | 1 | ||||
| -rw-r--r-- | protocols/jabber/jabber_util.c | 19 | 
4 files changed, 27 insertions, 16 deletions
| diff --git a/protocols/jabber/conference.c b/protocols/jabber/conference.c index 24b5631a..f49dbd1c 100644 --- a/protocols/jabber/conference.c +++ b/protocols/jabber/conference.c @@ -64,6 +64,19 @@ struct groupchat *jabber_chat_join( struct im_connection *ic, char *room, char *  	return c;  } +void jabber_chat_free( struct groupchat *c ) +{ +	struct jabber_chat *jc = c->data; +	 +	jabber_buddy_remove_bare( c->ic, jc->name ); +	 +	g_free( jc->my_full_jid ); +	g_free( jc->name ); +	g_free( jc ); +	 +	imcb_chat_free( c ); +} +  int jabber_chat_msg( struct groupchat *c, char *message, int flags )  {  	struct im_connection *ic = c->ic; @@ -191,13 +204,7 @@ void jabber_chat_pkt_presence( struct im_connection *ic, struct jabber_buddy *bu  		if( s ) *s = '/';  		if( bud == jc->me ) -		{ -			jabber_buddy_remove_bare( ic, jc->name ); -			 -			g_free( jc->name ); -			g_free( jc ); -			imcb_chat_free( chat ); -		} +			jabber_chat_free( chat );  	}  } diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 9df1dc74..9176cd68 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -197,7 +197,7 @@ static void jabber_logout( struct im_connection *ic )  	jabber_end_stream( ic );  	while( ic->groupchats ) -		imcb_chat_free( ic->groupchats ); +		jabber_chat_free( ic->groupchats );  	if( jd->r_inpa >= 0 )  		b_event_remove( jd->r_inpa ); diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h index bc639fea..90c1e9f6 100644 --- a/protocols/jabber/jabber.h +++ b/protocols/jabber/jabber.h @@ -219,6 +219,7 @@ gboolean sasl_supported( struct im_connection *ic );  /* conference.c */  struct groupchat *jabber_chat_join( struct im_connection *ic, char *room, char *nick, char *password ); +void jabber_chat_free( struct groupchat *c );  int jabber_chat_msg( struct groupchat *ic, char *message, int flags );  int jabber_chat_leave( struct groupchat *c, const char *reason );  void jabber_chat_pkt_presence( struct im_connection *ic, struct jabber_buddy *bud, struct xt_node *node ); 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;  	}  } | 
