Mercurial > pidgin.yaz
annotate src/protocols/jabber/chat.c @ 7974:415df6fa0395
[gaim-migrate @ 8651]
jabber /part support (with /part messages!)
the list of the cool jabber chat stuff I can do w/o certain extras
from people who know who they are is getting shorter and shorter
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Fri, 02 Jan 2004 15:34:04 +0000 |
parents | ac01b7d67ff9 |
children | c4b5a35c7a12 |
rev | line source |
---|---|
7014 | 1 /* |
2 * gaim - Jabber Protocol Plugin | |
3 * | |
4 * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 #include "internal.h" | |
22 #include "debug.h" | |
23 #include "multi.h" /* for proto_chat_entry */ | |
7310 | 24 #include "notify.h" |
7971 | 25 #include "util.h" |
7014 | 26 |
27 #include "chat.h" | |
7895 | 28 #include "iq.h" |
7014 | 29 #include "message.h" |
7073 | 30 #include "presence.h" |
7923 | 31 #include "xdata.h" |
7014 | 32 |
33 GList *jabber_chat_info(GaimConnection *gc) | |
34 { | |
35 GList *m = NULL; | |
36 struct proto_chat_entry *pce; | |
37 JabberStream *js = gc->proto_data; | |
38 | |
39 pce = g_new0(struct proto_chat_entry, 1); | |
7841 | 40 pce->label = _("_Room:"); |
7014 | 41 pce->identifier = "room"; |
42 m = g_list_append(m, pce); | |
43 | |
44 /* we're gonna default to a conference server I know is true, until | |
45 * I can figure out how to disco for a chat server */ | |
46 pce = g_new0(struct proto_chat_entry, 1); | |
7841 | 47 pce->label = _("_Server:"); |
7014 | 48 pce->identifier = "server"; |
49 pce->def = "conference.jabber.org"; | |
50 m = g_list_append(m, pce); | |
51 | |
52 pce = g_new0(struct proto_chat_entry, 1); | |
7841 | 53 pce->label = _("_Handle:"); |
7014 | 54 pce->identifier = "handle"; |
55 pce->def = js->user->node; | |
56 m = g_list_append(m, pce); | |
57 | |
58 pce = g_new0(struct proto_chat_entry, 1); | |
7841 | 59 pce->label = _("_Password:"); |
7014 | 60 pce->identifier = "password"; |
61 pce->secret = TRUE; | |
62 m = g_list_append(m, pce); | |
63 | |
64 return m; | |
65 } | |
66 | |
67 JabberChat *jabber_chat_find(JabberStream *js, const char *room, | |
68 const char *server) | |
69 { | |
70 JabberChat *chat; | |
71 char *room_jid; | |
72 | |
73 room_jid = g_strdup_printf("%s@%s", room, server); | |
74 | |
7322 | 75 chat = g_hash_table_lookup(js->chats, jabber_normalize(NULL, room_jid)); |
7014 | 76 g_free(room_jid); |
77 | |
78 return chat; | |
79 } | |
80 | |
81 struct _find_by_id_data { | |
82 int id; | |
83 JabberChat *chat; | |
84 }; | |
85 | |
86 void find_by_id_foreach_cb(gpointer key, gpointer value, gpointer user_data) | |
87 { | |
88 JabberChat *chat = value; | |
89 struct _find_by_id_data *fbid = user_data; | |
90 | |
91 if(chat->id == fbid->id) | |
92 fbid->chat = chat; | |
93 } | |
94 | |
95 JabberChat *jabber_chat_find_by_id(JabberStream *js, int id) | |
96 { | |
97 JabberChat *chat; | |
98 struct _find_by_id_data *fbid = g_new0(struct _find_by_id_data, 1); | |
7073 | 99 fbid->id = id; |
7014 | 100 g_hash_table_foreach(js->chats, find_by_id_foreach_cb, fbid); |
101 chat = fbid->chat; | |
102 g_free(fbid); | |
103 return chat; | |
104 } | |
105 | |
106 void jabber_chat_invite(GaimConnection *gc, int id, const char *msg, | |
107 const char *name) | |
108 { | |
109 JabberStream *js = gc->proto_data; | |
110 JabberChat *chat; | |
111 xmlnode *message, *body, *x, *invite; | |
112 char *room_jid; | |
113 | |
114 chat = jabber_chat_find_by_id(js, id); | |
115 if(!chat) | |
116 return; | |
117 | |
118 message = xmlnode_new("message"); | |
119 | |
120 room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); | |
121 | |
122 if(chat->muc) { | |
123 xmlnode_set_attrib(message, "to", room_jid); | |
124 x = xmlnode_new_child(message, "x"); | |
125 xmlnode_set_attrib(x, "xmlns", "http://jabber.org/protocol/muc#user"); | |
126 invite = xmlnode_new_child(x, "invite"); | |
127 xmlnode_set_attrib(invite, "to", name); | |
128 body = xmlnode_new_child(invite, "reason"); | |
129 xmlnode_insert_data(body, msg, -1); | |
130 } else { | |
131 xmlnode_set_attrib(message, "to", name); | |
132 body = xmlnode_new_child(message, "body"); | |
133 xmlnode_insert_data(body, msg, -1); | |
134 x = xmlnode_new_child(message, "x"); | |
135 xmlnode_set_attrib(x, "jid", room_jid); | |
136 xmlnode_set_attrib(x, "xmlns", "jabber:x:conference"); | |
137 } | |
138 | |
139 jabber_send(js, message); | |
140 xmlnode_free(message); | |
141 g_free(room_jid); | |
142 } | |
143 | |
144 void jabber_chat_join(GaimConnection *gc, GHashTable *data) | |
145 { | |
146 JabberChat *chat; | |
147 char *room, *server, *handle, *passwd; | |
148 xmlnode *presence, *x; | |
7262 | 149 char *tmp, *room_jid, *full_jid; |
7014 | 150 JabberStream *js = gc->proto_data; |
151 | |
152 room = g_hash_table_lookup(data, "room"); | |
153 server = g_hash_table_lookup(data, "server"); | |
154 handle = g_hash_table_lookup(data, "handle"); | |
155 passwd = g_hash_table_lookup(data, "password"); | |
156 | |
157 if(!room || !server || !handle) | |
158 return; | |
159 | |
7310 | 160 if(!jabber_nodeprep_validate(room)) { |
161 char *buf = g_strdup_printf(_("%s is not a valid room name"), room); | |
162 gaim_notify_error(gc, _("Invalid Room Name"), _("Invalid Room Name"), | |
163 buf); | |
164 g_free(buf); | |
165 return; | |
166 } else if(!jabber_nameprep_validate(server)) { | |
167 char *buf = g_strdup_printf(_("%s is not a valid server name"), server); | |
168 gaim_notify_error(gc, _("Invalid Server Name"), | |
169 _("Invalid Server Name"), buf); | |
170 g_free(buf); | |
171 return; | |
172 } else if(!jabber_resourceprep_validate(handle)) { | |
173 char *buf = g_strdup_printf(_("%s is not a valid room handle"), handle); | |
174 gaim_notify_error(gc, _("Invalid Room Handle"), | |
175 _("Invalid Room Handle"), buf); | |
176 } | |
177 | |
7014 | 178 if(jabber_chat_find(js, room, server)) |
179 return; | |
180 | |
7262 | 181 tmp = g_strdup_printf("%s@%s", room, server); |
7322 | 182 room_jid = g_strdup(jabber_normalize(NULL, tmp)); |
7262 | 183 g_free(tmp); |
7014 | 184 |
185 chat = g_new0(JabberChat, 1); | |
186 chat->js = gc->proto_data; | |
187 | |
188 chat->room = g_strdup(room); | |
189 chat->server = g_strdup(server); | |
190 chat->nick = g_strdup(handle); | |
191 | |
192 g_hash_table_insert(js->chats, room_jid, chat); | |
193 | |
7073 | 194 presence = jabber_presence_create(gc->away_state, gc->away); |
7014 | 195 full_jid = g_strdup_printf("%s/%s", room_jid, handle); |
196 xmlnode_set_attrib(presence, "to", full_jid); | |
197 g_free(full_jid); | |
198 | |
199 x = xmlnode_new_child(presence, "x"); | |
200 xmlnode_set_attrib(x, "xmlns", "http://jabber.org/protocol/muc"); | |
201 | |
202 if(passwd && *passwd) { | |
203 xmlnode *password = xmlnode_new_child(x, "password"); | |
204 xmlnode_insert_data(password, passwd, -1); | |
205 } | |
206 | |
207 jabber_send(js, presence); | |
208 xmlnode_free(presence); | |
209 } | |
210 | |
211 void jabber_chat_leave(GaimConnection *gc, int id) | |
212 { | |
213 JabberStream *js = gc->proto_data; | |
214 JabberChat *chat = jabber_chat_find_by_id(js, id); | |
7974 | 215 |
7014 | 216 |
217 if(!chat) | |
218 return; | |
219 | |
7974 | 220 jabber_chat_part(chat, NULL); |
7014 | 221 } |
222 | |
223 void jabber_chat_destroy(JabberChat *chat) | |
224 { | |
225 JabberStream *js = chat->js; | |
226 char *room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); | |
227 | |
7322 | 228 g_hash_table_remove(js->chats, jabber_normalize(NULL, room_jid)); |
7014 | 229 g_free(room_jid); |
230 | |
231 g_free(chat->room); | |
232 g_free(chat->server); | |
233 g_free(chat->nick); | |
234 g_free(chat); | |
235 } | |
236 | |
237 gboolean jabber_chat_find_buddy(GaimConversation *conv, const char *name) | |
238 { | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7073
diff
changeset
|
239 GList *m = gaim_conv_chat_get_users(GAIM_CONV_CHAT(conv)); |
7014 | 240 |
241 while(m) { | |
242 if(!strcmp(m->data, name)) | |
243 return TRUE; | |
244 m = m->next; | |
245 } | |
246 | |
247 return FALSE; | |
248 } | |
249 | |
7398 | 250 char *jabber_chat_buddy_real_name(GaimConnection *gc, int id, const char *who) |
251 { | |
252 JabberStream *js = gc->proto_data; | |
253 JabberChat *chat; | |
254 | |
255 chat = jabber_chat_find_by_id(js, id); | |
256 | |
257 if(!chat) | |
258 return NULL; | |
259 | |
260 return g_strdup_printf("%s@%s/%s", chat->room, chat->server, who); | |
261 } | |
7895 | 262 |
7923 | 263 static void jabber_chat_room_configure_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) |
264 { | |
265 JabberChat *chat = data; | |
266 xmlnode *query; | |
267 JabberIq *iq; | |
268 char *to = g_strdup_printf("%s@%s", chat->room, chat->server); | |
269 | |
270 iq = jabber_iq_new_query(js, JABBER_IQ_SET, "http://jabber.org/protocol/muc#owner"); | |
271 xmlnode_set_attrib(iq->node, "to", to); | |
272 g_free(to); | |
273 | |
274 query = xmlnode_get_child(iq->node, "query"); | |
275 | |
276 xmlnode_insert_child(query, result); | |
277 | |
278 jabber_iq_send(iq); | |
279 } | |
280 | |
281 static void jabber_chat_room_configure_cb(JabberStream *js, xmlnode *packet, gpointer data) | |
282 { | |
283 xmlnode *query, *x; | |
284 const char *type = xmlnode_get_attrib(packet, "type"); | |
285 const char *from = xmlnode_get_attrib(packet, "from"); | |
7926 | 286 char *msg; |
7923 | 287 JabberChat *chat; |
288 JabberID *jid; | |
289 | |
290 if(!type || !from) | |
291 return; | |
292 | |
293 | |
7926 | 294 |
7923 | 295 if(!strcmp(type, "result")) { |
296 jid = jabber_id_new(from); | |
297 | |
298 if(!jid) | |
299 return; | |
300 | |
301 chat = jabber_chat_find(js, jid->node, jid->domain); | |
302 jabber_id_free(jid); | |
303 | |
304 if(!chat) | |
305 return; | |
306 | |
307 if(!(query = xmlnode_get_child(packet, "query"))) | |
308 return; | |
309 | |
310 for(x = query->child; x; x = x->next) { | |
311 const char *xmlns; | |
312 if(strcmp(x->name, "x")) | |
313 continue; | |
314 | |
315 if(!(xmlns = xmlnode_get_attrib(x, "xmlns"))) | |
316 continue; | |
317 | |
318 if(!strcmp(xmlns, "jabber:x:data")) { | |
319 jabber_x_data_request(js, x, jabber_chat_room_configure_x_data_cb, chat); | |
320 return; | |
321 } | |
322 } | |
7926 | 323 } else if(!strcmp(type, "error")) { |
324 xmlnode *errnode = xmlnode_get_child(packet, "error"); | |
325 const char *code = NULL; | |
326 char *code_txt = NULL; | |
327 char *msg; | |
328 char *text = NULL; | |
329 | |
330 if(errnode) { | |
331 code = xmlnode_get_attrib(errnode, "code"); | |
332 text = xmlnode_get_data(errnode); | |
333 } | |
334 | |
335 if(code) | |
336 code_txt = g_strdup_printf(_(" (Code %s)"), code); | |
337 | |
338 msg = g_strdup_printf("%s%s", text ? text : "", code_txt ? code_txt : ""); | |
339 gaim_notify_error(js->gc, _("Configuration error"), _("Configuration error"), msg); | |
340 | |
341 g_free(msg); | |
342 if(code_txt) | |
343 g_free(code_txt); | |
344 | |
345 return; | |
7923 | 346 } |
347 | |
7926 | 348 msg = g_strdup_printf("Unable to configure room %s", from); |
349 | |
350 gaim_notify_info(js->gc, _("Unable to configure"), _("Unable to configure"), msg); | |
351 g_free(msg); | |
7923 | 352 |
353 } | |
354 | |
355 void jabber_chat_request_room_configure(JabberChat *chat) { | |
356 JabberIq *iq; | |
357 xmlnode *query; | |
358 char *room_jid; | |
359 | |
7895 | 360 if(!chat) |
361 return; | |
362 | |
7955 | 363 if(!chat->muc) { |
364 gaim_notify_error(chat->js->gc, _("Room Configuration Error"), _("Room Configuration Error"), | |
365 _("This room is not capable of being configured")); | |
366 return; | |
367 } | |
368 | |
7923 | 369 iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, |
370 "http://jabber.org/protocol/muc#owner"); | |
371 query = xmlnode_get_child(iq->node, "query"); | |
372 room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); | |
7895 | 373 |
7923 | 374 xmlnode_set_attrib(iq->node, "to", room_jid); |
375 | |
376 jabber_iq_set_callback(iq, jabber_chat_room_configure_cb, NULL); | |
377 | |
378 jabber_iq_send(iq); | |
379 | |
380 g_free(room_jid); | |
7895 | 381 } |
382 | |
383 void jabber_chat_create_instant_room(JabberChat *chat) { | |
384 JabberIq *iq; | |
385 xmlnode *query, *x; | |
386 char *room_jid; | |
387 | |
388 if(!chat) | |
389 return; | |
390 | |
391 iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET, | |
392 "http://jabber.org/protocol/muc#owner"); | |
393 query = xmlnode_get_child(iq->node, "query"); | |
394 x = xmlnode_new_child(query, "x"); | |
395 room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); | |
396 | |
397 xmlnode_set_attrib(iq->node, "to", room_jid); | |
398 xmlnode_set_attrib(x, "xmlns", "jabber:x:data"); | |
399 xmlnode_set_attrib(x, "type", "submit"); | |
400 | |
401 jabber_iq_send(iq); | |
402 | |
403 g_free(room_jid); | |
404 } | |
7955 | 405 |
406 static void jabber_chat_register_x_data_result_cb(JabberStream *js, xmlnode *packet, gpointer data) | |
407 { | |
408 const char *type = xmlnode_get_attrib(packet, "type"); | |
409 | |
410 if(type && !strcmp(type, "error")) { | |
411 /* XXX: handle an error (you'll get a 409 if the nick is already registered) */ | |
412 } | |
413 } | |
414 | |
415 static void jabber_chat_register_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) | |
416 { | |
417 JabberChat *chat = data; | |
418 xmlnode *query; | |
419 JabberIq *iq; | |
420 char *to = g_strdup_printf("%s@%s", chat->room, chat->server); | |
421 | |
422 iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:register"); | |
423 xmlnode_set_attrib(iq->node, "to", to); | |
424 g_free(to); | |
425 | |
426 query = xmlnode_get_child(iq->node, "query"); | |
427 | |
428 xmlnode_insert_child(query, result); | |
429 | |
430 jabber_iq_set_callback(iq, jabber_chat_register_x_data_result_cb, NULL); | |
431 | |
432 jabber_iq_send(iq); | |
433 } | |
434 | |
435 static void jabber_chat_register_cb(JabberStream *js, xmlnode *packet, gpointer data) | |
436 { | |
437 xmlnode *query, *x; | |
438 const char *type = xmlnode_get_attrib(packet, "type"); | |
439 const char *from = xmlnode_get_attrib(packet, "from"); | |
440 char *msg; | |
441 JabberChat *chat; | |
442 JabberID *jid; | |
443 | |
444 if(!type || !from) | |
445 return; | |
446 | |
447 if(!strcmp(type, "result")) { | |
448 jid = jabber_id_new(from); | |
449 | |
450 if(!jid) | |
451 return; | |
452 | |
453 chat = jabber_chat_find(js, jid->node, jid->domain); | |
454 jabber_id_free(jid); | |
455 | |
456 if(!chat) | |
457 return; | |
458 | |
459 if(!(query = xmlnode_get_child(packet, "query"))) | |
460 return; | |
461 | |
462 for(x = query->child; x; x = x->next) { | |
463 const char *xmlns; | |
464 if(strcmp(x->name, "x")) | |
465 continue; | |
466 | |
467 if(!(xmlns = xmlnode_get_attrib(x, "xmlns"))) | |
468 continue; | |
469 | |
470 if(!strcmp(xmlns, "jabber:x:data")) { | |
471 jabber_x_data_request(js, x, jabber_chat_register_x_data_cb, chat); | |
472 return; | |
473 } | |
474 } | |
475 } else if(!strcmp(type, "error")) { | |
476 /* XXX: how many places is this code duplicated? Fix it, immediately */ | |
477 xmlnode *errnode = xmlnode_get_child(packet, "error"); | |
478 const char *code = NULL; | |
479 char *code_txt = NULL; | |
480 char *msg; | |
481 char *text = NULL; | |
482 | |
483 if(errnode) { | |
484 code = xmlnode_get_attrib(errnode, "code"); | |
485 text = xmlnode_get_data(errnode); | |
486 } | |
487 | |
488 if(code) | |
489 code_txt = g_strdup_printf(_(" (Code %s)"), code); | |
490 | |
491 msg = g_strdup_printf("%s%s", text ? text : "", code_txt ? code_txt : ""); | |
492 gaim_notify_error(js->gc, _("Registration error"), _("Registration error"), msg); | |
493 | |
494 g_free(msg); | |
495 if(code_txt) | |
496 g_free(code_txt); | |
497 | |
498 return; | |
499 } | |
500 | |
501 msg = g_strdup_printf("Unable to configure room %s", from); | |
502 | |
503 gaim_notify_info(js->gc, _("Unable to configure"), _("Unable to configure"), msg); | |
504 g_free(msg); | |
505 | |
506 } | |
507 | |
508 void jabber_chat_register(JabberChat *chat) | |
509 { | |
510 JabberIq *iq; | |
511 char *room_jid; | |
512 | |
513 if(!chat) | |
514 return; | |
515 | |
516 room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); | |
517 | |
518 iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, "jabber:iq:register"); | |
519 xmlnode_set_attrib(iq->node, "to", room_jid); | |
520 g_free(room_jid); | |
521 | |
522 jabber_iq_set_callback(iq, jabber_chat_register_cb, NULL); | |
523 | |
524 jabber_iq_send(iq); | |
525 } | |
526 | |
7971 | 527 /* merge this with the function below when we get everyone on the same page wrt /commands */ |
528 void jabber_chat_change_topic(JabberChat *chat, const char *topic) | |
529 { | |
530 if(topic && *topic) { | |
531 JabberMessage *jm; | |
532 jm = g_new0(JabberMessage, 1); | |
533 jm->js = chat->js; | |
534 jm->type = JABBER_MESSAGE_GROUPCHAT; | |
535 jm->subject = gaim_markup_strip_html(topic); | |
536 jm->to = g_strdup_printf("%s@%s", chat->room, chat->server); | |
537 jabber_message_send(jm); | |
538 jabber_message_free(jm); | |
539 } else { | |
540 const char *cur = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(chat->conv)); | |
541 char *buf; | |
7955 | 542 |
7971 | 543 if(cur) |
544 buf = g_strdup_printf(_("current topic is: %s"), topic); | |
545 else | |
546 buf = g_strdup(_("No topic is set")); | |
547 gaim_conv_chat_write(GAIM_CONV_CHAT(chat->conv), "", buf, | |
548 GAIM_MESSAGE_SYSTEM | GAIM_MESSAGE_NO_LOG, time(NULL)); | |
549 g_free(buf); | |
550 } | |
551 | |
552 } | |
553 | |
554 void jabber_chat_set_topic(GaimConnection *gc, int id, const char *topic) | |
555 { | |
556 JabberStream *js = gc->proto_data; | |
557 JabberChat *chat = jabber_chat_find_by_id(js, id); | |
558 | |
559 if(!chat) | |
560 return; | |
561 | |
562 jabber_chat_change_topic(chat, topic); | |
563 } | |
564 | |
565 | |
7972 | 566 void jabber_chat_change_nick(JabberChat *chat, const char *nick) |
567 { | |
568 xmlnode *presence; | |
569 char *full_jid; | |
570 | |
571 if(!chat->muc) { | |
572 gaim_conv_chat_write(GAIM_CONV_CHAT(chat->conv), "", | |
573 _("Nick changing not supported in non-MUC chatrooms"), | |
574 GAIM_MESSAGE_SYSTEM, time(NULL)); | |
575 return; | |
576 } | |
577 | |
578 presence = jabber_presence_create(chat->js->gc->away_state, chat->js->gc->away); | |
579 full_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server, nick); | |
580 xmlnode_set_attrib(presence, "to", full_jid); | |
581 g_free(full_jid); | |
582 | |
583 jabber_send(chat->js, presence); | |
584 xmlnode_free(presence); | |
585 } | |
586 | |
7974 | 587 void jabber_chat_part(JabberChat *chat, const char *msg) |
588 { | |
589 char *room_jid; | |
590 xmlnode *presence; | |
7972 | 591 |
7974 | 592 room_jid = g_strdup_printf("%s@%s", chat->room, chat->server); |
593 gaim_debug(GAIM_DEBUG_INFO, "jabber", "%s is leaving chat %s\n", | |
594 chat->nick, room_jid); | |
595 presence = xmlnode_new("presence"); | |
596 xmlnode_set_attrib(presence, "to", room_jid); | |
597 xmlnode_set_attrib(presence, "type", "unavailable"); | |
598 if(msg) { | |
599 xmlnode *status = xmlnode_new_child(presence, "status"); | |
600 xmlnode_insert_data(status, msg, -1); | |
601 } | |
602 jabber_send(chat->js, presence); | |
603 xmlnode_free(presence); | |
604 g_free(room_jid); | |
605 } | |
606 | |
607 |