comparison mcabber/mcabber/xmpp_muc.c @ 1994:024bdd1c6418

Add a dummy handler for some unhandled IQ replies
author Mikael Berthe <mikael@lilotux.net>
date Wed, 30 Mar 2011 22:02:48 +0200
parents 6febc7d1f760
children e0aedfa091ec
comparison
equal deleted inserted replaced
1993:d4273346d52d 1994:024bdd1c6418
23 23
24 #include <string.h> 24 #include <string.h>
25 #include <stdlib.h> 25 #include <stdlib.h>
26 26
27 #include "xmpp_helper.h" 27 #include "xmpp_helper.h"
28 #include "xmpp_iq.h"
28 #include "xmpp_muc.h" 29 #include "xmpp_muc.h"
29 #include "events.h" 30 #include "events.h"
30 #include "hooks.h" 31 #include "hooks.h"
31 #include "screen.h" 32 #include "screen.h"
32 #include "hbuf.h" 33 #include "hbuf.h"
192 int xmpp_room_setattrib(const char *roomid, const char *fjid, 193 int xmpp_room_setattrib(const char *roomid, const char *fjid,
193 const char *nick, struct role_affil ra, 194 const char *nick, struct role_affil ra,
194 const char *reason) 195 const char *reason)
195 { 196 {
196 LmMessage *iq; 197 LmMessage *iq;
198 LmMessageHandler *handler;
197 LmMessageNode *query, *x; 199 LmMessageNode *query, *x;
198 200
199 if (!xmpp_is_online() || !roomid) 201 if (!xmpp_is_online() || !roomid)
200 return 1; 202 return 1;
201 if (!fjid && !nick) return 1; 203 if (!fjid && !nick) return 1;
230 lm_message_node_set_attribute(x, "role", strrole[ra.val.role]); 232 lm_message_node_set_attribute(x, "role", strrole[ra.val.role]);
231 233
232 if (reason) 234 if (reason)
233 lm_message_node_add_child(x, "reason", reason); 235 lm_message_node_add_child(x, "reason", reason);
234 236
235 lm_connection_send(lconnection, iq, NULL); 237 handler = lm_message_handler_new(handle_iq_dummy, NULL, FALSE);
238 lm_connection_send_with_reply(lconnection, iq, handler, NULL);
239 lm_message_handler_unref(handler);
236 lm_message_unref(iq); 240 lm_message_unref(iq);
237 241
238 return 0; 242 return 0;
239 } 243 }
240 244
241 // Unlock a MUC room 245 // Unlock a MUC room
242 // room syntax: "room@server" 246 // room syntax: "room@server"
243 void xmpp_room_unlock(const char *room) 247 void xmpp_room_unlock(const char *room)
244 { 248 {
245 LmMessageNode *node; 249 LmMessageNode *node;
250 LmMessageHandler *handler;
246 LmMessage *iq; 251 LmMessage *iq;
247 252
248 if (!xmpp_is_online() || !room) 253 if (!xmpp_is_online() || !room)
249 return; 254 return;
250 255
255 lm_message_node_set_attribute(node, "xmlns", NS_MUC_OWNER); 260 lm_message_node_set_attribute(node, "xmlns", NS_MUC_OWNER);
256 node = lm_message_node_add_child(node, "x", NULL); 261 node = lm_message_node_add_child(node, "x", NULL);
257 lm_message_node_set_attributes(node, "xmlns", "jabber:x:data", 262 lm_message_node_set_attributes(node, "xmlns", "jabber:x:data",
258 "type", "submit", NULL); 263 "type", "submit", NULL);
259 264
260 lm_connection_send(lconnection, iq, NULL); 265 handler = lm_message_handler_new(handle_iq_dummy, NULL, FALSE);
266 lm_connection_send_with_reply(lconnection, iq, handler, NULL);
267 lm_message_handler_unref(handler);
261 lm_message_unref(iq); 268 lm_message_unref(iq);
262 } 269 }
263 270
264 // Destroy a MUC room 271 // Destroy a MUC room
265 // room syntax: "room@server" 272 // room syntax: "room@server"
266 void xmpp_room_destroy(const char *room, const char *venue, const char *reason) 273 void xmpp_room_destroy(const char *room, const char *venue, const char *reason)
267 { 274 {
268 LmMessage *iq; 275 LmMessage *iq;
276 LmMessageHandler *handler;
269 LmMessageNode *query, *x; 277 LmMessageNode *query, *x;
270 278
271 if (!xmpp_is_online() || !room) 279 if (!xmpp_is_online() || !room)
272 return; 280 return;
273 281
281 lm_message_node_set_attribute(x, "jid", venue); 289 lm_message_node_set_attribute(x, "jid", venue);
282 290
283 if (reason) 291 if (reason)
284 lm_message_node_add_child(x, "reason", reason); 292 lm_message_node_add_child(x, "reason", reason);
285 293
286 lm_connection_send(lconnection, iq, NULL); 294 handler = lm_message_handler_new(handle_iq_dummy, NULL, FALSE);
295 lm_connection_send_with_reply(lconnection, iq, handler, NULL);
296 lm_message_handler_unref(handler);
287 lm_message_unref(iq); 297 lm_message_unref(iq);
288 } 298 }
289 299
290 // muc_get_item_info(...) 300 // muc_get_item_info(...)
291 // Get room member's information from xmlndata. 301 // Get room member's information from xmlndata.