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/jabber/jabber.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/jabber/jabber.c')
-rw-r--r-- | protocols/jabber/jabber.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 4b5cb3a1..ccc13f47 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -317,6 +317,7 @@ static void jabber_logout( struct im_connection *ic ) g_free( jd->oauth2_access_token ); g_free( jd->away_message ); + g_free( jd->internal_jid ); g_free( jd->username ); g_free( jd->me ); g_free( jd ); @@ -620,6 +621,13 @@ void *jabber_buddy_action( struct bee_user *bu, const char *action, char * const return NULL; } +gboolean jabber_handle_is_self( struct im_connection *ic, const char *who ) { + struct jabber_data *jd = ic->proto_data; + return ( ( g_strcasecmp( who, ic->acc->user ) == 0 ) || + ( jd->internal_jid && + g_strcasecmp( who, jd->internal_jid ) == 0 ) ); +} + void jabber_initmodule() { struct prpl *ret = g_new0( struct prpl, 1 ); @@ -647,6 +655,7 @@ void jabber_initmodule() ret->keepalive = jabber_keepalive; ret->send_typing = jabber_send_typing; ret->handle_cmp = g_strcasecmp; + ret->handle_is_self = jabber_handle_is_self; ret->transfer_request = jabber_si_transfer_request; ret->buddy_action_list = jabber_buddy_action_list; ret->buddy_action = jabber_buddy_action; |