Changeset 1ba7e8f for protocols/jabber/conference.c
- Timestamp:
- 2008-02-15T17:38:57Z (17 years ago)
- Branches:
- master
- Children:
- 506e61b
- Parents:
- 0fbd3a6d (diff), eeb85a8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/conference.c
r0fbd3a6d r1ba7e8f 37 37 xt_add_attr( node, "xmlns", XMLNS_MUC ); 38 38 node = jabber_make_packet( "presence", NULL, roomjid, node ); 39 if( password ) 40 xt_add_child( node, xt_new_node( "password", password, NULL ) ); 39 41 jabber_cache_add( ic, node, jabber_chat_join_failed ); 40 42 … … 73 75 74 76 room = xt_find_attr( orig, "to" ); 75 if( ( bud = jabber_buddy_by_jid( ic, room, 0 ) ) ) 76 jabber_chat_free( jabber_chat_by_jid( ic, bud->bare_jid ) ); 77 77 bud = jabber_buddy_by_jid( ic, room, 0 ); 78 78 err = jabber_error_parse( xt_find_node( node->children, "error" ), XMLNS_STANZA_ERROR ); 79 79 if( err ) 80 80 { 81 imcb_error( ic, "Error joining groupchat %s: %s%s%s", 82 bud->bare_jid, err->code, err->text ? ": " : "", 83 err->text ? err->text : "" ); 81 imcb_error( ic, "Error joining groupchat %s: %s%s%s", room, err->code, 82 err->text ? ": " : "", err->text ? err->text : "" ); 84 83 jabber_error_free( err ); 85 84 } 85 if( bud ) 86 jabber_chat_free( jabber_chat_by_jid( ic, bud->bare_jid ) ); 86 87 87 88 return XT_HANDLED; … … 123 124 struct jabber_chat *jc = c->data; 124 125 struct xt_node *node; 126 127 jc->flags |= JCFLAG_MESSAGE_SENT; 125 128 126 129 node = xt_new_node( "body", message, NULL ); … … 296 299 struct xt_node *subject = xt_find_node( node->children, "subject" ); 297 300 struct xt_node *body = xt_find_node( node->children, "body" ); 298 struct groupchat *chat; 301 struct groupchat *chat = bud ? jabber_chat_by_jid( ic, bud->bare_jid ) : NULL; 302 struct jabber_chat *jc = chat ? chat->data : NULL; 299 303 char *s; 300 304 301 if( bud == NULL ) 302 { 305 if( bud == NULL || ( jc && ~jc->flags & JCFLAG_MESSAGE_SENT && bud == jc->me ) ) 306 { 307 char *nick; 308 309 if( body == NULL || body->text_len == 0 ) 310 /* Meh. Empty messages aren't very interesting, no matter 311 how much some servers love to send them. */ 312 return; 313 303 314 s = xt_find_attr( node, "from" ); /* pkt_message() already NULL-checked this one. */ 304 if( strchr( s, '/' ) == NULL ) 315 nick = strchr( s, '/' ); 316 if( nick ) 317 { 318 /* If this message included a resource/nick we don't know, 319 we might still know the groupchat itself. */ 320 *nick = 0; 321 chat = jabber_chat_by_jid( ic, s ); 322 *nick = '/'; 323 324 nick ++; 325 } 326 else 327 { 328 /* message.c uses the EXACT_JID option, so bud should 329 always be NULL here for bare JIDs. */ 330 chat = jabber_chat_by_jid( ic, s ); 331 } 332 333 if( nick == NULL ) 334 { 305 335 /* This is fine, the groupchat itself isn't in jd->buddies. */ 306 imcb_log( ic, "System message from groupchat %s: %s", s, body? body->text : "NULL" ); 336 if( chat ) 337 imcb_chat_log( chat, "From conference server: %s", body->text ); 338 else 339 imcb_log( ic, "System message from unknown groupchat %s: %s", s, body->text ); 340 } 307 341 else 308 /* This, however, isn't fine! */ 309 imcb_log( ic, "Groupchat message from unknown participant %s: %s", s, body ? body->text : "NULL" ); 342 { 343 /* This can happen too, at least when receiving a backlog when 344 just joining a channel. */ 345 if( chat ) 346 imcb_chat_log( chat, "Message from unknown participant %s: %s", nick, body->text ); 347 else 348 imcb_log( ic, "Groupchat message from unknown JID %s: %s", s, body->text ); 349 } 310 350 311 351 return; 312 352 } 313 else if( ( chat = jabber_chat_by_jid( ic, bud->bare_jid ) )== NULL )353 else if( chat == NULL ) 314 354 { 315 355 /* How could this happen?? We could do kill( self, 11 )
Note: See TracChangeset
for help on using the changeset viewer.