Changeset 68286eb
- Timestamp:
- 2011-12-20T16:45:53Z (13 years ago)
- Branches:
- master
- Children:
- e14b47b8
- Parents:
- f9789d4
- Location:
- protocols/jabber
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/conference.c
rf9789d4 r68286eb 211 211 struct xt_node *c; 212 212 char *type = xt_find_attr( node, "type" ); 213 struct jabber_data *jd = ic->proto_data; 213 214 struct jabber_chat *jc; 214 215 char *s; … … 252 253 if( bud == jc->me ) 253 254 { 254 bud->ext_jid = jabber_normalize( ic->acc->user);255 bud->ext_jid = g_strdup( jd->me ); 255 256 } 256 257 else -
protocols/jabber/iq.c
rf9789d4 r68286eb 31 31 { 32 32 struct im_connection *ic = data; 33 struct jabber_data *jd = ic->proto_data; 33 34 struct xt_node *c, *reply = NULL; 34 35 char *type, *s; … … 170 171 was added to (or removed from) the buddy list. AFAIK they're 171 172 sent even if we added this buddy in our own session. */ 172 int bare_len = strlen( ic->acc->user);173 int bare_len = strlen( jd->me ); 173 174 174 175 if( ( s = xt_find_attr( node, "from" ) ) == NULL || 175 ( strncmp( s, ic->acc->user, bare_len ) == 0 &&176 ( strncmp( s, jd->me, bare_len ) == 0 && 176 177 ( s[bare_len] == 0 || s[bare_len] == '/' ) ) ) 177 178 { … … 343 344 { 344 345 c = xt_find_node( c->children, "jid" ); 345 if( c && c->text_len && ( s = strchr( c->text, '/' ) ) && 346 strcmp( s + 1, set_getstr( &ic->acc->set, "resource" ) ) != 0 ) 346 if( !c || !c->text ) 347 { 348 /* Server is crap, but this is no disaster. */ 349 } 350 else if( strncmp( jd->me, c->text, strlen( jd->me ) ) != 0 ) 351 { 352 s = strchr( c->text, '/' ); 353 if( s ) 354 *s = '\0'; 355 jabber_set_me( ic, c->text ); 356 imcb_log( ic, "Server claims your JID is `%s' instead of `%s'. " 357 "This mismatch may cause problems with groupchats " 358 "and possibly other things.", 359 c->text, ic->acc->user ); 360 if( s ) 361 *s = '/'; 362 } 363 else if( c && c->text_len && ( s = strchr( c->text, '/' ) ) && 364 strcmp( s + 1, set_getstr( &ic->acc->set, "resource" ) ) != 0 ) 347 365 imcb_log( ic, "Server changed session resource string to `%s'", s + 1 ); 348 366 } -
protocols/jabber/jabber.c
rf9789d4 r68286eb 111 111 ic->proto_data = jd; 112 112 113 jd->username = g_strdup( acc->user ); 114 jd->server = strchr( jd->username, '@' ); 113 jabber_set_me( ic, acc->user ); 115 114 116 115 jd->fd = jd->r_inpa = jd->w_inpa = -1; … … 122 121 return; 123 122 } 124 125 /* So don't think of free()ing jd->server.. :-) */126 *jd->server = 0;127 jd->server ++;128 123 129 124 if( ( s = strchr( jd->server, '/' ) ) ) … … 314 309 g_free( jd->away_message ); 315 310 g_free( jd->username ); 311 g_free( jd->me ); 316 312 g_free( jd ); 317 313 … … 495 491 static void jabber_chat_invite_( struct groupchat *c, char *who, char *msg ) 496 492 { 493 struct jabber_data *jd = c->ic->proto_data; 497 494 struct jabber_chat *jc = c->data; 498 495 gchar *msg_alt = NULL; 499 496 500 497 if( msg == NULL ) 501 msg_alt = g_strdup_printf( "%s invited you to %s", c->ic->acc->user, jc->name );498 msg_alt = g_strdup_printf( "%s invited you to %s", jd->me, jc->name ); 502 499 503 500 if( c && who ) -
protocols/jabber/jabber.h
rf9789d4 r68286eb 94 94 char *username; /* USERNAME@server */ 95 95 char *server; /* username@SERVER -=> server/domain, not hostname */ 96 char *me; /* bare jid */ 96 97 97 98 const struct oauth2_service *oauth2_service; … … 308 309 struct jabber_error *jabber_error_parse( struct xt_node *node, char *xmlns ); 309 310 void jabber_error_free( struct jabber_error *err ); 311 gboolean jabber_set_me( struct im_connection *ic, const char *me ); 310 312 311 313 extern const struct jabber_away_state jabber_away_state_list[]; -
protocols/jabber/jabber_util.c
rf9789d4 r68286eb 761 761 g_free( err ); 762 762 } 763 764 gboolean jabber_set_me( struct im_connection *ic, const char *me ) 765 { 766 struct jabber_data *jd = ic->proto_data; 767 768 if( strchr( me, '@' ) == NULL ) 769 return FALSE; 770 771 g_free( jd->username ); 772 g_free( jd->me ); 773 774 jd->me = jabber_normalize( me ); 775 jd->server = strchr( jd->me, '@' ); 776 jd->username = g_strndup( jd->me, jd->server - jd->me ); 777 jd->server ++; 778 779 return TRUE; 780 }
Note: See TracChangeset
for help on using the changeset viewer.