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