diff options
Diffstat (limited to 'protocols/jabber')
-rw-r--r-- | protocols/jabber/conference.c | 18 | ||||
-rw-r--r-- | protocols/jabber/jabber.h | 2 | ||||
-rw-r--r-- | protocols/jabber/message.c | 13 |
3 files changed, 23 insertions, 10 deletions
diff --git a/protocols/jabber/conference.c b/protocols/jabber/conference.c index e04b9792..0c2db0b3 100644 --- a/protocols/jabber/conference.c +++ b/protocols/jabber/conference.c @@ -311,6 +311,15 @@ void jabber_chat_pkt_message( struct im_connection *ic, struct jabber_buddy *bud struct jabber_chat *jc = chat ? chat->data : NULL; char *s; + if( subject && chat ) + { + s = bud ? strchr( bud->ext_jid, '/' ) : NULL; + if( s ) *s = 0; + imcb_chat_topic( chat, bud ? bud->ext_jid : NULL, subject->text_len > 0 ? + subject->text : NULL, jabber_get_timestamp( node ) ); + if( s ) *s = '/'; + } + if( bud == NULL || ( jc && ~jc->flags & JCFLAG_MESSAGE_SENT && bud == jc->me ) ) { char *nick; @@ -365,15 +374,6 @@ void jabber_chat_pkt_message( struct im_connection *ic, struct jabber_buddy *bud now or just wait for the OS to do it. :-) */ return; } - - if( subject ) - { - s = strchr( bud->ext_jid, '/' ); - if( s ) *s = 0; - imcb_chat_topic( chat, bud->ext_jid, subject->text_len > 0 ? - subject->text : NULL, jabber_get_timestamp( node ) ); - if( s ) *s = '/'; - } if( body && body->text_len > 0 ) { s = strchr( bud->ext_jid, '/' ); diff --git a/protocols/jabber/jabber.h b/protocols/jabber/jabber.h index 45a1c5c1..1523e096 100644 --- a/protocols/jabber/jabber.h +++ b/protocols/jabber/jabber.h @@ -58,6 +58,8 @@ typedef enum groupchat state info too. */ JBFLAG_IS_ANONYMOUS = 8, /* For anonymous chatrooms, when we don't have have a real JID. */ + JBFLAG_HIDE_SUBJECT = 16, /* Hide the subject field since we probably + showed it already. */ } jabber_buddy_flags_t; /* Stores a streamhost's (a.k.a. proxy) data */ diff --git a/protocols/jabber/message.c b/protocols/jabber/message.c index 6e40e521..85c71c9d 100644 --- a/protocols/jabber/message.c +++ b/protocols/jabber/message.c @@ -92,9 +92,20 @@ xt_status jabber_pkt_message( struct xt_node *node, gpointer data ) g_string_append_printf( fullmsg, "URL: %s\n", url->text ); } } - else if( ( c = xt_find_node( node->children, "subject" ) ) && c->text_len > 0 ) + else if( ( c = xt_find_node( node->children, "subject" ) ) && c->text_len > 0 && + ( !bud || !( bud->flags & JBFLAG_HIDE_SUBJECT ) ) ) { g_string_append_printf( fullmsg, "<< \002BitlBee\002 - Message with subject: %s >>\n", c->text ); + if( bud ) + bud->flags |= JBFLAG_HIDE_SUBJECT; + } + else if( bud && !c ) + { + /* Yeah, possibly we're hiding changes to this field now. But nobody uses + this for anything useful anyway, except GMail when people reply to an + e-mail via chat, repeating the same subject all the time. I don't want + to have to remember full subject strings for everyone. */ + bud->flags &= ~JBFLAG_HIDE_SUBJECT; } if( body && body->text_len > 0 ) /* Could be just a typing notification. */ |