Changes in protocols/jabber/jabber_util.c [5bd21df:2ff2076]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/jabber_util.c
r5bd21df r2ff2076 97 97 } 98 98 99 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type )99 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type, char *err_code ) 100 100 { 101 101 struct xt_node *node, *c; … … 109 109 c = xt_new_node( "error", NULL, c ); 110 110 xt_add_attr( c, "type", err_type ); 111 112 /* Add the error code, if present */ 113 if (err_code) 114 xt_add_attr( c, "code", err_code ); 111 115 112 116 /* To make the actual error packet, we copy the original packet and … … 179 183 return FALSE; 180 184 } 181 }182 183 xt_status jabber_cache_handle_packet( struct im_connection *ic, struct xt_node *node )184 {185 struct jabber_data *jd = ic->proto_data;186 struct jabber_cache_entry *entry;187 char *s;188 189 if( ( s = xt_find_attr( node, "id" ) ) == NULL ||190 strncmp( s, jd->cached_id_prefix, strlen( jd->cached_id_prefix ) ) != 0 )191 {192 /* Silently ignore it, without an ID (or a non-cache193 ID) we don't know how to handle the packet and we194 probably don't have to. */195 return XT_HANDLED;196 }197 198 entry = g_hash_table_lookup( jd->node_cache, s );199 200 if( entry == NULL )201 {202 imcb_log( ic, "WARNING: Received %s-%s packet with unknown/expired ID %s!",203 node->name, xt_find_attr( node, "type" ) ? : "(no type)", s );204 }205 else if( entry->func )206 {207 return entry->func( ic, node, entry->node );208 }209 210 return XT_HANDLED;211 185 } 212 186 … … 291 265 new = g_new( char, len + 1 ); 292 266 for( i = 0; i < len; i ++ ) 267 { 268 /* don't normalize the resource */ 269 if( orig[i] == '/' ) 270 break; 293 271 new[i] = tolower( orig[i] ); 272 } 273 for( ; i < len; i ++ ) 274 new[i] = orig[i]; 294 275 295 276 new[i] = 0; … … 614 595 } 615 596 597 struct groupchat *jabber_chat_by_name( struct im_connection *ic, const char *name ) 598 { 599 char *normalized = jabber_normalize( name ); 600 struct groupchat *ret; 601 struct jabber_chat *jc; 602 603 for( ret = ic->groupchats; ret; ret = ret->next ) 604 { 605 jc = ret->data; 606 if( strcmp( normalized, jc->name ) == 0 ) 607 break; 608 } 609 g_free( normalized ); 610 611 return ret; 612 } 613 616 614 time_t jabber_get_timestamp( struct xt_node *xt ) 617 615 { … … 665 663 struct jabber_error *jabber_error_parse( struct xt_node *node, char *xmlns ) 666 664 { 667 struct jabber_error *err ;665 struct jabber_error *err = g_new0( struct jabber_error, 1 ); 668 666 struct xt_node *c; 669 667 char *s; 670 668 671 if( node == NULL )672 return NULL;673 674 err = g_new0( struct jabber_error, 1 );675 669 err->type = xt_find_attr( node, "type" ); 676 670
Note: See TracChangeset
for help on using the changeset viewer.