1 | /***************************************************************************\ |
---|
2 | * * |
---|
3 | * BitlBee - An IRC to IM gateway * |
---|
4 | * Jabber module - Conference rooms * |
---|
5 | * * |
---|
6 | * Copyright 2007-2012 Wilmer van der Gaast <wilmer@gaast.net> * |
---|
7 | * * |
---|
8 | * This program is free software; you can redistribute it and/or modify * |
---|
9 | * it under the terms of the GNU General Public License as published by * |
---|
10 | * the Free Software Foundation; either version 2 of the License, or * |
---|
11 | * (at your option) any later version. * |
---|
12 | * * |
---|
13 | * This program is distributed in the hope that it will be useful, * |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
---|
16 | * GNU General Public License for more details. * |
---|
17 | * * |
---|
18 | * You should have received a copy of the GNU General Public License along * |
---|
19 | * with this program; if not, write to the Free Software Foundation, Inc., * |
---|
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * |
---|
21 | * * |
---|
22 | \***************************************************************************/ |
---|
23 | |
---|
24 | #include "jabber.h" |
---|
25 | #include "sha1.h" |
---|
26 | |
---|
27 | static xt_status jabber_chat_join_failed(struct im_connection *ic, struct xt_node *node, struct xt_node *orig); |
---|
28 | static xt_status jabber_chat_self_message(struct im_connection *ic, struct xt_node *node, struct xt_node *orig); |
---|
29 | |
---|
30 | struct groupchat *jabber_chat_join(struct im_connection *ic, const char *room, const char *nick, const char *password, |
---|
31 | gboolean always_use_nicks) |
---|
32 | { |
---|
33 | struct jabber_chat *jc; |
---|
34 | struct xt_node *node; |
---|
35 | struct groupchat *c; |
---|
36 | char *roomjid; |
---|
37 | |
---|
38 | roomjid = g_strdup_printf("%s/%s", room, nick); |
---|
39 | node = xt_new_node("x", NULL, NULL); |
---|
40 | xt_add_attr(node, "xmlns", XMLNS_MUC); |
---|
41 | if (password) { |
---|
42 | xt_add_child(node, xt_new_node("password", password, NULL)); |
---|
43 | } |
---|
44 | node = jabber_make_packet("presence", NULL, roomjid, node); |
---|
45 | jabber_cache_add(ic, node, jabber_chat_join_failed); |
---|
46 | |
---|
47 | if (!jabber_write_packet(ic, node)) { |
---|
48 | g_free(roomjid); |
---|
49 | return NULL; |
---|
50 | } |
---|
51 | |
---|
52 | jc = g_new0(struct jabber_chat, 1); |
---|
53 | jc->name = jabber_normalize(room); |
---|
54 | |
---|
55 | if ((jc->me = jabber_buddy_add(ic, roomjid)) == NULL) { |
---|
56 | g_free(roomjid); |
---|
57 | g_free(jc->name); |
---|
58 | g_free(jc); |
---|
59 | return NULL; |
---|
60 | } |
---|
61 | |
---|
62 | if (always_use_nicks) { |
---|
63 | jc->flags = JCFLAG_ALWAYS_USE_NICKS; |
---|
64 | } |
---|
65 | |
---|
66 | /* roomjid isn't normalized yet, and we need an original version |
---|
67 | of the nick to send a proper presence update. */ |
---|
68 | jc->my_full_jid = roomjid; |
---|
69 | |
---|
70 | c = imcb_chat_new(ic, room); |
---|
71 | c->data = jc; |
---|
72 | |
---|
73 | return c; |
---|
74 | } |
---|
75 | |
---|
76 | struct groupchat *jabber_chat_with(struct im_connection *ic, char *who) |
---|
77 | { |
---|
78 | struct jabber_data *jd = ic->proto_data; |
---|
79 | struct jabber_chat *jc; |
---|
80 | struct groupchat *c; |
---|
81 | sha1_state_t sum; |
---|
82 | double now = gettime(); |
---|
83 | char *uuid, *rjid, *cserv; |
---|
84 | |
---|
85 | sha1_init(&sum); |
---|
86 | sha1_append(&sum, (uint8_t *) ic->acc->user, strlen(ic->acc->user)); |
---|
87 | sha1_append(&sum, (uint8_t *) &now, sizeof(now)); |
---|
88 | sha1_append(&sum, (uint8_t *) who, strlen(who)); |
---|
89 | uuid = sha1_random_uuid(&sum); |
---|
90 | |
---|
91 | if (jd->flags & JFLAG_GTALK) { |
---|
92 | cserv = g_strdup("groupchat.google.com"); |
---|
93 | } else { |
---|
94 | /* Guess... */ |
---|
95 | cserv = g_strdup_printf("conference.%s", jd->server); |
---|
96 | } |
---|
97 | |
---|
98 | rjid = g_strdup_printf("private-chat-%s@%s", uuid, cserv); |
---|
99 | g_free(uuid); |
---|
100 | g_free(cserv); |
---|
101 | |
---|
102 | c = jabber_chat_join(ic, rjid, jd->username, NULL, FALSE); |
---|
103 | g_free(rjid); |
---|
104 | if (c == NULL) { |
---|
105 | return NULL; |
---|
106 | } |
---|
107 | |
---|
108 | jc = c->data; |
---|
109 | jc->invite = g_strdup(who); |
---|
110 | |
---|
111 | return c; |
---|
112 | } |
---|
113 | |
---|
114 | static xt_status jabber_chat_join_failed(struct im_connection *ic, struct xt_node *node, struct xt_node *orig) |
---|
115 | { |
---|
116 | struct jabber_error *err; |
---|
117 | struct jabber_buddy *bud; |
---|
118 | char *room; |
---|
119 | |
---|
120 | room = xt_find_attr(orig, "to"); |
---|
121 | bud = jabber_buddy_by_jid(ic, room, 0); |
---|
122 | err = jabber_error_parse(xt_find_node(node->children, "error"), XMLNS_STANZA_ERROR); |
---|
123 | if (err) { |
---|
124 | imcb_error(ic, "Error joining groupchat %s: %s%s%s", room, err->code, |
---|
125 | err->text ? ": " : "", err->text ? err->text : ""); |
---|
126 | jabber_error_free(err); |
---|
127 | } |
---|
128 | if (bud) { |
---|
129 | struct groupchat *c = jabber_chat_by_jid(ic, bud->bare_jid); |
---|
130 | if (c) { |
---|
131 | jabber_chat_free(c); |
---|
132 | } |
---|
133 | } |
---|
134 | |
---|
135 | return XT_HANDLED; |
---|
136 | } |
---|
137 | |
---|
138 | static xt_status jabber_chat_self_message(struct im_connection *ic, struct xt_node *node, struct xt_node *orig) |
---|
139 | { |
---|
140 | /* This is a self message sent by this bitlbee - just drop it */ |
---|
141 | return XT_ABORT; |
---|
142 | } |
---|
143 | |
---|
144 | struct groupchat *jabber_chat_by_jid(struct im_connection *ic, const char *name) |
---|
145 | { |
---|
146 | char *normalized = jabber_normalize(name); |
---|
147 | GSList *l; |
---|
148 | struct groupchat *ret; |
---|
149 | struct jabber_chat *jc; |
---|
150 | |
---|
151 | for (l = ic->groupchats; l; l = l->next) { |
---|
152 | ret = l->data; |
---|
153 | jc = ret->data; |
---|
154 | if (strcmp(normalized, jc->name) == 0) { |
---|
155 | break; |
---|
156 | } |
---|
157 | } |
---|
158 | g_free(normalized); |
---|
159 | |
---|
160 | return l ? ret : NULL; |
---|
161 | } |
---|
162 | |
---|
163 | void jabber_chat_free(struct groupchat *c) |
---|
164 | { |
---|
165 | struct jabber_chat *jc = c->data; |
---|
166 | |
---|
167 | jabber_buddy_remove_bare(c->ic, jc->name); |
---|
168 | |
---|
169 | g_free(jc->last_sent_message); |
---|
170 | g_free(jc->my_full_jid); |
---|
171 | g_free(jc->name); |
---|
172 | g_free(jc->invite); |
---|
173 | g_free(jc); |
---|
174 | |
---|
175 | imcb_chat_free(c); |
---|
176 | } |
---|
177 | |
---|
178 | int jabber_chat_msg(struct groupchat *c, char *message, int flags) |
---|
179 | { |
---|
180 | struct im_connection *ic = c->ic; |
---|
181 | struct jabber_chat *jc = c->data; |
---|
182 | struct xt_node *node; |
---|
183 | |
---|
184 | jc->flags |= JCFLAG_MESSAGE_SENT; |
---|
185 | |
---|
186 | node = xt_new_node("body", message, NULL); |
---|
187 | node = jabber_make_packet("message", "groupchat", jc->name, node); |
---|
188 | |
---|
189 | jabber_cache_add(ic, node, jabber_chat_self_message); |
---|
190 | |
---|
191 | g_free(jc->last_sent_message); |
---|
192 | jc->last_sent_message = g_strdup(message); |
---|
193 | |
---|
194 | return !jabber_write_packet(ic, node); |
---|
195 | } |
---|
196 | |
---|
197 | int jabber_chat_topic(struct groupchat *c, char *topic) |
---|
198 | { |
---|
199 | struct im_connection *ic = c->ic; |
---|
200 | struct jabber_chat *jc = c->data; |
---|
201 | struct xt_node *node; |
---|
202 | |
---|
203 | node = xt_new_node("subject", topic, NULL); |
---|
204 | node = jabber_make_packet("message", "groupchat", jc->name, node); |
---|
205 | |
---|
206 | if (!jabber_write_packet(ic, node)) { |
---|
207 | xt_free_node(node); |
---|
208 | return 0; |
---|
209 | } |
---|
210 | xt_free_node(node); |
---|
211 | |
---|
212 | return 1; |
---|
213 | } |
---|
214 | |
---|
215 | int jabber_chat_leave(struct groupchat *c, const char *reason) |
---|
216 | { |
---|
217 | struct im_connection *ic = c->ic; |
---|
218 | struct jabber_chat *jc = c->data; |
---|
219 | struct xt_node *node; |
---|
220 | |
---|
221 | node = xt_new_node("x", NULL, NULL); |
---|
222 | xt_add_attr(node, "xmlns", XMLNS_MUC); |
---|
223 | node = jabber_make_packet("presence", "unavailable", jc->my_full_jid, node); |
---|
224 | |
---|
225 | if (!jabber_write_packet(ic, node)) { |
---|
226 | xt_free_node(node); |
---|
227 | return 0; |
---|
228 | } |
---|
229 | xt_free_node(node); |
---|
230 | |
---|
231 | return 1; |
---|
232 | } |
---|
233 | |
---|
234 | void jabber_chat_invite(struct groupchat *c, char *who, char *message) |
---|
235 | { |
---|
236 | struct xt_node *node; |
---|
237 | struct im_connection *ic = c->ic; |
---|
238 | struct jabber_chat *jc = c->data; |
---|
239 | |
---|
240 | node = xt_new_node("reason", message, NULL); |
---|
241 | |
---|
242 | node = xt_new_node("invite", NULL, node); |
---|
243 | xt_add_attr(node, "to", who); |
---|
244 | |
---|
245 | node = xt_new_node("x", NULL, node); |
---|
246 | xt_add_attr(node, "xmlns", XMLNS_MUC_USER); |
---|
247 | |
---|
248 | node = jabber_make_packet("message", NULL, jc->name, node); |
---|
249 | |
---|
250 | jabber_write_packet(ic, node); |
---|
251 | |
---|
252 | xt_free_node(node); |
---|
253 | } |
---|
254 | |
---|
255 | static int jabber_chat_has_other_resources(struct im_connection *ic, struct jabber_buddy *bud) |
---|
256 | { |
---|
257 | struct jabber_buddy *cur; |
---|
258 | |
---|
259 | for (cur = jabber_buddy_by_jid(ic, bud->bare_jid, GET_BUDDY_FIRST); cur; cur = cur->next) { |
---|
260 | if (cur != bud && jabber_compare_jid(cur->ext_jid, bud->ext_jid)) { |
---|
261 | return TRUE; |
---|
262 | } |
---|
263 | } |
---|
264 | |
---|
265 | return FALSE; |
---|
266 | } |
---|
267 | |
---|
268 | /* Not really the same syntax as the normal pkt_ functions, but this isn't |
---|
269 | called by the xmltree parser directly and this way I can add some extra |
---|
270 | parameters so we won't have to repeat too many things done by the caller |
---|
271 | already. */ |
---|
272 | void jabber_chat_pkt_presence(struct im_connection *ic, struct jabber_buddy *bud, struct xt_node *node) |
---|
273 | { |
---|
274 | struct groupchat *chat; |
---|
275 | struct xt_node *c; |
---|
276 | char *type = xt_find_attr(node, "type"); |
---|
277 | struct jabber_data *jd = ic->proto_data; |
---|
278 | struct jabber_chat *jc; |
---|
279 | char *s; |
---|
280 | |
---|
281 | if ((chat = jabber_chat_by_jid(ic, bud->bare_jid)) == NULL) { |
---|
282 | /* How could this happen?? We could do kill( self, 11 ) |
---|
283 | now or just wait for the OS to do it. :-) */ |
---|
284 | return; |
---|
285 | } |
---|
286 | |
---|
287 | jc = chat->data; |
---|
288 | |
---|
289 | if (type == NULL && !(bud->flags & JBFLAG_IS_CHATROOM)) { |
---|
290 | bud->flags |= JBFLAG_IS_CHATROOM; |
---|
291 | /* If this one wasn't set yet, this buddy just joined the chat. |
---|
292 | Slightly hackish way of finding out eh? ;-) */ |
---|
293 | |
---|
294 | /* This is pretty messy... Here it sets ext_jid to the real |
---|
295 | JID of the participant. Works for non-anonymized channels. |
---|
296 | Might break if someone joins a chat twice, though. */ |
---|
297 | for (c = node->children; (c = xt_find_node(c, "x")); c = c->next) { |
---|
298 | if ((s = xt_find_attr(c, "xmlns")) && |
---|
299 | (strcmp(s, XMLNS_MUC_USER) == 0)) { |
---|
300 | struct xt_node *item; |
---|
301 | |
---|
302 | item = xt_find_node(c->children, "item"); |
---|
303 | if ((s = xt_find_attr(item, "jid"))) { |
---|
304 | /* Yay, found what we need. :-) */ |
---|
305 | bud->ext_jid = jabber_normalize(s); |
---|
306 | break; |
---|
307 | } |
---|
308 | } |
---|
309 | } |
---|
310 | |
---|
311 | /* Make up some other handle, if necessary. */ |
---|
312 | if (bud->ext_jid == NULL) { |
---|
313 | if (bud == jc->me) { |
---|
314 | bud->ext_jid = g_strdup(jd->me); |
---|
315 | } else { |
---|
316 | int i; |
---|
317 | |
---|
318 | /* Don't want the nick to be at the end, so let's |
---|
319 | think of some slightly different notation to use |
---|
320 | for anonymous groupchat participants in BitlBee. */ |
---|
321 | bud->ext_jid = g_strdup_printf("%s=%s", bud->resource, bud->bare_jid); |
---|
322 | |
---|
323 | /* And strip any unwanted characters. */ |
---|
324 | for (i = 0; bud->resource[i]; i++) { |
---|
325 | if (bud->ext_jid[i] == '=' || bud->ext_jid[i] == '@') { |
---|
326 | bud->ext_jid[i] = '_'; |
---|
327 | } |
---|
328 | } |
---|
329 | } |
---|
330 | bud->flags |= JBFLAG_IS_ANONYMOUS; |
---|
331 | } |
---|
332 | |
---|
333 | if (bud != jc->me && bud->flags & JBFLAG_IS_ANONYMOUS) { |
---|
334 | /* If JIDs are anonymized, add them to the local |
---|
335 | list for the duration of this chat. */ |
---|
336 | imcb_add_buddy(ic, bud->ext_jid, NULL); |
---|
337 | imcb_buddy_nick_hint(ic, bud->ext_jid, bud->resource); |
---|
338 | } |
---|
339 | |
---|
340 | if (bud == jc->me && jc->invite != NULL) { |
---|
341 | char *msg = g_strdup_printf("Please join me in room %s", jc->name); |
---|
342 | jabber_chat_invite(chat, jc->invite, msg); |
---|
343 | g_free(jc->invite); |
---|
344 | g_free(msg); |
---|
345 | jc->invite = NULL; |
---|
346 | } |
---|
347 | |
---|
348 | s = strchr(bud->ext_jid, '/'); |
---|
349 | if (s) { |
---|
350 | *s = 0; /* Should NEVER be NULL, but who knows... */ |
---|
351 | } |
---|
352 | |
---|
353 | imcb_chat_add_buddy(chat, bud->ext_jid); |
---|
354 | |
---|
355 | if (bud != jc->me && (jc->flags & JCFLAG_ALWAYS_USE_NICKS) && !(bud->flags & JBFLAG_IS_ANONYMOUS)) { |
---|
356 | imcb_buddy_nick_change(ic, bud->ext_jid, bud->resource); |
---|
357 | } |
---|
358 | |
---|
359 | if (s) { |
---|
360 | *s = '/'; |
---|
361 | } |
---|
362 | } else if (type) { /* type can only be NULL or "unavailable" in this function */ |
---|
363 | if ((bud->flags & JBFLAG_IS_CHATROOM) && bud->ext_jid && !jabber_chat_has_other_resources(ic, bud)) { |
---|
364 | char *reason = NULL; |
---|
365 | char *status = NULL; |
---|
366 | char *status_text = NULL; |
---|
367 | |
---|
368 | if ((c = xt_find_node_by_attr(node->children, "x", "xmlns", XMLNS_MUC_USER))) { |
---|
369 | struct xt_node *c2 = c->children; |
---|
370 | |
---|
371 | while ((c2 = xt_find_node(c2, "status"))) { |
---|
372 | char *code = xt_find_attr(c2, "code"); |
---|
373 | if (g_strcmp0(code, "301") == 0) { |
---|
374 | status = "Banned"; |
---|
375 | break; |
---|
376 | } else if (g_strcmp0(code, "303") == 0) { |
---|
377 | /* This could be handled in a cleverer way, |
---|
378 | * but let's just show a literal part/join for now */ |
---|
379 | status = "Changing nicks"; |
---|
380 | break; |
---|
381 | } else if (g_strcmp0(code, "307") == 0) { |
---|
382 | status = "Kicked"; |
---|
383 | break; |
---|
384 | } |
---|
385 | c2 = c2->next; |
---|
386 | } |
---|
387 | |
---|
388 | /* Sometimes the status message is in presence/x/item/reason */ |
---|
389 | if ((c2 = xt_find_path(c, "item/reason")) && c2->text && c2->text_len) { |
---|
390 | status_text = c2->text; |
---|
391 | } |
---|
392 | } |
---|
393 | |
---|
394 | /* Sometimes the status message is right inside <presence> */ |
---|
395 | if ((c = xt_find_node(node->children, "status")) && c->text && c->text_len) { |
---|
396 | status_text = c->text; |
---|
397 | } |
---|
398 | |
---|
399 | if (status_text && status) { |
---|
400 | reason = g_strdup_printf("%s: %s", status, status_text); |
---|
401 | } else { |
---|
402 | reason = g_strdup(status_text ? : status); |
---|
403 | } |
---|
404 | |
---|
405 | s = strchr(bud->ext_jid, '/'); |
---|
406 | if (s) { |
---|
407 | *s = 0; |
---|
408 | } |
---|
409 | imcb_chat_remove_buddy(chat, bud->ext_jid, reason); |
---|
410 | if (bud != jc->me && bud->flags & JBFLAG_IS_ANONYMOUS) { |
---|
411 | imcb_remove_buddy(ic, bud->ext_jid, reason); |
---|
412 | } |
---|
413 | if (s) { |
---|
414 | *s = '/'; |
---|
415 | } |
---|
416 | |
---|
417 | g_free(reason); |
---|
418 | } |
---|
419 | |
---|
420 | if (bud == jc->me) { |
---|
421 | jabber_chat_free(chat); |
---|
422 | } |
---|
423 | } |
---|
424 | } |
---|
425 | |
---|
426 | void jabber_chat_pkt_message(struct im_connection *ic, struct jabber_buddy *bud, struct xt_node *node) |
---|
427 | { |
---|
428 | struct xt_node *subject = xt_find_node(node->children, "subject"); |
---|
429 | struct xt_node *body = xt_find_node(node->children, "body"); |
---|
430 | struct groupchat *chat = NULL; |
---|
431 | struct jabber_chat *jc = NULL; |
---|
432 | char *from = NULL; |
---|
433 | char *nick = NULL; |
---|
434 | char *final_from = NULL; |
---|
435 | char *bare_jid = NULL; |
---|
436 | guint32 flags = 0; |
---|
437 | |
---|
438 | from = (bud) ? bud->full_jid : xt_find_attr(node, "from"); |
---|
439 | |
---|
440 | if (from) { |
---|
441 | nick = strchr(from, '/'); |
---|
442 | if (nick) { |
---|
443 | *nick = 0; |
---|
444 | } |
---|
445 | chat = jabber_chat_by_jid(ic, from); |
---|
446 | if (nick) { |
---|
447 | *nick = '/'; |
---|
448 | nick++; |
---|
449 | } |
---|
450 | } |
---|
451 | |
---|
452 | jc = (chat) ? chat->data : NULL; |
---|
453 | |
---|
454 | if (!bud) { |
---|
455 | struct xt_node *c; |
---|
456 | char *s; |
---|
457 | |
---|
458 | /* Try some clever stuff to find out the real JID here */ |
---|
459 | c = xt_find_node_by_attr(node->children, "delay", "xmlns", XMLNS_DELAY); |
---|
460 | |
---|
461 | if (c && ((s = xt_find_attr(c, "from")) || |
---|
462 | (s = xt_find_attr(c, "from_jid")))) { |
---|
463 | /* This won't be useful if it's the MUC JID */ |
---|
464 | if (!(jc && jabber_compare_jid(s, jc->name))) { |
---|
465 | /* Hopefully this one makes more sense! */ |
---|
466 | bud = jabber_buddy_by_jid(ic, s, GET_BUDDY_FIRST | GET_BUDDY_CREAT); |
---|
467 | } |
---|
468 | } |
---|
469 | |
---|
470 | } |
---|
471 | |
---|
472 | if (subject && chat) { |
---|
473 | char empty[1] = ""; |
---|
474 | char *subject_text = subject->text_len > 0 ? subject->text : empty; |
---|
475 | if (g_strcmp0(chat->topic, subject_text) != 0) { |
---|
476 | bare_jid = (bud) ? jabber_get_bare_jid(bud->ext_jid) : NULL; |
---|
477 | imcb_chat_topic(chat, bare_jid, subject_text, |
---|
478 | jabber_get_timestamp(node)); |
---|
479 | g_free(bare_jid); |
---|
480 | bare_jid = NULL; |
---|
481 | } |
---|
482 | } |
---|
483 | |
---|
484 | if (body == NULL || body->text_len == 0) { |
---|
485 | /* Meh. Empty messages aren't very interesting, no matter |
---|
486 | how much some servers love to send them. */ |
---|
487 | return; |
---|
488 | } |
---|
489 | |
---|
490 | if (chat == NULL) { |
---|
491 | if (nick == NULL) { |
---|
492 | imcb_log(ic, "System message from unknown groupchat %s: %s", from, body->text); |
---|
493 | } else { |
---|
494 | imcb_log(ic, "Groupchat message from unknown JID %s: %s", from, body->text); |
---|
495 | } |
---|
496 | |
---|
497 | return; |
---|
498 | } else if (chat != NULL && bud == NULL && nick == NULL) { |
---|
499 | imcb_chat_log(chat, "From conference server: %s", body->text); |
---|
500 | return; |
---|
501 | } else if (jc && jc->flags & JCFLAG_MESSAGE_SENT && bud == jc->me) { |
---|
502 | if (jabber_cache_handle_packet(ic, node) == XT_ABORT) { |
---|
503 | /* Self message marked by this bitlbee, don't show it */ |
---|
504 | return; |
---|
505 | } else if (xt_find_attr(node, "id") == NULL && |
---|
506 | g_strcmp0(body->text, jc->last_sent_message) == 0) { |
---|
507 | /* Some misbehaving servers (like slack) eat the ids and echo anyway. |
---|
508 | * Try to detect those cases by comparing against the last sent message. */ |
---|
509 | return; |
---|
510 | } |
---|
511 | } |
---|
512 | |
---|
513 | if (bud) { |
---|
514 | bare_jid = jabber_get_bare_jid(bud->ext_jid ? bud->ext_jid : bud->full_jid); |
---|
515 | final_from = bare_jid; |
---|
516 | if (bud == jc->me || (g_strcasecmp(final_from, ic->acc->user) == 0)) { |
---|
517 | flags = OPT_SELFMESSAGE; |
---|
518 | } |
---|
519 | } else { |
---|
520 | final_from = nick; |
---|
521 | } |
---|
522 | |
---|
523 | imcb_chat_msg(chat, final_from, body->text, flags, jabber_get_timestamp(node)); |
---|
524 | |
---|
525 | g_free(bare_jid); |
---|
526 | } |
---|