comparison libpurple/protocols/jabber/message.c @ 27943:684690dbda4a

propagate from branch 'im.pidgin.pidgin' (head f92d95c83baba97463f923077688ba2eb144763b) to branch 'im.pidgin.pidgin.yaz' (head ae2b51da61a998a69de04124f2696ce2a419a7b3)
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Fri, 01 May 2009 20:44:30 +0000
parents f3ccb5a36fd6 f67f24008334
children e0bcdc2bad7d
comparison
equal deleted inserted replaced
27942:583c36c03e50 27943:684690dbda4a
22 22
23 #include "debug.h" 23 #include "debug.h"
24 #include "notify.h" 24 #include "notify.h"
25 #include "server.h" 25 #include "server.h"
26 #include "util.h" 26 #include "util.h"
27 #include "adhoccommands.h"
27 #include "buddy.h" 28 #include "buddy.h"
28 #include "chat.h" 29 #include "chat.h"
29 #include "data.h" 30 #include "data.h"
30 #include "google.h" 31 #include "google.h"
31 #include "message.h" 32 #include "message.h"
595 if(!strcmp(child->name, "x")) 596 if(!strcmp(child->name, "x"))
596 jm->etc = g_list_append(jm->etc, child); 597 jm->etc = g_list_append(jm->etc, child);
597 /* The following tests expect xmlns != NULL */ 598 /* The following tests expect xmlns != NULL */
598 continue; 599 continue;
599 } else if(!strcmp(child->name, "subject") && !strcmp(xmlns,"jabber:client")) { 600 } else if(!strcmp(child->name, "subject") && !strcmp(xmlns,"jabber:client")) {
600 if(!jm->subject) 601 if(!jm->subject) {
601 jm->subject = xmlnode_get_data(child); 602 jm->subject = xmlnode_get_data(child);
603 if(!jm->subject)
604 jm->subject = g_strdup("");
605 }
602 } else if(!strcmp(child->name, "thread") && !strcmp(xmlns,"jabber:client")) { 606 } else if(!strcmp(child->name, "thread") && !strcmp(xmlns,"jabber:client")) {
603 if(!jm->thread_id) 607 if(!jm->thread_id)
604 jm->thread_id = xmlnode_get_data(child); 608 jm->thread_id = xmlnode_get_data(child);
605 } else if(!strcmp(child->name, "body") && !strcmp(xmlns,"jabber:client")) { 609 } else if(!strcmp(child->name, "body") && !strcmp(xmlns,"jabber:client")) {
606 if(!jm->body) { 610 if(!jm->body) {
639 chat = jabber_chat_find(js, jid->node, jid->domain); 643 chat = jabber_chat_find(js, jid->node, jid->domain);
640 if (chat) conv = chat->conv; 644 if (chat) conv = chat->conv;
641 } 645 }
642 646
643 jabber_id_free(jid); 647 jabber_id_free(jid);
644 } else { 648 } else if (jm->type == JABBER_MESSAGE_NORMAL ||
649 jm->type == JABBER_MESSAGE_CHAT) {
645 conv = 650 conv =
646 purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, 651 purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY,
647 who, account); 652 who, account);
648 if (!conv) { 653 if (!conv) {
649 /* we need to create the conversation here */ 654 /* we need to create the conversation here */
780 jm->type = JABBER_MESSAGE_GROUPCHAT_INVITE; 785 jm->type = JABBER_MESSAGE_GROUPCHAT_INVITE;
781 } 786 }
782 } else { 787 } else {
783 jm->etc = g_list_append(jm->etc, child); 788 jm->etc = g_list_append(jm->etc, child);
784 } 789 }
790 } else if (g_str_equal(child->name, "query")) {
791 const char *node = xmlnode_get_attrib(child, "node");
792 if (purple_strequal(xmlns, "http://jabber.org/protocol/disco#items")
793 && purple_strequal(node, "http://jabber.org/protocol/commands")) {
794 jabber_adhoc_got_list(js, jm->from, child);
795 }
785 } 796 }
786 } 797 }
787 798
788 if(jm->hasBuzz) 799 if(jm->hasBuzz)
789 handle_buzz(jm); 800 handle_buzz(jm);
1219 jabber_message_free(jm); 1230 jabber_message_free(jm);
1220 1231
1221 return 0; 1232 return 0;
1222 } 1233 }
1223 1234
1224 void jabber_message_conv_closed(JabberStream *js, const char *who) 1235 gboolean jabber_buzz_isenabled(JabberStream *js, const gchar *namespace) {
1225 {
1226 JabberMessage *jm;
1227 if (!purple_prefs_get_bool("/purple/conversations/im/send_typing"))
1228 return;
1229
1230 jm = g_new0(JabberMessage, 1);
1231 jm->js = js;
1232 jm->type = JABBER_MESSAGE_CHAT;
1233 jm->to = g_strdup(who);
1234 jm->id = jabber_get_next_id(jm->js);
1235 jm->typing_style = JM_TS_JEP_0085;
1236 jm->chat_state = JM_STATE_GONE;
1237 jabber_message_send(jm);
1238 jabber_message_free(jm);
1239 }
1240
1241 gboolean jabber_buzz_isenabled(JabberStream *js, const gchar *shortname, const gchar *namespace) {
1242 return js->allowBuzz; 1236 return js->allowBuzz;
1243 } 1237 }
1244 1238
1245 gboolean jabber_custom_smileys_isenabled(JabberStream *js, const gchar *shortname, 1239 gboolean jabber_custom_smileys_isenabled(JabberStream *js, const gchar *namespace)
1246 const gchar *namespace)
1247 { 1240 {
1248 const PurpleConnection *gc = js->gc; 1241 const PurpleConnection *gc = js->gc;
1249 PurpleAccount *account = purple_connection_get_account(gc); 1242 PurpleAccount *account = purple_connection_get_account(gc);
1250 1243
1251 return purple_account_get_bool(account, "custom_smileys", TRUE); 1244 return purple_account_get_bool(account, "custom_smileys", TRUE);