diff options
| author | dequis <dx@dxzone.com.ar> | 2014-07-20 03:28:49 -0300 | 
|---|---|---|
| committer | dequis <dx@dxzone.com.ar> | 2015-01-25 23:43:34 -0300 | 
| commit | be1efa31e01a96be922c7addba2d9207bfbdf5fc (patch) | |
| tree | 7ed979bde6284ded3cf1f1c1a7a870b2a55e9d00 /protocols/bee_chat.c | |
| parent | 8519f457c31139750b9f7497834ac90a57196d22 (diff) | |
Add handle_is_self() prpl function to fix JID mismatch confusion bugs
When bee_chat needs to check for self messages, it can call this
function to let the protocol implementation do the comparison.
In the case of jabber, sometimes the server reports a different username
after login, this one is stored in jd->internal_jid, and the one that is
used for login isn't changed
Diffstat (limited to 'protocols/bee_chat.c')
| -rw-r--r-- | protocols/bee_chat.c | 15 | 
1 files changed, 11 insertions, 4 deletions
| diff --git a/protocols/bee_chat.c b/protocols/bee_chat.c index 39110a10..e1d07925 100644 --- a/protocols/bee_chat.c +++ b/protocols/bee_chat.c @@ -79,6 +79,13 @@ void imcb_chat_free( struct groupchat *c )  	g_free( c );  } +static gboolean handle_is_self( struct im_connection *ic, const char *handle ) +{ +	return ( ic->acc->prpl->handle_is_self ) ? +		 ic->acc->prpl->handle_is_self( ic, handle ) : +		 ( ic->acc->prpl->handle_cmp( ic->acc->user, handle ) == 0 ); +} +  void imcb_chat_msg( struct groupchat *c, const char *who, char *msg, uint32_t flags, time_t sent_at )  {  	struct im_connection *ic = c->ic; @@ -88,7 +95,7 @@ void imcb_chat_msg( struct groupchat *c, const char *who, char *msg, uint32_t fl  	char *s;  	/* Gaim sends own messages through this too. IRC doesn't want this, so kill them */ -	if( g_strcasecmp( who, ic->acc->user ) == 0 ) +	if( handle_is_self( ic, who ) )  		return;  	bu = bee_user_by_handle( bee, ic, who ); @@ -138,7 +145,7 @@ void imcb_chat_topic( struct groupchat *c, char *who, char *topic, time_t set_at  	if( who == NULL)  		bu = NULL; -	else if( g_strcasecmp( who, ic->acc->user ) == 0 ) +	else if( handle_is_self( ic, who ) )  		bu = bee->user;  	else  		bu = bee_user_by_handle( bee, ic, who ); @@ -160,7 +167,7 @@ void imcb_chat_add_buddy( struct groupchat *c, const char *handle )  	if( set_getbool( &c->ic->bee->set, "debug" ) )  		imcb_log( c->ic, "User %s added to conversation %p", handle, c ); -	me = ic->acc->prpl->handle_cmp( handle, ic->acc->user ) == 0; +	me = handle_is_self( ic, handle );  	/* Most protocols allow people to join, even when they're not in  	   your contact list. Try to handle that here */ @@ -188,7 +195,7 @@ void imcb_chat_remove_buddy( struct groupchat *c, const char *handle, const char  		imcb_log( ic, "User %s removed from conversation %p (%s)", handle, c, reason ? reason : "" );  	/* It might be yourself! */ -	if( g_strcasecmp( handle, ic->acc->user ) == 0 ) +	if( handle_is_self( ic, handle ) )  	{  		if( c->joined == 0 )  			return; | 
