Changeset a882d6c


Ignore:
Timestamp:
2008-01-20T11:15:40Z (16 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
613cc55
Parents:
31e5846
Message:

The Jabber module now uses imcb_chat_log() instead of imcb_log() where
possible.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/conference.c

    r31e5846 ra882d6c  
    295295        struct xt_node *subject = xt_find_node( node->children, "subject" );
    296296        struct xt_node *body = xt_find_node( node->children, "body" );
    297         struct groupchat *chat;
     297        struct groupchat *chat = NULL;
    298298        char *s;
    299299       
    300300        if( bud == NULL )
    301301        {
     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               
    302309                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                {
    304330                        /* 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                }
    306336                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                }
    309345               
    310346                return;
Note: See TracChangeset for help on using the changeset viewer.