Changeset be1efa3 for protocols/jabber


Ignore:
Timestamp:
2015-01-26T02:43:34Z (10 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
fcb2c2e
Parents:
8519f45
git-author:
dequis <dx@…> (20-07-14 06:28:49)
git-committer:
dequis <dx@…> (26-01-15 02:43:34)
Message:

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

Location:
protocols/jabber
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/iq.c

    r8519f45 rbe1efa3  
    358358                                *s = '\0';
    359359                        jabber_set_me( ic, c->text );
    360                         imcb_log( ic, "Server claims your JID is `%s' instead of `%s'. "
    361                                   "This mismatch may cause problems with groupchats "
    362                                   "and possibly other things.",
    363                                   c->text, ic->acc->user );
    364360                        if( s )
    365361                                *s = '/';
  • protocols/jabber/jabber.c

    r8519f45 rbe1efa3  
    318318        g_free( jd->oauth2_access_token );
    319319        g_free( jd->away_message );
     320        g_free( jd->internal_jid );
    320321        g_free( jd->username );
    321322        g_free( jd->me );
     
    619620       
    620621        return NULL;
     622}
     623
     624gboolean jabber_handle_is_self( struct im_connection *ic, const char *who ) {
     625        struct jabber_data *jd = ic->proto_data;
     626        return ( ( g_strcasecmp( who, ic->acc->user ) == 0 ) ||
     627                 ( jd->internal_jid &&
     628                   g_strcasecmp( who, jd->internal_jid ) == 0 ) );
    621629}
    622630
     
    648656        ret->send_typing = jabber_send_typing;
    649657        ret->handle_cmp = g_strcasecmp;
     658        ret->handle_is_self = jabber_handle_is_self;
    650659        ret->transfer_request = jabber_si_transfer_request;
    651660        ret->buddy_action_list = jabber_buddy_action_list;
  • protocols/jabber/jabber.h

    r8519f45 rbe1efa3  
    9797        char *server;           /* username@SERVER -=> server/domain, not hostname */
    9898        char *me;               /* bare jid */
     99        char *internal_jid;
    99100       
    100101        const struct oauth2_service *oauth2_service;
  • protocols/jabber/jabber_util.c

    r8519f45 rbe1efa3  
    824824        jd->username = g_strndup( jd->me, jd->server - jd->me );
    825825        jd->server ++;
     826
     827        /* Set the "internal" account username, for groupchats */
     828        g_free( jd->internal_jid );
     829        jd->internal_jid = g_strdup( jd->me );
    826830       
    827831        return TRUE;
Note: See TracChangeset for help on using the changeset viewer.