Mercurial > pidgin
diff src/protocols/jabber/message.c @ 7971:6fca0d9cc98b
[gaim-migrate @ 8648]
this particular work of art is topic changing support for jabber, and
support for setting the topic by just changing the text in the chat window.
hopefully someone less lazy than I will implement the right function for
IRC, and any other chats that do topics.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Fri, 02 Jan 2004 06:16:44 +0000 |
parents | 64e94b6823c3 |
children | ac01b7d67ff9 |
line wrap: on
line diff
--- a/src/protocols/jabber/message.c Thu Jan 01 18:20:01 2004 +0000 +++ b/src/protocols/jabber/message.c Fri Jan 02 06:16:44 2004 +0000 @@ -178,9 +178,19 @@ if(!chat) return; - if(jm->subject) + if(jm->subject) { gaim_conv_chat_set_topic(GAIM_CONV_CHAT(chat->conv), jid->resource, jm->subject); + if(!jm->xhtml && !jm->body) { + char *msg; + if(jid->resource) + msg = g_strdup_printf(_("%s has set the topic to: %s"), jid->resource, jm->subject); + else + msg = g_strdup_printf(_("The topic is: %s"), jm->subject); + gaim_conv_chat_write(GAIM_CONV_CHAT(chat->conv), "", msg, GAIM_MESSAGE_SYSTEM, jm->sent); + g_free(msg); + } + } if(jm->xhtml || jm->body) { if(jid->resource) @@ -394,7 +404,7 @@ xmlnode_set_attrib(message, "to", jm->to); - if(jm->events || (!jm->body && !jm->xhtml)) { + if(jm->events || (!jm->body && !jm->xhtml && !jm->subject)) { child = xmlnode_new_child(message, "x"); xmlnode_set_attrib(child, "xmlns", "jabber:x:event"); if(jm->events & JABBER_MESSAGE_EVENT_COMPOSING) @@ -485,6 +495,10 @@ return 1; } else if(!strcmp(msg, "/register")) { jabber_chat_register(chat); + return 1; + } else if(!strncmp(msg, "/topic", 6)) { + jabber_chat_change_topic(chat, strlen(msg) > 7 ? msg+7 : NULL); + return 1; } jm = g_new0(JabberMessage, 1);