libpurple/protocols/jabber/presence.c

Thu, 20 Sep 2007 16:30:17 +0000

author
Sadrul Habib Chowdhury <sadrul@pidgin.im>
date
Thu, 20 Sep 2007 16:30:17 +0000
branch
sadrul.currentmedia
changeset 21193
e918a1846d03
parent 20320
6337e101f6ab
child 21195
fd63ef5027d7
permissions
-rw-r--r--

Use an independant status type for 'current media' stuff, instead of using
status attributes. This includes changes in both xmpp and msn.
Also, in MSN, CurrentMedia is sent with PSM if you turn on the status and
set the attributes on the account.

7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
1 /*
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
2 * purple - Jabber Protocol Plugin
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
3 *
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
4 * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com>
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
5 *
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
9 * (at your option) any later version.
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
10 *
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
14 * GNU General Public License for more details.
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
15 *
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19335
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
19 *
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
20 */
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
21 #include "internal.h"
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
22
15952
c087855dc551 Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15884
diff changeset
23 #include "account.h"
10684
0325b164a7eb [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10646
diff changeset
24 #include "cipher.h"
15952
c087855dc551 Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15884
diff changeset
25 #include "conversation.h"
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
26 #include "debug.h"
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
27 #include "notify.h"
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
28 #include "request.h"
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
29 #include "server.h"
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
30 #include "status.h"
7095
17d2b54254f8 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7015
diff changeset
31 #include "util.h"
15952
c087855dc551 Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15884
diff changeset
32 #include "xmlnode.h"
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
33
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
34 #include "buddy.h"
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
35 #include "chat.h"
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
36 #include "presence.h"
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
37 #include "iq.h"
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
38 #include "jutil.h"
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
39 #include "adhoccommands.h"
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
40
17800
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
41 #include "usertune.h"
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
42
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
43
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
44 static void chats_send_presence_foreach(gpointer key, gpointer val,
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
45 gpointer user_data)
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
46 {
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
47 JabberChat *chat = val;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
48 xmlnode *presence = user_data;
8577
64f25a17f8e4 [gaim-migrate @ 9326]
Nathan Walp <nwalp@pidgin.im>
parents: 8462
diff changeset
49 char *chat_full_jid;
64f25a17f8e4 [gaim-migrate @ 9326]
Nathan Walp <nwalp@pidgin.im>
parents: 8462
diff changeset
50
64f25a17f8e4 [gaim-migrate @ 9326]
Nathan Walp <nwalp@pidgin.im>
parents: 8462
diff changeset
51 if(!chat->conv)
64f25a17f8e4 [gaim-migrate @ 9326]
Nathan Walp <nwalp@pidgin.im>
parents: 8462
diff changeset
52 return;
64f25a17f8e4 [gaim-migrate @ 9326]
Nathan Walp <nwalp@pidgin.im>
parents: 8462
diff changeset
53
64f25a17f8e4 [gaim-migrate @ 9326]
Nathan Walp <nwalp@pidgin.im>
parents: 8462
diff changeset
54 chat_full_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server,
8401
9fe6cadf2581 [gaim-migrate @ 9130]
Nathan Walp <nwalp@pidgin.im>
parents: 8396
diff changeset
55 chat->handle);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
56
8401
9fe6cadf2581 [gaim-migrate @ 9130]
Nathan Walp <nwalp@pidgin.im>
parents: 8396
diff changeset
57 xmlnode_set_attrib(presence, "to", chat_full_jid);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
58 jabber_send(chat->js, presence);
8401
9fe6cadf2581 [gaim-migrate @ 9130]
Nathan Walp <nwalp@pidgin.im>
parents: 8396
diff changeset
59 g_free(chat_full_jid);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
60 }
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
61
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
62 void jabber_presence_fake_to_self(JabberStream *js, const PurpleStatus *gstatus) {
10286
04732ee468cc [gaim-migrate @ 11460]
Nathan Walp <nwalp@pidgin.im>
parents: 10216
diff changeset
63 char *my_base_jid;
04732ee468cc [gaim-migrate @ 11460]
Nathan Walp <nwalp@pidgin.im>
parents: 10216
diff changeset
64
04732ee468cc [gaim-migrate @ 11460]
Nathan Walp <nwalp@pidgin.im>
parents: 10216
diff changeset
65 if(!js->user)
04732ee468cc [gaim-migrate @ 11460]
Nathan Walp <nwalp@pidgin.im>
parents: 10216
diff changeset
66 return;
04732ee468cc [gaim-migrate @ 11460]
Nathan Walp <nwalp@pidgin.im>
parents: 10216
diff changeset
67
04732ee468cc [gaim-migrate @ 11460]
Nathan Walp <nwalp@pidgin.im>
parents: 10216
diff changeset
68 my_base_jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
69 if(purple_find_buddy(js->gc->account, my_base_jid)) {
8185
3a1d79a4e55a [gaim-migrate @ 8906]
Nathan Walp <nwalp@pidgin.im>
parents: 8182
diff changeset
70 JabberBuddy *jb;
3a1d79a4e55a [gaim-migrate @ 8906]
Nathan Walp <nwalp@pidgin.im>
parents: 8182
diff changeset
71 JabberBuddyResource *jbr;
3a1d79a4e55a [gaim-migrate @ 8906]
Nathan Walp <nwalp@pidgin.im>
parents: 8182
diff changeset
72 if((jb = jabber_buddy_find(js, my_base_jid, TRUE))) {
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
73 JabberBuddyState state;
14525
b278a2724686 [gaim-migrate @ 17177]
Nathan Walp <nwalp@pidgin.im>
parents: 14254
diff changeset
74 char *msg;
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
75 int priority;
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
76
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
77 purple_status_to_jabber(gstatus, &state, &msg, &priority);
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
78
10490
72932e32f29d [gaim-migrate @ 11780]
Nathan Walp <nwalp@pidgin.im>
parents: 10486
diff changeset
79 if (state == JABBER_BUDDY_STATE_UNAVAILABLE || state == JABBER_BUDDY_STATE_UNKNOWN) {
9744
c2b450de1fc0 [gaim-migrate @ 10609]
Daniel Atallah <datallah@pidgin.im>
parents: 9743
diff changeset
80 jabber_buddy_remove_resource(jb, js->user->resource);
c2b450de1fc0 [gaim-migrate @ 10609]
Daniel Atallah <datallah@pidgin.im>
parents: 9743
diff changeset
81 } else {
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
82 jabber_buddy_track_resource(jb, js->user->resource, priority, state, msg);
9744
c2b450de1fc0 [gaim-migrate @ 10609]
Daniel Atallah <datallah@pidgin.im>
parents: 9743
diff changeset
83 }
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
84 if((jbr = jabber_buddy_find_resource(jb, NULL))) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
85 purple_prpl_got_user_status(js->gc->account, my_base_jid, jabber_buddy_state_get_status_id(jbr->state), "priority", jbr->priority, jbr->status ? "message" : NULL, jbr->status, NULL);
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
86 } else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
87 purple_prpl_got_user_status(js->gc->account, my_base_jid, "offline", msg ? "message" : NULL, msg, NULL);
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
88 }
14525
b278a2724686 [gaim-migrate @ 17177]
Nathan Walp <nwalp@pidgin.im>
parents: 14254
diff changeset
89
b278a2724686 [gaim-migrate @ 17177]
Nathan Walp <nwalp@pidgin.im>
parents: 14254
diff changeset
90 g_free(msg);
8185
3a1d79a4e55a [gaim-migrate @ 8906]
Nathan Walp <nwalp@pidgin.im>
parents: 8182
diff changeset
91 }
3a1d79a4e55a [gaim-migrate @ 8906]
Nathan Walp <nwalp@pidgin.im>
parents: 8182
diff changeset
92 }
3a1d79a4e55a [gaim-migrate @ 8906]
Nathan Walp <nwalp@pidgin.im>
parents: 8182
diff changeset
93 g_free(my_base_jid);
3a1d79a4e55a [gaim-migrate @ 8906]
Nathan Walp <nwalp@pidgin.im>
parents: 8182
diff changeset
94 }
3a1d79a4e55a [gaim-migrate @ 8906]
Nathan Walp <nwalp@pidgin.im>
parents: 8182
diff changeset
95
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
96
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
97 void jabber_presence_send(PurpleAccount *account, PurpleStatus *status)
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
98 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
99 PurpleConnection *gc = NULL;
10382
32e07712e224 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10286
diff changeset
100 JabberStream *js = NULL;
11251
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11183
diff changeset
101 gboolean disconnected;
10755
a336a5d3102d [gaim-migrate @ 12358]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
102 int primitive;
10189
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
103 xmlnode *presence, *x, *photo;
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
104 char *stripped = NULL;
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
105 JabberBuddyState state;
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
106 int priority;
21193
e918a1846d03 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20320
diff changeset
107 const char *artist = NULL, *title = NULL, *source = NULL, *uri = NULL, *track = NULL;
e918a1846d03 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20320
diff changeset
108 int length = -1;
17824
52683dfc1f7d Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <am@adiumx.com>
parents: 17816
diff changeset
109 gboolean allowBuzz;
21193
e918a1846d03 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20320
diff changeset
110 PurpleStatus *tune;
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
111
18195
9cd0565f856e kill some code duplication when sending current presence
Nathan Walp <nwalp@pidgin.im>
parents: 17703
diff changeset
112 if(NULL == status) {
9cd0565f856e kill some code duplication when sending current presence
Nathan Walp <nwalp@pidgin.im>
parents: 17703
diff changeset
113 PurplePresence *gpresence = purple_account_get_presence(account);
9cd0565f856e kill some code duplication when sending current presence
Nathan Walp <nwalp@pidgin.im>
parents: 17703
diff changeset
114 status = purple_presence_get_active_status(gpresence);
9cd0565f856e kill some code duplication when sending current presence
Nathan Walp <nwalp@pidgin.im>
parents: 17703
diff changeset
115 }
9cd0565f856e kill some code duplication when sending current presence
Nathan Walp <nwalp@pidgin.im>
parents: 17703
diff changeset
116
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
117 if(!purple_status_is_active(status))
10486
840c61a6437f [gaim-migrate @ 11776]
Nathan Walp <nwalp@pidgin.im>
parents: 10382
diff changeset
118 return;
840c61a6437f [gaim-migrate @ 11776]
Nathan Walp <nwalp@pidgin.im>
parents: 10382
diff changeset
119
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
120 disconnected = purple_account_is_disconnected(account);
10755
a336a5d3102d [gaim-migrate @ 12358]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
121
11251
e38d86958a63 [gaim-migrate @ 13420]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11183
diff changeset
122 if(disconnected)
10755
a336a5d3102d [gaim-migrate @ 12358]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
123 return;
a336a5d3102d [gaim-migrate @ 12358]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
124
17422
1c47da5c1589 don't do unneeded work
Nathan Walp <nwalp@pidgin.im>
parents: 17049
diff changeset
125 primitive = purple_status_type_get_primitive(purple_status_get_type(status));
1c47da5c1589 don't do unneeded work
Nathan Walp <nwalp@pidgin.im>
parents: 17049
diff changeset
126
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
127 gc = purple_account_get_connection(account);
10755
a336a5d3102d [gaim-migrate @ 12358]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
128 js = gc->proto_data;
a336a5d3102d [gaim-migrate @ 12358]
Mark Doliner <markdoliner@pidgin.im>
parents: 10738
diff changeset
129
18226
adf83935e838 really and truly enforce the no-presence-before-roster thing
Nathan Walp <nwalp@pidgin.im>
parents: 18195
diff changeset
130 /* we don't want to send presence before we've gotten our roster */
adf83935e838 really and truly enforce the no-presence-before-roster thing
Nathan Walp <nwalp@pidgin.im>
parents: 18195
diff changeset
131 if(!js->roster_parsed) {
adf83935e838 really and truly enforce the no-presence-before-roster thing
Nathan Walp <nwalp@pidgin.im>
parents: 18195
diff changeset
132 purple_debug_info("jabber", "attempt to send presence before roster retrieved\n");
adf83935e838 really and truly enforce the no-presence-before-roster thing
Nathan Walp <nwalp@pidgin.im>
parents: 18195
diff changeset
133 return;
adf83935e838 really and truly enforce the no-presence-before-roster thing
Nathan Walp <nwalp@pidgin.im>
parents: 18195
diff changeset
134 }
adf83935e838 really and truly enforce the no-presence-before-roster thing
Nathan Walp <nwalp@pidgin.im>
parents: 18195
diff changeset
135
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
136 purple_status_to_jabber(status, &state, &stripped, &priority);
17800
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
137
17824
52683dfc1f7d Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <am@adiumx.com>
parents: 17816
diff changeset
138 /* check for buzz support */
52683dfc1f7d Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <am@adiumx.com>
parents: 17816
diff changeset
139 allowBuzz = purple_status_get_attr_boolean(status,"buzz");
52683dfc1f7d Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <am@adiumx.com>
parents: 17816
diff changeset
140 /* changing the buzz state has to trigger a re-broadcasting of the presence for caps */
52683dfc1f7d Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <am@adiumx.com>
parents: 17816
diff changeset
141
17800
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
142 #define CHANGED(a,b) ((!a && b) || (a && a[0] == '\0' && b && b[0] != '\0') || \
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
143 (a && !b) || (a && a[0] != '\0' && b && b[0] == '\0') || (a && b && strcmp(a,b)))
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
144 /* check if there are any differences to the <presence> and send them in that case */
17824
52683dfc1f7d Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <am@adiumx.com>
parents: 17816
diff changeset
145 if (allowBuzz != js->allowBuzz || js->old_state != state || CHANGED(js->old_msg, stripped) ||
17800
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
146 js->old_priority != priority || CHANGED(js->old_avatarhash, js->avatar_hash)) {
17824
52683dfc1f7d Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <am@adiumx.com>
parents: 17816
diff changeset
147 js->allowBuzz = allowBuzz;
17800
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
148 presence = jabber_presence_create_js(js, state, stripped, priority);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
149
17800
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
150 if(js->avatar_hash) {
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
151 x = xmlnode_new_child(presence, "x");
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
152 xmlnode_set_namespace(x, "vcard-temp:x:update");
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
153 photo = xmlnode_new_child(x, "photo");
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
154 xmlnode_insert_data(photo, js->avatar_hash, -1);
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
155 }
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
156
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
157 jabber_send(js, presence);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
158
17800
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
159 g_hash_table_foreach(js->chats, chats_send_presence_foreach, presence);
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
160 xmlnode_free(presence);
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
161
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
162 /* update old values */
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
163
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
164 if(js->old_msg)
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
165 g_free(js->old_msg);
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
166 if(js->old_avatarhash)
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
167 g_free(js->old_avatarhash);
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
168 js->old_msg = g_strdup(stripped);
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
169 js->old_avatarhash = g_strdup(js->avatar_hash);
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
170 js->old_state = state;
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
171 js->old_priority = priority;
17801
1a29a61dda8d fixed a bug in the status change tracking code
Andreas Monitzer <am@adiumx.com>
parents: 17800
diff changeset
172 g_free(stripped);
10189
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
173 }
17824
52683dfc1f7d Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <am@adiumx.com>
parents: 17816
diff changeset
174
17800
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
175 /* next, check if there are any changes to the tune values */
21193
e918a1846d03 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20320
diff changeset
176 tune = purple_presence_get_status(purple_status_get_presence(status), "tune");
e918a1846d03 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20320
diff changeset
177 if (tune && purple_status_is_active(tune)) {
e918a1846d03 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20320
diff changeset
178 artist = purple_status_get_attr_string(tune, PURPLE_TUNE_ARTIST);
e918a1846d03 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20320
diff changeset
179 title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE);
e918a1846d03 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20320
diff changeset
180 source = purple_status_get_attr_string(tune, PURPLE_TUNE_ALBUM);
e918a1846d03 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20320
diff changeset
181 uri = purple_status_get_attr_string(tune, PURPLE_TUNE_URL);
e918a1846d03 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20320
diff changeset
182 track = purple_status_get_attr_string(tune, PURPLE_TUNE_TRACK);
e918a1846d03 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20320
diff changeset
183 length = (!purple_status_get_attr_value(tune, PURPLE_TUNE_TIME)) ? -1 :
e918a1846d03 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20320
diff changeset
184 purple_status_get_attr_int(tune, PURPLE_TUNE_TIME);
e918a1846d03 Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20320
diff changeset
185 }
17800
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
186
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
187 if(CHANGED(artist, js->old_artist) || CHANGED(title, js->old_title) || CHANGED(source, js->old_source) ||
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
188 CHANGED(uri, js->old_uri) || CHANGED(track, js->old_track) || (length != js->old_length)) {
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
189 PurpleJabberTuneInfo tuneinfo = {
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
190 (char*)artist,
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
191 (char*)title,
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
192 (char*)source,
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
193 (char*)track,
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
194 length,
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
195 (char*)uri
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
196 };
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
197 jabber_tune_set(js->gc, &tuneinfo);
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
198
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
199 /* update old values */
20320
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19899
diff changeset
200 g_free(js->old_artist);
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19899
diff changeset
201 g_free(js->old_title);
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19899
diff changeset
202 g_free(js->old_source);
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19899
diff changeset
203 g_free(js->old_uri);
6337e101f6ab Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19899
diff changeset
204 g_free(js->old_track);
17800
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
205 js->old_artist = g_strdup(artist);
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
206 js->old_title = g_strdup(title);
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
207 js->old_source = g_strdup(source);
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
208 js->old_uri = g_strdup(uri);
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
209 js->old_length = length;
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
210 js->old_track = g_strdup(track);
39a0f9ed0e26 Replaced a clean and simple API with a very weird hack due to vivid request on #pidgin by multiple devs. This avoids the change in PurplePluginProtocolInfo, but requires complicated change tracking in every prpl. The others prpl should add this change tracking, too (since otherwise the status gets changed even though nothing they care about changed), but that's not up to me.
Andreas Monitzer <am@adiumx.com>
parents: 17783
diff changeset
211 }
19899
483c4f495a6c Various warning fixes for the xmpp prpl.
Daniel Atallah <datallah@pidgin.im>
parents: 19897
diff changeset
212
483c4f495a6c Various warning fixes for the xmpp prpl.
Daniel Atallah <datallah@pidgin.im>
parents: 19897
diff changeset
213 #undef CHANGED
483c4f495a6c Various warning fixes for the xmpp prpl.
Daniel Atallah <datallah@pidgin.im>
parents: 19897
diff changeset
214
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
215 jabber_presence_fake_to_self(js, status);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
216 }
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
217
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
218 xmlnode *jabber_presence_create(JabberBuddyState state, const char *msg, int priority)
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
219 {
17770
e67998927a3c Added the ability to define extensions to caps
Andreas Monitzer <am@adiumx.com>
parents: 17422
diff changeset
220 return jabber_presence_create_js(NULL, state, msg, priority);
e67998927a3c Added the ability to define extensions to caps
Andreas Monitzer <am@adiumx.com>
parents: 17422
diff changeset
221 }
e67998927a3c Added the ability to define extensions to caps
Andreas Monitzer <am@adiumx.com>
parents: 17422
diff changeset
222
e67998927a3c Added the ability to define extensions to caps
Andreas Monitzer <am@adiumx.com>
parents: 17422
diff changeset
223 xmlnode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority)
e67998927a3c Added the ability to define extensions to caps
Andreas Monitzer <am@adiumx.com>
parents: 17422
diff changeset
224 {
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 13214
diff changeset
225 xmlnode *show, *status, *presence, *pri, *c;
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
226 const char *show_string = NULL;
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
227
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
228 presence = xmlnode_new("presence");
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
229
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
230 if(state == JABBER_BUDDY_STATE_UNAVAILABLE)
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
231 xmlnode_set_attrib(presence, "type", "unavailable");
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
232 else if(state != JABBER_BUDDY_STATE_ONLINE &&
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
233 state != JABBER_BUDDY_STATE_UNKNOWN &&
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
234 state != JABBER_BUDDY_STATE_ERROR)
12683
9ff688ee3fec [gaim-migrate @ 15026]
Nathan Walp <nwalp@pidgin.im>
parents: 12603
diff changeset
235 show_string = jabber_buddy_state_get_show(state);
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
236
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
237 if(show_string) {
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
238 show = xmlnode_new_child(presence, "show");
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
239 xmlnode_insert_data(show, show_string, -1);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
240 }
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
241
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
242 if(msg) {
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
243 status = xmlnode_new_child(presence, "status");
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
244 xmlnode_insert_data(status, msg, -1);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
245 }
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
246
11568
ea479b2a8808 [gaim-migrate @ 13835]
Nathan Walp <nwalp@pidgin.im>
parents: 11361
diff changeset
247 if(priority) {
ea479b2a8808 [gaim-migrate @ 13835]
Nathan Walp <nwalp@pidgin.im>
parents: 11361
diff changeset
248 char *pstr = g_strdup_printf("%d", priority);
ea479b2a8808 [gaim-migrate @ 13835]
Nathan Walp <nwalp@pidgin.im>
parents: 11361
diff changeset
249 pri = xmlnode_new_child(presence, "priority");
ea479b2a8808 [gaim-migrate @ 13835]
Nathan Walp <nwalp@pidgin.im>
parents: 11361
diff changeset
250 xmlnode_insert_data(pri, pstr, -1);
ea479b2a8808 [gaim-migrate @ 13835]
Nathan Walp <nwalp@pidgin.im>
parents: 11361
diff changeset
251 g_free(pstr);
ea479b2a8808 [gaim-migrate @ 13835]
Nathan Walp <nwalp@pidgin.im>
parents: 11361
diff changeset
252 }
ea479b2a8808 [gaim-migrate @ 13835]
Nathan Walp <nwalp@pidgin.im>
parents: 11361
diff changeset
253
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 13214
diff changeset
254 /* JEP-0115 */
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 13214
diff changeset
255 c = xmlnode_new_child(presence, "c");
13808
411ee56da344 [gaim-migrate @ 16229]
Sean Egan <seanegan@pidgin.im>
parents: 13497
diff changeset
256 xmlnode_set_namespace(c, "http://jabber.org/protocol/caps");
13385
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 13214
diff changeset
257 xmlnode_set_attrib(c, "node", CAPS0115_NODE);
6fb64ae23761 [gaim-migrate @ 15757]
Nathan Walp <nwalp@pidgin.im>
parents: 13214
diff changeset
258 xmlnode_set_attrib(c, "ver", VERSION);
19894
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
259
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
260 if(js != NULL) {
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
261 /* add the extensions */
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
262 char extlist[1024];
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
263 unsigned remaining = 1023; /* one less for the \0 */
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
264 GList *feature;
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
265
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
266 extlist[0] = '\0';
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
267 for(feature = jabber_features; feature && remaining > 0; feature = feature->next) {
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
268 JabberFeature *feat = (JabberFeature*)feature->data;
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
269 unsigned featlen;
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
270
17783
2687df1ca202 PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents: 17773
diff changeset
271 if(feat->is_enabled != NULL && feat->is_enabled(js, feat->shortname, feat->namespace) == FALSE)
2687df1ca202 PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents: 17773
diff changeset
272 continue; /* skip this feature */
2687df1ca202 PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents: 17773
diff changeset
273
2687df1ca202 PEP publishing features are now only announced in disco#info when PEP is supported by the server.
Andreas Monitzer <am@adiumx.com>
parents: 17773
diff changeset
274 featlen = strlen(feat->shortname);
19894
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
275
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
276 /* cut off when we don't have any more space left in our buffer (too bad) */
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
277 if(featlen > remaining)
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
278 break;
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
279
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
280 strncat(extlist,feat->shortname,remaining);
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
281 remaining -= featlen;
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
282 if(feature->next) { /* no space at the end */
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
283 strncat(extlist," ",remaining);
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
284 --remaining;
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
285 }
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
286 }
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
287 /* did we add anything? */
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
288 if(remaining < 1023)
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
289 xmlnode_set_attrib(c, "ext", extlist);
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
290 }
b273d0db2bdd Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents: 19389
diff changeset
291
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
292 return presence;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
293 }
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
294
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
295 struct _jabber_add_permit {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
296 PurpleConnection *gc;
12285
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12265
diff changeset
297 JabberStream *js;
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
298 char *who;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
299 };
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
300
19335
4613b53d5741 Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <datallah@pidgin.im>
parents: 18991
diff changeset
301 static void authorize_add_cb(gpointer data)
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
302 {
19335
4613b53d5741 Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <datallah@pidgin.im>
parents: 18991
diff changeset
303 struct _jabber_add_permit *jap = data;
14030
23144f1dc950 [gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents: 13952
diff changeset
304 jabber_presence_subscription_set(jap->gc->proto_data, jap->who,
23144f1dc950 [gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents: 13952
diff changeset
305 "subscribed");
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
306 g_free(jap->who);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
307 g_free(jap);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
308 }
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
309
19335
4613b53d5741 Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <datallah@pidgin.im>
parents: 18991
diff changeset
310 static void deny_add_cb(gpointer data)
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
311 {
19335
4613b53d5741 Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <datallah@pidgin.im>
parents: 18991
diff changeset
312 struct _jabber_add_permit *jap = data;
14030
23144f1dc950 [gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents: 13952
diff changeset
313 jabber_presence_subscription_set(jap->gc->proto_data, jap->who,
23144f1dc950 [gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents: 13952
diff changeset
314 "unsubscribed");
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
315
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
316 g_free(jap->who);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
317 g_free(jap);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
318 }
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
319
10189
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
320 static void jabber_vcard_parse_avatar(JabberStream *js, xmlnode *packet, gpointer blah)
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
321 {
10941
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
322 JabberBuddy *jb = NULL;
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
323 xmlnode *vcard, *photo, *binval;
11127
5e539d9d26a4 [gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents: 11013
diff changeset
324 char *text;
11137
cf40226ddff7 [gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents: 11127
diff changeset
325 guchar *data;
11127
5e539d9d26a4 [gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents: 11013
diff changeset
326 gsize size;
10189
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
327 const char *from = xmlnode_get_attrib(packet, "from");
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
328
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
329 if(!from)
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
330 return;
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
331
10941
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
332 jb = jabber_buddy_find(js, from, TRUE);
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
333
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
334 js->pending_avatar_requests = g_slist_remove(js->pending_avatar_requests, jb);
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
335
10189
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
336 if((vcard = xmlnode_get_child(packet, "vCard")) ||
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
337 (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) {
10941
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
338 if((photo = xmlnode_get_child(vcard, "PHOTO")) &&
11361
b8c9532c9ffe [gaim-migrate @ 13585]
Nathan Walp <nwalp@pidgin.im>
parents: 11251
diff changeset
339 (( (binval = xmlnode_get_child(photo, "BINVAL")) &&
b8c9532c9ffe [gaim-migrate @ 13585]
Nathan Walp <nwalp@pidgin.im>
parents: 11251
diff changeset
340 (text = xmlnode_get_data(binval))) ||
b8c9532c9ffe [gaim-migrate @ 13585]
Nathan Walp <nwalp@pidgin.im>
parents: 11251
diff changeset
341 (text = xmlnode_get_data(photo)))) {
16534
2ab9e23f99d9 Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@pidgin.im>
parents: 16018
diff changeset
342 unsigned char hashval[20];
2ab9e23f99d9 Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@pidgin.im>
parents: 16018
diff changeset
343 char hash[41], *p;
2ab9e23f99d9 Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@pidgin.im>
parents: 16018
diff changeset
344 int i;
2ab9e23f99d9 Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@pidgin.im>
parents: 16018
diff changeset
345
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
346 data = purple_base64_decode(text, &size);
10189
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
347
16534
2ab9e23f99d9 Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@pidgin.im>
parents: 16018
diff changeset
348 purple_cipher_digest_region("sha1", data, size,
2ab9e23f99d9 Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@pidgin.im>
parents: 16018
diff changeset
349 sizeof(hashval), hashval, NULL);
2ab9e23f99d9 Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@pidgin.im>
parents: 16018
diff changeset
350 p = hash;
2ab9e23f99d9 Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@pidgin.im>
parents: 16018
diff changeset
351 for(i=0; i<20; i++, p+=2)
2ab9e23f99d9 Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@pidgin.im>
parents: 16018
diff changeset
352 snprintf(p, 3, "%02x", hashval[i]);
10189
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
353
16534
2ab9e23f99d9 Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@pidgin.im>
parents: 16018
diff changeset
354 purple_buddy_icons_set_for_user(js->gc->account, from, data, size, hash);
10941
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
355 g_free(text);
10189
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
356 }
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
357 }
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
358 }
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
359
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
360 typedef struct _JabberPresenceCapabilities {
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
361 JabberStream *js;
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
362 JabberBuddyResource *jbr;
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
363 char *from;
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
364 } JabberPresenceCapabilities;
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
365
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
366 static void jabber_presence_set_capabilities(JabberCapsClientInfo *info, gpointer user_data) {
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
367 JabberPresenceCapabilities *userdata = user_data;
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
368 GList *iter;
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
369
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
370 if(userdata->jbr->caps)
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
371 jabber_caps_free_clientinfo(userdata->jbr->caps);
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
372 userdata->jbr->caps = info;
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
373
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
374 for(iter = info->features; iter; iter = g_list_next(iter)) {
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
375 if(!strcmp((const char*)iter->data, "http://jabber.org/protocol/commands")) {
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
376 JabberIq *iq = jabber_iq_new_query(userdata->js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#items");
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
377 xmlnode *query = xmlnode_get_child_with_namespace(iq->node,"query","http://jabber.org/protocol/disco#items");
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
378 xmlnode_set_attrib(iq->node, "to", userdata->from);
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
379 xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/commands");
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
380
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
381 jabber_iq_set_callback(iq, jabber_adhoc_disco_result_cb, NULL);
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
382 jabber_iq_send(iq);
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
383 break;
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
384 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
385 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
386 g_free(user_data);
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
387 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
388
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
389 void jabber_presence_parse(JabberStream *js, xmlnode *packet)
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
390 {
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
391 const char *from = xmlnode_get_attrib(packet, "from");
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
392 const char *type = xmlnode_get_attrib(packet, "type");
7944
619ec16df2c8 [gaim-migrate @ 8615]
Nathan Walp <nwalp@pidgin.im>
parents: 7923
diff changeset
393 const char *real_jid = NULL;
9152
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
394 const char *affiliation = NULL;
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
395 const char *role = NULL;
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
396 char *status = NULL;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
397 int priority = 0;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
398 JabberID *jid;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
399 JabberChat *chat;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
400 JabberBuddy *jb;
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
401 JabberBuddyResource *jbr = NULL, *found_jbr = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
402 PurpleConvChatBuddyFlags flags = PURPLE_CBFLAGS_NONE;
9846
61f7349c153a [gaim-migrate @ 10724]
Nathan Fredrickson <nathan@silverorange.com>
parents: 9745
diff changeset
403 gboolean delayed = FALSE;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
404 PurpleBuddy *b = NULL;
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
405 char *buddy_name;
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
406 JabberBuddyState state = JABBER_BUDDY_STATE_UNKNOWN;
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
407 xmlnode *y;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
408 gboolean muc = FALSE;
10189
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
409 char *avatar_hash = NULL;
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
410 xmlnode *caps = NULL;
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
411
8043
86a087e9624c [gaim-migrate @ 8727]
Nathan Walp <nwalp@pidgin.im>
parents: 8010
diff changeset
412 if(!(jb = jabber_buddy_find(js, from, TRUE)))
86a087e9624c [gaim-migrate @ 8727]
Nathan Walp <nwalp@pidgin.im>
parents: 8010
diff changeset
413 return;
86a087e9624c [gaim-migrate @ 8727]
Nathan Walp <nwalp@pidgin.im>
parents: 8010
diff changeset
414
86a087e9624c [gaim-migrate @ 8727]
Nathan Walp <nwalp@pidgin.im>
parents: 8010
diff changeset
415 if(!(jid = jabber_id_new(from)))
7280
f00e23f50698 [gaim-migrate @ 7859]
Nathan Walp <nwalp@pidgin.im>
parents: 7273
diff changeset
416 return;
f00e23f50698 [gaim-migrate @ 7859]
Nathan Walp <nwalp@pidgin.im>
parents: 7273
diff changeset
417
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
418 if(jb->error_msg) {
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
419 g_free(jb->error_msg);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
420 jb->error_msg = NULL;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
421 }
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
422
7813
b25628709267 [gaim-migrate @ 8460]
Nathan Walp <nwalp@pidgin.im>
parents: 7644
diff changeset
423 if(type && !strcmp(type, "error")) {
8401
9fe6cadf2581 [gaim-migrate @ 9130]
Nathan Walp <nwalp@pidgin.im>
parents: 8396
diff changeset
424 char *msg = jabber_parse_error(js, packet);
7644
9c1af0d50941 [gaim-migrate @ 8287]
Nathan Walp <nwalp@pidgin.im>
parents: 7630
diff changeset
425
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
426 state = JABBER_BUDDY_STATE_ERROR;
8401
9fe6cadf2581 [gaim-migrate @ 9130]
Nathan Walp <nwalp@pidgin.im>
parents: 8396
diff changeset
427 jb->error_msg = msg ? msg : g_strdup(_("Unknown Error in presence"));
7813
b25628709267 [gaim-migrate @ 8460]
Nathan Walp <nwalp@pidgin.im>
parents: 7644
diff changeset
428 } else if(type && !strcmp(type, "subscribe")) {
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
429 struct _jabber_add_permit *jap = g_new0(struct _jabber_add_permit, 1);
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 15119
diff changeset
430 gboolean onlist = FALSE;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
431 PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(js->gc), from);
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 15119
diff changeset
432 JabberBuddy *jb = NULL;
10949
b2949f5fc512 [gaim-migrate @ 12749]
Evan Schoenberg <evands@pidgin.im>
parents: 10941
diff changeset
433
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 15119
diff changeset
434 if (buddy) {
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 15119
diff changeset
435 jb = jabber_buddy_find(js, from, TRUE);
16018
0cbbb5b642ce fix prompting to add a buddy after authorization if they're already on our list
Nathan Walp <nwalp@pidgin.im>
parents: 15952
diff changeset
436 if ((jb->subscription & JABBER_SUB_TO))
15197
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 15119
diff changeset
437 onlist = TRUE;
1d98528d4ee3 [gaim-migrate @ 17921]
Sean Egan <seanegan@pidgin.im>
parents: 15119
diff changeset
438 }
16018
0cbbb5b642ce fix prompting to add a buddy after authorization if they're already on our list
Nathan Walp <nwalp@pidgin.im>
parents: 15952
diff changeset
439
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
440 jap->gc = js->gc;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
441 jap->who = g_strdup(from);
12285
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12265
diff changeset
442 jap->js = js;
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
443
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
444 purple_account_request_authorization(purple_connection_get_account(js->gc), from, NULL, NULL, NULL, onlist,
19335
4613b53d5741 Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <datallah@pidgin.im>
parents: 18991
diff changeset
445 authorize_add_cb, deny_add_cb, jap);
8043
86a087e9624c [gaim-migrate @ 8727]
Nathan Walp <nwalp@pidgin.im>
parents: 8010
diff changeset
446 jabber_id_free(jid);
7145
c77dd3b09666 [gaim-migrate @ 7712]
Nathan Walp <nwalp@pidgin.im>
parents: 7124
diff changeset
447 return;
7813
b25628709267 [gaim-migrate @ 8460]
Nathan Walp <nwalp@pidgin.im>
parents: 7644
diff changeset
448 } else if(type && !strcmp(type, "subscribed")) {
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
449 /* we've been allowed to see their presence, but we don't care */
8043
86a087e9624c [gaim-migrate @ 8727]
Nathan Walp <nwalp@pidgin.im>
parents: 8010
diff changeset
450 jabber_id_free(jid);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
451 return;
12285
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12265
diff changeset
452 } else if(type && !strcmp(type, "unsubscribe")) {
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12265
diff changeset
453 /* XXX I'm not sure this is the right way to handle this, it
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12265
diff changeset
454 * might be better to add "unsubscribe" to the presence status
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12265
diff changeset
455 * if lower down, but I'm not sure. */
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12265
diff changeset
456 /* they are unsubscribing from our presence, we don't care */
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12265
diff changeset
457 /* Well, maybe just a little, we might want/need to start
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12265
diff changeset
458 * acknowledging this (and the others) at some point. */
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12265
diff changeset
459 jabber_id_free(jid);
5a0f4619b0c5 [gaim-migrate @ 14589]
Etan Reisner <deryni@pidgin.im>
parents: 12265
diff changeset
460 return;
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
461 } else {
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
462 if((y = xmlnode_get_child(packet, "show"))) {
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
463 char *show = xmlnode_get_data(y);
12683
9ff688ee3fec [gaim-migrate @ 15026]
Nathan Walp <nwalp@pidgin.im>
parents: 12603
diff changeset
464 state = jabber_buddy_show_get_state(show);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
465 g_free(show);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
466 } else {
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
467 state = JABBER_BUDDY_STATE_ONLINE;
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
468 }
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
469 }
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
470
7310
1346a99cba40 [gaim-migrate @ 7894]
Nathan Walp <nwalp@pidgin.im>
parents: 7280
diff changeset
471
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
472 for(y = packet->child; y; y = y->next) {
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
473 const char *xmlns;
8135
d4df7d1821a5 [gaim-migrate @ 8840]
Nathan Walp <nwalp@pidgin.im>
parents: 8043
diff changeset
474 if(y->type != XMLNODE_TYPE_TAG)
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
475 continue;
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
476 xmlns = xmlnode_get_namespace(y);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
477
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
478 if(!strcmp(y->name, "status")) {
7615
6bf94a91db1c [gaim-migrate @ 8239]
Nathan Walp <nwalp@pidgin.im>
parents: 7425
diff changeset
479 g_free(status);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
480 status = xmlnode_get_data(y);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
481 } else if(!strcmp(y->name, "priority")) {
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
482 char *p = xmlnode_get_data(y);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
483 if(p) {
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
484 priority = atoi(p);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
485 g_free(p);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
486 }
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
487 } else if(!strcmp(y->name, "delay") && !strcmp(xmlns, "urn:xmpp:delay")) {
17812
be440f0a0acf Forgot to implement XEP-0203 for presence packets, too.
Andreas Monitzer <am@adiumx.com>
parents: 17801
diff changeset
488 /* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */
be440f0a0acf Forgot to implement XEP-0203 for presence packets, too.
Andreas Monitzer <am@adiumx.com>
parents: 17801
diff changeset
489 delayed = TRUE;
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
490 } else if(!strcmp(y->name, "c") && !strcmp(xmlns, "http://jabber.org/protocol/caps")) {
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
491 caps = y; /* store for later, when creating buddy resource */
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
492 } else if(!strcmp(y->name, "x")) {
13808
411ee56da344 [gaim-migrate @ 16229]
Sean Egan <seanegan@pidgin.im>
parents: 13497
diff changeset
493 const char *xmlns = xmlnode_get_namespace(y);
9846
61f7349c153a [gaim-migrate @ 10724]
Nathan Fredrickson <nathan@silverorange.com>
parents: 9745
diff changeset
494 if(xmlns && !strcmp(xmlns, "jabber:x:delay")) {
9847
afbca7f109fd [gaim-migrate @ 10725]
Nathan Walp <nwalp@pidgin.im>
parents: 9846
diff changeset
495 /* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */
9846
61f7349c153a [gaim-migrate @ 10724]
Nathan Fredrickson <nathan@silverorange.com>
parents: 9745
diff changeset
496 delayed = TRUE;
61f7349c153a [gaim-migrate @ 10724]
Nathan Fredrickson <nathan@silverorange.com>
parents: 9745
diff changeset
497 } else if(xmlns && !strcmp(xmlns, "http://jabber.org/protocol/muc#user")) {
7629
c776e0ca8025 [gaim-migrate @ 8253]
Nathan Walp <nwalp@pidgin.im>
parents: 7615
diff changeset
498 xmlnode *z;
c776e0ca8025 [gaim-migrate @ 8253]
Nathan Walp <nwalp@pidgin.im>
parents: 7615
diff changeset
499
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
500 muc = TRUE;
7629
c776e0ca8025 [gaim-migrate @ 8253]
Nathan Walp <nwalp@pidgin.im>
parents: 7615
diff changeset
501 if((z = xmlnode_get_child(y, "status"))) {
c776e0ca8025 [gaim-migrate @ 8253]
Nathan Walp <nwalp@pidgin.im>
parents: 7615
diff changeset
502 const char *code = xmlnode_get_attrib(z, "code");
c776e0ca8025 [gaim-migrate @ 8253]
Nathan Walp <nwalp@pidgin.im>
parents: 7615
diff changeset
503 if(code && !strcmp(code, "201")) {
13445
a67047ddc5c1 [gaim-migrate @ 15819]
Nathan Walp <nwalp@pidgin.im>
parents: 13443
diff changeset
504 if((chat = jabber_chat_find(js, jid->node, jid->domain))) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
505 chat->config_dialog_type = PURPLE_REQUEST_ACTION;
13445
a67047ddc5c1 [gaim-migrate @ 15819]
Nathan Walp <nwalp@pidgin.im>
parents: 13443
diff changeset
506 chat->config_dialog_handle =
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
507 purple_request_action(js->gc,
13445
a67047ddc5c1 [gaim-migrate @ 15819]
Nathan Walp <nwalp@pidgin.im>
parents: 13443
diff changeset
508 _("Create New Room"),
a67047ddc5c1 [gaim-migrate @ 15819]
Nathan Walp <nwalp@pidgin.im>
parents: 13443
diff changeset
509 _("Create New Room"),
a67047ddc5c1 [gaim-migrate @ 15819]
Nathan Walp <nwalp@pidgin.im>
parents: 13443
diff changeset
510 _("You are creating a new room. Would"
a67047ddc5c1 [gaim-migrate @ 15819]
Nathan Walp <nwalp@pidgin.im>
parents: 13443
diff changeset
511 " you like to configure it, or"
a67047ddc5c1 [gaim-migrate @ 15819]
Nathan Walp <nwalp@pidgin.im>
parents: 13443
diff changeset
512 " accept the default settings?"),
16490
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16018
diff changeset
513 /* Default Action */ 1,
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16018
diff changeset
514 purple_connection_get_account(js->gc), NULL, chat->conv,
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16018
diff changeset
515 chat, 2,
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16018
diff changeset
516 _("_Configure Room"), G_CALLBACK(jabber_chat_request_room_configure),
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16018
diff changeset
517 _("_Accept Defaults"), G_CALLBACK(jabber_chat_create_instant_room));
13445
a67047ddc5c1 [gaim-migrate @ 15819]
Nathan Walp <nwalp@pidgin.im>
parents: 13443
diff changeset
518 }
18971
34b3eb14ea8f Commit a patch by bibliochat to handle an XMPP MUC status code that I pushed
Etan Reisner <deryni@pidgin.im>
parents: 18382
diff changeset
519 } else if(code && !strcmp(code, "210")) {
34b3eb14ea8f Commit a patch by bibliochat to handle an XMPP MUC status code that I pushed
Etan Reisner <deryni@pidgin.im>
parents: 18382
diff changeset
520 /* server rewrote room-nick */
34b3eb14ea8f Commit a patch by bibliochat to handle an XMPP MUC status code that I pushed
Etan Reisner <deryni@pidgin.im>
parents: 18382
diff changeset
521 if((chat = jabber_chat_find(js, jid->node, jid->domain))) {
34b3eb14ea8f Commit a patch by bibliochat to handle an XMPP MUC status code that I pushed
Etan Reisner <deryni@pidgin.im>
parents: 18382
diff changeset
522 g_free(chat->handle);
34b3eb14ea8f Commit a patch by bibliochat to handle an XMPP MUC status code that I pushed
Etan Reisner <deryni@pidgin.im>
parents: 18382
diff changeset
523 chat->handle = g_strdup(jid->resource);
34b3eb14ea8f Commit a patch by bibliochat to handle an XMPP MUC status code that I pushed
Etan Reisner <deryni@pidgin.im>
parents: 18382
diff changeset
524 }
7629
c776e0ca8025 [gaim-migrate @ 8253]
Nathan Walp <nwalp@pidgin.im>
parents: 7615
diff changeset
525 }
c776e0ca8025 [gaim-migrate @ 8253]
Nathan Walp <nwalp@pidgin.im>
parents: 7615
diff changeset
526 }
7944
619ec16df2c8 [gaim-migrate @ 8615]
Nathan Walp <nwalp@pidgin.im>
parents: 7923
diff changeset
527 if((z = xmlnode_get_child(y, "item"))) {
619ec16df2c8 [gaim-migrate @ 8615]
Nathan Walp <nwalp@pidgin.im>
parents: 7923
diff changeset
528 real_jid = xmlnode_get_attrib(z, "jid");
9152
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
529 affiliation = xmlnode_get_attrib(z, "affiliation");
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
530 role = xmlnode_get_attrib(z, "role");
9931
379686e1d709 [gaim-migrate @ 10823]
Nathan Walp <nwalp@pidgin.im>
parents: 9927
diff changeset
531 if(affiliation != NULL && !strcmp(affiliation, "owner"))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
532 flags |= PURPLE_CBFLAGS_FOUNDER;
9743
839b2bce3853 [gaim-migrate @ 10608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9559
diff changeset
533 if (role != NULL) {
839b2bce3853 [gaim-migrate @ 10608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9559
diff changeset
534 if (!strcmp(role, "moderator"))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
535 flags |= PURPLE_CBFLAGS_OP;
9743
839b2bce3853 [gaim-migrate @ 10608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9559
diff changeset
536 else if (!strcmp(role, "participant"))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
537 flags |= PURPLE_CBFLAGS_VOICE;
9743
839b2bce3853 [gaim-migrate @ 10608]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9559
diff changeset
538 }
7944
619ec16df2c8 [gaim-migrate @ 8615]
Nathan Walp <nwalp@pidgin.im>
parents: 7923
diff changeset
539 }
10189
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
540 } else if(xmlns && !strcmp(xmlns, "vcard-temp:x:update")) {
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
541 xmlnode *photo = xmlnode_get_child(y, "photo");
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
542 if(photo) {
17702
15af85f94634 Don't check for null before calling free. I can't help but get rid
Mark Doliner <markdoliner@pidgin.im>
parents: 17683
diff changeset
543 g_free(avatar_hash);
10189
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
544 avatar_hash = xmlnode_get_data(photo);
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
545 }
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
546 }
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
547 }
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
548 }
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
549
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
550
7322
de15a9314c04 [gaim-migrate @ 7908]
Nathan Walp <nwalp@pidgin.im>
parents: 7321
diff changeset
551 if(jid->node && (chat = jabber_chat_find(js, jid->node, jid->domain))) {
8462
7afffaf5997b [gaim-migrate @ 9192]
Nathan Walp <nwalp@pidgin.im>
parents: 8401
diff changeset
552 static int i = 1;
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
553 char *room_jid = g_strdup_printf("%s@%s", jid->node, jid->domain);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
554
17049
fe85f1b2d70b chat error fix from sadrul
Nathan Walp <nwalp@pidgin.im>
parents: 16545
diff changeset
555 if(state == JABBER_BUDDY_STATE_ERROR) {
8401
9fe6cadf2581 [gaim-migrate @ 9130]
Nathan Walp <nwalp@pidgin.im>
parents: 8396
diff changeset
556 char *title, *msg = jabber_parse_error(js, packet);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
557
7321
432276dbb354 [gaim-migrate @ 7907]
Nathan Walp <nwalp@pidgin.im>
parents: 7320
diff changeset
558 if(chat->conv) {
8401
9fe6cadf2581 [gaim-migrate @ 9130]
Nathan Walp <nwalp@pidgin.im>
parents: 8396
diff changeset
559 title = g_strdup_printf(_("Error in chat %s"), from);
18991
aa6a1feb874a applied changes from 5542a465de12fedee4ebe7c124a754f9992d0d62
Mark Doliner <markdoliner@pidgin.im>
parents: 18989
diff changeset
560 if (g_hash_table_size(chat->members) == 0)
aa6a1feb874a applied changes from 5542a465de12fedee4ebe7c124a754f9992d0d62
Mark Doliner <markdoliner@pidgin.im>
parents: 18989
diff changeset
561 serv_got_chat_left(js->gc, chat->id);
7321
432276dbb354 [gaim-migrate @ 7907]
Nathan Walp <nwalp@pidgin.im>
parents: 7320
diff changeset
562 } else {
8401
9fe6cadf2581 [gaim-migrate @ 9130]
Nathan Walp <nwalp@pidgin.im>
parents: 8396
diff changeset
563 title = g_strdup_printf(_("Error joining chat %s"), from);
7321
432276dbb354 [gaim-migrate @ 7907]
Nathan Walp <nwalp@pidgin.im>
parents: 7320
diff changeset
564 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
565 purple_notify_error(js->gc, title, title, msg);
8401
9fe6cadf2581 [gaim-migrate @ 9130]
Nathan Walp <nwalp@pidgin.im>
parents: 8396
diff changeset
566 g_free(title);
9fe6cadf2581 [gaim-migrate @ 9130]
Nathan Walp <nwalp@pidgin.im>
parents: 8396
diff changeset
567 g_free(msg);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
568
18991
aa6a1feb874a applied changes from 5542a465de12fedee4ebe7c124a754f9992d0d62
Mark Doliner <markdoliner@pidgin.im>
parents: 18989
diff changeset
569 if (g_hash_table_size(chat->members) == 0)
aa6a1feb874a applied changes from 5542a465de12fedee4ebe7c124a754f9992d0d62
Mark Doliner <markdoliner@pidgin.im>
parents: 18989
diff changeset
570 /* Only destroy the chat if the error happened while joining */
aa6a1feb874a applied changes from 5542a465de12fedee4ebe7c124a754f9992d0d62
Mark Doliner <markdoliner@pidgin.im>
parents: 18989
diff changeset
571 jabber_chat_destroy(chat);
7310
1346a99cba40 [gaim-migrate @ 7894]
Nathan Walp <nwalp@pidgin.im>
parents: 7280
diff changeset
572 jabber_id_free(jid);
7615
6bf94a91db1c [gaim-migrate @ 8239]
Nathan Walp <nwalp@pidgin.im>
parents: 7425
diff changeset
573 g_free(status);
8182
a024bf275ba2 [gaim-migrate @ 8901]
Nathan Walp <nwalp@pidgin.im>
parents: 8158
diff changeset
574 g_free(room_jid);
17702
15af85f94634 Don't check for null before calling free. I can't help but get rid
Mark Doliner <markdoliner@pidgin.im>
parents: 17683
diff changeset
575 g_free(avatar_hash);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
576 return;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
577 }
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
578
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
579
7813
b25628709267 [gaim-migrate @ 8460]
Nathan Walp <nwalp@pidgin.im>
parents: 7644
diff changeset
580 if(type && !strcmp(type, "unavailable")) {
7972
f8538961a159 [gaim-migrate @ 8649]
Nathan Walp <nwalp@pidgin.im>
parents: 7965
diff changeset
581 gboolean nick_change = FALSE;
7973
f1d1001702be [gaim-migrate @ 8650]
Nathan Walp <nwalp@pidgin.im>
parents: 7972
diff changeset
582
9152
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
583 /* If we haven't joined the chat yet, we don't care that someone
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
584 * left, or it was us leaving after we closed the chat */
8182
a024bf275ba2 [gaim-migrate @ 8901]
Nathan Walp <nwalp@pidgin.im>
parents: 8158
diff changeset
585 if(!chat->conv) {
10558
da1cfd91fd94 [gaim-migrate @ 11936]
Nathan Walp <nwalp@pidgin.im>
parents: 10490
diff changeset
586 if(jid->resource && chat->handle && !strcmp(jid->resource, chat->handle))
9152
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
587 jabber_chat_destroy(chat);
8182
a024bf275ba2 [gaim-migrate @ 8901]
Nathan Walp <nwalp@pidgin.im>
parents: 8158
diff changeset
588 jabber_id_free(jid);
a024bf275ba2 [gaim-migrate @ 8901]
Nathan Walp <nwalp@pidgin.im>
parents: 8158
diff changeset
589 g_free(status);
a024bf275ba2 [gaim-migrate @ 8901]
Nathan Walp <nwalp@pidgin.im>
parents: 8158
diff changeset
590 g_free(room_jid);
17702
15af85f94634 Don't check for null before calling free. I can't help but get rid
Mark Doliner <markdoliner@pidgin.im>
parents: 17683
diff changeset
591 g_free(avatar_hash);
8182
a024bf275ba2 [gaim-migrate @ 8901]
Nathan Walp <nwalp@pidgin.im>
parents: 8158
diff changeset
592 return;
a024bf275ba2 [gaim-migrate @ 8901]
Nathan Walp <nwalp@pidgin.im>
parents: 8158
diff changeset
593 }
a024bf275ba2 [gaim-migrate @ 8901]
Nathan Walp <nwalp@pidgin.im>
parents: 8158
diff changeset
594
7973
f1d1001702be [gaim-migrate @ 8650]
Nathan Walp <nwalp@pidgin.im>
parents: 7972
diff changeset
595 jabber_buddy_remove_resource(jb, jid->resource);
7972
f8538961a159 [gaim-migrate @ 8649]
Nathan Walp <nwalp@pidgin.im>
parents: 7965
diff changeset
596 if(chat->muc) {
f8538961a159 [gaim-migrate @ 8649]
Nathan Walp <nwalp@pidgin.im>
parents: 7965
diff changeset
597 xmlnode *x;
8135
d4df7d1821a5 [gaim-migrate @ 8840]
Nathan Walp <nwalp@pidgin.im>
parents: 8043
diff changeset
598 for(x = xmlnode_get_child(packet, "x"); x; x = xmlnode_get_next_twin(x)) {
7972
f8538961a159 [gaim-migrate @ 8649]
Nathan Walp <nwalp@pidgin.im>
parents: 7965
diff changeset
599 const char *xmlns, *nick, *code;
f8538961a159 [gaim-migrate @ 8649]
Nathan Walp <nwalp@pidgin.im>
parents: 7965
diff changeset
600 xmlnode *stat, *item;
13808
411ee56da344 [gaim-migrate @ 16229]
Sean Egan <seanegan@pidgin.im>
parents: 13497
diff changeset
601 if(!(xmlns = xmlnode_get_namespace(x)) ||
7972
f8538961a159 [gaim-migrate @ 8649]
Nathan Walp <nwalp@pidgin.im>
parents: 7965
diff changeset
602 strcmp(xmlns, "http://jabber.org/protocol/muc#user"))
f8538961a159 [gaim-migrate @ 8649]
Nathan Walp <nwalp@pidgin.im>
parents: 7965
diff changeset
603 continue;
f8538961a159 [gaim-migrate @ 8649]
Nathan Walp <nwalp@pidgin.im>
parents: 7965
diff changeset
604 if(!(stat = xmlnode_get_child(x, "status")))
f8538961a159 [gaim-migrate @ 8649]
Nathan Walp <nwalp@pidgin.im>
parents: 7965
diff changeset
605 continue;
9152
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
606 if(!(code = xmlnode_get_attrib(stat, "code")))
7972
f8538961a159 [gaim-migrate @ 8649]
Nathan Walp <nwalp@pidgin.im>
parents: 7965
diff changeset
607 continue;
9152
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
608 if(!strcmp(code, "301")) {
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
609 /* XXX: we got banned */
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
610 } else if(!strcmp(code, "303")) {
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
611 if(!(item = xmlnode_get_child(x, "item")))
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
612 continue;
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
613 if(!(nick = xmlnode_get_attrib(item, "nick")))
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
614 continue;
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
615 nick_change = TRUE;
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
616 if(!strcmp(jid->resource, chat->handle)) {
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
617 g_free(chat->handle);
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
618 chat->handle = g_strdup(nick);
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
619 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
620 purple_conv_chat_rename_user(PURPLE_CONV_CHAT(chat->conv), jid->resource, nick);
9152
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
621 jabber_chat_remove_handle(chat, jid->resource);
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
622 break;
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
623 } else if(!strcmp(code, "307")) {
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
624 /* XXX: we got kicked */
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
625 } else if(!strcmp(code, "321")) {
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
626 /* XXX: removed due to an affiliation change */
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
627 } else if(!strcmp(code, "322")) {
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
628 /* XXX: removed because room is now members-only */
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
629 } else if(!strcmp(code, "332")) {
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
630 /* XXX: removed due to system shutdown */
8401
9fe6cadf2581 [gaim-migrate @ 9130]
Nathan Walp <nwalp@pidgin.im>
parents: 8396
diff changeset
631 }
7972
f8538961a159 [gaim-migrate @ 8649]
Nathan Walp <nwalp@pidgin.im>
parents: 7965
diff changeset
632 }
f8538961a159 [gaim-migrate @ 8649]
Nathan Walp <nwalp@pidgin.im>
parents: 7965
diff changeset
633 }
f8538961a159 [gaim-migrate @ 8649]
Nathan Walp <nwalp@pidgin.im>
parents: 7965
diff changeset
634 if(!nick_change) {
9152
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
635 if(!g_utf8_collate(jid->resource, chat->handle)) {
7972
f8538961a159 [gaim-migrate @ 8649]
Nathan Walp <nwalp@pidgin.im>
parents: 7965
diff changeset
636 serv_got_chat_left(js->gc, chat->id);
f8538961a159 [gaim-migrate @ 8649]
Nathan Walp <nwalp@pidgin.im>
parents: 7965
diff changeset
637 jabber_chat_destroy(chat);
f8538961a159 [gaim-migrate @ 8649]
Nathan Walp <nwalp@pidgin.im>
parents: 7965
diff changeset
638 } else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
639 purple_conv_chat_remove_user(PURPLE_CONV_CHAT(chat->conv), jid->resource,
7974
08ec901d48fb [gaim-migrate @ 8651]
Nathan Walp <nwalp@pidgin.im>
parents: 7973
diff changeset
640 status);
9152
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
641 jabber_chat_remove_handle(chat, jid->resource);
7972
f8538961a159 [gaim-migrate @ 8649]
Nathan Walp <nwalp@pidgin.im>
parents: 7965
diff changeset
642 }
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
643 }
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
644 } else {
8182
a024bf275ba2 [gaim-migrate @ 8901]
Nathan Walp <nwalp@pidgin.im>
parents: 8158
diff changeset
645 if(!chat->conv) {
a024bf275ba2 [gaim-migrate @ 8901]
Nathan Walp <nwalp@pidgin.im>
parents: 8158
diff changeset
646 chat->id = i++;
a024bf275ba2 [gaim-migrate @ 8901]
Nathan Walp <nwalp@pidgin.im>
parents: 8158
diff changeset
647 chat->muc = muc;
a024bf275ba2 [gaim-migrate @ 8901]
Nathan Walp <nwalp@pidgin.im>
parents: 8158
diff changeset
648 chat->conv = serv_got_joined_chat(js->gc, chat->id, room_jid);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
649 purple_conv_chat_set_nick(PURPLE_CONV_CHAT(chat->conv), chat->handle);
10486
840c61a6437f [gaim-migrate @ 11776]
Nathan Walp <nwalp@pidgin.im>
parents: 10382
diff changeset
650
10941
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
651 jabber_chat_disco_traffic(chat);
8182
a024bf275ba2 [gaim-migrate @ 8901]
Nathan Walp <nwalp@pidgin.im>
parents: 8158
diff changeset
652 }
a024bf275ba2 [gaim-migrate @ 8901]
Nathan Walp <nwalp@pidgin.im>
parents: 8158
diff changeset
653
7973
f1d1001702be [gaim-migrate @ 8650]
Nathan Walp <nwalp@pidgin.im>
parents: 7972
diff changeset
654 jabber_buddy_track_resource(jb, jid->resource, priority, state,
f1d1001702be [gaim-migrate @ 8650]
Nathan Walp <nwalp@pidgin.im>
parents: 7972
diff changeset
655 status);
f1d1001702be [gaim-migrate @ 8650]
Nathan Walp <nwalp@pidgin.im>
parents: 7972
diff changeset
656
9152
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
657 jabber_chat_track_handle(chat, jid->resource, real_jid, affiliation, role);
ff7aaa305cbd [gaim-migrate @ 9936]
Nathan Walp <nwalp@pidgin.im>
parents: 8577
diff changeset
658
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
659 if(!jabber_chat_find_buddy(chat->conv, jid->resource))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
660 purple_conv_chat_add_user(PURPLE_CONV_CHAT(chat->conv), jid->resource,
9846
61f7349c153a [gaim-migrate @ 10724]
Nathan Fredrickson <nathan@silverorange.com>
parents: 9745
diff changeset
661 real_jid, flags, !delayed);
9554
1609ba3612c3 [gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9320
diff changeset
662 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
663 purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(chat->conv), jid->resource,
9554
1609ba3612c3 [gaim-migrate @ 10387]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9320
diff changeset
664 flags);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
665 }
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
666 g_free(room_jid);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
667 } else {
7322
de15a9314c04 [gaim-migrate @ 7908]
Nathan Walp <nwalp@pidgin.im>
parents: 7321
diff changeset
668 buddy_name = g_strdup_printf("%s%s%s", jid->node ? jid->node : "",
18725
a3ab5c711de7 Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
669 jid->node ? "@" : "", jid->domain);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
670 if((b = purple_find_buddy(js->gc->account, buddy_name)) == NULL) {
18725
a3ab5c711de7 Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
671 if(!jid->node || strcmp(jid->node,js->user->node) || strcmp(jid->domain,js->user->domain)) {
a3ab5c711de7 Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
672 purple_debug_warning("jabber", "Got presence for unknown buddy %s on account %s (%x)\n",
a3ab5c711de7 Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
673 buddy_name, purple_account_get_username(js->gc->account), js->gc->account);
a3ab5c711de7 Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
674 jabber_id_free(jid);
a3ab5c711de7 Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
675 g_free(avatar_hash);
a3ab5c711de7 Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
676 g_free(buddy_name);
a3ab5c711de7 Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
677 g_free(status);
a3ab5c711de7 Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
678 return;
a3ab5c711de7 Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
679 } else {
a3ab5c711de7 Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
680 /* this is a different resource of our own account. Resume even when this account isn't on our blist */
a3ab5c711de7 Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
681 }
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
682 }
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
683
18725
a3ab5c711de7 Now showing ad-hoc commands of other clients connected to the same account in the account menu (per XEP-0146). Since it is becoming messy in that menu, I also prefixed all ad-hoc commands with the node this command belongs to in [], which is the resource name for clients and the domain name for the server. Examples: "[home] Set status" for clients and "[jabber.org] Send message to all connected users" for servers.
Andreas Monitzer <am@adiumx.com>
parents: 18718
diff changeset
684 if(b && avatar_hash) {
16534
2ab9e23f99d9 Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@pidgin.im>
parents: 16018
diff changeset
685 const char *avatar_hash2 = purple_buddy_icons_get_checksum_for_user(b);
10189
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
686 if(!avatar_hash2 || strcmp(avatar_hash, avatar_hash2)) {
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
687 JabberIq *iq;
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
688 xmlnode *vcard;
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
689
10941
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
690 /* XXX this is a crappy way of trying to prevent
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
691 * someone from spamming us with presence packets
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
692 * and causing us to DoS ourselves...what we really
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
693 * need is a queue system that can throttle itself,
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
694 * but i'm too tired to write that right now */
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
695 if(!g_slist_find(js->pending_avatar_requests, jb)) {
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
696
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
697 js->pending_avatar_requests = g_slist_prepend(js->pending_avatar_requests, jb);
10189
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
698
10941
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
699 iq = jabber_iq_new(js, JABBER_IQ_GET);
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
700 xmlnode_set_attrib(iq->node, "to", buddy_name);
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
701 vcard = xmlnode_new_child(iq->node, "vCard");
13808
411ee56da344 [gaim-migrate @ 16229]
Sean Egan <seanegan@pidgin.im>
parents: 13497
diff changeset
702 xmlnode_set_namespace(vcard, "vcard-temp");
10941
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
703
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
704 jabber_iq_set_callback(iq, jabber_vcard_parse_avatar, NULL);
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
705 jabber_iq_send(iq);
7a67db0a7f43 [gaim-migrate @ 12731]
Nathan Walp <nwalp@pidgin.im>
parents: 10755
diff changeset
706 }
10189
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
707 }
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
708 }
bc7691fee058 [gaim-migrate @ 11304]
Nathan Walp <nwalp@pidgin.im>
parents: 10116
diff changeset
709
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
710 if(state == JABBER_BUDDY_STATE_ERROR ||
7813
b25628709267 [gaim-migrate @ 8460]
Nathan Walp <nwalp@pidgin.im>
parents: 7644
diff changeset
711 (type && (!strcmp(type, "unavailable") ||
b25628709267 [gaim-migrate @ 8460]
Nathan Walp <nwalp@pidgin.im>
parents: 7644
diff changeset
712 !strcmp(type, "unsubscribed")))) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
713 PurpleConversation *conv;
8043
86a087e9624c [gaim-migrate @ 8727]
Nathan Walp <nwalp@pidgin.im>
parents: 8010
diff changeset
714
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
715 jabber_buddy_remove_resource(jb, jid->resource);
8043
86a087e9624c [gaim-migrate @ 8727]
Nathan Walp <nwalp@pidgin.im>
parents: 8010
diff changeset
716 if((conv = jabber_find_unnormalized_conv(from, js->gc->account)))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
717 purple_conversation_set_name(conv, buddy_name);
8043
86a087e9624c [gaim-migrate @ 8727]
Nathan Walp <nwalp@pidgin.im>
parents: 8010
diff changeset
718
7395
e5595e8e13e4 [gaim-migrate @ 7990]
Nathan Walp <nwalp@pidgin.im>
parents: 7322
diff changeset
719 } else {
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
720 jbr = jabber_buddy_track_resource(jb, jid->resource, priority,
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
721 state, status);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
722 if(caps) {
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
723 const char *node = xmlnode_get_attrib(caps,"node");
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
724 const char *ver = xmlnode_get_attrib(caps,"ver");
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
725 const char *ext = xmlnode_get_attrib(caps,"ext");
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
726
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
727 if(node && ver) {
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
728 JabberPresenceCapabilities *userdata = g_new0(JabberPresenceCapabilities, 1);
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
729 userdata->js = js;
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
730 userdata->jbr = jbr;
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
731 userdata->from = g_strdup(from);
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
732 jabber_caps_get_info(js, from, node, ver, ext, jabber_presence_set_capabilities, userdata);
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
733 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents: 17812
diff changeset
734 }
7395
e5595e8e13e4 [gaim-migrate @ 7990]
Nathan Walp <nwalp@pidgin.im>
parents: 7322
diff changeset
735 }
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
736
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
737 if((found_jbr = jabber_buddy_find_resource(jb, NULL))) {
18366
6a0ad943967f When an XMPP buddy signs off, show the status of the currently highest priority buddy, rather than the status of the signed off buddy. Fixes #1126
Sean Egan <seanegan@pidgin.im>
parents: 18330
diff changeset
738 purple_prpl_got_user_status(js->gc->account, buddy_name, jabber_buddy_state_get_status_id(found_jbr->state), "priority", found_jbr->priority, found_jbr->status ? "message" : NULL, found_jbr->status, NULL);
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
739 } else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
740 purple_prpl_got_user_status(js->gc->account, buddy_name, "offline", status ? "message" : NULL, status, NULL);
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
741 }
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
742 g_free(buddy_name);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
743 }
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
744 g_free(status);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
745 jabber_id_free(jid);
17702
15af85f94634 Don't check for null before calling free. I can't help but get rid
Mark Doliner <markdoliner@pidgin.im>
parents: 17683
diff changeset
746 g_free(avatar_hash);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
747 }
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
748
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
749 void jabber_presence_subscription_set(JabberStream *js, const char *who, const char *type)
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
750 {
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
751 xmlnode *presence = xmlnode_new("presence");
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
752
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
753 xmlnode_set_attrib(presence, "to", who);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
754 xmlnode_set_attrib(presence, "type", type);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
755
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
756 jabber_send(js, presence);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
757 xmlnode_free(presence);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
758 }
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
759
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
760 void purple_status_to_jabber(const PurpleStatus *status, JabberBuddyState *state, char **msg, int *priority)
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
761 {
10216
37091349650c [gaim-migrate @ 11343]
Nathan Walp <nwalp@pidgin.im>
parents: 10189
diff changeset
762 const char *status_id = NULL;
14525
b278a2724686 [gaim-migrate @ 17177]
Nathan Walp <nwalp@pidgin.im>
parents: 14254
diff changeset
763 const char *formatted_msg = NULL;
10216
37091349650c [gaim-migrate @ 11343]
Nathan Walp <nwalp@pidgin.im>
parents: 10189
diff changeset
764
13443
e27e92c22036 [gaim-migrate @ 15817]
Nathan Walp <nwalp@pidgin.im>
parents: 13385
diff changeset
765 if(state) *state = JABBER_BUDDY_STATE_UNKNOWN;
e27e92c22036 [gaim-migrate @ 15817]
Nathan Walp <nwalp@pidgin.im>
parents: 13385
diff changeset
766 if(msg) *msg = NULL;
e27e92c22036 [gaim-migrate @ 15817]
Nathan Walp <nwalp@pidgin.im>
parents: 13385
diff changeset
767 if(priority) *priority = 0;
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
768
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
769 if(!status) {
13443
e27e92c22036 [gaim-migrate @ 15817]
Nathan Walp <nwalp@pidgin.im>
parents: 13385
diff changeset
770 if(state) *state = JABBER_BUDDY_STATE_UNAVAILABLE;
10216
37091349650c [gaim-migrate @ 11343]
Nathan Walp <nwalp@pidgin.im>
parents: 10189
diff changeset
771 } else {
37091349650c [gaim-migrate @ 11343]
Nathan Walp <nwalp@pidgin.im>
parents: 10189
diff changeset
772 if(state) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
773 status_id = purple_status_get_id(status);
10216
37091349650c [gaim-migrate @ 11343]
Nathan Walp <nwalp@pidgin.im>
parents: 10189
diff changeset
774 *state = jabber_buddy_status_id_get_state(status_id);
37091349650c [gaim-migrate @ 11343]
Nathan Walp <nwalp@pidgin.im>
parents: 10189
diff changeset
775 }
37091349650c [gaim-migrate @ 11343]
Nathan Walp <nwalp@pidgin.im>
parents: 10189
diff changeset
776
13497
07fc0a9826b8 [gaim-migrate @ 15872]
Richard Laager <rlaager@pidgin.im>
parents: 13445
diff changeset
777 if(msg) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
778 formatted_msg = purple_status_get_attr_string(status, "message");
10216
37091349650c [gaim-migrate @ 11343]
Nathan Walp <nwalp@pidgin.im>
parents: 10189
diff changeset
779
13497
07fc0a9826b8 [gaim-migrate @ 15872]
Richard Laager <rlaager@pidgin.im>
parents: 13445
diff changeset
780 /* if the message is blank, then there really isn't a message */
14525
b278a2724686 [gaim-migrate @ 17177]
Nathan Walp <nwalp@pidgin.im>
parents: 14254
diff changeset
781 if(formatted_msg && !*formatted_msg)
b278a2724686 [gaim-migrate @ 17177]
Nathan Walp <nwalp@pidgin.im>
parents: 14254
diff changeset
782 formatted_msg = NULL;
b278a2724686 [gaim-migrate @ 17177]
Nathan Walp <nwalp@pidgin.im>
parents: 14254
diff changeset
783
b278a2724686 [gaim-migrate @ 17177]
Nathan Walp <nwalp@pidgin.im>
parents: 14254
diff changeset
784 if(formatted_msg)
17683
cc7e7a1d5d8c Two questions:
Mark Doliner <markdoliner@pidgin.im>
parents: 17422
diff changeset
785 *msg = purple_markup_strip_html(formatted_msg);
13497
07fc0a9826b8 [gaim-migrate @ 15872]
Richard Laager <rlaager@pidgin.im>
parents: 13445
diff changeset
786 }
11872
05cdcbf6f145 [gaim-migrate @ 14163]
Nathan Walp <nwalp@pidgin.im>
parents: 11718
diff changeset
787
10216
37091349650c [gaim-migrate @ 11343]
Nathan Walp <nwalp@pidgin.im>
parents: 10189
diff changeset
788 if(priority)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15810
diff changeset
789 *priority = purple_status_get_attr_int(status, "priority");
9954
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
790 }
52a14a58a33e [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9931
diff changeset
791 }

mercurial