Changes in / [94d52d64:fc5d06d]
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
configure
r94d52d64 rfc5d06d 135 135 [ -z "$CFLAGS" ] && CFLAGS=-g 136 136 echo 'DEBUG=1' >> Makefile.settings 137 echo '#define DEBUG' >> config.h137 CFLAGS="$CFLAGS -DDEBUG" 138 138 else 139 139 [ -z "$CFLAGS" ] && CFLAGS="-O2 -fno-strict-aliasing" -
protocols/jabber/conference.c
r94d52d64 rfc5d06d 24 24 #include "jabber.h" 25 25 26 static xt_status jabber_chat_join_failed( struct im_connection *ic, struct xt_node *node, struct xt_node *orig ); 27 26 28 struct groupchat *jabber_chat_join( struct im_connection *ic, char *room, char *nick, char *password ) 27 29 { … … 35 37 xt_add_attr( node, "xmlns", XMLNS_MUC ); 36 38 node = jabber_make_packet( "presence", NULL, roomjid, node ); 39 jabber_cache_add( ic, node, jabber_chat_join_failed ); 37 40 38 41 if( !jabber_write_packet( ic, node ) ) 39 42 { 40 43 g_free( roomjid ); 41 xt_free_node( node );42 44 return NULL; 43 45 } 44 xt_free_node( node );45 46 46 47 jc = g_new0( struct jabber_chat, 1 ); … … 63 64 64 65 return c; 66 } 67 68 static xt_status jabber_chat_join_failed( struct im_connection *ic, struct xt_node *node, struct xt_node *orig ) 69 { 70 struct jabber_error *err; 71 struct jabber_buddy *bud; 72 char *room; 73 74 room = xt_find_attr( orig, "to" ); 75 bud = jabber_buddy_by_jid( ic, room, 0 ); 76 77 err = jabber_error_parse( xt_find_node( node->children, "error" ), XMLNS_STANZA_ERROR ); 78 if( err ) 79 { 80 imcb_error( ic, "Error joining groupchat %s: %s%s%s", 81 bud->bare_jid, err->code, err->text ? ": " : "", 82 err->text ? err->text : "" ); 83 jabber_error_free( err ); 84 } 85 86 if( bud ) 87 jabber_chat_free( jabber_chat_by_jid( ic, bud->bare_jid ) ); 88 } 89 90 struct groupchat *jabber_chat_by_jid( struct im_connection *ic, const char *name ) 91 { 92 char *normalized = jabber_normalize( name ); 93 struct groupchat *ret; 94 struct jabber_chat *jc; 95 96 for( ret = ic->groupchats; ret; ret = ret->next ) 97 { 98 jc = ret->data; 99 if( strcmp( normalized, jc->name ) == 0 ) 100 break; 101 } 102 g_free( normalized ); 103 104 return ret; 65 105 } 66 106 … … 148 188 char *s; 149 189 150 if( ( chat = jabber_chat_by_ name( ic, bud->bare_jid ) ) == NULL )190 if( ( chat = jabber_chat_by_jid( ic, bud->bare_jid ) ) == NULL ) 151 191 { 152 192 /* How could this happen?? We could do kill( self, 11 ) … … 250 290 return; 251 291 } 252 else if( ( chat = jabber_chat_by_ name( ic, bud->bare_jid ) ) == NULL )292 else if( ( chat = jabber_chat_by_jid( ic, bud->bare_jid ) ) == NULL ) 253 293 { 254 294 /* How could this happen?? We could do kill( self, 11 ) -
protocols/jabber/iq.c
r94d52d64 rfc5d06d 31 31 { 32 32 struct im_connection *ic = data; 33 struct jabber_data *jd = ic->proto_data;34 33 struct xt_node *c, *reply = NULL; 35 34 char *type, *s; … … 47 46 if( strcmp( type, "result" ) == 0 || strcmp( type, "error" ) == 0 ) 48 47 { 49 struct jabber_cache_entry *entry; 50 51 if( ( s = xt_find_attr( node, "id" ) ) == NULL || 52 strncmp( s, jd->cached_id_prefix, strlen( jd->cached_id_prefix ) ) != 0 ) 53 { 54 /* Silently ignore it, without an ID (or a non-cache 55 ID) we don't know how to handle the packet and we 56 probably don't have to. */ 57 return XT_HANDLED; 58 } 59 60 entry = g_hash_table_lookup( jd->node_cache, s ); 61 62 if( entry == NULL ) 63 imcb_log( ic, "WARNING: Received IQ-%s packet with unknown/expired ID %s!", type, s ); 64 else if( entry->func ) 65 return entry->func( ic, node, entry->node ); 48 return jabber_cache_handle_packet( ic, node ); 66 49 } 67 50 else if( strcmp( type, "get" ) == 0 ) -
protocols/jabber/jabber.c
r94d52d64 rfc5d06d 226 226 jd->cached_id_prefix = g_strdup_printf( "%s%s", JABBER_CACHED_ID, s ); 227 227 g_free( s ); 228 229 printf( "%s\n", jd->cached_id_prefix );230 228 } 231 229 … … 272 270 return jabber_write( ic, message, strlen( message ) ); 273 271 274 if( ( s = strchr( who, '=' ) ) && jabber_chat_by_ name( ic, s + 1 ) )272 if( ( s = strchr( who, '=' ) ) && jabber_chat_by_jid( ic, s + 1 ) ) 275 273 bud = jabber_buddy_by_ext_jid( ic, who, 0 ); 276 274 else … … 399 397 if( strchr( room, '@' ) == NULL ) 400 398 imcb_error( ic, "Invalid room name: %s", room ); 401 else if( jabber_chat_by_ name( ic, room ) )399 else if( jabber_chat_by_jid( ic, room ) ) 402 400 imcb_error( ic, "Already present in chat `%s'", room ); 403 401 else -
protocols/jabber/jabber.h
r94d52d64 rfc5d06d 185 185 void jabber_cache_entry_free( gpointer entry ); 186 186 void jabber_cache_clean( struct im_connection *ic ); 187 xt_status jabber_cache_handle_packet( struct im_connection *ic, struct xt_node *node ); 187 188 const struct jabber_away_state *jabber_away_state_by_code( char *code ); 188 189 const struct jabber_away_state *jabber_away_state_by_name( char *name ); … … 207 208 int jabber_buddy_remove( struct im_connection *ic, char *full_jid ); 208 209 int jabber_buddy_remove_bare( struct im_connection *ic, char *bare_jid ); 209 struct groupchat *jabber_chat_by_name( struct im_connection *ic, const char *name );210 210 time_t jabber_get_timestamp( struct xt_node *xt ); 211 211 struct jabber_error *jabber_error_parse( struct xt_node *node, char *xmlns ); … … 230 230 /* conference.c */ 231 231 struct groupchat *jabber_chat_join( struct im_connection *ic, char *room, char *nick, char *password ); 232 struct groupchat *jabber_chat_by_jid( struct im_connection *ic, const char *name ); 232 233 void jabber_chat_free( struct groupchat *c ); 233 234 int jabber_chat_msg( struct groupchat *ic, char *message, int flags ); -
protocols/jabber/jabber_util.c
r94d52d64 rfc5d06d 179 179 return FALSE; 180 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; 181 211 } 182 212 … … 584 614 } 585 615 586 struct groupchat *jabber_chat_by_name( struct im_connection *ic, const char *name )587 {588 char *normalized = jabber_normalize( name );589 struct groupchat *ret;590 struct jabber_chat *jc;591 592 for( ret = ic->groupchats; ret; ret = ret->next )593 {594 jc = ret->data;595 if( strcmp( normalized, jc->name ) == 0 )596 break;597 }598 g_free( normalized );599 600 return ret;601 }602 603 616 time_t jabber_get_timestamp( struct xt_node *xt ) 604 617 { … … 652 665 struct jabber_error *jabber_error_parse( struct xt_node *node, char *xmlns ) 653 666 { 654 struct jabber_error *err = g_new0( struct jabber_error, 1 );667 struct jabber_error *err; 655 668 struct xt_node *c; 656 669 char *s; 657 670 671 if( node == NULL ) 672 return NULL; 673 674 err = g_new0( struct jabber_error, 1 ); 658 675 err->type = xt_find_attr( node, "type" ); 659 676 -
protocols/jabber/presence.c
r94d52d64 rfc5d06d 40 40 { 41 41 *s = 0; 42 if( jabber_chat_by_ name( ic, from ) )42 if( jabber_chat_by_jid( ic, from ) ) 43 43 is_chat = 1; 44 44 *s = '/'; … … 164 164 else if( strcmp( type, "error" ) == 0 ) 165 165 { 166 return jabber_cache_handle_packet( ic, node ); 167 168 /* 166 169 struct jabber_error *err; 167 168 170 if( ( c = xt_find_node( node->children, "error" ) ) ) 169 171 { … … 173 175 err->text ? err->text : "" ); 174 176 jabber_error_free( err ); 175 } 176 /* What else to do with it? */ 177 } */ 177 178 } 178 179
Note: See TracChangeset
for help on using the changeset viewer.