| 1069 |
1070 |
| 1070 query = xmlnode_get_child(iq->node, "query"); |
1071 query = xmlnode_get_child(iq->node, "query"); |
| 1071 item = xmlnode_new_child(query, "item"); |
1072 item = xmlnode_new_child(query, "item"); |
| 1072 xmlnode_set_attrib(item, "nick", jcm->handle); |
1073 xmlnode_set_attrib(item, "nick", jcm->handle); |
| 1073 xmlnode_set_attrib(item, "role", role); |
1074 xmlnode_set_attrib(item, "role", role); |
| |
1075 if (why) { |
| |
1076 xmlnode *reason = xmlnode_new_child(item, "reason"); |
| |
1077 xmlnode_insert_data(reason, why, -1); |
| |
1078 } |
| 1074 |
1079 |
| 1075 jabber_iq_send(iq); |
1080 jabber_iq_send(iq); |
| 1076 |
1081 |
| 1077 return TRUE; |
1082 return TRUE; |
| 1078 } |
1083 } |
| 1136 jabber_iq_send(iq); |
1141 jabber_iq_send(iq); |
| 1137 |
1142 |
| 1138 return TRUE; |
1143 return TRUE; |
| 1139 } |
1144 } |
| 1140 |
1145 |
| 1141 gboolean jabber_chat_kick_user(JabberChat *chat, const char *who, const char *why) |
|
| 1142 { |
|
| 1143 JabberIq *iq; |
|
| 1144 JabberChatMember *jcm = g_hash_table_lookup(chat->members, who); |
|
| 1145 char *to; |
|
| 1146 xmlnode *query, *item, *reason; |
|
| 1147 |
|
| 1148 if(!jcm || !jcm->jid) |
|
| 1149 return FALSE; |
|
| 1150 |
|
| 1151 iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, |
|
| 1152 "http://jabber.org/protocol/muc#admin"); |
|
| 1153 |
|
| 1154 to = g_strdup_printf("%s@%s", chat->room, chat->server); |
|
| 1155 xmlnode_set_attrib(iq->node, "to", to); |
|
| 1156 g_free(to); |
|
| 1157 |
|
| 1158 query = xmlnode_get_child(iq->node, "query"); |
|
| 1159 item = xmlnode_new_child(query, "item"); |
|
| 1160 xmlnode_set_attrib(item, "jid", jcm->jid); |
|
| 1161 xmlnode_set_attrib(item, "role", "none"); |
|
| 1162 if(why) { |
|
| 1163 reason = xmlnode_new_child(item, "reason"); |
|
| 1164 xmlnode_insert_data(reason, why, -1); |
|
| 1165 } |
|
| 1166 |
|
| 1167 jabber_iq_send(iq); |
|
| 1168 |
|
| 1169 return TRUE; |
|
| 1170 } |
|
| 1171 |
|
| 1172 static void jabber_chat_disco_traffic_cb(JabberStream *js, const char *from, |
1146 static void jabber_chat_disco_traffic_cb(JabberStream *js, const char *from, |
| 1173 JabberIqType type, const char *id, |
1147 JabberIqType type, const char *id, |
| 1174 xmlnode *packet, gpointer data) |
1148 xmlnode *packet, gpointer data) |
| 1175 { |
1149 { |
| 1176 JabberChat *chat; |
1150 JabberChat *chat; |