Mercurial > pidgin.yaz
diff src/protocols/jabber/chat.c @ 13237:b0d020a66144
[gaim-migrate @ 15603]
SF patch 1411796 by Andrej Krivul????k
It adds a /role command to jabber chat rooms.
committer: Tailor Script <tailor@pidgin.im>
author | Etan Reisner <pidgin@unreliablesource.net> |
---|---|
date | Sun, 12 Feb 2006 04:35:35 +0000 |
parents | fc464a0abccc |
children | 967ef719cb62 |
line wrap: on
line diff
--- a/src/protocols/jabber/chat.c Sun Feb 12 04:22:16 2006 +0000 +++ b/src/protocols/jabber/chat.c Sun Feb 12 04:35:35 2006 +0000 @@ -856,10 +856,12 @@ gboolean jabber_chat_affiliate_user(JabberChat *chat, const char *who, const char *affiliation) { + char *to; JabberIq *iq; - JabberChatMember *jcm = g_hash_table_lookup(chat->members, who); - char *to; xmlnode *query, *item; + JabberChatMember *jcm; + + jcm = g_hash_table_lookup(chat->members, who); if (!jcm || !jcm->jid) return FALSE; @@ -881,6 +883,35 @@ return TRUE; } +gboolean jabber_chat_role_user(JabberChat *chat, const char *who, const char *role) +{ + char *to; + JabberIq *iq; + xmlnode *query, *item; + JabberChatMember *jcm; + + jcm = g_hash_table_lookup(chat->members, who); + + if (!jcm || !jcm->handle) + 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, "nick", jcm->handle); + xmlnode_set_attrib(item, "role", role); + + jabber_iq_send(iq); + + return TRUE; +} + gboolean jabber_chat_kick_user(JabberChat *chat, const char *who, const char *why) { JabberIq *iq;