Mercurial > pidgin
diff src/protocols/jabber/chat.c @ 7974:415df6fa0395
[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 <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Fri, 02 Jan 2004 15:34:04 +0000 |
parents | ac01b7d67ff9 |
children | c4b5a35c7a12 |
line wrap: on
line diff
--- 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); +} + +