Changeset abbd8ed
- Timestamp:
- 2006-10-28T20:54:40Z (18 years ago)
- Branches:
- master
- Children:
- 47d3ac4
- Parents:
- 62d0c14
- Location:
- protocols/jabber
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/iq.c
r62d0c14 rabbd8ed 24 24 #include "jabber.h" 25 25 26 static xt_status jabber_parse_roster( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig ); 27 static xt_status jabber_iq_display_vcard( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig ); 28 26 29 xt_status jabber_pkt_iq( struct xt_node *node, gpointer data ) 27 30 { … … 135 138 if( strcmp( s, "jabber:iq:roster" ) == 0 ) 136 139 { 137 /* This is a roster push packet, probably. Here we 138 should check if the packet is legitimate by 139 checking if it really comes from the user's JID 140 and, if so, process it. */ 140 int bare_len = strlen( gc->acc->user ); 141 142 if( ( s = xt_find_attr( node, "from" ) ) == NULL || 143 ( strncmp( s, gc->acc->user, bare_len ) == 0 && 144 ( s[bare_len] == 0 || s[bare_len] == '/' ) ) ) 145 { 146 jabber_parse_roster( gc, node, NULL ); 147 148 /* Should we generate a reply here? Don't think it's 149 very important... */ 150 } 151 else 152 { 153 serv_got_crap( gc, "WARNING: %s tried to fake a roster push!", s ); 154 155 xt_free_node( reply ); 156 reply = jabber_make_error_packet( node, "not-allowed", "cancel" ); 157 pack = 0; 158 } 141 159 } 142 160 else … … 296 314 } 297 315 298 static xt_status jabber_parse_roster( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );299 300 316 int jabber_get_roster( struct gaim_connection *gc ) 301 317 { … … 318 334 { 319 335 struct xt_node *query, *c; 336 int initial = ( orig != NULL ); 320 337 321 338 query = xt_find_node( node->children, "query" ); … … 328 345 char *sub = xt_find_attr( c, "subscription" ); 329 346 330 if( jid && sub && ( strcmp( sub, "both" ) == 0 || strcmp( sub, "to" ) == 0 ) ) 331 add_buddy( gc, NULL, jid, name ); 347 if( !jid || !sub ) 348 { 349 /* Maybe warn. But how likely is this to happen in the first place? */ 350 } 351 else if( initial ) 352 { 353 if( ( strcmp( sub, "both" ) == 0 || strcmp( sub, "to" ) == 0 ) ) 354 add_buddy( gc, NULL, jid, name ); 355 } 356 else 357 { 358 /* This is a roster push item. Find out what changed exactly. */ 359 if( ( strcmp( sub, "both" ) == 0 || strcmp( sub, "to" ) == 0 ) ) 360 { 361 if( find_buddy( gc, jid ) == NULL ) 362 add_buddy( gc, NULL, jid, name ); 363 else 364 serv_buddy_rename( gc, jid, name ); 365 } 366 else if( strcmp( sub, "remove" ) == 0 ) 367 { 368 /* Don't have any API call for this yet! So let's 369 just try to handle this as well as we can. */ 370 jabber_buddy_remove_bare( gc, jid ); 371 serv_got_update( gc, jid, 0, 0, 0, 0, 0, 0 ); 372 /* FIXME! */ 373 } 374 } 332 375 333 376 c = c->next; 334 377 } 335 378 336 account_online( gc ); 379 if( initial ) 380 account_online( gc ); 337 381 338 382 return XT_HANDLED; 339 383 } 340 341 static xt_status jabber_iq_display_vcard( struct gaim_connection *gc, struct xt_node *node, struct xt_node *orig );342 384 343 385 int jabber_get_vcard( struct gaim_connection *gc, char *bare_jid ) -
protocols/jabber/jabber.c
r62d0c14 rabbd8ed 230 230 /* If the user likes typing notification and if we don't know 231 231 (and didn't probe before) if this resource supports XEP85, 232 include a probe in this packet now. */ 232 include a probe in this packet now. Also, if we know this 233 buddy does support XEP85, we have to send this <active/> 234 tag to tell that the user stopped typing (well, that's what 235 we guess when s/he pressed Enter...). */ 233 236 act = xt_new_node( "active", NULL, NULL ); 234 237 xt_add_attr( act, "xmlns", "http://jabber.org/protocol/chatstates" );
Note: See TracChangeset
for help on using the changeset viewer.