~lericson/bitlbee/bitlbee-toxik

« back to all changes in this revision

Viewing changes to protocols/jabber/conference.c

  • Committer: Ludvig Ericson
  • Date: 2008-01-25 16:34:21 UTC
  • mfrom: (181.1.7 bitlbee-mek-ft)
  • Revision ID: toxik@odin.valhall-20080125163421-li93zx1umx6peg8b
MergeĀ bitlbee-mek-ft.

Show diffs side-by-side

added added

removed removed

Lines of Context:
294
294
{
295
295
        struct xt_node *subject = xt_find_node( node->children, "subject" );
296
296
        struct xt_node *body = xt_find_node( node->children, "body" );
297
 
        struct groupchat *chat;
 
297
        struct groupchat *chat = NULL;
298
298
        char *s;
299
299
        
300
300
        if( bud == NULL )
301
301
        {
 
302
                char *nick;
 
303
                
 
304
                if( body == NULL || body->text_len == 0 )
 
305
                        /* Meh. Empty messages aren't very interesting, no matter
 
306
                           how much some servers love to send them. */
 
307
                        return;
 
308
                
302
309
                s = xt_find_attr( node, "from" ); /* pkt_message() already NULL-checked this one. */
303
 
                if( strchr( s, '/' ) == NULL )
 
310
                nick = strchr( s, '/' );
 
311
                if( nick )
 
312
                {
 
313
                        /* If this message included a resource/nick we don't know,
 
314
                           we might still know the groupchat itself. */
 
315
                        *nick = 0;
 
316
                        chat = jabber_chat_by_jid( ic, s );
 
317
                        *nick = '/';
 
318
                        
 
319
                        nick ++;
 
320
                }
 
321
                else
 
322
                {
 
323
                        /* message.c uses the EXACT_JID option, so bud should
 
324
                           always be NULL here for bare JIDs. */
 
325
                        chat = jabber_chat_by_jid( ic, s );
 
326
                }
 
327
                
 
328
                if( nick == NULL )
 
329
                {
304
330
                        /* This is fine, the groupchat itself isn't in jd->buddies. */
305
 
                        imcb_log( ic, "System message from groupchat %s: %s", s, body? body->text : "NULL" );
 
331
                        if( chat )
 
332
                                imcb_chat_log( chat, "From conference server: %s", body->text );
 
333
                        else
 
334
                                imcb_log( ic, "System message from unknown groupchat %s: %s", s, body->text );
 
335
                }
306
336
                else
307
 
                        /* This, however, isn't fine! */
308
 
                        imcb_log( ic, "Groupchat message from unknown participant %s: %s", s, body ? body->text : "NULL" );
 
337
                {
 
338
                        /* This can happen too, at least when receiving a backlog when
 
339
                           just joining a channel. */
 
340
                        if( chat )
 
341
                                imcb_chat_log( chat, "Message from unknown participant %s: %s", nick, body->text );
 
342
                        else
 
343
                                imcb_log( ic, "Groupchat message from unknown JID %s: %s", s, body->text );
 
344
                }
309
345
                
310
346
                return;
311
347
        }