| 85 if(jm->events & JABBER_MESSAGE_EVENT_COMPOSING) |
85 if(jm->events & JABBER_MESSAGE_EVENT_COMPOSING) |
| 86 serv_got_typing(jm->js->gc, from, 0, GAIM_TYPING); |
86 serv_got_typing(jm->js->gc, from, 0, GAIM_TYPING); |
| 87 else |
87 else |
| 88 serv_got_typing_stopped(jm->js->gc, from); |
88 serv_got_typing_stopped(jm->js->gc, from); |
| 89 } else { |
89 } else { |
| 90 if(jbr && jm->events & JABBER_MESSAGE_EVENT_COMPOSING) |
90 if(jbr) { |
| 91 jbr->capabilities |= JABBER_CAP_COMPOSING; |
91 if(jm->events & JABBER_MESSAGE_EVENT_COMPOSING) |
| |
92 jbr->capabilities |= JABBER_CAP_COMPOSING; |
| |
93 if(jbr->thread_id) |
| |
94 g_free(jbr->thread_id); |
| |
95 jbr->thread_id = g_strdup(jbr->thread_id); |
| |
96 } |
| 92 serv_got_im(jm->js->gc, from, jm->xhtml ? jm->xhtml : jm->body, 0, |
97 serv_got_im(jm->js->gc, from, jm->xhtml ? jm->xhtml : jm->body, 0, |
| 93 jm->sent); |
98 jm->sent); |
| 94 } |
99 } |
| 95 |
100 |
| 96 g_free(from); |
101 g_free(from); |
| 263 continue; |
268 continue; |
| 264 |
269 |
| 265 if(!strcmp(child->name, "subject")) { |
270 if(!strcmp(child->name, "subject")) { |
| 266 if(!jm->subject) |
271 if(!jm->subject) |
| 267 jm->subject = xmlnode_get_data(child); |
272 jm->subject = xmlnode_get_data(child); |
| |
273 } else if(!strcmp(child->name, "thread")) { |
| |
274 if(!jm->thread_id) |
| |
275 jm->thread_id = xmlnode_get_data(child); |
| 268 } else if(!strcmp(child->name, "body")) { |
276 } else if(!strcmp(child->name, "body")) { |
| 269 if(!jm->body) |
277 if(!jm->body) |
| 270 jm->body = xmlnode_to_str(child, NULL); |
278 jm->body = xmlnode_to_str(child, NULL); |
| 271 } else if(!strcmp(child->name, "html")) { |
279 } else if(!strcmp(child->name, "html")) { |
| 272 if(!jm->xhtml) |
280 if(!jm->xhtml) |
| 383 if(type) |
391 if(type) |
| 384 xmlnode_set_attrib(message, "type", type); |
392 xmlnode_set_attrib(message, "type", type); |
| 385 |
393 |
| 386 xmlnode_set_attrib(message, "to", jm->to); |
394 xmlnode_set_attrib(message, "to", jm->to); |
| 387 |
395 |
| |
396 if(jm->thread_id) { |
| |
397 child = xmlnode_new_child(message, "thread"); |
| |
398 xmlnode_insert_data(child, jm->thread_id, -1); |
| |
399 } |
| |
400 |
| 388 if(jm->events || (!jm->body && !jm->xhtml && !jm->subject)) { |
401 if(jm->events || (!jm->body && !jm->xhtml && !jm->subject)) { |
| 389 child = xmlnode_new_child(message, "x"); |
402 child = xmlnode_new_child(message, "x"); |
| 390 xmlnode_set_attrib(child, "xmlns", "jabber:x:event"); |
403 xmlnode_set_attrib(child, "xmlns", "jabber:x:event"); |
| 391 if(jm->events & JABBER_MESSAGE_EVENT_COMPOSING) |
404 if(jm->events & JABBER_MESSAGE_EVENT_COMPOSING) |
| 392 xmlnode_new_child(child, "composing"); |
405 xmlnode_new_child(child, "composing"); |
| 441 jm = g_new0(JabberMessage, 1); |
454 jm = g_new0(JabberMessage, 1); |
| 442 jm->js = gc->proto_data; |
455 jm->js = gc->proto_data; |
| 443 jm->type = JABBER_MESSAGE_CHAT; |
456 jm->type = JABBER_MESSAGE_CHAT; |
| 444 jm->events = JABBER_MESSAGE_EVENT_COMPOSING; |
457 jm->events = JABBER_MESSAGE_EVENT_COMPOSING; |
| 445 jm->to = g_strdup(who); |
458 jm->to = g_strdup(who); |
| |
459 if(jbr && jbr->thread_id) |
| |
460 jm->thread_id = jbr->thread_id; |
| 446 |
461 |
| 447 buf = g_strdup_printf("<html xmlns='http://jabber.org/protocol/xhtml-im'><body xmlns='http://www.w3.org/1999/xhtml'>%s</body></html>", msg); |
462 buf = g_strdup_printf("<html xmlns='http://jabber.org/protocol/xhtml-im'><body xmlns='http://www.w3.org/1999/xhtml'>%s</body></html>", msg); |
| 448 |
463 |
| 449 gaim_markup_html_to_xhtml(buf, &xhtml, &jm->body); |
464 gaim_markup_html_to_xhtml(buf, &xhtml, &jm->body); |
| 450 g_free(buf); |
465 g_free(buf); |