Changes in protocols/jabber/jabber_util.c [2ff2076:5bd21df]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/jabber_util.c
r2ff2076 r5bd21df 97 97 } 98 98 99 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type , char *err_code)99 struct xt_node *jabber_make_error_packet( struct xt_node *orig, char *err_cond, char *err_type ) 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 );115 111 116 112 /* To make the actual error packet, we copy the original packet and … … 183 179 return FALSE; 184 180 } 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-cache 193 ID) we don't know how to handle the packet and we 194 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; 185 211 } 186 212 … … 265 291 new = g_new( char, len + 1 ); 266 292 for( i = 0; i < len; i ++ ) 267 {268 /* don't normalize the resource */269 if( orig[i] == '/' )270 break;271 293 new[i] = tolower( orig[i] ); 272 }273 for( ; i < len; i ++ )274 new[i] = orig[i];275 294 276 295 new[i] = 0; … … 595 614 } 596 615 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 614 616 time_t jabber_get_timestamp( struct xt_node *xt ) 615 617 { … … 663 665 struct jabber_error *jabber_error_parse( struct xt_node *node, char *xmlns ) 664 666 { 665 struct jabber_error *err = g_new0( struct jabber_error, 1 );667 struct jabber_error *err; 666 668 struct xt_node *c; 667 669 char *s; 668 670 671 if( node == NULL ) 672 return NULL; 673 674 err = g_new0( struct jabber_error, 1 ); 669 675 err->type = xt_find_attr( node, "type" ); 670 676
Note: See TracChangeset
for help on using the changeset viewer.