# HG changeset patch # User Nathan Walp # Date 1073057644 0 # Node ID 415df6fa0395a46df4df3b85e3da6f1b832e38f7 # Parent aa99b8390092991af8f93436607b775aa083fb41 [gaim-migrate @ 8651] jabber /part support (with /part messages!) the list of the cool jabber chat stuff I can do w/o certain extras from people who know who they are is getting shorter and shorter committer: Tailor Script diff -r aa99b8390092 -r 415df6fa0395 src/protocols/jabber/chat.c --- a/src/protocols/jabber/chat.c Fri Jan 02 08:15:52 2004 +0000 +++ b/src/protocols/jabber/chat.c Fri Jan 02 15:34:04 2004 +0000 @@ -212,20 +212,12 @@ { JabberStream *js = gc->proto_data; JabberChat *chat = jabber_chat_find_by_id(js, id); - char *room_jid; - xmlnode *presence; + if(!chat) return; - room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); - gaim_debug(GAIM_DEBUG_INFO, "jabber", "%s is leaving chat %s\n", - chat->nick, room_jid); - presence = xmlnode_new("presence"); - xmlnode_set_attrib(presence, "to", room_jid); - xmlnode_set_attrib(presence, "type", "unavailable"); - jabber_send(js, presence); - xmlnode_free(presence); + jabber_chat_part(chat, NULL); } void jabber_chat_destroy(JabberChat *chat) @@ -592,4 +584,24 @@ xmlnode_free(presence); } +void jabber_chat_part(JabberChat *chat, const char *msg) +{ + char *room_jid; + xmlnode *presence; + room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); + gaim_debug(GAIM_DEBUG_INFO, "jabber", "%s is leaving chat %s\n", + chat->nick, room_jid); + presence = xmlnode_new("presence"); + xmlnode_set_attrib(presence, "to", room_jid); + xmlnode_set_attrib(presence, "type", "unavailable"); + if(msg) { + xmlnode *status = xmlnode_new_child(presence, "status"); + xmlnode_insert_data(status, msg, -1); + } + jabber_send(chat->js, presence); + xmlnode_free(presence); + g_free(room_jid); +} + + diff -r aa99b8390092 -r 415df6fa0395 src/protocols/jabber/chat.h --- a/src/protocols/jabber/chat.h Fri Jan 02 08:15:52 2004 +0000 +++ b/src/protocols/jabber/chat.h Fri Jan 02 15:34:04 2004 +0000 @@ -57,6 +57,7 @@ void jabber_chat_change_topic(JabberChat *chat, const char *topic); void jabber_chat_set_topic(GaimConnection *gc, int id, const char *topic); void jabber_chat_change_nick(JabberChat *chat, const char *nick); +void jabber_chat_part(JabberChat *chat, const char *msg); #endif /* _GAIM_JABBER_CHAT_H_ */ diff -r aa99b8390092 -r 415df6fa0395 src/protocols/jabber/message.c --- a/src/protocols/jabber/message.c Fri Jan 02 08:15:52 2004 +0000 +++ b/src/protocols/jabber/message.c Fri Jan 02 15:34:04 2004 +0000 @@ -503,6 +503,9 @@ if(strlen(msg) > 6) jabber_chat_change_nick(chat, msg+6); return 1; + } else if(!strncmp(msg, "/part", 5)) { + jabber_chat_part(chat, strlen(msg) > 6 ? msg+6 : NULL); + return 1; } jm = g_new0(JabberMessage, 1); diff -r aa99b8390092 -r 415df6fa0395 src/protocols/jabber/presence.c --- a/src/protocols/jabber/presence.c Fri Jan 02 08:15:52 2004 +0000 +++ b/src/protocols/jabber/presence.c Fri Jan 02 15:34:04 2004 +0000 @@ -344,7 +344,7 @@ jabber_chat_destroy(chat); } else { gaim_conv_chat_remove_user(GAIM_CONV_CHAT(chat->conv), jid->resource, - NULL); + status); } } } else {