Mercurial > pidgin.yaz
annotate libpurple/protocols/jabber/presence.c @ 29931:b0cb194dc139
Enable setting mood message with the global mood selection UI, when the
connection supports it.
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Thu, 04 Mar 2010 23:02:56 +0000 |
parents | 185677f47825 |
children | 13f320cde14f |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
15823 | 2 * purple - Jabber Protocol Plugin |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
28398
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
28205
diff
changeset
|
4 * Purple is the legal property of its developers, whose names are too numerous |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
28205
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
28205
diff
changeset
|
6 * source distribution. |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19195
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 #include "internal.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 |
15891
87ea711b9781
Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
25 #include "account.h" |
87ea711b9781
Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
26 #include "conversation.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "request.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "server.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "status.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "util.h" |
15891
87ea711b9781
Re-arrange #includes so 'make check' stands a chance of passing during
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
33 #include "xmlnode.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "buddy.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #include "chat.h" |
20571
c97e3ab9ef11
Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents:
20570
diff
changeset
|
37 #include "google.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #include "presence.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 #include "iq.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 #include "jutil.h" |
17609
f88b3a093cba
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 <pidgin@monitzer.com>
parents:
17605
diff
changeset
|
41 #include "adhoccommands.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 |
29863
5d56c0dd2810
jabber: Actually send a mood update when setting a mood status (using the generic mood selector).
Marcus Lundblad <ml@update.uu.se>
parents:
29289
diff
changeset
|
43 #include "usermood.h" |
17593
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
44 #include "usertune.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 static void chats_send_presence_foreach(gpointer key, gpointer val, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 gpointer user_data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 JabberChat *chat = val; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 xmlnode *presence = user_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 char *chat_full_jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 |
23262
5793bcea224c
Fix the chat-room rejoining bug where the list appears empty.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23105
diff
changeset
|
54 if(!chat->conv || chat->left) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 chat_full_jid = g_strdup_printf("%s@%s/%s", chat->room, chat->server, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 chat->handle); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 xmlnode_set_attrib(presence, "to", chat_full_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 jabber_send(chat->js, presence); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 g_free(chat_full_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 |
27573
9a5a9a4e7626
Simplify the fake_to_self function.
Paul Aurich <paul@darkrain42.org>
parents:
27571
diff
changeset
|
65 void jabber_presence_fake_to_self(JabberStream *js, PurpleStatus *status) |
9a5a9a4e7626
Simplify the fake_to_self function.
Paul Aurich <paul@darkrain42.org>
parents:
27571
diff
changeset
|
66 { |
9a5a9a4e7626
Simplify the fake_to_self function.
Paul Aurich <paul@darkrain42.org>
parents:
27571
diff
changeset
|
67 PurpleAccount *account; |
28030
735040819c16
jabber: Properly track own idle time in fake_to_self.
Paul Aurich <paul@darkrain42.org>
parents:
27683
diff
changeset
|
68 PurplePresence *presence; |
29438
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
69 JabberBuddy *jb; |
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
70 JabberBuddyResource *jbr; |
27573
9a5a9a4e7626
Simplify the fake_to_self function.
Paul Aurich <paul@darkrain42.org>
parents:
27571
diff
changeset
|
71 const char *username; |
29438
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
72 JabberBuddyState state; |
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
73 char *msg; |
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
74 int priority; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 |
27573
9a5a9a4e7626
Simplify the fake_to_self function.
Paul Aurich <paul@darkrain42.org>
parents:
27571
diff
changeset
|
76 g_return_if_fail(js->user != NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 |
27573
9a5a9a4e7626
Simplify the fake_to_self function.
Paul Aurich <paul@darkrain42.org>
parents:
27571
diff
changeset
|
78 account = purple_connection_get_account(js->gc); |
27683
f95bcb5eb047
Support connecting to IDNA XMPP domains.
Paul Aurich <paul@darkrain42.org>
parents:
27670
diff
changeset
|
79 username = purple_connection_get_display_name(js->gc); |
28030
735040819c16
jabber: Properly track own idle time in fake_to_self.
Paul Aurich <paul@darkrain42.org>
parents:
27683
diff
changeset
|
80 presence = purple_account_get_presence(account); |
27573
9a5a9a4e7626
Simplify the fake_to_self function.
Paul Aurich <paul@darkrain42.org>
parents:
27571
diff
changeset
|
81 if (status == NULL) |
28030
735040819c16
jabber: Properly track own idle time in fake_to_self.
Paul Aurich <paul@darkrain42.org>
parents:
27683
diff
changeset
|
82 status = purple_presence_get_active_status(presence); |
29438
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
83 purple_status_to_jabber(status, &state, &msg, &priority); |
27573
9a5a9a4e7626
Simplify the fake_to_self function.
Paul Aurich <paul@darkrain42.org>
parents:
27571
diff
changeset
|
84 |
29438
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
85 jb = js->user_jb; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 |
29438
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
87 if (state == JABBER_BUDDY_STATE_UNAVAILABLE || |
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
88 state == JABBER_BUDDY_STATE_UNKNOWN) { |
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
89 jabber_buddy_remove_resource(jb, js->user->resource); |
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
90 } else { |
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
91 jbr = jabber_buddy_track_resource(jb, js->user->resource, priority, |
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
92 state, msg); |
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
93 jbr->idle = purple_presence_is_idle(presence) ? |
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
94 purple_presence_get_idle_time(presence) : 0; |
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
95 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 |
29438
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
97 /* |
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
98 * While we need to track the status of this resource, the core |
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
99 * only cares if we're on our own buddy list. |
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
100 */ |
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
101 if (purple_find_buddy(account, username)) { |
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
102 jbr = jabber_buddy_find_resource(jb, NULL); |
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
103 if (jbr) { |
28030
735040819c16
jabber: Properly track own idle time in fake_to_self.
Paul Aurich <paul@darkrain42.org>
parents:
27683
diff
changeset
|
104 purple_prpl_got_user_status(account, username, |
735040819c16
jabber: Properly track own idle time in fake_to_self.
Paul Aurich <paul@darkrain42.org>
parents:
27683
diff
changeset
|
105 jabber_buddy_state_get_status_id(jbr->state), |
735040819c16
jabber: Properly track own idle time in fake_to_self.
Paul Aurich <paul@darkrain42.org>
parents:
27683
diff
changeset
|
106 "priority", jbr->priority, |
735040819c16
jabber: Properly track own idle time in fake_to_self.
Paul Aurich <paul@darkrain42.org>
parents:
27683
diff
changeset
|
107 jbr->status ? "message" : NULL, jbr->status, |
735040819c16
jabber: Properly track own idle time in fake_to_self.
Paul Aurich <paul@darkrain42.org>
parents:
27683
diff
changeset
|
108 NULL); |
735040819c16
jabber: Properly track own idle time in fake_to_self.
Paul Aurich <paul@darkrain42.org>
parents:
27683
diff
changeset
|
109 purple_prpl_got_user_idle(account, username, jbr->idle, jbr->idle); |
27573
9a5a9a4e7626
Simplify the fake_to_self function.
Paul Aurich <paul@darkrain42.org>
parents:
27571
diff
changeset
|
110 } else { |
28030
735040819c16
jabber: Properly track own idle time in fake_to_self.
Paul Aurich <paul@darkrain42.org>
parents:
27683
diff
changeset
|
111 purple_prpl_got_user_status(account, username, "offline", |
735040819c16
jabber: Properly track own idle time in fake_to_self.
Paul Aurich <paul@darkrain42.org>
parents:
27683
diff
changeset
|
112 msg ? "message" : NULL, msg, |
735040819c16
jabber: Properly track own idle time in fake_to_self.
Paul Aurich <paul@darkrain42.org>
parents:
27683
diff
changeset
|
113 NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 } |
29438
1c035c869344
jabber: Always track our own presence, even if we're not on the buddy list.
Paul Aurich <paul@darkrain42.org>
parents:
29408
diff
changeset
|
116 g_free(msg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 |
25743
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
119 void jabber_set_status(PurpleAccount *account, PurpleStatus *status) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 { |
25743
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
121 PurpleConnection *gc; |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
122 JabberStream *js; |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
123 |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
124 if (!purple_account_is_connected(account)) |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
125 return; |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
27002
diff
changeset
|
126 |
25743
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
127 if (purple_status_is_exclusive(status) && !purple_status_is_active(status)) { |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
128 /* An exclusive status can't be deactivated. You should just |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
129 * activate some other exclusive status. */ |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
130 return; |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
131 } |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
132 |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
133 gc = purple_account_get_connection(account); |
25987
c4fd9222dda1
propagate from branch 'im.pidgin.pidgin' (head 303af74a38e7b313d4fb0be4d4054a16cb13d819)
Paul Aurich <paul@darkrain42.org>
diff
changeset
|
134 js = purple_connection_get_protocol_data(gc); |
29863
5d56c0dd2810
jabber: Actually send a mood update when setting a mood status (using the generic mood selector).
Marcus Lundblad <ml@update.uu.se>
parents:
29289
diff
changeset
|
135 |
5d56c0dd2810
jabber: Actually send a mood update when setting a mood status (using the generic mood selector).
Marcus Lundblad <ml@update.uu.se>
parents:
29289
diff
changeset
|
136 /* it's a mood update */ |
5d56c0dd2810
jabber: Actually send a mood update when setting a mood status (using the generic mood selector).
Marcus Lundblad <ml@update.uu.se>
parents:
29289
diff
changeset
|
137 if (purple_status_type_get_primitive(purple_status_get_type(status)) == PURPLE_STATUS_MOOD) { |
5d56c0dd2810
jabber: Actually send a mood update when setting a mood status (using the generic mood selector).
Marcus Lundblad <ml@update.uu.se>
parents:
29289
diff
changeset
|
138 const char *mood = |
5d56c0dd2810
jabber: Actually send a mood update when setting a mood status (using the generic mood selector).
Marcus Lundblad <ml@update.uu.se>
parents:
29289
diff
changeset
|
139 purple_status_get_attr_string(status, PURPLE_MOOD_NAME); |
29931
b0cb194dc139
Enable setting mood message with the global mood selection UI, when the
Marcus Lundblad <ml@update.uu.se>
parents:
29867
diff
changeset
|
140 const char *mood_text = |
b0cb194dc139
Enable setting mood message with the global mood selection UI, when the
Marcus Lundblad <ml@update.uu.se>
parents:
29867
diff
changeset
|
141 purple_status_get_attr_string(status, PURPLE_MOOD_COMMENT); |
b0cb194dc139
Enable setting mood message with the global mood selection UI, when the
Marcus Lundblad <ml@update.uu.se>
parents:
29867
diff
changeset
|
142 jabber_mood_set(js, mood, mood_text); |
29863
5d56c0dd2810
jabber: Actually send a mood update when setting a mood status (using the generic mood selector).
Marcus Lundblad <ml@update.uu.se>
parents:
29289
diff
changeset
|
143 return; |
5d56c0dd2810
jabber: Actually send a mood update when setting a mood status (using the generic mood selector).
Marcus Lundblad <ml@update.uu.se>
parents:
29289
diff
changeset
|
144 } |
5d56c0dd2810
jabber: Actually send a mood update when setting a mood status (using the generic mood selector).
Marcus Lundblad <ml@update.uu.se>
parents:
29289
diff
changeset
|
145 |
25743
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
146 jabber_presence_send(js, FALSE); |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
147 } |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
148 |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
149 void jabber_presence_send(JabberStream *js, gboolean force) |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
150 { |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
151 PurpleAccount *account; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 xmlnode *presence, *x, *photo; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 char *stripped = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 JabberBuddyState state; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 int priority; |
20570
5913725cbcd6
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20058
diff
changeset
|
156 const char *artist = NULL, *title = NULL, *source = NULL, *uri = NULL, *track = NULL; |
5913725cbcd6
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20058
diff
changeset
|
157 int length = -1; |
17617
935005186312
Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17609
diff
changeset
|
158 gboolean allowBuzz; |
21629
6636546aeacf
We need to work with the exclusive status.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21602
diff
changeset
|
159 PurplePresence *p; |
25743
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
160 PurpleStatus *status, *tune; |
18123
ca965dfd3875
kill some code duplication when sending current presence
Nathan Walp <nwalp@pidgin.im>
parents:
17841
diff
changeset
|
161 |
25743
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
162 account = purple_connection_get_account(js->gc); |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
163 p = purple_account_get_presence(account); |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
164 status = purple_presence_get_active_status(p); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 |
18154
08e639dbac99
really and truly enforce the no-presence-before-roster thing
Nathan Walp <nwalp@pidgin.im>
parents:
18123
diff
changeset
|
166 /* we don't want to send presence before we've gotten our roster */ |
27571
c8390dc125c1
Use js->state to track whether the roster has been retrieved.
Paul Aurich <paul@darkrain42.org>
parents:
27079
diff
changeset
|
167 if (js->state != JABBER_STREAM_CONNECTED) { |
29141
f267c1608102
jabber: Lower the prio of this message; it's not very important.
Paul Aurich <paul@darkrain42.org>
parents:
29111
diff
changeset
|
168 purple_debug_misc("jabber", "attempt to send presence before roster retrieved\n"); |
18154
08e639dbac99
really and truly enforce the no-presence-before-roster thing
Nathan Walp <nwalp@pidgin.im>
parents:
18123
diff
changeset
|
169 return; |
08e639dbac99
really and truly enforce the no-presence-before-roster thing
Nathan Walp <nwalp@pidgin.im>
parents:
18123
diff
changeset
|
170 } |
08e639dbac99
really and truly enforce the no-presence-before-roster thing
Nathan Walp <nwalp@pidgin.im>
parents:
18123
diff
changeset
|
171 |
15823 | 172 purple_status_to_jabber(status, &state, &stripped, &priority); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24672
diff
changeset
|
173 |
17617
935005186312
Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17609
diff
changeset
|
174 /* check for buzz support */ |
935005186312
Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17609
diff
changeset
|
175 allowBuzz = purple_status_get_attr_boolean(status,"buzz"); |
935005186312
Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17609
diff
changeset
|
176 /* changing the buzz state has to trigger a re-broadcasting of the presence for caps */ |
23431
146d16459cda
make googletalk tune hack work, previously it's not doing anything unless
Ka-Hing Cheung <khc@hxbc.us>
parents:
23262
diff
changeset
|
177 |
25743
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
178 tune = purple_presence_get_status(p, "tune"); |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
179 if (js->googletalk && !stripped && purple_status_is_active(tune)) { |
23431
146d16459cda
make googletalk tune hack work, previously it's not doing anything unless
Ka-Hing Cheung <khc@hxbc.us>
parents:
23262
diff
changeset
|
180 stripped = jabber_google_presence_outgoing(tune); |
146d16459cda
make googletalk tune hack work, previously it's not doing anything unless
Ka-Hing Cheung <khc@hxbc.us>
parents:
23262
diff
changeset
|
181 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24672
diff
changeset
|
182 |
17593
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
183 #define CHANGED(a,b) ((!a && b) || (a && a[0] == '\0' && b && b[0] != '\0') || \ |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
184 (a && !b) || (a && a[0] != '\0' && b && b[0] == '\0') || (a && b && strcmp(a,b))) |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
185 /* check if there are any differences to the <presence> and send them in that case */ |
25743
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
186 if (force || allowBuzz != js->allowBuzz || js->old_state != state || |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
187 CHANGED(js->old_msg, stripped) || js->old_priority != priority || |
26817
3912f55a1633
propagate from branch 'im.pidgin.pidgin' (head fbb4fe5da444943eecc76bdcd6c8ba967790b6c8)
Paul Aurich <paul@darkrain42.org>
diff
changeset
|
188 CHANGED(js->old_avatarhash, js->avatar_hash) || js->old_idle != js->idle) { |
25743
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
189 /* Need to update allowBuzz before creating the presence (with caps) */ |
17617
935005186312
Added the option to enable/disable buzz via a status setting. It's default off for the pidgin folks.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17609
diff
changeset
|
190 js->allowBuzz = allowBuzz; |
20571
c97e3ab9ef11
Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents:
20570
diff
changeset
|
191 |
17593
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
192 presence = jabber_presence_create_js(js, state, stripped, priority); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 |
25831
0fa91206cf5a
Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents:
24672
diff
changeset
|
194 /* Per XEP-0153 4.1, we must always send the <x> */ |
0fa91206cf5a
Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents:
24672
diff
changeset
|
195 x = xmlnode_new_child(presence, "x"); |
0fa91206cf5a
Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents:
24672
diff
changeset
|
196 xmlnode_set_namespace(x, "vcard-temp:x:update"); |
0fa91206cf5a
Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents:
24672
diff
changeset
|
197 /* |
0fa91206cf5a
Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents:
24672
diff
changeset
|
198 * FIXME: Per XEP-0153 4.3.2 bullet 2, we must not publish our |
0fa91206cf5a
Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents:
24672
diff
changeset
|
199 * image hash if another resource has logged in and updated the |
0fa91206cf5a
Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents:
24672
diff
changeset
|
200 * vcard avatar. Requires changes in jabber_presence_parse. |
0fa91206cf5a
Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents:
24672
diff
changeset
|
201 */ |
0fa91206cf5a
Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents:
24672
diff
changeset
|
202 if (js->vcard_fetched) { |
0fa91206cf5a
Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents:
24672
diff
changeset
|
203 /* Always publish a <photo>; it's empty if we have no image. */ |
17593
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
204 photo = xmlnode_new_child(x, "photo"); |
25831
0fa91206cf5a
Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents:
24672
diff
changeset
|
205 if (js->avatar_hash) |
0fa91206cf5a
Always publish a <photo/> element, even if we have an empty buddy icon.
Paul Aurich <paul@darkrain42.org>
parents:
24672
diff
changeset
|
206 xmlnode_insert_data(photo, js->avatar_hash, -1); |
17593
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
207 } |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
208 |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
209 jabber_send(js, presence); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 |
17593
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
211 g_hash_table_foreach(js->chats, chats_send_presence_foreach, presence); |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
212 xmlnode_free(presence); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24672
diff
changeset
|
213 |
17593
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
214 /* update old values */ |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24672
diff
changeset
|
215 |
17593
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
216 if(js->old_msg) |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
217 g_free(js->old_msg); |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
218 if(js->old_avatarhash) |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
219 g_free(js->old_avatarhash); |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
220 js->old_msg = g_strdup(stripped); |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
221 js->old_avatarhash = g_strdup(js->avatar_hash); |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
222 js->old_state = state; |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
223 js->old_priority = priority; |
25805 | 224 js->old_idle = js->idle; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 } |
23432
74960bf43dae
let's not leak if nothing is changed
Ka-Hing Cheung <khc@hxbc.us>
parents:
23431
diff
changeset
|
226 g_free(stripped); |
74960bf43dae
let's not leak if nothing is changed
Ka-Hing Cheung <khc@hxbc.us>
parents:
23431
diff
changeset
|
227 |
17593
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
228 /* next, check if there are any changes to the tune values */ |
25743
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
25742
diff
changeset
|
229 if (purple_status_is_active(tune)) { |
20570
5913725cbcd6
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20058
diff
changeset
|
230 artist = purple_status_get_attr_string(tune, PURPLE_TUNE_ARTIST); |
5913725cbcd6
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20058
diff
changeset
|
231 title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE); |
5913725cbcd6
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20058
diff
changeset
|
232 source = purple_status_get_attr_string(tune, PURPLE_TUNE_ALBUM); |
5913725cbcd6
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20058
diff
changeset
|
233 uri = purple_status_get_attr_string(tune, PURPLE_TUNE_URL); |
5913725cbcd6
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20058
diff
changeset
|
234 track = purple_status_get_attr_string(tune, PURPLE_TUNE_TRACK); |
5913725cbcd6
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20058
diff
changeset
|
235 length = (!purple_status_get_attr_value(tune, PURPLE_TUNE_TIME)) ? -1 : |
5913725cbcd6
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20058
diff
changeset
|
236 purple_status_get_attr_int(tune, PURPLE_TUNE_TIME); |
5913725cbcd6
Use an independant status type for 'current media' stuff, instead of using
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20058
diff
changeset
|
237 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24672
diff
changeset
|
238 |
17593
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
239 if(CHANGED(artist, js->old_artist) || CHANGED(title, js->old_title) || CHANGED(source, js->old_source) || |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
240 CHANGED(uri, js->old_uri) || CHANGED(track, js->old_track) || (length != js->old_length)) { |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
241 PurpleJabberTuneInfo tuneinfo = { |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
242 (char*)artist, |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
243 (char*)title, |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
244 (char*)source, |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
245 (char*)track, |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
246 length, |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
247 (char*)uri |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
248 }; |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
249 jabber_tune_set(js->gc, &tuneinfo); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24672
diff
changeset
|
250 |
17593
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
251 /* update old values */ |
20058
5103485b4b26
Plug some memory leaks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19698
diff
changeset
|
252 g_free(js->old_artist); |
5103485b4b26
Plug some memory leaks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19698
diff
changeset
|
253 g_free(js->old_title); |
5103485b4b26
Plug some memory leaks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19698
diff
changeset
|
254 g_free(js->old_source); |
5103485b4b26
Plug some memory leaks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19698
diff
changeset
|
255 g_free(js->old_uri); |
5103485b4b26
Plug some memory leaks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19698
diff
changeset
|
256 g_free(js->old_track); |
17593
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
257 js->old_artist = g_strdup(artist); |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
258 js->old_title = g_strdup(title); |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
259 js->old_source = g_strdup(source); |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
260 js->old_uri = g_strdup(uri); |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
261 js->old_length = length; |
759cd72bd2ff
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 <pidgin@monitzer.com>
parents:
17576
diff
changeset
|
262 js->old_track = g_strdup(track); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 |
19698
680a3aea5eb6
Various warning fixes for the xmpp prpl.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19696
diff
changeset
|
265 #undef CHANGED |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
266 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 jabber_presence_fake_to_self(js, status); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 xmlnode *jabber_presence_create(JabberBuddyState state, const char *msg, int priority) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 { |
17563
95affacf6f82
Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents:
17439
diff
changeset
|
272 return jabber_presence_create_js(NULL, state, msg, priority); |
95affacf6f82
Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents:
17439
diff
changeset
|
273 } |
95affacf6f82
Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents:
17439
diff
changeset
|
274 |
95affacf6f82
Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents:
17439
diff
changeset
|
275 xmlnode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority) |
95affacf6f82
Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents:
17439
diff
changeset
|
276 { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 xmlnode *show, *status, *presence, *pri, *c; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 const char *show_string = NULL; |
27170
5330ffe6ca86
Fix compile warning for non-VV.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27079
diff
changeset
|
279 #ifdef USE_VV |
27079
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27014
diff
changeset
|
280 gboolean audio_enabled, video_enabled; |
27170
5330ffe6ca86
Fix compile warning for non-VV.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27079
diff
changeset
|
281 #endif |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 presence = xmlnode_new("presence"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 if(state == JABBER_BUDDY_STATE_UNAVAILABLE) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 xmlnode_set_attrib(presence, "type", "unavailable"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 else if(state != JABBER_BUDDY_STATE_ONLINE && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 state != JABBER_BUDDY_STATE_UNKNOWN && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 state != JABBER_BUDDY_STATE_ERROR) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 show_string = jabber_buddy_state_get_show(state); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 if(show_string) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 show = xmlnode_new_child(presence, "show"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 xmlnode_insert_data(show, show_string, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 if(msg) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 status = xmlnode_new_child(presence, "status"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 xmlnode_insert_data(status, msg, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 if(priority) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 char *pstr = g_strdup_printf("%d", priority); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 pri = xmlnode_new_child(presence, "priority"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 xmlnode_insert_data(pri, pstr, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 g_free(pstr); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 |
25805 | 309 /* if we are idle and not offline, include idle */ |
310 if (js->idle && state != JABBER_BUDDY_STATE_UNAVAILABLE) { | |
311 xmlnode *query = xmlnode_new_child(presence, "query"); | |
312 gchar seconds[10]; | |
313 g_snprintf(seconds, 10, "%d", (int) (time(NULL) - js->idle)); | |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
27002
diff
changeset
|
314 |
29031
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28893
diff
changeset
|
315 xmlnode_set_namespace(query, NS_LAST_ACTIVITY); |
25805 | 316 xmlnode_set_attrib(query, "seconds", seconds); |
317 } | |
26817
3912f55a1633
propagate from branch 'im.pidgin.pidgin' (head fbb4fe5da444943eecc76bdcd6c8ba967790b6c8)
Paul Aurich <paul@darkrain42.org>
diff
changeset
|
318 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 /* JEP-0115 */ |
25584
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
320 /* calculate hash */ |
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
321 jabber_caps_calculate_own_hash(js); |
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
322 /* create xml */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 c = xmlnode_new_child(presence, "c"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 xmlnode_set_namespace(c, "http://jabber.org/protocol/caps"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 xmlnode_set_attrib(c, "node", CAPS0115_NODE); |
25575
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
23262
diff
changeset
|
326 xmlnode_set_attrib(c, "hash", "sha-1"); |
25742
4040da08a733
Entity Capabilities must be per-JabberStream
Paul Aurich <paul@darkrain42.org>
parents:
25716
diff
changeset
|
327 xmlnode_set_attrib(c, "ver", jabber_caps_get_own_hash(js)); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24672
diff
changeset
|
328 |
26539
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26528
diff
changeset
|
329 #ifdef USE_VV |
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26528
diff
changeset
|
330 /* |
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26528
diff
changeset
|
331 * MASSIVE HUGE DISGUSTING HACK |
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26528
diff
changeset
|
332 * This is a huge hack. As far as I can tell, Google Talk's gmail client |
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26528
diff
changeset
|
333 * doesn't bother to check the actual features we advertise; they |
26545
b01e8e76c59d
Make my comment parse correctly.
Paul Aurich <paul@darkrain42.org>
parents:
26539
diff
changeset
|
334 * just assume that if we specify a 'voice-v1' ext (ignoring that |
b01e8e76c59d
Make my comment parse correctly.
Paul Aurich <paul@darkrain42.org>
parents:
26539
diff
changeset
|
335 * these are to be assigned no semantic value), we support receiving voice |
b01e8e76c59d
Make my comment parse correctly.
Paul Aurich <paul@darkrain42.org>
parents:
26539
diff
changeset
|
336 * calls. |
27079
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27014
diff
changeset
|
337 * |
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27014
diff
changeset
|
338 * Ditto for 'video-v1'. |
26539
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26528
diff
changeset
|
339 */ |
27079
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27014
diff
changeset
|
340 audio_enabled = jabber_audio_enabled(js, NULL /* unused */); |
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27014
diff
changeset
|
341 video_enabled = jabber_video_enabled(js, NULL /* unused */); |
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27014
diff
changeset
|
342 |
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27014
diff
changeset
|
343 if (audio_enabled && video_enabled) |
28079
49cb3fc2c01a
Add the camera-v1 cap or else Gmail refuses to accept we're video enabled.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28030
diff
changeset
|
344 xmlnode_set_attrib(c, "ext", "voice-v1 camera-v1 video-v1"); |
27079
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27014
diff
changeset
|
345 else if (audio_enabled) |
26539
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26528
diff
changeset
|
346 xmlnode_set_attrib(c, "ext", "voice-v1"); |
27079
72bcdcb0629f
Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27014
diff
changeset
|
347 else if (video_enabled) |
28079
49cb3fc2c01a
Add the camera-v1 cap or else Gmail refuses to accept we're video enabled.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
28030
diff
changeset
|
348 xmlnode_set_attrib(c, "ext", "camera-v1 video-v1"); |
26539
20743d9bd62d
Fix allowing gmail user to initiate voice call by advertising a specific ext
Paul Aurich <paul@darkrain42.org>
parents:
26528
diff
changeset
|
349 #endif |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24672
diff
changeset
|
350 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
351 return presence; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
354 struct _jabber_add_permit { |
15823 | 355 PurpleConnection *gc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 char *who; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
358 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 |
19195
1ca6c4b234ab
Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18739
diff
changeset
|
360 static void authorize_add_cb(gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 { |
19195
1ca6c4b234ab
Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18739
diff
changeset
|
362 struct _jabber_add_permit *jap = data; |
21602
53fee49ce1c5
Prevent crashing when authorizing or denying after the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21560
diff
changeset
|
363 if(PURPLE_CONNECTION_IS_VALID(jap->gc)) |
53fee49ce1c5
Prevent crashing when authorizing or denying after the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21560
diff
changeset
|
364 jabber_presence_subscription_set(jap->gc->proto_data, |
53fee49ce1c5
Prevent crashing when authorizing or denying after the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21560
diff
changeset
|
365 jap->who, "subscribed"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 g_free(jap->who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
367 g_free(jap); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
368 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
369 |
19195
1ca6c4b234ab
Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18739
diff
changeset
|
370 static void deny_add_cb(gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 { |
19195
1ca6c4b234ab
Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18739
diff
changeset
|
372 struct _jabber_add_permit *jap = data; |
21602
53fee49ce1c5
Prevent crashing when authorizing or denying after the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21560
diff
changeset
|
373 if(PURPLE_CONNECTION_IS_VALID(jap->gc)) |
53fee49ce1c5
Prevent crashing when authorizing or denying after the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21560
diff
changeset
|
374 jabber_presence_subscription_set(jap->gc->proto_data, |
53fee49ce1c5
Prevent crashing when authorizing or denying after the account is disconnected.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21560
diff
changeset
|
375 jap->who, "unsubscribed"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 g_free(jap->who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 g_free(jap); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
378 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
380 static void |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
381 jabber_vcard_parse_avatar(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
382 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25443
diff
changeset
|
383 xmlnode *packet, gpointer blah) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 JabberBuddy *jb = NULL; |
26862
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
386 xmlnode *vcard, *photo, *binval, *fn, *nick; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 char *text; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 if(!from) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
392 jb = jabber_buddy_find(js, from, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
394 js->pending_avatar_requests = g_slist_remove(js->pending_avatar_requests, jb); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 if((vcard = xmlnode_get_child(packet, "vCard")) || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
397 (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) { |
26862
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
398 /* The logic here regarding the nickname and full name is copied from |
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
399 * buddy.c:jabber_vcard_parse. */ |
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
400 gchar *nickname = NULL; |
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
401 if ((fn = xmlnode_get_child(vcard, "FN"))) |
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
402 nickname = xmlnode_get_data(fn); |
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
403 |
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
404 if ((nick = xmlnode_get_child(vcard, "NICKNAME"))) { |
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
405 char *tmp = xmlnode_get_data(nick); |
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
406 char *bare_jid = jabber_get_bare_jid(from); |
27002
c9ac5cc1e46c
Fix a crash when <NICKNAME/> is present in a vcard, but has no data.
Paul Aurich <paul@darkrain42.org>
parents:
26952
diff
changeset
|
407 if (tmp && strstr(bare_jid, tmp) == NULL) { |
26862
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
408 g_free(nickname); |
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
409 nickname = tmp; |
27002
c9ac5cc1e46c
Fix a crash when <NICKNAME/> is present in a vcard, but has no data.
Paul Aurich <paul@darkrain42.org>
parents:
26952
diff
changeset
|
410 } else if (tmp) |
26862
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
411 g_free(tmp); |
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
412 |
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
413 g_free(bare_jid); |
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
414 } |
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
415 |
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
416 if (nickname) { |
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
417 serv_got_alias(js->gc, from, nickname); |
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
418 g_free(nickname); |
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
419 } |
5c4a4a0f5929
When we download a buddy's vCard to update an avatar, also try to update the nickname.
Paul Aurich <paul@darkrain42.org>
parents:
26856
diff
changeset
|
420 |
28682
d9eb51a3a3a2
jabber: Don't try to pull a photo out of the <PHOTO/> cdata.
Paul Aurich <paul@darkrain42.org>
parents:
28410
diff
changeset
|
421 if ((photo = xmlnode_get_child(vcard, "PHOTO")) && |
d9eb51a3a3a2
jabber: Don't try to pull a photo out of the <PHOTO/> cdata.
Paul Aurich <paul@darkrain42.org>
parents:
28410
diff
changeset
|
422 (binval = xmlnode_get_child(photo, "BINVAL")) && |
d9eb51a3a3a2
jabber: Don't try to pull a photo out of the <PHOTO/> cdata.
Paul Aurich <paul@darkrain42.org>
parents:
28410
diff
changeset
|
423 (text = xmlnode_get_data(binval))) { |
26789
8953034dae88
Use jabber_calculate_data_sha1sum in one more place.
Paul Aurich <paul@darkrain42.org>
parents:
26787
diff
changeset
|
424 guchar *data; |
8953034dae88
Use jabber_calculate_data_sha1sum in one more place.
Paul Aurich <paul@darkrain42.org>
parents:
26787
diff
changeset
|
425 gsize size; |
16386
e0c9a46b459f
Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@wiktel.com>
parents:
15957
diff
changeset
|
426 |
15823 | 427 data = purple_base64_decode(text, &size); |
28682
d9eb51a3a3a2
jabber: Don't try to pull a photo out of the <PHOTO/> cdata.
Paul Aurich <paul@darkrain42.org>
parents:
28410
diff
changeset
|
428 if (data) { |
d9eb51a3a3a2
jabber: Don't try to pull a photo out of the <PHOTO/> cdata.
Paul Aurich <paul@darkrain42.org>
parents:
28410
diff
changeset
|
429 gchar *hash = jabber_calculate_data_sha1sum(data, size); |
d9eb51a3a3a2
jabber: Don't try to pull a photo out of the <PHOTO/> cdata.
Paul Aurich <paul@darkrain42.org>
parents:
28410
diff
changeset
|
430 purple_buddy_icons_set_for_user(js->gc->account, from, data, |
d9eb51a3a3a2
jabber: Don't try to pull a photo out of the <PHOTO/> cdata.
Paul Aurich <paul@darkrain42.org>
parents:
28410
diff
changeset
|
431 size, hash); |
d9eb51a3a3a2
jabber: Don't try to pull a photo out of the <PHOTO/> cdata.
Paul Aurich <paul@darkrain42.org>
parents:
28410
diff
changeset
|
432 g_free(hash); |
d9eb51a3a3a2
jabber: Don't try to pull a photo out of the <PHOTO/> cdata.
Paul Aurich <paul@darkrain42.org>
parents:
28410
diff
changeset
|
433 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 g_free(text); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 |
17609
f88b3a093cba
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 <pidgin@monitzer.com>
parents:
17605
diff
changeset
|
440 typedef struct _JabberPresenceCapabilities { |
f88b3a093cba
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 <pidgin@monitzer.com>
parents:
17605
diff
changeset
|
441 JabberStream *js; |
22757
2404b13940e9
Fix a crash in Jabber that I think happens someone someone signs off
Mark Doliner <mark@kingant.net>
parents:
22475
diff
changeset
|
442 JabberBuddy *jb; |
17609
f88b3a093cba
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 <pidgin@monitzer.com>
parents:
17605
diff
changeset
|
443 char *from; |
f88b3a093cba
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 <pidgin@monitzer.com>
parents:
17605
diff
changeset
|
444 } JabberPresenceCapabilities; |
f88b3a093cba
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 <pidgin@monitzer.com>
parents:
17605
diff
changeset
|
445 |
25784
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
446 static void |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
447 jabber_presence_set_capabilities(JabberCapsClientInfo *info, GList *exts, |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
448 JabberPresenceCapabilities *userdata) |
25745
416ff3d65c16
Rewrite jabber_presence_set_capabilities a little
Paul Aurich <paul@darkrain42.org>
parents:
25743
diff
changeset
|
449 { |
22757
2404b13940e9
Fix a crash in Jabber that I think happens someone someone signs off
Mark Doliner <mark@kingant.net>
parents:
22475
diff
changeset
|
450 JabberBuddyResource *jbr; |
29111
4ab6f0479bc5
strchr() is safe when searching for an ASCII character in UTF8 strings.
Paul Aurich <paul@darkrain42.org>
parents:
29055
diff
changeset
|
451 char *resource = strchr(userdata->from, '/'); |
21688
6f4ffdc65230
Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21629
diff
changeset
|
452 |
26924
33f98d662db8
Don't crash when resource is NULL. Thanks, Marcus!
Paul Aurich <paul@darkrain42.org>
parents:
26863
diff
changeset
|
453 if (resource) |
33f98d662db8
Don't crash when resource is NULL. Thanks, Marcus!
Paul Aurich <paul@darkrain42.org>
parents:
26863
diff
changeset
|
454 resource += 1; |
22757
2404b13940e9
Fix a crash in Jabber that I think happens someone someone signs off
Mark Doliner <mark@kingant.net>
parents:
22475
diff
changeset
|
455 |
25745
416ff3d65c16
Rewrite jabber_presence_set_capabilities a little
Paul Aurich <paul@darkrain42.org>
parents:
25743
diff
changeset
|
456 jbr = jabber_buddy_find_resource(userdata->jb, resource); |
416ff3d65c16
Rewrite jabber_presence_set_capabilities a little
Paul Aurich <paul@darkrain42.org>
parents:
25743
diff
changeset
|
457 if (!jbr) { |
22757
2404b13940e9
Fix a crash in Jabber that I think happens someone someone signs off
Mark Doliner <mark@kingant.net>
parents:
22475
diff
changeset
|
458 g_free(userdata->from); |
2404b13940e9
Fix a crash in Jabber that I think happens someone someone signs off
Mark Doliner <mark@kingant.net>
parents:
22475
diff
changeset
|
459 g_free(userdata); |
25784
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
460 if (exts) { |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
461 g_list_foreach(exts, (GFunc)g_free, NULL); |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
462 g_list_free(exts); |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
463 } |
22757
2404b13940e9
Fix a crash in Jabber that I think happens someone someone signs off
Mark Doliner <mark@kingant.net>
parents:
22475
diff
changeset
|
464 return; |
2404b13940e9
Fix a crash in Jabber that I think happens someone someone signs off
Mark Doliner <mark@kingant.net>
parents:
22475
diff
changeset
|
465 } |
2404b13940e9
Fix a crash in Jabber that I think happens someone someone signs off
Mark Doliner <mark@kingant.net>
parents:
22475
diff
changeset
|
466 |
25786
5ad14a53e266
Partial disapproval of b8fdbd255c614e7305f835b843a3414675a86a19
Paul Aurich <paul@darkrain42.org>
parents:
25784
diff
changeset
|
467 /* Any old jbr->caps.info is owned by the caps code */ |
25784
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
468 if (jbr->caps.exts) { |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
469 g_list_foreach(jbr->caps.exts, (GFunc)g_free, NULL); |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
470 g_list_free(jbr->caps.exts); |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
471 } |
21688
6f4ffdc65230
Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21629
diff
changeset
|
472 |
25784
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
473 jbr->caps.info = info; |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
474 jbr->caps.exts = exts; |
21688
6f4ffdc65230
Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21629
diff
changeset
|
475 |
29533
8a50c08c289d
Declare XMPP got media caps in the correct place.
maiku@pidgin.im
parents:
29530
diff
changeset
|
476 purple_prpl_got_media_caps( |
8a50c08c289d
Declare XMPP got media caps in the correct place.
maiku@pidgin.im
parents:
29530
diff
changeset
|
477 purple_connection_get_account(userdata->js->gc), |
8a50c08c289d
Declare XMPP got media caps in the correct place.
maiku@pidgin.im
parents:
29530
diff
changeset
|
478 userdata->from); |
8a50c08c289d
Declare XMPP got media caps in the correct place.
maiku@pidgin.im
parents:
29530
diff
changeset
|
479 |
27588
ed284238509b
Use Entity Capabilities to pick up Chat States support. Refs #4650.
Paul Aurich <paul@darkrain42.org>
parents:
27585
diff
changeset
|
480 if (info == NULL) |
ed284238509b
Use Entity Capabilities to pick up Chat States support. Refs #4650.
Paul Aurich <paul@darkrain42.org>
parents:
27585
diff
changeset
|
481 goto out; |
ed284238509b
Use Entity Capabilities to pick up Chat States support. Refs #4650.
Paul Aurich <paul@darkrain42.org>
parents:
27585
diff
changeset
|
482 |
26931
e7819fa37224
Only try to fetch adhoc commands from buddies once. Pushed updates (which we support now) are far superior.
Paul Aurich <paul@darkrain42.org>
parents:
26928
diff
changeset
|
483 if (!jbr->commands_fetched && jabber_resource_has_capability(jbr, "http://jabber.org/protocol/commands")) { |
29031
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28893
diff
changeset
|
484 JabberIq *iq = jabber_iq_new_query(userdata->js, JABBER_IQ_GET, NS_DISCO_ITEMS); |
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28893
diff
changeset
|
485 xmlnode *query = xmlnode_get_child_with_namespace(iq->node, "query", NS_DISCO_ITEMS); |
25770
b1b1b75a922e
Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents:
25764
diff
changeset
|
486 xmlnode_set_attrib(iq->node, "to", userdata->from); |
b1b1b75a922e
Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents:
25764
diff
changeset
|
487 xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/commands"); |
b1b1b75a922e
Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents:
25764
diff
changeset
|
488 jabber_iq_set_callback(iq, jabber_adhoc_disco_result_cb, NULL); |
b1b1b75a922e
Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents:
25764
diff
changeset
|
489 jabber_iq_send(iq); |
21688
6f4ffdc65230
Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21629
diff
changeset
|
490 |
26931
e7819fa37224
Only try to fetch adhoc commands from buddies once. Pushed updates (which we support now) are far superior.
Paul Aurich <paul@darkrain42.org>
parents:
26928
diff
changeset
|
491 jbr->commands_fetched = TRUE; |
17609
f88b3a093cba
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 <pidgin@monitzer.com>
parents:
17605
diff
changeset
|
492 } |
21688
6f4ffdc65230
Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21629
diff
changeset
|
493 |
28410
faf98a4b27d8
jabber: Fix typing notifications between 2.6.0 and <= 2.5.9.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
494 #if 0 |
faf98a4b27d8
jabber: Fix typing notifications between 2.6.0 and <= 2.5.9.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
495 /* |
faf98a4b27d8
jabber: Fix typing notifications between 2.6.0 and <= 2.5.9.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
496 * Versions of libpurple before 2.6.0 didn't advertise this capability, so |
faf98a4b27d8
jabber: Fix typing notifications between 2.6.0 and <= 2.5.9.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
497 * we can't yet use Entity Capabilities to determine whether or not the |
28779 | 498 * other client supports Chat States. |
28410
faf98a4b27d8
jabber: Fix typing notifications between 2.6.0 and <= 2.5.9.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
499 */ |
27588
ed284238509b
Use Entity Capabilities to pick up Chat States support. Refs #4650.
Paul Aurich <paul@darkrain42.org>
parents:
27585
diff
changeset
|
500 if (jabber_resource_has_capability(jbr, "http://jabber.org/protocol/chatstates")) |
ed284238509b
Use Entity Capabilities to pick up Chat States support. Refs #4650.
Paul Aurich <paul@darkrain42.org>
parents:
27585
diff
changeset
|
501 jbr->chat_states = JABBER_CHAT_STATES_SUPPORTED; |
ed284238509b
Use Entity Capabilities to pick up Chat States support. Refs #4650.
Paul Aurich <paul@darkrain42.org>
parents:
27585
diff
changeset
|
502 else |
ed284238509b
Use Entity Capabilities to pick up Chat States support. Refs #4650.
Paul Aurich <paul@darkrain42.org>
parents:
27585
diff
changeset
|
503 jbr->chat_states = JABBER_CHAT_STATES_UNSUPPORTED; |
28410
faf98a4b27d8
jabber: Fix typing notifications between 2.6.0 and <= 2.5.9.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
504 #endif |
27588
ed284238509b
Use Entity Capabilities to pick up Chat States support. Refs #4650.
Paul Aurich <paul@darkrain42.org>
parents:
27585
diff
changeset
|
505 |
ed284238509b
Use Entity Capabilities to pick up Chat States support. Refs #4650.
Paul Aurich <paul@darkrain42.org>
parents:
27585
diff
changeset
|
506 out: |
20318
bbfe52e817cf
applied changes from d50ecf4dc52f25cbd219d6c19846436dec5a8853
Luke Schierer <lschiere@pidgin.im>
parents:
20058
diff
changeset
|
507 g_free(userdata->from); |
bbfe52e817cf
applied changes from d50ecf4dc52f25cbd219d6c19846436dec5a8853
Luke Schierer <lschiere@pidgin.im>
parents:
20058
diff
changeset
|
508 g_free(userdata); |
17609
f88b3a093cba
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 <pidgin@monitzer.com>
parents:
17605
diff
changeset
|
509 } |
f88b3a093cba
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 <pidgin@monitzer.com>
parents:
17605
diff
changeset
|
510 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
511 void jabber_presence_parse(JabberStream *js, xmlnode *packet) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 { |
26952
92565c8e1e3a
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <paul@darkrain42.org>
parents:
26931
diff
changeset
|
513 const char *from; |
92565c8e1e3a
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <paul@darkrain42.org>
parents:
26931
diff
changeset
|
514 const char *type; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
515 char *status = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
516 int priority = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 JabberID *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
518 JabberChat *chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
519 JabberBuddy *jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 JabberBuddyResource *jbr = NULL, *found_jbr = NULL; |
15823 | 521 PurpleConvChatBuddyFlags flags = PURPLE_CBFLAGS_NONE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 gboolean delayed = FALSE; |
25805 | 523 const gchar *stamp = NULL; /* from <delayed/> element */ |
29403
a363b5aff793
jabber: Add a PurpleAccount convenience variable.
Paul Aurich <paul@darkrain42.org>
parents:
29402
diff
changeset
|
524 PurpleAccount *account; |
15823 | 525 PurpleBuddy *b = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
526 char *buddy_name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
527 JabberBuddyState state = JABBER_BUDDY_STATE_UNKNOWN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
528 xmlnode *y; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
529 char *avatar_hash = NULL; |
17609
f88b3a093cba
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 <pidgin@monitzer.com>
parents:
17605
diff
changeset
|
530 xmlnode *caps = NULL; |
25805 | 531 int idle = 0; |
26856
867e231bffbc
A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents:
26855
diff
changeset
|
532 gchar *nickname = NULL; |
26952
92565c8e1e3a
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <paul@darkrain42.org>
parents:
26931
diff
changeset
|
533 gboolean signal_return; |
92565c8e1e3a
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <paul@darkrain42.org>
parents:
26931
diff
changeset
|
534 |
92565c8e1e3a
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <paul@darkrain42.org>
parents:
26931
diff
changeset
|
535 from = xmlnode_get_attrib(packet, "from"); |
92565c8e1e3a
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <paul@darkrain42.org>
parents:
26931
diff
changeset
|
536 type = xmlnode_get_attrib(packet, "type"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 |
27445
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
538 jb = jabber_buddy_find(js, from, TRUE); |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
539 g_return_if_fail(jb != NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 |
28893
96ba7fd24177
jabber: Use purple_connection_get_prpl() instead of jabber_plugin.
Paul Aurich <paul@darkrain42.org>
parents:
28779
diff
changeset
|
541 signal_return = GPOINTER_TO_INT(purple_signal_emit_return_1(purple_connection_get_prpl(js->gc), |
26952
92565c8e1e3a
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <paul@darkrain42.org>
parents:
26931
diff
changeset
|
542 "jabber-receiving-presence", js->gc, type, from, packet)); |
92565c8e1e3a
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <paul@darkrain42.org>
parents:
26931
diff
changeset
|
543 if (signal_return) |
92565c8e1e3a
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <paul@darkrain42.org>
parents:
26931
diff
changeset
|
544 return; |
92565c8e1e3a
Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <paul@darkrain42.org>
parents:
26931
diff
changeset
|
545 |
29403
a363b5aff793
jabber: Add a PurpleAccount convenience variable.
Paul Aurich <paul@darkrain42.org>
parents:
29402
diff
changeset
|
546 account = purple_connection_get_account(js->gc); |
a363b5aff793
jabber: Add a PurpleAccount convenience variable.
Paul Aurich <paul@darkrain42.org>
parents:
29402
diff
changeset
|
547 |
27445
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
548 jid = jabber_id_new(from); |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
549 if (jid == NULL) { |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
550 purple_debug_error("jabber", "Ignoring presence with malformed 'from' " |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
551 "JID: %s\n", from); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 return; |
27445
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
553 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
554 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
555 if(jb->error_msg) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
556 g_free(jb->error_msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 jb->error_msg = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 |
27445
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
560 if (type == NULL) { |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
561 xmlnode *show; |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
562 char *show_data = NULL; |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
563 |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
564 state = JABBER_BUDDY_STATE_ONLINE; |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
565 |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
566 show = xmlnode_get_child(packet, "show"); |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
567 if (show) { |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
568 show_data = xmlnode_get_data(show); |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
569 if (show_data) { |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
570 state = jabber_buddy_show_get_state(show_data); |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
571 g_free(show_data); |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
572 } else |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
573 purple_debug_warning("jabber", "<show/> present on presence, " |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
574 "but no contents!\n"); |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
575 } |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
576 } else if (g_str_equal(type, "error")) { |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
20318
diff
changeset
|
577 char *msg = jabber_parse_error(js, packet, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 state = JABBER_BUDDY_STATE_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
580 jb->error_msg = msg ? msg : g_strdup(_("Unknown Error in presence")); |
27445
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
581 } else if (g_str_equal(type, "subscribe")) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
582 struct _jabber_add_permit *jap = g_new0(struct _jabber_add_permit, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 gboolean onlist = FALSE; |
27445
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
584 PurpleBuddy *buddy; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 JabberBuddy *jb = NULL; |
26856
867e231bffbc
A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents:
26855
diff
changeset
|
586 xmlnode *nick; |
867e231bffbc
A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents:
26855
diff
changeset
|
587 |
27445
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
588 buddy = purple_find_buddy(account, from); |
26856
867e231bffbc
A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents:
26855
diff
changeset
|
589 nick = xmlnode_get_child_with_namespace(packet, "nick", "http://jabber.org/protocol/nick"); |
867e231bffbc
A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents:
26855
diff
changeset
|
590 if (nick) |
867e231bffbc
A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents:
26855
diff
changeset
|
591 nickname = xmlnode_get_data(nick); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
592 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 if (buddy) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
594 jb = jabber_buddy_find(js, from, TRUE); |
24427
39841a84c944
A fix from Paul Aurich for a long-standing XMPP issue with duplicate buddies. Fixes #479.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23432
diff
changeset
|
595 if ((jb->subscription & (JABBER_SUB_TO | JABBER_SUB_PENDING))) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 onlist = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
597 } |
15957
84bf0f949b0b
fix prompting to add a buddy after authorization if they're already on our list
Nathan Walp <nwalp@pidgin.im>
parents:
15891
diff
changeset
|
598 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 jap->gc = js->gc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 jap->who = g_strdup(from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 jap->js = js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 |
27445
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
603 purple_account_request_authorization(account, from, NULL, nickname, |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
604 NULL, onlist, authorize_add_cb, deny_add_cb, jap); |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
605 |
26856
867e231bffbc
A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents:
26855
diff
changeset
|
606 g_free(nickname); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 jabber_id_free(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
608 return; |
27445
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
609 } else if (g_str_equal(type, "subscribed")) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 /* we've been allowed to see their presence, but we don't care */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 jabber_id_free(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
612 return; |
27445
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
613 } else if (g_str_equal(type, "unsubscribe")) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
614 /* XXX I'm not sure this is the right way to handle this, it |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
615 * might be better to add "unsubscribe" to the presence status |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
616 * if lower down, but I'm not sure. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
617 /* they are unsubscribing from our presence, we don't care */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
618 /* Well, maybe just a little, we might want/need to start |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
619 * acknowledging this (and the others) at some point. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
620 jabber_id_free(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
621 return; |
27448
b41b69e8b341
I missed a few presence types.
Paul Aurich <paul@darkrain42.org>
parents:
27447
diff
changeset
|
622 } else if (g_str_equal(type, "probe")) { |
b41b69e8b341
I missed a few presence types.
Paul Aurich <paul@darkrain42.org>
parents:
27447
diff
changeset
|
623 purple_debug_warning("jabber", "Ignoring presence probe\n"); |
b41b69e8b341
I missed a few presence types.
Paul Aurich <paul@darkrain42.org>
parents:
27447
diff
changeset
|
624 jabber_id_free(jid); |
b41b69e8b341
I missed a few presence types.
Paul Aurich <paul@darkrain42.org>
parents:
27447
diff
changeset
|
625 return; |
b41b69e8b341
I missed a few presence types.
Paul Aurich <paul@darkrain42.org>
parents:
27447
diff
changeset
|
626 } else if (g_str_equal(type, "unavailable")) { |
b41b69e8b341
I missed a few presence types.
Paul Aurich <paul@darkrain42.org>
parents:
27447
diff
changeset
|
627 state = JABBER_BUDDY_STATE_UNAVAILABLE; |
b41b69e8b341
I missed a few presence types.
Paul Aurich <paul@darkrain42.org>
parents:
27447
diff
changeset
|
628 } else if (g_str_equal(type, "unsubscribed")) { |
b41b69e8b341
I missed a few presence types.
Paul Aurich <paul@darkrain42.org>
parents:
27447
diff
changeset
|
629 state = JABBER_BUDDY_STATE_UNKNOWN; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
630 } else { |
27445
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
631 purple_debug_warning("jabber", "Ignoring presence with invalid type " |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
632 "'%s'\n", type); |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
633 jabber_id_free(jid); |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
634 return; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
638 for(y = packet->child; y; y = y->next) { |
17609
f88b3a093cba
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 <pidgin@monitzer.com>
parents:
17605
diff
changeset
|
639 const char *xmlns; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 if(y->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 continue; |
17609
f88b3a093cba
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 <pidgin@monitzer.com>
parents:
17605
diff
changeset
|
642 xmlns = xmlnode_get_namespace(y); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
644 if(!strcmp(y->name, "status")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 g_free(status); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 status = xmlnode_get_data(y); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 } else if(!strcmp(y->name, "priority")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 char *p = xmlnode_get_data(y); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
649 if(p) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
650 priority = atoi(p); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 g_free(p); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 } |
24672
bba38f03085d
Remove a double call to xmlnode_get_namespace and multiple tests for xmlns
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24641
diff
changeset
|
653 } else if(xmlns == NULL) { |
bba38f03085d
Remove a double call to xmlnode_get_namespace and multiple tests for xmlns
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24641
diff
changeset
|
654 /* The rest of the cases used to check xmlns individually. */ |
bba38f03085d
Remove a double call to xmlnode_get_namespace and multiple tests for xmlns
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24641
diff
changeset
|
655 continue; |
29044
5b449584fead
jabber: Delayed Delivery namespaces
Paul Aurich <paul@darkrain42.org>
parents:
29031
diff
changeset
|
656 } else if(!strcmp(y->name, "delay") && !strcmp(xmlns, NS_DELAYED_DELIVERY)) { |
27186
048bcf41deef
disapproval of revision 'a383ad6a4ae7e98bbcb32b4193531ccf960eb2bb'
Paul Aurich <paul@darkrain42.org>
parents:
27185
diff
changeset
|
657 /* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */ |
17605
3399dd1c258d
Forgot to implement XEP-0203 for presence packets, too.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17594
diff
changeset
|
658 delayed = TRUE; |
25805 | 659 stamp = xmlnode_get_attrib(y, "stamp"); |
24672
bba38f03085d
Remove a double call to xmlnode_get_namespace and multiple tests for xmlns
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24641
diff
changeset
|
660 } else if(!strcmp(y->name, "c") && !strcmp(xmlns, "http://jabber.org/protocol/caps")) { |
17609
f88b3a093cba
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 <pidgin@monitzer.com>
parents:
17605
diff
changeset
|
661 caps = y; /* store for later, when creating buddy resource */ |
26855
e816444c1a01
Handle User Nick notifications via <presence/> stanzas (receive-only). Refs #864.
Paul Aurich <paul@darkrain42.org>
parents:
26835
diff
changeset
|
662 } else if (g_str_equal(y->name, "nick") && g_str_equal(xmlns, "http://jabber.org/protocol/nick")) { |
26856
867e231bffbc
A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents:
26855
diff
changeset
|
663 nickname = xmlnode_get_data(y); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
664 } else if(!strcmp(y->name, "x")) { |
29044
5b449584fead
jabber: Delayed Delivery namespaces
Paul Aurich <paul@darkrain42.org>
parents:
29031
diff
changeset
|
665 if(!strcmp(xmlns, NS_DELAYED_DELIVERY_LEGACY)) { |
27186
048bcf41deef
disapproval of revision 'a383ad6a4ae7e98bbcb32b4193531ccf960eb2bb'
Paul Aurich <paul@darkrain42.org>
parents:
27185
diff
changeset
|
666 /* XXX: compare the time. jabber:x:delay can happen on presence packets that aren't really and truly delayed */ |
048bcf41deef
disapproval of revision 'a383ad6a4ae7e98bbcb32b4193531ccf960eb2bb'
Paul Aurich <paul@darkrain42.org>
parents:
27185
diff
changeset
|
667 delayed = TRUE; |
048bcf41deef
disapproval of revision 'a383ad6a4ae7e98bbcb32b4193531ccf960eb2bb'
Paul Aurich <paul@darkrain42.org>
parents:
27185
diff
changeset
|
668 stamp = xmlnode_get_attrib(y, "stamp"); |
048bcf41deef
disapproval of revision 'a383ad6a4ae7e98bbcb32b4193531ccf960eb2bb'
Paul Aurich <paul@darkrain42.org>
parents:
27185
diff
changeset
|
669 } else if(!strcmp(xmlns, "http://jabber.org/protocol/muc#user")) { |
24672
bba38f03085d
Remove a double call to xmlnode_get_namespace and multiple tests for xmlns
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24641
diff
changeset
|
670 } else if(!strcmp(xmlns, "vcard-temp:x:update")) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 xmlnode *photo = xmlnode_get_child(y, "photo"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 if(photo) { |
17840
6e0961356343
Don't check for null before calling free. I can't help but get rid
Mark Doliner <mark@kingant.net>
parents:
17814
diff
changeset
|
673 g_free(avatar_hash); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
674 avatar_hash = xmlnode_get_data(photo); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
675 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
676 } |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
27002
diff
changeset
|
677 } else if (!strcmp(y->name, "query") && |
29031
9ae3e70a327b
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <paul@darkrain42.org>
parents:
28893
diff
changeset
|
678 !strcmp(xmlnode_get_namespace(y), NS_LAST_ACTIVITY)) { |
25805 | 679 /* resource has specified idle */ |
680 const gchar *seconds = xmlnode_get_attrib(y, "seconds"); | |
681 if (seconds) { | |
682 /* we may need to take "delayed" into account here */ | |
683 idle = atoi(seconds); | |
684 } | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
685 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
687 |
25805 | 688 if (idle && delayed && stamp) { |
689 /* if we have a delayed presence, we need to add the delay to the idle | |
690 value */ | |
691 time_t offset = time(NULL) - purple_str_to_time(stamp, TRUE, NULL, NULL, | |
692 NULL); | |
693 purple_debug_info("jabber", "got delay %s yielding %ld s offset\n", | |
694 stamp, offset); | |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
27002
diff
changeset
|
695 idle += offset; |
25805 | 696 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
697 |
29404
9c9cfcd69181
jabber: Document these boundaries, because scrolling this much is terrible.
Paul Aurich <paul@darkrain42.org>
parents:
29403
diff
changeset
|
698 /* DEALING WITH CHATS */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
699 if(jid->node && (chat = jabber_chat_find(js, jid->node, jid->domain))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
700 static int i = 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
701 |
17004 | 702 if(state == JABBER_BUDDY_STATE_ERROR) { |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
20318
diff
changeset
|
703 char *title, *msg = jabber_parse_error(js, packet, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
704 |
23262
5793bcea224c
Fix the chat-room rejoining bug where the list appears empty.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23105
diff
changeset
|
705 if (!chat->conv) { |
5793bcea224c
Fix the chat-room rejoining bug where the list appears empty.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23105
diff
changeset
|
706 title = g_strdup_printf(_("Error joining chat %s"), from); |
5793bcea224c
Fix the chat-room rejoining bug where the list appears empty.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23105
diff
changeset
|
707 purple_serv_got_join_chat_failed(js->gc, chat->components); |
5793bcea224c
Fix the chat-room rejoining bug where the list appears empty.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23105
diff
changeset
|
708 } else { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
709 title = g_strdup_printf(_("Error in chat %s"), from); |
18739
f29794be0163
applied changes from bbcc1925d9e449bb9599d378da2764bf47da2a7a
Mark Doliner <mark@kingant.net>
parents:
18734
diff
changeset
|
710 if (g_hash_table_size(chat->members) == 0) |
f29794be0163
applied changes from bbcc1925d9e449bb9599d378da2764bf47da2a7a
Mark Doliner <mark@kingant.net>
parents:
18734
diff
changeset
|
711 serv_got_chat_left(js->gc, chat->id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
712 } |
15823 | 713 purple_notify_error(js->gc, title, title, msg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 g_free(title); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
715 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 |
18739
f29794be0163
applied changes from bbcc1925d9e449bb9599d378da2764bf47da2a7a
Mark Doliner <mark@kingant.net>
parents:
18734
diff
changeset
|
717 if (g_hash_table_size(chat->members) == 0) |
f29794be0163
applied changes from bbcc1925d9e449bb9599d378da2764bf47da2a7a
Mark Doliner <mark@kingant.net>
parents:
18734
diff
changeset
|
718 /* Only destroy the chat if the error happened while joining */ |
f29794be0163
applied changes from bbcc1925d9e449bb9599d378da2764bf47da2a7a
Mark Doliner <mark@kingant.net>
parents:
18734
diff
changeset
|
719 jabber_chat_destroy(chat); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
720 jabber_id_free(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
721 g_free(status); |
17840
6e0961356343
Don't check for null before calling free. I can't help but get rid
Mark Doliner <mark@kingant.net>
parents:
17814
diff
changeset
|
722 g_free(avatar_hash); |
26856
867e231bffbc
A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents:
26855
diff
changeset
|
723 g_free(nickname); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
724 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
725 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
726 |
27446
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
727 if (type == NULL) { |
27447
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
728 xmlnode *x; |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
729 const char *real_jid = NULL; |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
730 const char *affiliation = NULL; |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
731 const char *role = NULL; |
28205
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
732 gboolean is_our_resource = FALSE; /* Is the presence about us? */ |
27447
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
733 |
27446
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
734 /* |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
735 * XEP-0045 mandates the presence to include a resource (which is |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
736 * treated as the chat nick). Some non-compliant servers allow |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
737 * joining without a nick. |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
738 */ |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
739 if (!jid->resource) { |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
740 jabber_id_free(jid); |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
741 g_free(avatar_hash); |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
742 g_free(nickname); |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
743 g_free(status); |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
744 return; |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
745 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
746 |
27447
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
747 x = xmlnode_get_child_with_namespace(packet, "x", |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
748 "http://jabber.org/protocol/muc#user"); |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
749 if (x) { |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
750 xmlnode *status_node; |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
751 xmlnode *item_node; |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
752 |
28205
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
753 for (status_node = xmlnode_get_child(x, "status"); status_node; |
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
754 status_node = xmlnode_get_next_twin(status_node)) { |
27447
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
755 const char *code = xmlnode_get_attrib(status_node, "code"); |
28205
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
756 if (!code) |
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
757 continue; |
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
758 |
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
759 if (g_str_equal(code, "110")) { |
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
760 is_our_resource = TRUE; |
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
761 } else if (g_str_equal(code, "201")) { |
27447
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
762 if ((chat = jabber_chat_find(js, jid->node, jid->domain))) { |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
763 chat->config_dialog_type = PURPLE_REQUEST_ACTION; |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
764 chat->config_dialog_handle = |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
765 purple_request_action(js->gc, |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
766 _("Create New Room"), |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
767 _("Create New Room"), |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
768 _("You are creating a new room. Would" |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
769 " you like to configure it, or" |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
770 " accept the default settings?"), |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
771 /* Default Action */ 1, |
29403
a363b5aff793
jabber: Add a PurpleAccount convenience variable.
Paul Aurich <paul@darkrain42.org>
parents:
29402
diff
changeset
|
772 account, NULL, chat->conv, |
27447
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
773 chat, 2, |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
774 _("_Configure Room"), G_CALLBACK(jabber_chat_request_room_configure), |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
775 _("_Accept Defaults"), G_CALLBACK(jabber_chat_create_instant_room)); |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
776 } |
28205
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
777 } else if (g_str_equal(code, "210")) { |
27447
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
778 /* server rewrote room-nick */ |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
779 if((chat = jabber_chat_find(js, jid->node, jid->domain))) { |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
780 g_free(chat->handle); |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
781 chat->handle = g_strdup(jid->resource); |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
782 } |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
783 } |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
784 } |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
785 |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
786 item_node = xmlnode_get_child(x, "item"); |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
787 if (item_node) { |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
788 real_jid = xmlnode_get_attrib(item_node, "jid"); |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
789 affiliation = xmlnode_get_attrib(item_node, "affiliation"); |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
790 role = xmlnode_get_attrib(item_node, "role"); |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
791 |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
792 if (purple_strequal(affiliation, "owner")) |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
793 flags |= PURPLE_CBFLAGS_FOUNDER; |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
794 if (role) { |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
795 if (g_str_equal(role, "moderator")) |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
796 flags |= PURPLE_CBFLAGS_OP; |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
797 else if (g_str_equal(role, "participant")) |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
798 flags |= PURPLE_CBFLAGS_VOICE; |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
799 } |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
800 } |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
801 } |
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
802 |
27446
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
803 if(!chat->conv) { |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
804 char *room_jid = g_strdup_printf("%s@%s", jid->node, jid->domain); |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
805 chat->id = i++; |
27447
712289e2aa6d
Rearrange all the MUC code to be together.
Paul Aurich <paul@darkrain42.org>
parents:
27446
diff
changeset
|
806 chat->muc = (x != NULL); |
27446
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
807 chat->conv = serv_got_joined_chat(js->gc, chat->id, room_jid); |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
808 purple_conv_chat_set_nick(PURPLE_CONV_CHAT(chat->conv), chat->handle); |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
809 |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
810 jabber_chat_disco_traffic(chat); |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
811 g_free(room_jid); |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
812 } |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
813 |
29289
d9c97c2b29fd
jabber: Don't fetch Adhoc Commands for MUC chat members.
Paul Aurich <paul@darkrain42.org>
parents:
29141
diff
changeset
|
814 jbr = jabber_buddy_track_resource(jb, jid->resource, priority, state, |
27446
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
815 status); |
29289
d9c97c2b29fd
jabber: Don't fetch Adhoc Commands for MUC chat members.
Paul Aurich <paul@darkrain42.org>
parents:
29141
diff
changeset
|
816 jbr->commands_fetched = TRUE; |
27446
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
817 |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
818 jabber_chat_track_handle(chat, jid->resource, real_jid, affiliation, role); |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
819 |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
820 if(!jabber_chat_find_buddy(chat->conv, jid->resource)) |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
821 purple_conv_chat_add_user(PURPLE_CONV_CHAT(chat->conv), jid->resource, |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
822 real_jid, flags, !delayed); |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
823 else |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
824 purple_conv_chat_user_set_flags(PURPLE_CONV_CHAT(chat->conv), jid->resource, |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
825 flags); |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
826 } else if (g_str_equal(type, "unavailable")) { |
27515
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
827 xmlnode *x; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
828 gboolean nick_change = FALSE; |
27444
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
829 gboolean kick = FALSE; |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
830 gboolean is_our_resource = FALSE; /* Is the presence about us? */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 |
25882
54dcfe059dd4
*** Plucked rev 3993504a (darkrain42@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
24672
diff
changeset
|
832 /* If the chat nick is invalid, we haven't yet joined, or we've |
54dcfe059dd4
*** Plucked rev 3993504a (darkrain42@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
24672
diff
changeset
|
833 * already left (it was probably us leaving after we closed the |
54dcfe059dd4
*** Plucked rev 3993504a (darkrain42@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
24672
diff
changeset
|
834 * chat), we don't care. |
54dcfe059dd4
*** Plucked rev 3993504a (darkrain42@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
24672
diff
changeset
|
835 */ |
54dcfe059dd4
*** Plucked rev 3993504a (darkrain42@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
24672
diff
changeset
|
836 if (!jid->resource || !chat->conv || chat->left) { |
23262
5793bcea224c
Fix the chat-room rejoining bug where the list appears empty.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23105
diff
changeset
|
837 if (chat->left && |
5793bcea224c
Fix the chat-room rejoining bug where the list appears empty.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23105
diff
changeset
|
838 jid->resource && chat->handle && !strcmp(jid->resource, chat->handle)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
839 jabber_chat_destroy(chat); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
840 jabber_id_free(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
841 g_free(status); |
17840
6e0961356343
Don't check for null before calling free. I can't help but get rid
Mark Doliner <mark@kingant.net>
parents:
17814
diff
changeset
|
842 g_free(avatar_hash); |
26856
867e231bffbc
A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents:
26855
diff
changeset
|
843 g_free(nickname); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
844 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
845 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
846 |
27444
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
847 is_our_resource = (0 == g_utf8_collate(jid->resource, chat->handle)); |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
848 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
849 jabber_buddy_remove_resource(jb, jid->resource); |
27515
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
850 |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
851 x = xmlnode_get_child_with_namespace(packet, "x", |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
852 "http://jabber.org/protocol/muc#user"); |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
853 if (chat->muc && x) { |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
854 const char *nick; |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
855 const char *item_jid = NULL; |
27670
b448b259e3cf
The item JID will match the 'to' JID, not the from.
Paul Aurich <paul@darkrain42.org>
parents:
27667
diff
changeset
|
856 const char *to; |
27515
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
857 xmlnode *stat; |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
858 xmlnode *item; |
27444
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
859 |
27515
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
860 item = xmlnode_get_child(x, "item"); |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
861 if (item) |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
862 item_jid = xmlnode_get_attrib(item, "jid"); |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
863 |
28205
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
864 for (stat = xmlnode_get_child(x, "status"); stat; |
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
865 stat = xmlnode_get_next_twin(stat)) { |
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
866 const char *code = xmlnode_get_attrib(stat, "code"); |
27515
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
867 |
28205
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
868 if (!code) |
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
869 continue; |
27515
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
870 |
28205
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
871 if (g_str_equal(code, "110")) { |
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
872 is_our_resource = TRUE; |
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
873 } else if(!strcmp(code, "301")) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
874 /* XXX: we got banned */ |
27515
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
875 } else if(!strcmp(code, "303") && item && |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
876 (nick = xmlnode_get_attrib(item, "nick"))) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
877 nick_change = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
878 if(!strcmp(jid->resource, chat->handle)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
879 g_free(chat->handle); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
880 chat->handle = g_strdup(nick); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
881 } |
28205
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
882 |
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
883 /* TODO: This should probably be moved out of the loop */ |
15823 | 884 purple_conv_chat_rename_user(PURPLE_CONV_CHAT(chat->conv), jid->resource, nick); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
885 jabber_chat_remove_handle(chat, jid->resource); |
28205
f05c87f3121e
jabber: Read all MUC status codes in a presence. Fixes #6651.
Paul Aurich <paul@darkrain42.org>
parents:
28079
diff
changeset
|
886 continue; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
887 } else if(!strcmp(code, "307")) { |
27444
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
888 /* Someone was kicked from the room */ |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
889 xmlnode *reason = NULL, *actor = NULL; |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
890 const char *actor_name = NULL; |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
891 char *reason_text = NULL; |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
892 char *tmp; |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
893 |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
894 kick = TRUE; |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
895 |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
896 if (item) { |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
897 reason = xmlnode_get_child(item, "reason"); |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
898 actor = xmlnode_get_child(item, "actor"); |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
899 |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
900 if (reason != NULL) |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
901 reason_text = xmlnode_get_data(reason); |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
902 if (actor != NULL) |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
903 actor_name = xmlnode_get_attrib(actor, "jid"); |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
904 } |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
905 |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
906 if (reason_text == NULL) |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
907 reason_text = g_strdup(_("No reason")); |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
908 |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
909 if (is_our_resource) { |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
910 if (actor_name != NULL) |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
911 tmp = g_strdup_printf(_("You have been kicked by %s: (%s)"), |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
912 actor_name, reason_text); |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
913 else |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
914 tmp = g_strdup_printf(_("You have been kicked: (%s)"), |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
915 reason_text); |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
916 } else { |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
917 if (actor_name != NULL) |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
918 tmp = g_strdup_printf(_("Kicked by %s (%s)"), |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
919 actor_name, reason_text); |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
920 else |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
921 tmp = g_strdup_printf(_("Kicked (%s)"), |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
922 reason_text); |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
923 } |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
924 |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
925 g_free(reason_text); |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
926 g_free(status); |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
927 status = tmp; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
928 } else if(!strcmp(code, "321")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
929 /* XXX: removed due to an affiliation change */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
930 } else if(!strcmp(code, "322")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
931 /* XXX: removed because room is now members-only */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
932 } else if(!strcmp(code, "332")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
933 /* XXX: removed due to system shutdown */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
934 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
935 } |
27515
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
936 |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
937 /* |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
938 * Possibly another connected resource of our JID (see XEP-0045 |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
939 * v1.24 section 7.1.10) being disconnected. Should be |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
940 * distinguished by the item_jid. |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
941 * Also possibly works around bits of an Openfire bug. See |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
942 * #8319. |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
943 */ |
27670
b448b259e3cf
The item JID will match the 'to' JID, not the from.
Paul Aurich <paul@darkrain42.org>
parents:
27667
diff
changeset
|
944 to = xmlnode_get_attrib(packet, "to"); |
b448b259e3cf
The item JID will match the 'to' JID, not the from.
Paul Aurich <paul@darkrain42.org>
parents:
27667
diff
changeset
|
945 if (is_our_resource && item_jid && !purple_strequal(to, item_jid)) { |
27515
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
946 /* TODO: When the above is a loop, this needs to still act |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
947 * sanely for all cases (this code is a little fragile). */ |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
948 if (!kick && !nick_change) |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
949 /* Presumably, kicks and nick changes also affect us. */ |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
950 is_our_resource = FALSE; |
e1090ed76286
Notice when the MUC item JID on unavailable presence references another resource. Refs #8319.
Paul Aurich <paul@darkrain42.org>
parents:
27448
diff
changeset
|
951 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
952 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
953 if(!nick_change) { |
27444
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
954 if (is_our_resource) { |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
955 if (kick) |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
956 purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), jid->resource, |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
957 status, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
c4196cd47602
Add support for XEP-0045 code 307 (a.k.a. kicks).
Paul Aurich <paul@darkrain42.org>
parents:
27441
diff
changeset
|
958 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
959 serv_got_chat_left(js->gc, chat->id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
960 jabber_chat_destroy(chat); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
961 } else { |
15823 | 962 purple_conv_chat_remove_user(PURPLE_CONV_CHAT(chat->conv), jid->resource, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
963 status); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
964 jabber_chat_remove_handle(chat, jid->resource); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
965 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
966 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
967 } else { |
27446
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
968 /* A type that isn't available or unavailable */ |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
969 purple_debug_error("jabber", "MUC presence with bad type: %s\n", |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
970 type); |
25882
54dcfe059dd4
*** Plucked rev 3993504a (darkrain42@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
24672
diff
changeset
|
971 |
27446
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
972 jabber_id_free(jid); |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
973 g_free(avatar_hash); |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
974 g_free(status); |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
975 g_free(nickname); |
735e58197140
Rearranging this section and adding a catch for stuff that can't happen
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
976 g_return_if_reached(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
977 } |
29404
9c9cfcd69181
jabber: Document these boundaries, because scrolling this much is terrible.
Paul Aurich <paul@darkrain42.org>
parents:
29403
diff
changeset
|
978 /* End of DEALING WITH CHATS...about 5000 lines ago */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
979 } else { |
29404
9c9cfcd69181
jabber: Document these boundaries, because scrolling this much is terrible.
Paul Aurich <paul@darkrain42.org>
parents:
29403
diff
changeset
|
980 /* DEALING WITH CONTACT (i.e. not a chat) */ |
29405
1d1e653c4315
jabber: Unbind/Unlock from a specific resource on presences.
Paul Aurich <paul@darkrain42.org>
parents:
29404
diff
changeset
|
981 PurpleConversation *conv; |
1d1e653c4315
jabber: Unbind/Unlock from a specific resource on presences.
Paul Aurich <paul@darkrain42.org>
parents:
29404
diff
changeset
|
982 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
983 buddy_name = g_strdup_printf("%s%s%s", jid->node ? jid->node : "", |
18691
54a5fbeadd7c
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 <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
984 jid->node ? "@" : "", jid->domain); |
29405
1d1e653c4315
jabber: Unbind/Unlock from a specific resource on presences.
Paul Aurich <paul@darkrain42.org>
parents:
29404
diff
changeset
|
985 |
1d1e653c4315
jabber: Unbind/Unlock from a specific resource on presences.
Paul Aurich <paul@darkrain42.org>
parents:
29404
diff
changeset
|
986 /* |
1d1e653c4315
jabber: Unbind/Unlock from a specific resource on presences.
Paul Aurich <paul@darkrain42.org>
parents:
29404
diff
changeset
|
987 * Unbind/unlock from sending messages to a specific resource on |
1d1e653c4315
jabber: Unbind/Unlock from a specific resource on presences.
Paul Aurich <paul@darkrain42.org>
parents:
29404
diff
changeset
|
988 * presence changes. This is locked to a specific resource when |
1d1e653c4315
jabber: Unbind/Unlock from a specific resource on presences.
Paul Aurich <paul@darkrain42.org>
parents:
29404
diff
changeset
|
989 * receiving a message (in message.c). |
1d1e653c4315
jabber: Unbind/Unlock from a specific resource on presences.
Paul Aurich <paul@darkrain42.org>
parents:
29404
diff
changeset
|
990 */ |
1d1e653c4315
jabber: Unbind/Unlock from a specific resource on presences.
Paul Aurich <paul@darkrain42.org>
parents:
29404
diff
changeset
|
991 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, |
1d1e653c4315
jabber: Unbind/Unlock from a specific resource on presences.
Paul Aurich <paul@darkrain42.org>
parents:
29404
diff
changeset
|
992 buddy_name, account); |
1d1e653c4315
jabber: Unbind/Unlock from a specific resource on presences.
Paul Aurich <paul@darkrain42.org>
parents:
29404
diff
changeset
|
993 if (conv) { |
29408
1d58c44c87f4
Oops, that wasn't meant to be left in as a warning, but noting these is probably good.
Paul Aurich <paul@darkrain42.org>
parents:
29405
diff
changeset
|
994 purple_debug_info("jabber", "Changed conversation binding from %s to %s\n", |
29405
1d1e653c4315
jabber: Unbind/Unlock from a specific resource on presences.
Paul Aurich <paul@darkrain42.org>
parents:
29404
diff
changeset
|
995 purple_conversation_get_name(conv), buddy_name); |
1d1e653c4315
jabber: Unbind/Unlock from a specific resource on presences.
Paul Aurich <paul@darkrain42.org>
parents:
29404
diff
changeset
|
996 purple_conversation_set_name(conv, buddy_name); |
1d1e653c4315
jabber: Unbind/Unlock from a specific resource on presences.
Paul Aurich <paul@darkrain42.org>
parents:
29404
diff
changeset
|
997 } |
1d1e653c4315
jabber: Unbind/Unlock from a specific resource on presences.
Paul Aurich <paul@darkrain42.org>
parents:
29404
diff
changeset
|
998 |
29403
a363b5aff793
jabber: Add a PurpleAccount convenience variable.
Paul Aurich <paul@darkrain42.org>
parents:
29402
diff
changeset
|
999 if((b = purple_find_buddy(account, buddy_name)) == NULL) { |
29032
31497213393c
jabber: This is more clear.
Paul Aurich <paul@darkrain42.org>
parents:
29031
diff
changeset
|
1000 if (jb != js->user_jb) { |
22475
3225c99785b8
Fix a bunch of compiler warnings caused by my addition of G_GNUC_PRINTF()
Mark Doliner <mark@kingant.net>
parents:
21688
diff
changeset
|
1001 purple_debug_warning("jabber", "Got presence for unknown buddy %s on account %s (%p)\n", |
29403
a363b5aff793
jabber: Add a PurpleAccount convenience variable.
Paul Aurich <paul@darkrain42.org>
parents:
29402
diff
changeset
|
1002 buddy_name, purple_account_get_username(account), account); |
18691
54a5fbeadd7c
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 <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1003 jabber_id_free(jid); |
54a5fbeadd7c
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 <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1004 g_free(avatar_hash); |
54a5fbeadd7c
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 <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1005 g_free(buddy_name); |
26856
867e231bffbc
A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents:
26855
diff
changeset
|
1006 g_free(nickname); |
18691
54a5fbeadd7c
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 <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1007 g_free(status); |
54a5fbeadd7c
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 <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1008 return; |
54a5fbeadd7c
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 <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1009 } else { |
54a5fbeadd7c
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 <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1010 /* this is a different resource of our own account. Resume even when this account isn't on our blist */ |
54a5fbeadd7c
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 <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1011 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1012 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1013 |
18691
54a5fbeadd7c
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 <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1014 if(b && avatar_hash) { |
16386
e0c9a46b459f
Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@wiktel.com>
parents:
15957
diff
changeset
|
1015 const char *avatar_hash2 = purple_buddy_icons_get_checksum_for_user(b); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1016 if(!avatar_hash2 || strcmp(avatar_hash, avatar_hash2)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1017 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1018 xmlnode *vcard; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1019 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1020 /* XXX this is a crappy way of trying to prevent |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1021 * someone from spamming us with presence packets |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1022 * and causing us to DoS ourselves...what we really |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1023 * need is a queue system that can throttle itself, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1024 * but i'm too tired to write that right now */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1025 if(!g_slist_find(js->pending_avatar_requests, jb)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1026 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1027 js->pending_avatar_requests = g_slist_prepend(js->pending_avatar_requests, jb); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1028 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1029 iq = jabber_iq_new(js, JABBER_IQ_GET); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1030 xmlnode_set_attrib(iq->node, "to", buddy_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1031 vcard = xmlnode_new_child(iq->node, "vCard"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1032 xmlnode_set_namespace(vcard, "vcard-temp"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1033 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1034 jabber_iq_set_callback(iq, jabber_vcard_parse_avatar, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1035 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1036 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1037 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1038 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1039 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1040 if(state == JABBER_BUDDY_STATE_ERROR || |
27445
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
1041 (type && (g_str_equal(type, "unavailable") || |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
1042 g_str_equal(type, "unsubscribed")))) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1043 jabber_buddy_remove_resource(jb, jid->resource); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1044 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1045 jbr = jabber_buddy_track_resource(jb, jid->resource, priority, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1046 state, status); |
25805 | 1047 if (idle) { |
1048 jbr->idle = time(NULL) - idle; | |
1049 } else { | |
1050 jbr->idle = 0; | |
17609
f88b3a093cba
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 <pidgin@monitzer.com>
parents:
17605
diff
changeset
|
1051 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1052 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1053 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1054 if((found_jbr = jabber_buddy_find_resource(jb, NULL))) { |
20571
c97e3ab9ef11
Music support for Google Talk
Sean Egan <seanegan@gmail.com>
parents:
20570
diff
changeset
|
1055 jabber_google_presence_incoming(js, buddy_name, found_jbr); |
29403
a363b5aff793
jabber: Add a PurpleAccount convenience variable.
Paul Aurich <paul@darkrain42.org>
parents:
29402
diff
changeset
|
1056 purple_prpl_got_user_status(account, buddy_name, jabber_buddy_state_get_status_id(found_jbr->state), "priority", found_jbr->priority, "message", found_jbr->status, NULL); |
a363b5aff793
jabber: Add a PurpleAccount convenience variable.
Paul Aurich <paul@darkrain42.org>
parents:
29402
diff
changeset
|
1057 purple_prpl_got_user_idle(account, buddy_name, found_jbr->idle, found_jbr->idle); |
26856
867e231bffbc
A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents:
26855
diff
changeset
|
1058 if (nickname) |
867e231bffbc
A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents:
26855
diff
changeset
|
1059 serv_got_alias(js->gc, buddy_name, nickname); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1060 } else { |
29403
a363b5aff793
jabber: Add a PurpleAccount convenience variable.
Paul Aurich <paul@darkrain42.org>
parents:
29402
diff
changeset
|
1061 purple_prpl_got_user_status(account, buddy_name, "offline", status ? "message" : NULL, status, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1062 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1063 g_free(buddy_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1064 } |
26835
09dc63a697e1
Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents:
26834
diff
changeset
|
1065 |
27445
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27444
diff
changeset
|
1066 if (caps && !type) { |
26835
09dc63a697e1
Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents:
26834
diff
changeset
|
1067 /* handle Entity Capabilities (XEP-0115) */ |
09dc63a697e1
Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents:
26834
diff
changeset
|
1068 const char *node = xmlnode_get_attrib(caps, "node"); |
09dc63a697e1
Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents:
26834
diff
changeset
|
1069 const char *ver = xmlnode_get_attrib(caps, "ver"); |
09dc63a697e1
Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents:
26834
diff
changeset
|
1070 const char *hash = xmlnode_get_attrib(caps, "hash"); |
09dc63a697e1
Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents:
26834
diff
changeset
|
1071 const char *ext = xmlnode_get_attrib(caps, "ext"); |
09dc63a697e1
Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents:
26834
diff
changeset
|
1072 |
09dc63a697e1
Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents:
26834
diff
changeset
|
1073 /* v1.3 uses: node, ver, and optionally ext. |
09dc63a697e1
Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents:
26834
diff
changeset
|
1074 * v1.5 uses: node, ver, and hash. */ |
09dc63a697e1
Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents:
26834
diff
changeset
|
1075 if (node && *node && ver && *ver) { |
26928
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1076 gchar **exts = ext && *ext ? g_strsplit(ext, " ", -1) : NULL; |
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1077 jbr = jabber_buddy_find_resource(jb, jid->resource); |
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1078 |
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1079 /* Look it up if we don't already have all this information */ |
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1080 if (!jbr || !jbr->caps.info || |
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1081 !g_str_equal(node, jbr->caps.info->tuple.node) || |
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1082 !g_str_equal(ver, jbr->caps.info->tuple.ver) || |
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1083 !purple_strequal(hash, jbr->caps.info->tuple.hash) || |
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1084 !jabber_caps_exts_known(jbr->caps.info, (gchar **)exts)) { |
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1085 JabberPresenceCapabilities *userdata = g_new0(JabberPresenceCapabilities, 1); |
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1086 userdata->js = js; |
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1087 userdata->jb = jb; |
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1088 userdata->from = g_strdup(from); |
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1089 jabber_caps_get_info(js, from, node, ver, hash, exts, |
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1090 (jabber_caps_get_info_cb)jabber_presence_set_capabilities, |
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1091 userdata); |
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1092 } else { |
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1093 if (exts) |
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1094 g_strfreev(exts); |
d0a049ede31e
Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <paul@darkrain42.org>
parents:
26924
diff
changeset
|
1095 } |
26835
09dc63a697e1
Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents:
26834
diff
changeset
|
1096 } |
09dc63a697e1
Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents:
26834
diff
changeset
|
1097 } |
09dc63a697e1
Fetch and track capabilities for MUC members. Add a further constraint for
Paul Aurich <paul@darkrain42.org>
parents:
26834
diff
changeset
|
1098 |
26856
867e231bffbc
A little bit better (free memory and support receiving the nick in subscriptions) and Changelog.
Paul Aurich <paul@darkrain42.org>
parents:
26855
diff
changeset
|
1099 g_free(nickname); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1100 g_free(status); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1101 jabber_id_free(jid); |
17840
6e0961356343
Don't check for null before calling free. I can't help but get rid
Mark Doliner <mark@kingant.net>
parents:
17814
diff
changeset
|
1102 g_free(avatar_hash); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1103 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1104 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1105 void jabber_presence_subscription_set(JabberStream *js, const char *who, const char *type) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1106 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1107 xmlnode *presence = xmlnode_new("presence"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1108 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1109 xmlnode_set_attrib(presence, "to", who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1110 xmlnode_set_attrib(presence, "type", type); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1111 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1112 jabber_send(js, presence); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1113 xmlnode_free(presence); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1114 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1115 |
15823 | 1116 void purple_status_to_jabber(const PurpleStatus *status, JabberBuddyState *state, char **msg, int *priority) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1117 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1118 const char *status_id = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1119 const char *formatted_msg = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1120 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1121 if(state) *state = JABBER_BUDDY_STATE_UNKNOWN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1122 if(msg) *msg = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1123 if(priority) *priority = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1124 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1125 if(!status) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1126 if(state) *state = JABBER_BUDDY_STATE_UNAVAILABLE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1127 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1128 if(state) { |
15823 | 1129 status_id = purple_status_get_id(status); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1130 *state = jabber_buddy_status_id_get_state(status_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1131 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1132 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1133 if(msg) { |
15823 | 1134 formatted_msg = purple_status_get_attr_string(status, "message"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1135 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1136 /* if the message is blank, then there really isn't a message */ |
27563
7a2891487a00
Don't pre-escape jbr->status. Almost every place required it in unescaped
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27515
diff
changeset
|
1137 if(formatted_msg && *formatted_msg) |
17814 | 1138 *msg = purple_markup_strip_html(formatted_msg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1139 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1140 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1141 if(priority) |
15823 | 1142 *priority = purple_status_get_attr_int(status, "priority"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1143 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1144 } |