Mercurial > pidgin
diff src/protocols/jabber/chat.c @ 11393:1e756e251dc3
[gaim-migrate @ 13623]
patch from Ken Tossell for jabber chat affiliations
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Wed, 31 Aug 2005 19:08:33 +0000 |
parents | e8890f996cc1 |
children | fc464a0abccc |
line wrap: on
line diff
--- a/src/protocols/jabber/chat.c Wed Aug 31 19:00:27 2005 +0000 +++ b/src/protocols/jabber/chat.c Wed Aug 31 19:08:33 2005 +0000 @@ -854,6 +854,32 @@ return TRUE; } +gboolean jabber_chat_affiliate_user(JabberChat *chat, const char *who, const char *affiliation) +{ + JabberIq *iq; + JabberChatMember *jcm = g_hash_table_lookup(chat->members, who); + char *to; + xmlnode *query, *item; + + if (!jcm || !jcm->jid) + return FALSE; + + iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, + "http://jabber.org/protocol/muc#admin"); + + to = g_strdup_printf("%s@%s", chat->room, chat->server); + xmlnode_set_attrib(iq->node, "to", to); + g_free(to); + + query = xmlnode_get_child(iq->node, "query"); + item = xmlnode_new_child(query, "item"); + xmlnode_set_attrib(item, "jid", jcm->jid); + xmlnode_set_attrib(item, "affiliation", affiliation); + + jabber_iq_send(iq); + + return TRUE; +} gboolean jabber_chat_kick_user(JabberChat *chat, const char *who, const char *why) {