# HG changeset patch # User Mark Doliner # Date 1189138307 0 # Node ID e68694150fd83056a150b105f7444e320924b887 # Parent a486814031032e10fb3cef6b585e198e8a71207a Add the ability to affiliate people in an xmpp chat room even if they're not in the room. Just use their real bare jid instead of their room nickname. diff -r a48681403103 -r e68694150fd8 libpurple/protocols/jabber/chat.c --- a/libpurple/protocols/jabber/chat.c Fri Sep 07 01:52:47 2007 +0000 +++ b/libpurple/protocols/jabber/chat.c Fri Sep 07 04:11:47 2007 +0000 @@ -833,12 +833,18 @@ gboolean jabber_chat_ban_user(JabberChat *chat, const char *who, const char *why) { + JabberChatMember *jcm; + const char *jid; + char *to; JabberIq *iq; - JabberChatMember *jcm = g_hash_table_lookup(chat->members, who); - char *to; xmlnode *query, *item, *reason; - if(!jcm || !jcm->jid) + jcm = g_hash_table_lookup(chat->members, who); + if (jcm && jcm->jid) + jid = jcm->jid; + else if (g_utf8_strchr(who, -1, '@') != NULL) + jid = who; + else return FALSE; iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, @@ -850,7 +856,7 @@ query = xmlnode_get_child(iq->node, "query"); item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "jid", jcm->jid); + xmlnode_set_attrib(item, "jid", jid); xmlnode_set_attrib(item, "affiliation", "outcast"); if(why) { reason = xmlnode_new_child(item, "reason"); @@ -864,14 +870,18 @@ gboolean jabber_chat_affiliate_user(JabberChat *chat, const char *who, const char *affiliation) { + JabberChatMember *jcm; + const char *jid; char *to; JabberIq *iq; xmlnode *query, *item; - JabberChatMember *jcm; jcm = g_hash_table_lookup(chat->members, who); - - if (!jcm || !jcm->jid) + if (jcm && jcm->jid) + jid = jcm->jid; + else if (g_utf8_strchr(who, -1, '@') != NULL) + jid = who; + else return FALSE; iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, @@ -883,7 +893,7 @@ query = xmlnode_get_child(iq->node, "query"); item = xmlnode_new_child(query, "item"); - xmlnode_set_attrib(item, "jid", jcm->jid); + xmlnode_set_attrib(item, "jid", jid); xmlnode_set_attrib(item, "affiliation", affiliation); jabber_iq_send(iq);