Mon, 02 Jan 2023 02:54:22 -0600
Remove the user search from XMPP
This was from XEP-0055 and doesn't seem to be implemented anywhere anymore. Even
the user directory they mention in the XEP (users.jabber.org) no longer exists.
Testing Done:
Connected an xmpp account and verified that the menu item was removed.
Reviewed at https://reviews.imfreedom.org/r/2163/
| 7014 | 1 | /* |
| 15884 | 2 | * purple - Jabber Protocol Plugin |
| 7014 | 3 | * |
|
28322
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28311
diff
changeset
|
4 | * Purple is the legal property of its developers, whose names are too numerous |
|
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28311
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28311
diff
changeset
|
6 | * source distribution. |
| 7014 | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18315
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 7014 | 21 | * |
| 22 | */ | |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40358
diff
changeset
|
23 | #include <glib/gi18n-lib.h> |
|
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40358
diff
changeset
|
24 | |
|
40358
e6fe6fc1f516
move all protocols, purple plugins, and purple tests to use purple.h instead of including files individually
Gary Kramlich <grim@reaperworld.com>
parents:
40160
diff
changeset
|
25 | #include <purple.h> |
| 7014 | 26 | |
|
40818
3891ef6e3b56
Fix building on glib < 2.58.0 as we have a minimum of 2.52.0
Gary Kramlich <grim@reaperworld.com>
parents:
40726
diff
changeset
|
27 | #include "glibcompat.h" |
|
3891ef6e3b56
Fix building on glib < 2.58.0 as we have a minimum of 2.52.0
Gary Kramlich <grim@reaperworld.com>
parents:
40726
diff
changeset
|
28 | |
| 7014 | 29 | #include "buddy.h" |
| 30 | #include "chat.h" | |
| 31 | #include "jabber.h" | |
| 32 | #include "iq.h" | |
| 33 | #include "presence.h" | |
|
25475
ad7612a5d678
Migrate the XMPP User Avatar (XEP-0084) code to its own file
Paul Aurich <darkrain42@pidgin.im>
parents:
25391
diff
changeset
|
34 | #include "useravatar.h" |
| 11675 | 35 | #include "xdata.h" |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
36 | #include "pep.h" |
|
17816
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
37 | #include "adhoccommands.h" |
| 7014 | 38 | |
| 13794 | 39 | typedef struct { |
| 40 | long idle_seconds; | |
| 41 | } JabberBuddyInfoResource; | |
| 42 | ||
| 43 | typedef struct { | |
| 44 | JabberStream *js; | |
| 45 | JabberBuddy *jb; | |
| 46 | char *jid; | |
| 47 | GSList *ids; | |
| 48 | GHashTable *resources; | |
|
27305
ef06405deeb0
Use guint for a timeout handle here, too.
Paul Aurich <darkrain42@pidgin.im>
parents:
27297
diff
changeset
|
49 | guint timeout_handle; |
|
35823
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
50 | GSList *vcard_images; |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
51 | PurpleNotifyUserInfo *user_info; |
|
27069
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
52 | long last_seconds; |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
53 | gchar *last_message; |
| 13794 | 54 | } JabberBuddyInfo; |
| 55 | ||
|
29388
d46f089712e8
jabber: --header_contents;
Paul Aurich <darkrain42@pidgin.im>
parents:
29387
diff
changeset
|
56 | static void |
|
d46f089712e8
jabber: --header_contents;
Paul Aurich <darkrain42@pidgin.im>
parents:
29387
diff
changeset
|
57 | jabber_buddy_resource_free(JabberBuddyResource *jbr) |
|
d46f089712e8
jabber: --header_contents;
Paul Aurich <darkrain42@pidgin.im>
parents:
29387
diff
changeset
|
58 | { |
|
d46f089712e8
jabber: --header_contents;
Paul Aurich <darkrain42@pidgin.im>
parents:
29387
diff
changeset
|
59 | g_return_if_fail(jbr != NULL); |
|
d46f089712e8
jabber: --header_contents;
Paul Aurich <darkrain42@pidgin.im>
parents:
29387
diff
changeset
|
60 | |
|
40137
016690872c6c
Add new and free functions for structs to reduce duplication
qarkai <qarkai@gmail.com>
parents:
40135
diff
changeset
|
61 | g_list_free_full(jbr->commands, (GDestroyNotify)jabber_adhoc_commands_free); |
|
29388
d46f089712e8
jabber: --header_contents;
Paul Aurich <darkrain42@pidgin.im>
parents:
29387
diff
changeset
|
62 | g_free(jbr->name); |
|
d46f089712e8
jabber: --header_contents;
Paul Aurich <darkrain42@pidgin.im>
parents:
29387
diff
changeset
|
63 | g_free(jbr->status); |
|
d46f089712e8
jabber: --header_contents;
Paul Aurich <darkrain42@pidgin.im>
parents:
29387
diff
changeset
|
64 | g_free(jbr->thread_id); |
|
d46f089712e8
jabber: --header_contents;
Paul Aurich <darkrain42@pidgin.im>
parents:
29387
diff
changeset
|
65 | g_free(jbr->client.name); |
|
d46f089712e8
jabber: --header_contents;
Paul Aurich <darkrain42@pidgin.im>
parents:
29387
diff
changeset
|
66 | g_free(jbr->client.version); |
|
d46f089712e8
jabber: --header_contents;
Paul Aurich <darkrain42@pidgin.im>
parents:
29387
diff
changeset
|
67 | g_free(jbr->client.os); |
|
41764
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
68 | g_clear_pointer(&jbr->tz_off, g_time_zone_unref); |
|
29388
d46f089712e8
jabber: --header_contents;
Paul Aurich <darkrain42@pidgin.im>
parents:
29387
diff
changeset
|
69 | g_free(jbr); |
|
d46f089712e8
jabber: --header_contents;
Paul Aurich <darkrain42@pidgin.im>
parents:
29387
diff
changeset
|
70 | } |
|
d46f089712e8
jabber: --header_contents;
Paul Aurich <darkrain42@pidgin.im>
parents:
29387
diff
changeset
|
71 | |
| 7116 | 72 | void jabber_buddy_free(JabberBuddy *jb) |
| 73 | { | |
| 74 | g_return_if_fail(jb != NULL); | |
| 75 | ||
|
22942
2bf494f8e2a4
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents:
22928
diff
changeset
|
76 | g_free(jb->error_msg); |
|
40145
27c5004a6c65
Re-arrange jabber_buddy_resource_free to avoid use-after-free warning.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40139
diff
changeset
|
77 | g_list_free_full(jb->resources, (GDestroyNotify)jabber_buddy_resource_free); |
| 7116 | 78 | |
| 79 | g_free(jb); | |
| 80 | } | |
| 81 | ||
| 7014 | 82 | JabberBuddy *jabber_buddy_find(JabberStream *js, const char *name, |
| 83 | gboolean create) | |
| 84 | { | |
| 85 | JabberBuddy *jb; | |
|
27297
168f268f927d
Plug a leak from changing this to use jabber_get_bare_jid instead of normalize.
Paul Aurich <darkrain42@pidgin.im>
parents:
27289
diff
changeset
|
86 | char *realname; |
| 7014 | 87 | |
|
15143
37451143f5c4
[gaim-migrate @ 17867]
Mark Doliner <markdoliner@pidgin.im>
parents:
15092
diff
changeset
|
88 | if (js->buddies == NULL) |
|
37451143f5c4
[gaim-migrate @ 17867]
Mark Doliner <markdoliner@pidgin.im>
parents:
15092
diff
changeset
|
89 | return NULL; |
|
37451143f5c4
[gaim-migrate @ 17867]
Mark Doliner <markdoliner@pidgin.im>
parents:
15092
diff
changeset
|
90 | |
|
27110
05ca719b901b
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <malu@pidgin.im>
parents:
27075
diff
changeset
|
91 | if(!(realname = jabber_get_bare_jid(name))) |
| 7014 | 92 | return NULL; |
| 93 | ||
| 94 | jb = g_hash_table_lookup(js->buddies, realname); | |
| 95 | ||
| 96 | if(!jb && create) { | |
| 97 | jb = g_new0(JabberBuddy, 1); | |
|
27297
168f268f927d
Plug a leak from changing this to use jabber_get_bare_jid instead of normalize.
Paul Aurich <darkrain42@pidgin.im>
parents:
27289
diff
changeset
|
98 | g_hash_table_insert(js->buddies, realname, jb); |
|
168f268f927d
Plug a leak from changing this to use jabber_get_bare_jid instead of normalize.
Paul Aurich <darkrain42@pidgin.im>
parents:
27289
diff
changeset
|
99 | } else |
|
168f268f927d
Plug a leak from changing this to use jabber_get_bare_jid instead of normalize.
Paul Aurich <darkrain42@pidgin.im>
parents:
27289
diff
changeset
|
100 | g_free(realname); |
| 7014 | 101 | |
| 102 | return jb; | |
| 103 | } | |
| 104 | ||
|
29385
314d07cec6ba
jabber: Fix the resource_compare_cb function after checking how they're used with GSLists
Paul Aurich <darkrain42@pidgin.im>
parents:
29384
diff
changeset
|
105 | /* Returns -1 if a is a higher priority resource than b, or is |
|
314d07cec6ba
jabber: Fix the resource_compare_cb function after checking how they're used with GSLists
Paul Aurich <darkrain42@pidgin.im>
parents:
29384
diff
changeset
|
106 | * "more available" than b. 0 if they're the same, and 1 if b is |
|
314d07cec6ba
jabber: Fix the resource_compare_cb function after checking how they're used with GSLists
Paul Aurich <darkrain42@pidgin.im>
parents:
29384
diff
changeset
|
107 | * higher priority/more available than a. |
|
314d07cec6ba
jabber: Fix the resource_compare_cb function after checking how they're used with GSLists
Paul Aurich <darkrain42@pidgin.im>
parents:
29384
diff
changeset
|
108 | */ |
|
27965
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
109 | static gint resource_compare_cb(gconstpointer a, gconstpointer b) |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
110 | { |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
111 | const JabberBuddyResource *jbra = a; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
112 | const JabberBuddyResource *jbrb = b; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
113 | JabberBuddyState state_a, state_b; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
114 | |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
115 | if (jbra->priority != jbrb->priority) |
|
29385
314d07cec6ba
jabber: Fix the resource_compare_cb function after checking how they're used with GSLists
Paul Aurich <darkrain42@pidgin.im>
parents:
29384
diff
changeset
|
116 | return jbra->priority > jbrb->priority ? -1 : 1; |
|
27965
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
117 | |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
118 | /* Fold the states for easier comparison */ |
|
29385
314d07cec6ba
jabber: Fix the resource_compare_cb function after checking how they're used with GSLists
Paul Aurich <darkrain42@pidgin.im>
parents:
29384
diff
changeset
|
119 | /* TODO: Differentiate online/chat and away/dnd? */ |
|
27965
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
120 | switch (jbra->state) { |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
121 | case JABBER_BUDDY_STATE_ONLINE: |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
122 | case JABBER_BUDDY_STATE_CHAT: |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
123 | state_a = JABBER_BUDDY_STATE_ONLINE; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
124 | break; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
125 | case JABBER_BUDDY_STATE_AWAY: |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
126 | case JABBER_BUDDY_STATE_DND: |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
127 | state_a = JABBER_BUDDY_STATE_AWAY; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
128 | break; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
129 | case JABBER_BUDDY_STATE_XA: |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
130 | state_a = JABBER_BUDDY_STATE_XA; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
131 | break; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
132 | case JABBER_BUDDY_STATE_UNAVAILABLE: |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
133 | state_a = JABBER_BUDDY_STATE_UNAVAILABLE; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
134 | break; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
135 | default: |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
136 | state_a = JABBER_BUDDY_STATE_UNKNOWN; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
137 | break; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
138 | } |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
139 | |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
140 | switch (jbrb->state) { |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
141 | case JABBER_BUDDY_STATE_ONLINE: |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
142 | case JABBER_BUDDY_STATE_CHAT: |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
143 | state_b = JABBER_BUDDY_STATE_ONLINE; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
144 | break; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
145 | case JABBER_BUDDY_STATE_AWAY: |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
146 | case JABBER_BUDDY_STATE_DND: |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
147 | state_b = JABBER_BUDDY_STATE_AWAY; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
148 | break; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
149 | case JABBER_BUDDY_STATE_XA: |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
150 | state_b = JABBER_BUDDY_STATE_XA; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
151 | break; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
152 | case JABBER_BUDDY_STATE_UNAVAILABLE: |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
153 | state_b = JABBER_BUDDY_STATE_UNAVAILABLE; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
154 | break; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
155 | default: |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
156 | state_b = JABBER_BUDDY_STATE_UNKNOWN; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
157 | break; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
158 | } |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
159 | |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
160 | if (state_a == state_b) { |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
161 | if (jbra->idle == jbrb->idle) |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
162 | return 0; |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
163 | else if ((jbra->idle && !jbrb->idle) || |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
164 | (jbra->idle && jbrb->idle && jbra->idle < jbrb->idle)) |
|
29385
314d07cec6ba
jabber: Fix the resource_compare_cb function after checking how they're used with GSLists
Paul Aurich <darkrain42@pidgin.im>
parents:
29384
diff
changeset
|
165 | return 1; |
|
27965
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
166 | else |
|
29385
314d07cec6ba
jabber: Fix the resource_compare_cb function after checking how they're used with GSLists
Paul Aurich <darkrain42@pidgin.im>
parents:
29384
diff
changeset
|
167 | return -1; |
|
27965
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
168 | } |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
169 | |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
170 | if (state_a == JABBER_BUDDY_STATE_ONLINE) |
|
29385
314d07cec6ba
jabber: Fix the resource_compare_cb function after checking how they're used with GSLists
Paul Aurich <darkrain42@pidgin.im>
parents:
29384
diff
changeset
|
171 | return -1; |
|
27965
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
172 | else if (state_a == JABBER_BUDDY_STATE_AWAY && |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
173 | (state_b == JABBER_BUDDY_STATE_XA || |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
174 | state_b == JABBER_BUDDY_STATE_UNAVAILABLE || |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
175 | state_b == JABBER_BUDDY_STATE_UNKNOWN)) |
|
29385
314d07cec6ba
jabber: Fix the resource_compare_cb function after checking how they're used with GSLists
Paul Aurich <darkrain42@pidgin.im>
parents:
29384
diff
changeset
|
176 | return -1; |
|
27965
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
177 | else if (state_a == JABBER_BUDDY_STATE_XA && |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
178 | (state_b == JABBER_BUDDY_STATE_UNAVAILABLE || |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
179 | state_b == JABBER_BUDDY_STATE_UNKNOWN)) |
|
29385
314d07cec6ba
jabber: Fix the resource_compare_cb function after checking how they're used with GSLists
Paul Aurich <darkrain42@pidgin.im>
parents:
29384
diff
changeset
|
180 | return -1; |
|
27965
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
181 | else if (state_a == JABBER_BUDDY_STATE_UNAVAILABLE && |
|
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
182 | state_b == JABBER_BUDDY_STATE_UNKNOWN) |
|
29385
314d07cec6ba
jabber: Fix the resource_compare_cb function after checking how they're used with GSLists
Paul Aurich <darkrain42@pidgin.im>
parents:
29384
diff
changeset
|
183 | return -1; |
|
27965
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
184 | |
|
29385
314d07cec6ba
jabber: Fix the resource_compare_cb function after checking how they're used with GSLists
Paul Aurich <darkrain42@pidgin.im>
parents:
29384
diff
changeset
|
185 | return 1; |
|
27965
d2f136953034
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <darkrain42@pidgin.im>
parents:
27846
diff
changeset
|
186 | } |
| 7014 | 187 | |
| 188 | JabberBuddyResource *jabber_buddy_find_resource(JabberBuddy *jb, | |
| 189 | const char *resource) | |
| 190 | { | |
| 191 | GList *l; | |
| 192 | ||
|
29387
21ecdd98e791
jabber: Treat JabberBuddy->resources as a sorted list.
Paul Aurich <darkrain42@pidgin.im>
parents:
29385
diff
changeset
|
193 | if (!jb) |
| 7014 | 194 | return NULL; |
| 195 | ||
|
29387
21ecdd98e791
jabber: Treat JabberBuddy->resources as a sorted list.
Paul Aurich <darkrain42@pidgin.im>
parents:
29385
diff
changeset
|
196 | if (resource == NULL) |
|
21ecdd98e791
jabber: Treat JabberBuddy->resources as a sorted list.
Paul Aurich <darkrain42@pidgin.im>
parents:
29385
diff
changeset
|
197 | return jb->resources ? jb->resources->data : NULL; |
|
21ecdd98e791
jabber: Treat JabberBuddy->resources as a sorted list.
Paul Aurich <darkrain42@pidgin.im>
parents:
29385
diff
changeset
|
198 | |
|
21ecdd98e791
jabber: Treat JabberBuddy->resources as a sorted list.
Paul Aurich <darkrain42@pidgin.im>
parents:
29385
diff
changeset
|
199 | for (l = jb->resources; l; l = l->next) |
| 7014 | 200 | { |
|
29387
21ecdd98e791
jabber: Treat JabberBuddy->resources as a sorted list.
Paul Aurich <darkrain42@pidgin.im>
parents:
29385
diff
changeset
|
201 | JabberBuddyResource *jbr = l->data; |
|
38266
7c1706b2bd11
Remove found redundant NULL checks
qarkai <qarkai@gmail.com>
parents:
38260
diff
changeset
|
202 | if (purple_strequal(resource, jbr->name)) |
|
29387
21ecdd98e791
jabber: Treat JabberBuddy->resources as a sorted list.
Paul Aurich <darkrain42@pidgin.im>
parents:
29385
diff
changeset
|
203 | return jbr; |
| 7014 | 204 | } |
| 205 | ||
|
29387
21ecdd98e791
jabber: Treat JabberBuddy->resources as a sorted list.
Paul Aurich <darkrain42@pidgin.im>
parents:
29385
diff
changeset
|
206 | return NULL; |
| 7014 | 207 | } |
| 208 | ||
| 9954 | 209 | JabberBuddyResource *jabber_buddy_track_resource(JabberBuddy *jb, const char *resource, |
| 210 | int priority, JabberBuddyState state, const char *status) | |
| 7014 | 211 | { |
|
29387
21ecdd98e791
jabber: Treat JabberBuddy->resources as a sorted list.
Paul Aurich <darkrain42@pidgin.im>
parents:
29385
diff
changeset
|
212 | /* TODO: Optimization: Only reinsert if priority+state changed */ |
| 7014 | 213 | JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, resource); |
|
29387
21ecdd98e791
jabber: Treat JabberBuddy->resources as a sorted list.
Paul Aurich <darkrain42@pidgin.im>
parents:
29385
diff
changeset
|
214 | if (jbr) { |
|
21ecdd98e791
jabber: Treat JabberBuddy->resources as a sorted list.
Paul Aurich <darkrain42@pidgin.im>
parents:
29385
diff
changeset
|
215 | jb->resources = g_list_remove(jb->resources, jbr); |
|
21ecdd98e791
jabber: Treat JabberBuddy->resources as a sorted list.
Paul Aurich <darkrain42@pidgin.im>
parents:
29385
diff
changeset
|
216 | } else { |
| 7014 | 217 | jbr = g_new0(JabberBuddyResource, 1); |
| 7116 | 218 | jbr->jb = jb; |
| 7014 | 219 | jbr->name = g_strdup(resource); |
|
27746
4b3f015977d9
For contacts who advertise Entity Caps, check for XHTML-IM support. Refs #4650.
Paul Aurich <darkrain42@pidgin.im>
parents:
27696
diff
changeset
|
220 | jbr->capabilities = JABBER_CAP_NONE; |
| 7014 | 221 | } |
| 222 | jbr->priority = priority; | |
| 223 | jbr->state = state; | |
| 22928 | 224 | g_free(jbr->status); |
|
27775
b8569a76e02e
Don't pre-escape jbr->status. Almost every place required it in unescaped
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27696
diff
changeset
|
225 | jbr->status = g_strdup(status); |
| 9954 | 226 | |
|
29387
21ecdd98e791
jabber: Treat JabberBuddy->resources as a sorted list.
Paul Aurich <darkrain42@pidgin.im>
parents:
29385
diff
changeset
|
227 | jb->resources = g_list_insert_sorted(jb->resources, jbr, |
|
21ecdd98e791
jabber: Treat JabberBuddy->resources as a sorted list.
Paul Aurich <darkrain42@pidgin.im>
parents:
29385
diff
changeset
|
228 | resource_compare_cb); |
| 9954 | 229 | return jbr; |
| 7014 | 230 | } |
| 231 | ||
| 232 | void jabber_buddy_remove_resource(JabberBuddy *jb, const char *resource) | |
| 233 | { | |
| 234 | JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, resource); | |
| 235 | ||
| 236 | if(!jbr) | |
| 237 | return; | |
| 238 | ||
|
40145
27c5004a6c65
Re-arrange jabber_buddy_resource_free to avoid use-after-free warning.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40139
diff
changeset
|
239 | jbr->jb->resources = g_list_remove(jbr->jb->resources, jbr); |
| 7116 | 240 | jabber_buddy_resource_free(jbr); |
| 7014 | 241 | } |
| 242 | ||
| 243 | /******* | |
| 244 | * This is the old vCard stuff taken from the old prpl. vCards, by definition | |
| 245 | * are a temporary thing until jabber can get its act together and come up | |
| 246 | * with a format for user information, hence the namespace of 'vcard-temp' | |
| 247 | * | |
| 248 | * Since I don't feel like putting that much work into something that's | |
| 249 | * _supposed_ to go away, i'm going to just copy the kludgy old code here, | |
| 250 | * and make it purdy when jabber comes up with a standards-track JEP to | |
| 251 | * replace vcard-temp | |
| 252 | * --Nathan | |
| 253 | *******/ | |
| 254 | ||
| 255 | /*---------------------------------------*/ | |
| 256 | /* Jabber "set info" (vCard) support */ | |
| 257 | /*---------------------------------------*/ | |
| 258 | ||
| 259 | /* | |
| 260 | * V-Card format: | |
| 261 | * | |
| 262 | * <vCard prodid='' version='' xmlns=''> | |
| 263 | * <FN></FN> | |
| 264 | * <N> | |
| 265 | * <FAMILY/> | |
| 266 | * <GIVEN/> | |
| 267 | * </N> | |
| 268 | * <NICKNAME/> | |
| 269 | * <URL/> | |
| 270 | * <ADR> | |
| 271 | * <STREET/> | |
| 272 | * <EXTADD/> | |
| 273 | * <LOCALITY/> | |
| 274 | * <REGION/> | |
| 275 | * <PCODE/> | |
| 276 | * <COUNTRY/> | |
| 277 | * </ADR> | |
| 278 | * <TEL/> | |
| 279 | * <EMAIL/> | |
| 280 | * <ORG> | |
| 281 | * <ORGNAME/> | |
| 282 | * <ORGUNIT/> | |
| 283 | * </ORG> | |
| 284 | * <TITLE/> | |
| 285 | * <ROLE/> | |
| 286 | * <DESC/> | |
| 287 | * <BDAY/> | |
| 288 | * </vCard> | |
| 289 | * | |
| 290 | * See also: | |
| 291 | * | |
| 292 | * http://docs.jabber.org/proto/html/vcard-temp.html | |
| 293 | * http://www.vcard-xml.org/dtd/vCard-XML-v2-20010520.dtd | |
| 294 | */ | |
| 295 | ||
| 296 | /* | |
| 297 | * Cross-reference user-friendly V-Card entry labels to vCard XML tags | |
| 298 | * and attributes. | |
| 299 | * | |
| 300 | * Order is (or should be) unimportant. For example: we have no way of | |
| 301 | * knowing in what order real data will arrive. | |
| 302 | * | |
| 303 | * Format: Label, Pre-set text, "visible" flag, "editable" flag, XML tag | |
| 304 | * name, XML tag's parent tag "path" (relative to vCard node). | |
| 305 | * | |
| 306 | * List is terminated by a NULL label pointer. | |
| 307 | * | |
| 308 | * Entries with no label text, but with XML tag and parent tag | |
| 309 | * entries, are used by V-Card XML construction routines to | |
| 310 | * "automagically" construct the appropriate XML node tree. | |
| 311 | * | |
| 312 | * Thoughts on future direction/expansion | |
| 313 | * | |
| 314 | * This is a "simple" vCard. | |
| 315 | * | |
| 316 | * It is possible for nodes other than the "vCard" node to have | |
| 317 | * attributes. Should that prove necessary/desirable, add an | |
| 318 | * "attributes" pointer to the vcard_template struct, create the | |
| 319 | * necessary tag_attr structs, and add 'em to the vcard_dflt_data | |
| 320 | * array. | |
| 321 | * | |
| 322 | * The above changes will (obviously) require changes to the vCard | |
| 323 | * construction routines. | |
| 324 | */ | |
| 325 | ||
| 326 | struct vcard_template { | |
| 327 | char *label; /* label text pointer */ | |
| 328 | char *tag; /* tag text */ | |
| 329 | char *ptag; /* parent tag "path" text */ | |
|
21091
07fe1a99c47b
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@pidgin.im>
parents:
20169
diff
changeset
|
330 | } const vcard_template_data[] = { |
|
26563
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
331 | {N_("Full Name"), "FN", NULL}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
332 | {N_("Family Name"), "FAMILY", "N"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
333 | {N_("Given Name"), "GIVEN", "N"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
334 | {N_("Nickname"), "NICKNAME", NULL}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
335 | {N_("URL"), "URL", NULL}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
336 | {N_("Street Address"), "STREET", "ADR"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
337 | {N_("Extended Address"), "EXTADD", "ADR"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
338 | {N_("Locality"), "LOCALITY", "ADR"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
339 | {N_("Region"), "REGION", "ADR"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
340 | {N_("Postal Code"), "PCODE", "ADR"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
341 | {N_("Country"), "CTRY", "ADR"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
342 | {N_("Telephone"), "NUMBER", "TEL"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
343 | {N_("Email"), "USERID", "EMAIL"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
344 | {N_("Organization Name"), "ORGNAME", "ORG"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
345 | {N_("Organization Unit"), "ORGUNIT", "ORG"}, |
|
29965
d4d794093d2d
Eliminate the name collisions on "Title". I have a few qualms:
Paul Aurich <darkrain42@pidgin.im>
parents:
29910
diff
changeset
|
346 | {N_("Job Title"), "TITLE", NULL}, |
|
26563
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
347 | {N_("Role"), "ROLE", NULL}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
348 | {N_("Birthday"), "BDAY", NULL}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
349 | {N_("Description"), "DESC", NULL}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
350 | {"", "N", NULL}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
351 | {"", "ADR", NULL}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
352 | {"", "ORG", NULL}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
353 | {NULL, NULL, NULL} |
| 7014 | 354 | }; |
| 355 | ||
| 356 | /* | |
|
8735
01248ea222d3
[gaim-migrate @ 9490]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
8401
diff
changeset
|
357 | * The "vCard" tag's attribute list... |
| 7014 | 358 | */ |
| 359 | struct tag_attr { | |
| 360 | char *attr; | |
| 361 | char *value; | |
|
21091
07fe1a99c47b
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@pidgin.im>
parents:
20169
diff
changeset
|
362 | } const vcard_tag_attr_list[] = { |
| 7014 | 363 | {"prodid", "-//HandGen//NONSGML vGen v1.0//EN"}, |
| 364 | {"version", "2.0", }, | |
| 365 | {"xmlns", "vcard-temp", }, | |
| 366 | {NULL, NULL}, | |
| 367 | }; | |
| 368 | ||
| 369 | ||
| 370 | /* | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
371 | * Insert a tag node into an PurpleXmlNode tree, recursively inserting parent tag |
| 7014 | 372 | * nodes as necessary |
| 373 | * | |
| 374 | * Returns pointer to inserted node | |
| 375 | * | |
| 376 | * Note to hackers: this code is designed to be re-entrant (it's recursive--it | |
| 377 | * calls itself), so don't put any "static"s in here! | |
| 378 | */ | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
379 | static PurpleXmlNode *insert_tag_to_parent_tag(PurpleXmlNode *start, const char *parent_tag, const char *new_tag) |
| 7014 | 380 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
381 | PurpleXmlNode *x = NULL; |
| 7014 | 382 | |
| 383 | /* | |
| 384 | * If the parent tag wasn't specified, see if we can get it | |
| 385 | * from the vCard template struct. | |
| 386 | */ | |
| 387 | if(parent_tag == NULL) { | |
|
21091
07fe1a99c47b
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@pidgin.im>
parents:
20169
diff
changeset
|
388 | const struct vcard_template *vc_tp = vcard_template_data; |
| 7014 | 389 | |
| 390 | while(vc_tp->label != NULL) { | |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
391 | if(purple_strequal(vc_tp->tag, new_tag)) { |
| 7014 | 392 | parent_tag = vc_tp->ptag; |
| 393 | break; | |
| 394 | } | |
| 395 | ++vc_tp; | |
| 396 | } | |
| 397 | } | |
| 398 | ||
| 399 | /* | |
| 400 | * If we have a parent tag... | |
| 401 | */ | |
| 402 | if(parent_tag != NULL ) { | |
| 403 | /* | |
| 404 | * Try to get the parent node for a tag | |
| 405 | */ | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
406 | if((x = purple_xmlnode_get_child(start, parent_tag)) == NULL) { |
| 7014 | 407 | /* |
| 408 | * Descend? | |
| 409 | */ | |
| 410 | char *grand_parent = g_strdup(parent_tag); | |
| 411 | char *parent; | |
| 412 | ||
| 413 | if((parent = strrchr(grand_parent, '/')) != NULL) { | |
| 414 | *(parent++) = '\0'; | |
| 415 | x = insert_tag_to_parent_tag(start, grand_parent, parent); | |
| 416 | } else { | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
417 | x = purple_xmlnode_new_child(start, grand_parent); |
| 7014 | 418 | } |
| 419 | g_free(grand_parent); | |
| 420 | } else { | |
| 421 | /* | |
| 422 | * We found *something* to be the parent node. | |
| 423 | * Note: may be the "root" node! | |
| 424 | */ | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
425 | PurpleXmlNode *y; |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
426 | if((y = purple_xmlnode_get_child(x, new_tag)) != NULL) { |
| 7014 | 427 | return(y); |
| 428 | } | |
| 429 | } | |
| 430 | } | |
| 431 | ||
| 432 | /* | |
| 433 | * insert the new tag into its parent node | |
| 434 | */ | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
435 | return(purple_xmlnode_new_child((x == NULL? start : x), new_tag)); |
| 7014 | 436 | } |
| 437 | ||
| 438 | /* | |
| 439 | * Send vCard info to Jabber server | |
| 440 | */ | |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
441 | void |
|
41967
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
442 | jabber_set_info(G_GNUC_UNUSED PurpleProtocolServer *protocol_server, |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
443 | PurpleConnection *gc, const char *info) |
| 7014 | 444 | { |
|
35823
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
445 | PurpleImage *img; |
| 7014 | 446 | JabberIq *iq; |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
447 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
448 | PurpleXmlNode *vc_node; |
|
21091
07fe1a99c47b
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@pidgin.im>
parents:
20169
diff
changeset
|
449 | const struct tag_attr *tag_attr; |
| 7014 | 450 | |
| 31691 | 451 | /* if we haven't grabbed the remote vcard yet, we can't |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
452 | * assume that what we have here is correct */ |
|
31692
97c06411eb81
Update js->initial_avatar_hash if the user tries to set the icon before
Mark Doliner <markdoliner@pidgin.im>
parents:
31691
diff
changeset
|
453 | if(!js->vcard_fetched) { |
|
35823
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
454 | PurpleImage *image; |
|
31692
97c06411eb81
Update js->initial_avatar_hash if the user tries to set the icon before
Mark Doliner <markdoliner@pidgin.im>
parents:
31691
diff
changeset
|
455 | g_free(js->initial_avatar_hash); |
|
97c06411eb81
Update js->initial_avatar_hash if the user tries to set the icon before
Mark Doliner <markdoliner@pidgin.im>
parents:
31691
diff
changeset
|
456 | image = purple_buddy_icons_find_account_icon(purple_connection_get_account(gc)); |
|
97c06411eb81
Update js->initial_avatar_hash if the user tries to set the icon before
Mark Doliner <markdoliner@pidgin.im>
parents:
31691
diff
changeset
|
457 | if (image != NULL) { |
|
38327
c842a56b9967
jabber: Port to use GChecksum instead of PurpleHash
Mike Ruprecht <cmaiku@gmail.com>
parents:
37134
diff
changeset
|
458 | js->initial_avatar_hash = g_compute_checksum_for_data( |
|
c842a56b9967
jabber: Port to use GChecksum instead of PurpleHash
Mike Ruprecht <cmaiku@gmail.com>
parents:
37134
diff
changeset
|
459 | G_CHECKSUM_SHA1, |
|
35823
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
460 | purple_image_get_data(image), |
|
38334
cb3f85d86752
Merge/update port to GChecksum changes, resolving conflicts
Mike Ruprecht <cmaiku@gmail.com>
diff
changeset
|
461 | purple_image_get_data_size(image) |
|
38298
f0a8f63f9312
rename purple_image_get_size to purple_image_get_data_size and deal with the fallout
Gary Kramlich <grim@reaperworld.com>
parents:
37134
diff
changeset
|
462 | ); |
|
35823
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
463 | g_object_unref(image); |
|
31692
97c06411eb81
Update js->initial_avatar_hash if the user tries to set the icon before
Mark Doliner <markdoliner@pidgin.im>
parents:
31691
diff
changeset
|
464 | } else { |
|
97c06411eb81
Update js->initial_avatar_hash if the user tries to set the icon before
Mark Doliner <markdoliner@pidgin.im>
parents:
31691
diff
changeset
|
465 | js->initial_avatar_hash = NULL; |
|
97c06411eb81
Update js->initial_avatar_hash if the user tries to set the icon before
Mark Doliner <markdoliner@pidgin.im>
parents:
31691
diff
changeset
|
466 | } |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
467 | return; |
|
31692
97c06411eb81
Update js->initial_avatar_hash if the user tries to set the icon before
Mark Doliner <markdoliner@pidgin.im>
parents:
31691
diff
changeset
|
468 | } |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
469 | |
|
15273
a7838f939207
[gaim-migrate @ 18001]
Mark Doliner <markdoliner@pidgin.im>
parents:
15205
diff
changeset
|
470 | g_free(js->avatar_hash); |
| 10189 | 471 | js->avatar_hash = NULL; |
| 7014 | 472 | |
| 473 | /* | |
| 474 | * Send only if there's actually any *information* to send | |
| 475 | */ | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
476 | vc_node = info ? purple_xmlnode_from_str(info, -1) : NULL; |
| 10189 | 477 | |
|
22425
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
478 | if (vc_node && (!vc_node->name || |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
479 | g_ascii_strncasecmp(vc_node->name, "vCard", 5))) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
480 | purple_xmlnode_free(vc_node); |
|
22425
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
481 | vc_node = NULL; |
| 10189 | 482 | } |
| 7014 | 483 | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32277
diff
changeset
|
484 | if ((img = purple_buddy_icons_find_account_icon(purple_connection_get_account(gc)))) { |
|
22425
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
485 | gconstpointer avatar_data; |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
486 | gsize avatar_len; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
487 | PurpleXmlNode *photo, *binval, *type; |
|
22425
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
488 | gchar *enc; |
| 10189 | 489 | |
|
22425
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
490 | if(!vc_node) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
491 | vc_node = purple_xmlnode_new("vCard"); |
|
22425
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
492 | for(tag_attr = vcard_tag_attr_list; tag_attr->attr != NULL; ++tag_attr) |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
493 | purple_xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value); |
|
15273
a7838f939207
[gaim-migrate @ 18001]
Mark Doliner <markdoliner@pidgin.im>
parents:
15205
diff
changeset
|
494 | } |
| 10189 | 495 | |
|
35823
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
496 | avatar_data = purple_image_get_data(img); |
|
38298
f0a8f63f9312
rename purple_image_get_size to purple_image_get_data_size and deal with the fallout
Gary Kramlich <grim@reaperworld.com>
parents:
37134
diff
changeset
|
497 | avatar_len = purple_image_get_data_size(img); |
|
25386
7ca88088e0de
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <darkrain42@pidgin.im>
parents:
25385
diff
changeset
|
498 | /* Get rid of an old PHOTO if one exists. |
|
7ca88088e0de
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <darkrain42@pidgin.im>
parents:
25385
diff
changeset
|
499 | * TODO: This may want to be modified to remove all old PHOTO |
|
7ca88088e0de
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <darkrain42@pidgin.im>
parents:
25385
diff
changeset
|
500 | * children, at the moment some people have managed to get |
|
7ca88088e0de
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <darkrain42@pidgin.im>
parents:
25385
diff
changeset
|
501 | * multiple PHOTO entries in their vCard. */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
502 | if((photo = purple_xmlnode_get_child(vc_node, "PHOTO"))) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
503 | purple_xmlnode_free(photo); |
|
22425
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
504 | } |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
505 | photo = purple_xmlnode_new_child(vc_node, "PHOTO"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
506 | type = purple_xmlnode_new_child(photo, "TYPE"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
507 | purple_xmlnode_insert_data(type, "image/png", -1); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
508 | binval = purple_xmlnode_new_child(photo, "BINVAL"); |
|
38341
3da74e727e78
Remove purple_base64_encode/decode() wrappers
Mike Ruprecht <cmaiku@gmail.com>
parents:
38334
diff
changeset
|
509 | enc = g_base64_encode(avatar_data, avatar_len); |
|
22425
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
510 | |
|
38327
c842a56b9967
jabber: Port to use GChecksum instead of PurpleHash
Mike Ruprecht <cmaiku@gmail.com>
parents:
37134
diff
changeset
|
511 | js->avatar_hash = g_compute_checksum_for_data(G_CHECKSUM_SHA1, |
|
c842a56b9967
jabber: Port to use GChecksum instead of PurpleHash
Mike Ruprecht <cmaiku@gmail.com>
parents:
37134
diff
changeset
|
512 | avatar_data, avatar_len); |
|
22425
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
513 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
514 | purple_xmlnode_insert_data(binval, enc, -1); |
|
22425
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
515 | g_free(enc); |
|
35823
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
516 | g_object_unref(img); |
|
25386
7ca88088e0de
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <darkrain42@pidgin.im>
parents:
25385
diff
changeset
|
517 | } else if (vc_node) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
518 | PurpleXmlNode *photo; |
|
25386
7ca88088e0de
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <darkrain42@pidgin.im>
parents:
25385
diff
changeset
|
519 | /* TODO: Remove all PHOTO children? (see above note) */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
520 | if ((photo = purple_xmlnode_get_child(vc_node, "PHOTO"))) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
521 | purple_xmlnode_free(photo); |
|
25386
7ca88088e0de
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <darkrain42@pidgin.im>
parents:
25385
diff
changeset
|
522 | } |
|
22425
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
523 | } |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
524 | |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
525 | if (vc_node != NULL) { |
|
15273
a7838f939207
[gaim-migrate @ 18001]
Mark Doliner <markdoliner@pidgin.im>
parents:
15205
diff
changeset
|
526 | iq = jabber_iq_new(js, JABBER_IQ_SET); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
527 | purple_xmlnode_insert_child(iq->node, vc_node); |
|
15273
a7838f939207
[gaim-migrate @ 18001]
Mark Doliner <markdoliner@pidgin.im>
parents:
15205
diff
changeset
|
528 | jabber_iq_send(iq); |
|
25478
0a7f22678a35
Send presence updates from jabber_set_info, not jabber_set_buddy_icon.
Paul Aurich <darkrain42@pidgin.im>
parents:
25477
diff
changeset
|
529 | |
|
0a7f22678a35
Send presence updates from jabber_set_info, not jabber_set_buddy_icon.
Paul Aurich <darkrain42@pidgin.im>
parents:
25477
diff
changeset
|
530 | /* Send presence to update vcard-temp:x:update */ |
|
26958
a955bd42f529
propagate from branch 'im.pidgin.pidgin' (head 36f75a1d52a6af5574bf847d60054a1392dcbc67)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
531 | jabber_presence_send(js, FALSE); |
| 7014 | 532 | } |
| 533 | } | |
| 534 | ||
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
535 | void |
|
41967
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
536 | jabber_set_buddy_icon(G_GNUC_UNUSED PurpleProtocolServer *protocol_server, |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
537 | PurpleConnection *gc, PurpleImage *img) |
| 10189 | 538 | { |
|
25811
57012229a242
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <darkrain42@pidgin.im>
parents:
25542
diff
changeset
|
539 | PurpleAccount *account = purple_connection_get_account(gc); |
| 10189 | 540 | |
|
26950
842628304397
Publish only 'new' xmlns of avatars and delete old.
Paul Aurich <darkrain42@pidgin.im>
parents:
26947
diff
changeset
|
541 | /* Publish the avatar as specified in XEP-0084 */ |
|
32277
97f16af01a05
Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents:
32204
diff
changeset
|
542 | jabber_avatar_set(purple_connection_get_protocol_data(gc), img); |
|
26950
842628304397
Publish only 'new' xmlns of avatars and delete old.
Paul Aurich <darkrain42@pidgin.im>
parents:
26947
diff
changeset
|
543 | /* Set the image in our vCard */ |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
544 | jabber_set_info(NULL, gc, purple_account_get_user_info(account)); |
|
25385
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
545 | |
|
25811
57012229a242
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <darkrain42@pidgin.im>
parents:
25542
diff
changeset
|
546 | /* TODO: Fake image to ourselves, since a number of servers do not echo |
|
57012229a242
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <darkrain42@pidgin.im>
parents:
25542
diff
changeset
|
547 | * back our presence to us. To do this without uselessly copying the data |
|
57012229a242
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <darkrain42@pidgin.im>
parents:
25542
diff
changeset
|
548 | * of the image, we need purple_buddy_icons_set_for_user_image (i.e. takes |
|
57012229a242
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <darkrain42@pidgin.im>
parents:
25542
diff
changeset
|
549 | * an existing icon/stored image). */ |
| 10189 | 550 | } |
| 551 | ||
| 7014 | 552 | /* |
| 553 | * This is the callback from the "ok clicked" for "set vCard" | |
| 554 | * | |
|
25391
363cb62aa353
Correct a comment, I don't imagine anyone will actually need this but better
Etan Reisner <deryni@pidgin.im>
parents:
25386
diff
changeset
|
555 | * Sets the vCard with data from PurpleRequestFields. |
| 7014 | 556 | */ |
| 557 | static void | |
| 15884 | 558 | jabber_format_info(PurpleConnection *gc, PurpleRequestFields *fields) |
| 7014 | 559 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
560 | PurpleXmlNode *vc_node; |
| 15884 | 561 | PurpleRequestField *field; |
|
41924
7646d24a31be
Inline purple_serv_get_info and purple_serv_set_info
Gary Kramlich <grim@reaperworld.com>
parents:
41791
diff
changeset
|
562 | PurpleProtocol *protocol = NULL; |
| 7014 | 563 | const char *text; |
| 564 | char *p; | |
| 565 | const struct vcard_template *vc_tp; | |
|
21091
07fe1a99c47b
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@pidgin.im>
parents:
20169
diff
changeset
|
566 | const struct tag_attr *tag_attr; |
| 7014 | 567 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
568 | vc_node = purple_xmlnode_new("vCard"); |
| 7014 | 569 | |
| 570 | for(tag_attr = vcard_tag_attr_list; tag_attr->attr != NULL; ++tag_attr) | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
571 | purple_xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value); |
| 7014 | 572 | |
| 573 | for (vc_tp = vcard_template_data; vc_tp->label != NULL; vc_tp++) { | |
| 574 | if (*vc_tp->label == '\0') | |
| 575 | continue; | |
| 576 | ||
| 15884 | 577 | field = purple_request_fields_get_field(fields, vc_tp->tag); |
| 578 | text = purple_request_field_string_get_value(field); | |
| 7014 | 579 | |
| 580 | ||
| 581 | if (text != NULL && *text != '\0') { | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
582 | PurpleXmlNode *xp; |
| 7014 | 583 | |
|
28828
7c1855f037e7
jabber: Convert to purple_debug_* convenience functions.
Paul Aurich <darkrain42@pidgin.im>
parents:
28667
diff
changeset
|
584 | purple_debug_info("jabber", "Setting %s to '%s'\n", vc_tp->tag, text); |
| 9339 | 585 | |
| 7014 | 586 | if ((xp = insert_tag_to_parent_tag(vc_node, |
| 587 | NULL, vc_tp->tag)) != NULL) { | |
| 588 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
589 | purple_xmlnode_insert_data(xp, text, -1); |
| 7014 | 590 | } |
| 591 | } | |
| 592 | } | |
| 593 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
594 | p = purple_xmlnode_to_str(vc_node, NULL); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
595 | purple_xmlnode_free(vc_node); |
| 7014 | 596 | |
| 15884 | 597 | purple_account_set_user_info(purple_connection_get_account(gc), p); |
|
41924
7646d24a31be
Inline purple_serv_get_info and purple_serv_set_info
Gary Kramlich <grim@reaperworld.com>
parents:
41791
diff
changeset
|
598 | protocol = purple_connection_get_protocol(gc); |
|
7646d24a31be
Inline purple_serv_get_info and purple_serv_set_info
Gary Kramlich <grim@reaperworld.com>
parents:
41791
diff
changeset
|
599 | if(PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER, set_info)) { |
|
7646d24a31be
Inline purple_serv_get_info and purple_serv_set_info
Gary Kramlich <grim@reaperworld.com>
parents:
41791
diff
changeset
|
600 | purple_protocol_server_set_info(PURPLE_PROTOCOL_SERVER(protocol), |
|
7646d24a31be
Inline purple_serv_get_info and purple_serv_set_info
Gary Kramlich <grim@reaperworld.com>
parents:
41791
diff
changeset
|
601 | gc, p); |
|
7646d24a31be
Inline purple_serv_get_info and purple_serv_set_info
Gary Kramlich <grim@reaperworld.com>
parents:
41791
diff
changeset
|
602 | } |
| 7014 | 603 | |
| 604 | g_free(p); | |
| 605 | } | |
| 606 | ||
| 607 | /* | |
|
41789
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
608 | * This gets executed as the protocol action. |
| 7014 | 609 | * |
| 15884 | 610 | * Creates a new PurpleRequestFields struct, gets the XML-formatted user_info |
| 7014 | 611 | * string (if any) into GSLists for the (multi-entry) edit dialog and |
| 612 | * calls the set_vcard dialog. | |
| 613 | */ | |
|
41789
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
614 | void |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
615 | jabber_setup_set_info(G_GNUC_UNUSED GSimpleAction *action, GVariant *parameter, |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
616 | G_GNUC_UNUSED gpointer data) |
| 7014 | 617 | { |
|
41789
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
618 | const char *account_id = NULL; |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
619 | PurpleAccountManager *manager = NULL; |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
620 | PurpleAccount *account = NULL; |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
621 | PurpleConnection *connection = NULL; |
| 15884 | 622 | PurpleRequestFields *fields; |
| 623 | PurpleRequestFieldGroup *group; | |
| 624 | PurpleRequestField *field; | |
| 7014 | 625 | const struct vcard_template *vc_tp; |
|
14129
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
626 | const char *user_info; |
|
14130
02a5f8dad9cf
[gaim-migrate @ 16689]
Daniel Atallah <datallah@pidgin.im>
parents:
14129
diff
changeset
|
627 | char *cdata = NULL; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
628 | PurpleXmlNode *x_vc_data = NULL; |
| 7014 | 629 | |
|
41789
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
630 | if(!g_variant_is_of_type(parameter, G_VARIANT_TYPE_STRING)) { |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
631 | g_critical("XMPP Set Info action parameter is of incorrect type %s", |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
632 | g_variant_get_type_string(parameter)); |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
633 | } |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
634 | |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
635 | account_id = g_variant_get_string(parameter, NULL); |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
636 | manager = purple_account_manager_get_default(); |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
637 | account = purple_account_manager_find_by_id(manager, account_id); |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
638 | connection = purple_account_get_connection(account); |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
639 | |
| 15884 | 640 | fields = purple_request_fields_new(); |
| 641 | group = purple_request_field_group_new(NULL); | |
| 642 | purple_request_fields_add_group(fields, group); | |
| 7014 | 643 | |
| 644 | /* | |
| 645 | * Get existing, XML-formatted, user info | |
| 646 | */ | |
|
41789
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
647 | if((user_info = purple_account_get_user_info(account)) != NULL) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
648 | x_vc_data = purple_xmlnode_from_str(user_info, -1); |
|
41789
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
649 | } |
| 7014 | 650 | |
| 651 | /* | |
| 652 | * Set up GSLists for edit with labels from "template," data from user info | |
| 653 | */ | |
| 654 | for(vc_tp = vcard_template_data; vc_tp->label != NULL; ++vc_tp) { | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
655 | PurpleXmlNode *data_node; |
| 7014 | 656 | if((vc_tp->label)[0] == '\0') |
| 657 | continue; | |
|
14129
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
658 | |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
659 | if (x_vc_data != NULL) { |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
660 | if(vc_tp->ptag == NULL) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
661 | data_node = purple_xmlnode_get_child(x_vc_data, vc_tp->tag); |
|
14129
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
662 | } else { |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
663 | gchar *tag = g_strdup_printf("%s/%s", vc_tp->ptag, vc_tp->tag); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
664 | data_node = purple_xmlnode_get_child(x_vc_data, tag); |
|
14129
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
665 | g_free(tag); |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
666 | } |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
667 | if(data_node) |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
668 | cdata = purple_xmlnode_get_data(data_node); |
|
14130
02a5f8dad9cf
[gaim-migrate @ 16689]
Daniel Atallah <datallah@pidgin.im>
parents:
14129
diff
changeset
|
669 | } |
| 7014 | 670 | |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
671 | if(purple_strequal(vc_tp->tag, "DESC")) { |
| 15884 | 672 | field = purple_request_field_string_new(vc_tp->tag, |
| 7014 | 673 | _(vc_tp->label), cdata, |
| 674 | TRUE); | |
| 675 | } else { | |
| 15884 | 676 | field = purple_request_field_string_new(vc_tp->tag, |
| 7014 | 677 | _(vc_tp->label), cdata, |
| 678 | FALSE); | |
| 679 | } | |
| 680 | ||
|
14130
02a5f8dad9cf
[gaim-migrate @ 16689]
Daniel Atallah <datallah@pidgin.im>
parents:
14129
diff
changeset
|
681 | g_free(cdata); |
|
02a5f8dad9cf
[gaim-migrate @ 16689]
Daniel Atallah <datallah@pidgin.im>
parents:
14129
diff
changeset
|
682 | cdata = NULL; |
|
02a5f8dad9cf
[gaim-migrate @ 16689]
Daniel Atallah <datallah@pidgin.im>
parents:
14129
diff
changeset
|
683 | |
| 15884 | 684 | purple_request_field_group_add_field(group, field); |
| 7014 | 685 | } |
| 686 | ||
| 687 | if(x_vc_data != NULL) | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
688 | purple_xmlnode_free(x_vc_data); |
| 7014 | 689 | |
|
41789
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
690 | purple_request_fields(connection, _("Edit XMPP vCard"), |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
691 | _("Edit XMPP vCard"), |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
692 | _("All items below are optional. Enter only the " |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
693 | "information with which you feel comfortable."), |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
694 | fields, |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
695 | _("Save"), G_CALLBACK(jabber_format_info), |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
696 | _("Cancel"), NULL, |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
697 | purple_request_cpar_from_connection(connection), |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
698 | connection); |
| 7014 | 699 | } |
| 700 | ||
| 701 | /*---------------------------------------*/ | |
| 702 | /* End Jabber "set info" (vCard) support */ | |
| 703 | /*---------------------------------------*/ | |
| 704 | ||
| 705 | /****** | |
| 706 | * end of that ancient crap that needs to die | |
| 707 | ******/ | |
| 708 | ||
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
709 | static void jabber_buddy_info_destroy(JabberBuddyInfo *jbi) |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
710 | { |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
711 | /* Remove the timeout, which would otherwise trigger jabber_buddy_get_info_timeout() */ |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
712 | if (jbi->timeout_handle > 0) |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
713 | g_source_remove(jbi->timeout_handle); |
|
15727
0754583ceeae
Don't access the list element after it has been freed.
Daniel Atallah <datallah@pidgin.im>
parents:
15688
diff
changeset
|
714 | |
| 40135 | 715 | g_slist_free(jbi->ids); |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
716 | g_free(jbi->jid); |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
717 | g_hash_table_destroy(jbi->resources); |
|
27069
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
718 | g_free(jbi->last_message); |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
719 | purple_notify_user_info_destroy(jbi->user_info); |
|
15727
0754583ceeae
Don't access the list element after it has been freed.
Daniel Atallah <datallah@pidgin.im>
parents:
15688
diff
changeset
|
720 | g_free(jbi); |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
721 | } |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
722 | |
|
27550
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
723 | static void |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
724 | add_jbr_info(JabberBuddyInfo *jbi, const char *resource, |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
725 | JabberBuddyResource *jbr) |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
726 | { |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
727 | JabberBuddyInfoResource *jbir; |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
728 | PurpleNotifyUserInfo *user_info; |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
729 | |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
730 | jbir = g_hash_table_lookup(jbi->resources, resource); |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
731 | user_info = jbi->user_info; |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
732 | |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
733 | if (jbr && jbr->client.name) { |
| 27551 | 734 | char *tmp = |
| 735 | g_strdup_printf("%s%s%s", jbr->client.name, | |
| 736 | (jbr->client.version ? " " : ""), | |
| 737 | (jbr->client.version ? jbr->client.version : "")); | |
|
32203
e7c2d37aecd5
Add purple_notify_user_info_prepend_pair_plaintext and use it in a few
Mark Doliner <markdoliner@pidgin.im>
parents:
32202
diff
changeset
|
738 | /* TODO: Check whether it's correct to call prepend_pair_html, |
|
e7c2d37aecd5
Add purple_notify_user_info_prepend_pair_plaintext and use it in a few
Mark Doliner <markdoliner@pidgin.im>
parents:
32202
diff
changeset
|
739 | or if we should be using prepend_pair_plaintext */ |
|
32204
2a09624616c3
Actually commit the purple_notify_user_info_prepend_pair_plaintext
Mark Doliner <markdoliner@pidgin.im>
parents:
32203
diff
changeset
|
740 | purple_notify_user_info_prepend_pair_html(user_info, _("Client"), tmp); |
|
27550
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
741 | g_free(tmp); |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
742 | |
|
32203
e7c2d37aecd5
Add purple_notify_user_info_prepend_pair_plaintext and use it in a few
Mark Doliner <markdoliner@pidgin.im>
parents:
32202
diff
changeset
|
743 | if (jbr->client.os) { |
|
e7c2d37aecd5
Add purple_notify_user_info_prepend_pair_plaintext and use it in a few
Mark Doliner <markdoliner@pidgin.im>
parents:
32202
diff
changeset
|
744 | /* TODO: Check whether it's correct to call prepend_pair_html, |
|
e7c2d37aecd5
Add purple_notify_user_info_prepend_pair_plaintext and use it in a few
Mark Doliner <markdoliner@pidgin.im>
parents:
32202
diff
changeset
|
745 | or if we should be using prepend_pair_plaintext */ |
|
32204
2a09624616c3
Actually commit the purple_notify_user_info_prepend_pair_plaintext
Mark Doliner <markdoliner@pidgin.im>
parents:
32203
diff
changeset
|
746 | purple_notify_user_info_prepend_pair_html(user_info, _("Operating System"), jbr->client.os); |
|
32203
e7c2d37aecd5
Add purple_notify_user_info_prepend_pair_plaintext and use it in a few
Mark Doliner <markdoliner@pidgin.im>
parents:
32202
diff
changeset
|
747 | } |
|
27550
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
748 | } |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
749 | |
|
41764
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
750 | if (jbr && jbr->tz_off != NULL) { |
|
40551
e9573eaa68f9
Start replacing time utility functions with GDateTime
Gary Kramlich <grim@reaperworld.com>
parents:
40474
diff
changeset
|
751 | GDateTime *dt = NULL; |
|
e9573eaa68f9
Start replacing time utility functions with GDateTime
Gary Kramlich <grim@reaperworld.com>
parents:
40474
diff
changeset
|
752 | char *timestamp = NULL; |
|
27550
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
753 | |
|
41764
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
754 | dt = g_date_time_new_now(jbr->tz_off); |
|
40551
e9573eaa68f9
Start replacing time utility functions with GDateTime
Gary Kramlich <grim@reaperworld.com>
parents:
40474
diff
changeset
|
755 | |
|
e9573eaa68f9
Start replacing time utility functions with GDateTime
Gary Kramlich <grim@reaperworld.com>
parents:
40474
diff
changeset
|
756 | timestamp = g_date_time_format(dt, "%X %:z"); |
|
e9573eaa68f9
Start replacing time utility functions with GDateTime
Gary Kramlich <grim@reaperworld.com>
parents:
40474
diff
changeset
|
757 | g_date_time_unref(dt); |
|
e9573eaa68f9
Start replacing time utility functions with GDateTime
Gary Kramlich <grim@reaperworld.com>
parents:
40474
diff
changeset
|
758 | |
|
32203
e7c2d37aecd5
Add purple_notify_user_info_prepend_pair_plaintext and use it in a few
Mark Doliner <markdoliner@pidgin.im>
parents:
32202
diff
changeset
|
759 | purple_notify_user_info_prepend_pair_plaintext(user_info, _("Local Time"), timestamp); |
|
27550
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
760 | g_free(timestamp); |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
761 | } |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
762 | |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
763 | if (jbir && jbir->idle_seconds > 0) { |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
764 | char *idle = purple_str_seconds_to_string(jbir->idle_seconds); |
|
32203
e7c2d37aecd5
Add purple_notify_user_info_prepend_pair_plaintext and use it in a few
Mark Doliner <markdoliner@pidgin.im>
parents:
32202
diff
changeset
|
765 | purple_notify_user_info_prepend_pair_plaintext(user_info, _("Idle"), idle); |
|
27550
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
766 | g_free(idle); |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
767 | } |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
768 | |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
769 | if (jbr) { |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
770 | char *purdy = NULL; |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
771 | char *tmp; |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
772 | char priority[12]; |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
773 | const char *status_name = jabber_buddy_state_get_name(jbr->state); |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
774 | |
| 27551 | 775 | if (jbr->status) { |
|
41940
fa0478036eaf
Remove purple_markup_escape_text
Gary Kramlich <grim@reaperworld.com>
parents:
41924
diff
changeset
|
776 | tmp = g_markup_escape_text(jbr->status, -1); |
|
28290
55c4b5a11af7
jabber: Escape status messages with a '<' or '>' in the Get Info dialog.
Paul Aurich <darkrain42@pidgin.im>
parents:
28278
diff
changeset
|
777 | purdy = purple_strdup_withhtml(tmp); |
|
55c4b5a11af7
jabber: Escape status messages with a '<' or '>' in the Get Info dialog.
Paul Aurich <darkrain42@pidgin.im>
parents:
28278
diff
changeset
|
778 | g_free(tmp); |
| 27551 | 779 | |
| 780 | if (purple_strequal(status_name, purdy)) | |
| 781 | status_name = NULL; | |
| 782 | } | |
|
27550
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
783 | |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
784 | tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""), |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
785 | ((status_name && purdy) ? ": " : ""), |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
786 | (purdy ? purdy : "")); |
|
32204
2a09624616c3
Actually commit the purple_notify_user_info_prepend_pair_plaintext
Mark Doliner <markdoliner@pidgin.im>
parents:
32203
diff
changeset
|
787 | purple_notify_user_info_prepend_pair_html(user_info, _("Status"), tmp); |
|
27550
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
788 | |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
789 | g_snprintf(priority, sizeof(priority), "%d", jbr->priority); |
|
32203
e7c2d37aecd5
Add purple_notify_user_info_prepend_pair_plaintext and use it in a few
Mark Doliner <markdoliner@pidgin.im>
parents:
32202
diff
changeset
|
790 | purple_notify_user_info_prepend_pair_plaintext(user_info, _("Priority"), priority); |
|
27550
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
791 | |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
792 | g_free(tmp); |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
793 | g_free(purdy); |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
794 | } else { |
|
32203
e7c2d37aecd5
Add purple_notify_user_info_prepend_pair_plaintext and use it in a few
Mark Doliner <markdoliner@pidgin.im>
parents:
32202
diff
changeset
|
795 | purple_notify_user_info_prepend_pair_plaintext(user_info, _("Status"), _("Unknown")); |
|
27550
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
796 | } |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
797 | } |
|
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
798 | |
| 13794 | 799 | static void jabber_buddy_info_show_if_ready(JabberBuddyInfo *jbi) |
| 7014 | 800 | { |
|
27550
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
801 | char *resource_name; |
| 13794 | 802 | JabberBuddyResource *jbr; |
| 803 | GList *resources; | |
| 15884 | 804 | PurpleNotifyUserInfo *user_info; |
| 7014 | 805 | |
| 13794 | 806 | /* not yet */ |
| 27551 | 807 | if (jbi->ids) |
| 11361 | 808 | return; |
| 809 | ||
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
810 | user_info = jbi->user_info; |
| 13794 | 811 | resource_name = jabber_get_resource(jbi->jid); |
| 7014 | 812 | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
813 | /* If we have one or more pairs from the vcard, put a section break above it */ |
|
32193
42173d1c1317
Change PurpleNotifyUserInfo->user_info_entries from a GList to a GQueue.
Mark Doliner <markdoliner@pidgin.im>
parents:
32191
diff
changeset
|
814 | if (g_queue_get_length(purple_notify_user_info_get_entries(user_info))) |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
815 | purple_notify_user_info_prepend_section_break(user_info); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
816 | |
| 27551 | 817 | /* Add the information about the user's resource(s) */ |
| 818 | if (resource_name) { | |
| 13794 | 819 | jbr = jabber_buddy_find_resource(jbi->jb, resource_name); |
|
27550
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
820 | add_jbr_info(jbi, resource_name, jbr); |
| 7014 | 821 | } else { |
|
29387
21ecdd98e791
jabber: Treat JabberBuddy->resources as a sorted list.
Paul Aurich <darkrain42@pidgin.im>
parents:
29385
diff
changeset
|
822 | /* TODO: This is in priority-ascending order (lowest prio first), because |
|
21ecdd98e791
jabber: Treat JabberBuddy->resources as a sorted list.
Paul Aurich <darkrain42@pidgin.im>
parents:
29385
diff
changeset
|
823 | * everything is prepended. Is that ok? */ |
|
27550
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
824 | for (resources = jbi->jb->resources; resources; resources = resources->next) { |
| 7014 | 825 | jbr = resources->data; |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
826 | |
|
27053
fb088f01758d
Add a section break between resources in "Get info"
Marcus Lundblad <malu@pidgin.im>
parents:
26958
diff
changeset
|
827 | /* put a section break between resources, this is not needed if |
|
fb088f01758d
Add a section break between resources in "Get info"
Marcus Lundblad <malu@pidgin.im>
parents:
26958
diff
changeset
|
828 | we are at the first, because one was already added for the vcard |
|
fb088f01758d
Add a section break between resources in "Get info"
Marcus Lundblad <malu@pidgin.im>
parents:
26958
diff
changeset
|
829 | section */ |
| 27551 | 830 | if (resources != jbi->jb->resources) |
|
27053
fb088f01758d
Add a section break between resources in "Get info"
Marcus Lundblad <malu@pidgin.im>
parents:
26958
diff
changeset
|
831 | purple_notify_user_info_prepend_section_break(user_info); |
|
fb088f01758d
Add a section break between resources in "Get info"
Marcus Lundblad <malu@pidgin.im>
parents:
26958
diff
changeset
|
832 | |
|
27550
775140c24a35
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <darkrain42@pidgin.im>
parents:
27549
diff
changeset
|
833 | add_jbr_info(jbi, jbr->name, jbr); |
| 13794 | 834 | |
|
32203
e7c2d37aecd5
Add purple_notify_user_info_prepend_pair_plaintext and use it in a few
Mark Doliner <markdoliner@pidgin.im>
parents:
32202
diff
changeset
|
835 | if (jbr->name) { |
|
e7c2d37aecd5
Add purple_notify_user_info_prepend_pair_plaintext and use it in a few
Mark Doliner <markdoliner@pidgin.im>
parents:
32202
diff
changeset
|
836 | /* TODO: Check whether it's correct to call prepend_pair_html, |
|
e7c2d37aecd5
Add purple_notify_user_info_prepend_pair_plaintext and use it in a few
Mark Doliner <markdoliner@pidgin.im>
parents:
32202
diff
changeset
|
837 | or if we should be using prepend_pair_plaintext */ |
|
32204
2a09624616c3
Actually commit the purple_notify_user_info_prepend_pair_plaintext
Mark Doliner <markdoliner@pidgin.im>
parents:
32203
diff
changeset
|
838 | purple_notify_user_info_prepend_pair_html(user_info, _("Resource"), jbr->name); |
|
32203
e7c2d37aecd5
Add purple_notify_user_info_prepend_pair_plaintext and use it in a few
Mark Doliner <markdoliner@pidgin.im>
parents:
32202
diff
changeset
|
839 | } |
| 7014 | 840 | } |
| 841 | } | |
| 842 | ||
|
27069
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
843 | if (!jbi->jb->resources) { |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
844 | /* the buddy is offline */ |
|
29063
f245c5e9e9f3
jabber: When getting info on a "bare" domain JID, interpret the value of "last"
Marcus Lundblad <malu@pidgin.im>
parents:
28984
diff
changeset
|
845 | gboolean is_domain = jabber_jid_is_domain(jbi->jid); |
|
29097
0834410aa178
Tighter scoping and slightly less memory usage.
Paul Aurich <darkrain42@pidgin.im>
parents:
29064
diff
changeset
|
846 | |
|
27069
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
847 | if (jbi->last_seconds > 0) { |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
848 | char *last = purple_str_seconds_to_string(jbi->last_seconds); |
|
29063
f245c5e9e9f3
jabber: When getting info on a "bare" domain JID, interpret the value of "last"
Marcus Lundblad <malu@pidgin.im>
parents:
28984
diff
changeset
|
849 | gchar *message = NULL; |
|
f245c5e9e9f3
jabber: When getting info on a "bare" domain JID, interpret the value of "last"
Marcus Lundblad <malu@pidgin.im>
parents:
28984
diff
changeset
|
850 | const gchar *title = NULL; |
|
f245c5e9e9f3
jabber: When getting info on a "bare" domain JID, interpret the value of "last"
Marcus Lundblad <malu@pidgin.im>
parents:
28984
diff
changeset
|
851 | if (is_domain) { |
|
f245c5e9e9f3
jabber: When getting info on a "bare" domain JID, interpret the value of "last"
Marcus Lundblad <malu@pidgin.im>
parents:
28984
diff
changeset
|
852 | title = _("Uptime"); |
|
29184
6218763ad5b4
This string is already translated; so it need not be translated again.
Paul Aurich <darkrain42@pidgin.im>
parents:
29097
diff
changeset
|
853 | message = last; |
|
6218763ad5b4
This string is already translated; so it need not be translated again.
Paul Aurich <darkrain42@pidgin.im>
parents:
29097
diff
changeset
|
854 | last = NULL; |
|
29063
f245c5e9e9f3
jabber: When getting info on a "bare" domain JID, interpret the value of "last"
Marcus Lundblad <malu@pidgin.im>
parents:
28984
diff
changeset
|
855 | } else { |
|
f245c5e9e9f3
jabber: When getting info on a "bare" domain JID, interpret the value of "last"
Marcus Lundblad <malu@pidgin.im>
parents:
28984
diff
changeset
|
856 | title = _("Logged Off"); |
|
f245c5e9e9f3
jabber: When getting info on a "bare" domain JID, interpret the value of "last"
Marcus Lundblad <malu@pidgin.im>
parents:
28984
diff
changeset
|
857 | message = g_strdup_printf(_("%s ago"), last); |
|
f245c5e9e9f3
jabber: When getting info on a "bare" domain JID, interpret the value of "last"
Marcus Lundblad <malu@pidgin.im>
parents:
28984
diff
changeset
|
858 | } |
|
32203
e7c2d37aecd5
Add purple_notify_user_info_prepend_pair_plaintext and use it in a few
Mark Doliner <markdoliner@pidgin.im>
parents:
32202
diff
changeset
|
859 | purple_notify_user_info_prepend_pair_plaintext(user_info, title, message); |
|
27069
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
860 | g_free(last); |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
861 | g_free(message); |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
862 | } |
|
29063
f245c5e9e9f3
jabber: When getting info on a "bare" domain JID, interpret the value of "last"
Marcus Lundblad <malu@pidgin.im>
parents:
28984
diff
changeset
|
863 | |
|
29097
0834410aa178
Tighter scoping and slightly less memory usage.
Paul Aurich <darkrain42@pidgin.im>
parents:
29064
diff
changeset
|
864 | if (!is_domain) { |
|
0834410aa178
Tighter scoping and slightly less memory usage.
Paul Aurich <darkrain42@pidgin.im>
parents:
29064
diff
changeset
|
865 | gchar *status = |
|
0834410aa178
Tighter scoping and slightly less memory usage.
Paul Aurich <darkrain42@pidgin.im>
parents:
29064
diff
changeset
|
866 | g_strdup_printf("%s%s%s", _("Offline"), |
|
0834410aa178
Tighter scoping and slightly less memory usage.
Paul Aurich <darkrain42@pidgin.im>
parents:
29064
diff
changeset
|
867 | jbi->last_message ? ": " : "", |
|
0834410aa178
Tighter scoping and slightly less memory usage.
Paul Aurich <darkrain42@pidgin.im>
parents:
29064
diff
changeset
|
868 | jbi->last_message ? jbi->last_message : ""); |
|
32203
e7c2d37aecd5
Add purple_notify_user_info_prepend_pair_plaintext and use it in a few
Mark Doliner <markdoliner@pidgin.im>
parents:
32202
diff
changeset
|
869 | /* TODO: Check whether it's correct to call prepend_pair_html, |
|
e7c2d37aecd5
Add purple_notify_user_info_prepend_pair_plaintext and use it in a few
Mark Doliner <markdoliner@pidgin.im>
parents:
32202
diff
changeset
|
870 | or if we should be using prepend_pair_plaintext */ |
|
32204
2a09624616c3
Actually commit the purple_notify_user_info_prepend_pair_plaintext
Mark Doliner <markdoliner@pidgin.im>
parents:
32203
diff
changeset
|
871 | purple_notify_user_info_prepend_pair_html(user_info, _("Status"), status); |
|
29097
0834410aa178
Tighter scoping and slightly less memory usage.
Paul Aurich <darkrain42@pidgin.im>
parents:
29064
diff
changeset
|
872 | g_free(status); |
|
0834410aa178
Tighter scoping and slightly less memory usage.
Paul Aurich <darkrain42@pidgin.im>
parents:
29064
diff
changeset
|
873 | } |
|
27069
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
874 | } |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
875 | |
| 7306 | 876 | g_free(resource_name); |
| 877 | ||
| 15884 | 878 | purple_notify_userinfo(jbi->js->gc, jbi->jid, user_info, NULL, NULL); |
| 13794 | 879 | |
|
40052
cc03b5af25ea
Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
39483
diff
changeset
|
880 | g_slist_free_full(jbi->vcard_images, g_object_unref); |
| 13794 | 881 | |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
882 | jbi->js->pending_buddy_info_requests = g_slist_remove(jbi->js->pending_buddy_info_requests, jbi); |
|
14155
c754f6e5be1f
[gaim-migrate @ 16719]
Mark Doliner <markdoliner@pidgin.im>
parents:
14130
diff
changeset
|
883 | |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
884 | jabber_buddy_info_destroy(jbi); |
| 13794 | 885 | } |
| 886 | ||
| 887 | static void jabber_buddy_info_remove_id(JabberBuddyInfo *jbi, const char *id) | |
| 888 | { | |
|
40052
cc03b5af25ea
Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
39483
diff
changeset
|
889 | GSList *l; |
|
15727
0754583ceeae
Don't access the list element after it has been freed.
Daniel Atallah <datallah@pidgin.im>
parents:
15688
diff
changeset
|
890 | char *comp_id; |
| 13794 | 891 | |
| 892 | if(!id) | |
| 893 | return; | |
| 894 | ||
|
40052
cc03b5af25ea
Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
39483
diff
changeset
|
895 | l = g_slist_find_custom(jbi->ids, id, (GCompareFunc)g_strcmp0); |
|
cc03b5af25ea
Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
39483
diff
changeset
|
896 | if(l) { |
|
15727
0754583ceeae
Don't access the list element after it has been freed.
Daniel Atallah <datallah@pidgin.im>
parents:
15688
diff
changeset
|
897 | comp_id = l->data; |
|
40053
abbd9caef452
Use g_slist_delete_link instead of g_slist_remove
Arkadiy Illarionov <qarkai@gmail.com>
parents:
40052
diff
changeset
|
898 | jbi->ids = g_slist_delete_link(jbi->ids, l); |
|
40052
cc03b5af25ea
Use GSList functions instead of manual iterations
qarkai <qarkai@gmail.com>
parents:
39483
diff
changeset
|
899 | g_free(comp_id); |
| 13794 | 900 | } |
| 901 | } | |
| 902 | ||
|
41967
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
903 | static void |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
904 | jabber_vcard_save_mine(JabberStream *js, G_GNUC_UNUSED const char *from, |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
905 | JabberIqType type, G_GNUC_UNUSED const char *id, |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
906 | PurpleXmlNode *packet, G_GNUC_UNUSED gpointer data) |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
907 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
908 | PurpleXmlNode *vcard, *photo, *binval; |
|
25477
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
909 | char *txt, *vcard_hash = NULL; |
|
28046
8b6fcc2c95b3
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <darkrain42@pidgin.im>
parents:
27998
diff
changeset
|
910 | PurpleAccount *account; |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
911 | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
912 | if (type == JABBER_IQ_ERROR) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
913 | PurpleXmlNode *error; |
| 27417 | 914 | purple_debug_warning("jabber", "Server returned error while retrieving vCard\n"); |
|
27418
518044412902
If there's no vCard on the server, we have to be able to set ours. Allows bootstrapping a new account with (at least) Prosody.
Paul Aurich <darkrain42@pidgin.im>
parents:
27417
diff
changeset
|
915 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
916 | error = purple_xmlnode_get_child(packet, "error"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
917 | if (!error || !purple_xmlnode_get_child(error, "item-not-found")) |
|
27418
518044412902
If there's no vCard on the server, we have to be able to set ours. Allows bootstrapping a new account with (at least) Prosody.
Paul Aurich <darkrain42@pidgin.im>
parents:
27417
diff
changeset
|
918 | return; |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
919 | } |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
920 | |
|
28046
8b6fcc2c95b3
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <darkrain42@pidgin.im>
parents:
27998
diff
changeset
|
921 | account = purple_connection_get_account(js->gc); |
|
8b6fcc2c95b3
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <darkrain42@pidgin.im>
parents:
27998
diff
changeset
|
922 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
923 | if((vcard = purple_xmlnode_get_child(packet, "vCard")) || |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
924 | (vcard = purple_xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
925 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
926 | txt = purple_xmlnode_to_str(vcard, NULL); |
|
28046
8b6fcc2c95b3
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <darkrain42@pidgin.im>
parents:
27998
diff
changeset
|
927 | purple_account_set_user_info(account, txt); |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
928 | g_free(txt); |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
929 | } else { |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
930 | /* if we have no vCard, then lets not overwrite what we might have locally */ |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
931 | } |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
932 | |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
933 | js->vcard_fetched = TRUE; |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
934 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
935 | if (vcard && (photo = purple_xmlnode_get_child(vcard, "PHOTO")) && |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
936 | (binval = purple_xmlnode_get_child(photo, "BINVAL"))) { |
|
25477
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
937 | gsize size; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
938 | char *bintext = purple_xmlnode_get_data(binval); |
|
28311
9c92aae99f62
jabber: Fix a crash when the vcard includes an empty BINVAL.
Paul Aurich <darkrain42@pidgin.im>
parents:
28290
diff
changeset
|
939 | if (bintext) { |
|
38341
3da74e727e78
Remove purple_base64_encode/decode() wrappers
Mike Ruprecht <cmaiku@gmail.com>
parents:
38334
diff
changeset
|
940 | guchar *data = g_base64_decode(bintext, &size); |
|
28311
9c92aae99f62
jabber: Fix a crash when the vcard includes an empty BINVAL.
Paul Aurich <darkrain42@pidgin.im>
parents:
28290
diff
changeset
|
941 | g_free(bintext); |
|
25477
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
942 | |
|
28311
9c92aae99f62
jabber: Fix a crash when the vcard includes an empty BINVAL.
Paul Aurich <darkrain42@pidgin.im>
parents:
28290
diff
changeset
|
943 | if (data) { |
|
38327
c842a56b9967
jabber: Port to use GChecksum instead of PurpleHash
Mike Ruprecht <cmaiku@gmail.com>
parents:
37134
diff
changeset
|
944 | vcard_hash = g_compute_checksum_for_data( |
|
c842a56b9967
jabber: Port to use GChecksum instead of PurpleHash
Mike Ruprecht <cmaiku@gmail.com>
parents:
37134
diff
changeset
|
945 | G_CHECKSUM_SHA1, data, size); |
|
28311
9c92aae99f62
jabber: Fix a crash when the vcard includes an empty BINVAL.
Paul Aurich <darkrain42@pidgin.im>
parents:
28290
diff
changeset
|
946 | g_free(data); |
|
9c92aae99f62
jabber: Fix a crash when the vcard includes an empty BINVAL.
Paul Aurich <darkrain42@pidgin.im>
parents:
28290
diff
changeset
|
947 | } |
|
25477
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
948 | } |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
949 | } |
|
25477
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
950 | |
|
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
951 | /* Republish our vcard if the photo is different than the server's */ |
|
28881
244fb329e5df
jabber: Go back to not overwriting avatars if there is not one locally set.
Paul Aurich <darkrain42@pidgin.im>
parents:
28879
diff
changeset
|
952 | if (js->initial_avatar_hash && !purple_strequal(vcard_hash, js->initial_avatar_hash)) { |
|
40726
645607090674
Remove Google Talk from the XMPP plugin.
Gary Kramlich <grim@reaperworld.com>
parents:
40708
diff
changeset
|
953 | jabber_set_info(NULL, js->gc, purple_account_get_user_info(account)); |
|
28883
b005808ee1a5
jabber: This is more correct.
Paul Aurich <darkrain42@pidgin.im>
parents:
28882
diff
changeset
|
954 | } else if (vcard_hash) { |
|
28882
4d43dd2afadb
jabber: The second half; advertise the vCard avatar, whatever it is.
Paul Aurich <darkrain42@pidgin.im>
parents:
28881
diff
changeset
|
955 | /* A photo is in the vCard. Advertise its hash */ |
|
4d43dd2afadb
jabber: The second half; advertise the vCard avatar, whatever it is.
Paul Aurich <darkrain42@pidgin.im>
parents:
28881
diff
changeset
|
956 | js->avatar_hash = vcard_hash; |
|
4d43dd2afadb
jabber: The second half; advertise the vCard avatar, whatever it is.
Paul Aurich <darkrain42@pidgin.im>
parents:
28881
diff
changeset
|
957 | vcard_hash = NULL; |
|
4d43dd2afadb
jabber: The second half; advertise the vCard avatar, whatever it is.
Paul Aurich <darkrain42@pidgin.im>
parents:
28881
diff
changeset
|
958 | |
|
4d43dd2afadb
jabber: The second half; advertise the vCard avatar, whatever it is.
Paul Aurich <darkrain42@pidgin.im>
parents:
28881
diff
changeset
|
959 | /* Send presence to update vcard-temp:x:update */ |
|
4d43dd2afadb
jabber: The second half; advertise the vCard avatar, whatever it is.
Paul Aurich <darkrain42@pidgin.im>
parents:
28881
diff
changeset
|
960 | jabber_presence_send(js, FALSE); |
|
25477
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
961 | } |
|
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
962 | |
|
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
963 | g_free(vcard_hash); |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
964 | } |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
965 | |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
966 | void jabber_vcard_fetch_mine(JabberStream *js) |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
967 | { |
|
21957
0ce77f86c7f3
Fix XMPP buddy icons. Somehow a 'VCard' element got changed to a query
Sean Egan <seanegan@pidgin.im>
parents:
21681
diff
changeset
|
968 | JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
969 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
970 | PurpleXmlNode *vcard = purple_xmlnode_new_child(iq->node, "vCard"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
971 | purple_xmlnode_set_namespace(vcard, "vcard-temp"); |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
972 | jabber_iq_set_callback(iq, jabber_vcard_save_mine, NULL); |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
973 | |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
974 | jabber_iq_send(iq); |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
975 | } |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
976 | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
977 | static void jabber_vcard_parse(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
978 | JabberIqType type, const char *id, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
979 | PurpleXmlNode *packet, gpointer data) |
| 13794 | 980 | { |
| 981 | char *bare_jid; | |
| 982 | char *text; | |
|
22586
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
983 | char *serverside_alias = NULL; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
984 | PurpleXmlNode *vcard; |
|
29368
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
985 | PurpleAccount *account; |
| 13794 | 986 | JabberBuddyInfo *jbi = data; |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
987 | PurpleNotifyUserInfo *user_info; |
| 13794 | 988 | |
|
29368
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
989 | g_return_if_fail(jbi != NULL); |
| 13794 | 990 | |
|
14129
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
991 | jabber_buddy_info_remove_id(jbi, id); |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
992 | |
|
29368
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
993 | if (type == JABBER_IQ_ERROR) { |
|
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
994 | purple_debug_info("jabber", "Got error response for vCard\n"); |
|
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
995 | jabber_buddy_info_show_if_ready(jbi); |
| 13794 | 996 | return; |
|
29368
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
997 | } |
| 13794 | 998 | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
999 | user_info = jbi->user_info; |
|
29368
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1000 | account = purple_connection_get_account(js->gc); |
|
41978
1771d4dda31a
Update the jabber plugin to not use the deprecated account api
Gary Kramlich <grim@reaperworld.com>
parents:
41967
diff
changeset
|
1001 | |
|
1771d4dda31a
Update the jabber plugin to not use the deprecated account api
Gary Kramlich <grim@reaperworld.com>
parents:
41967
diff
changeset
|
1002 | if(from == NULL) { |
|
1771d4dda31a
Update the jabber plugin to not use the deprecated account api
Gary Kramlich <grim@reaperworld.com>
parents:
41967
diff
changeset
|
1003 | from = purple_contact_info_get_username(PURPLE_CONTACT_INFO(account)); |
|
1771d4dda31a
Update the jabber plugin to not use the deprecated account api
Gary Kramlich <grim@reaperworld.com>
parents:
41967
diff
changeset
|
1004 | } |
|
1771d4dda31a
Update the jabber plugin to not use the deprecated account api
Gary Kramlich <grim@reaperworld.com>
parents:
41967
diff
changeset
|
1005 | bare_jid = jabber_get_bare_jid(from); |
| 13794 | 1006 | |
|
29368
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1007 | /* TODO: Is the query xmlns='vcard-temp' version of this still necessary? */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1008 | if((vcard = purple_xmlnode_get_child(packet, "vCard")) || |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1009 | (vcard = purple_xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1010 | PurpleXmlNode *child; |
| 7014 | 1011 | for(child = vcard->child; child; child = child->next) |
| 1012 | { | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1013 | PurpleXmlNode *child2; |
| 7014 | 1014 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1015 | if(child->type != PURPLE_XMLNODE_TYPE_TAG) |
| 7014 | 1016 | continue; |
| 1017 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1018 | text = purple_xmlnode_get_data(child); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1019 | if(text && purple_strequal(child->name, "FN")) { |
|
22586
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1020 | if (!serverside_alias) |
|
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1021 | serverside_alias = g_strdup(text); |
|
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1022 | |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1023 | purple_notify_user_info_add_pair_plaintext(user_info, _("Full Name"), text); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1024 | } else if(purple_strequal(child->name, "N")) { |
| 7014 | 1025 | for(child2 = child->child; child2; child2 = child2->next) |
| 1026 | { | |
| 1027 | char *text2; | |
| 1028 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1029 | if(child2->type != PURPLE_XMLNODE_TYPE_TAG) |
| 7014 | 1030 | continue; |
| 1031 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1032 | text2 = purple_xmlnode_get_data(child2); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1033 | if(text2 && purple_strequal(child2->name, "FAMILY")) { |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1034 | purple_notify_user_info_add_pair_plaintext(user_info, _("Family Name"), text2); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1035 | } else if(text2 && purple_strequal(child2->name, "GIVEN")) { |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1036 | purple_notify_user_info_add_pair_plaintext(user_info, _("Given Name"), text2); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1037 | } else if(text2 && purple_strequal(child2->name, "MIDDLE")) { |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1038 | purple_notify_user_info_add_pair_plaintext(user_info, _("Middle Name"), text2); |
| 7014 | 1039 | } |
| 1040 | g_free(text2); | |
| 1041 | } | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1042 | } else if(text && purple_strequal(child->name, "NICKNAME")) { |
|
24200
6c6870d15155
Ignore nicknames which are just the user portion of the JID, as these aren't useful. Instead, prefer the fullname in that situation for serverside alias purposes.
Evan Schoenberg <evands@pidgin.im>
parents:
24012
diff
changeset
|
1043 | /* Prefer the Nickcname to the Full Name as the serverside alias if it's not just part of the jid. |
|
6c6870d15155
Ignore nicknames which are just the user portion of the JID, as these aren't useful. Instead, prefer the fullname in that situation for serverside alias purposes.
Evan Schoenberg <evands@pidgin.im>
parents:
24012
diff
changeset
|
1044 | * Ignore it if it's part of the jid. */ |
|
6c6870d15155
Ignore nicknames which are just the user portion of the JID, as these aren't useful. Instead, prefer the fullname in that situation for serverside alias purposes.
Evan Schoenberg <evands@pidgin.im>
parents:
24012
diff
changeset
|
1045 | if (strstr(bare_jid, text) == NULL) { |
|
6c6870d15155
Ignore nicknames which are just the user portion of the JID, as these aren't useful. Instead, prefer the fullname in that situation for serverside alias purposes.
Evan Schoenberg <evands@pidgin.im>
parents:
24012
diff
changeset
|
1046 | g_free(serverside_alias); |
|
6c6870d15155
Ignore nicknames which are just the user portion of the JID, as these aren't useful. Instead, prefer the fullname in that situation for serverside alias purposes.
Evan Schoenberg <evands@pidgin.im>
parents:
24012
diff
changeset
|
1047 | serverside_alias = g_strdup(text); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1048 | |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1049 | purple_notify_user_info_add_pair_plaintext(user_info, _("Nickname"), text); |
|
24200
6c6870d15155
Ignore nicknames which are just the user portion of the JID, as these aren't useful. Instead, prefer the fullname in that situation for serverside alias purposes.
Evan Schoenberg <evands@pidgin.im>
parents:
24012
diff
changeset
|
1050 | } |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1051 | } else if(text && purple_strequal(child->name, "BDAY")) { |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1052 | purple_notify_user_info_add_pair_plaintext(user_info, _("Birthday"), text); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1053 | } else if(purple_strequal(child->name, "ADR")) { |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1054 | gboolean address_line_added = FALSE; |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1055 | |
| 7014 | 1056 | for(child2 = child->child; child2; child2 = child2->next) |
| 1057 | { | |
| 1058 | char *text2; | |
| 1059 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1060 | if(child2->type != PURPLE_XMLNODE_TYPE_TAG) |
| 7014 | 1061 | continue; |
| 1062 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1063 | text2 = purple_xmlnode_get_data(child2); |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1064 | if (text2 == NULL) |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1065 | continue; |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1066 | |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1067 | /* We do this here so that it's not added if all the child |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1068 | * elements are empty. */ |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1069 | if (!address_line_added) |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1070 | { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1071 | purple_notify_user_info_add_section_header(user_info, _("Address")); |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1072 | address_line_added = TRUE; |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1073 | } |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1074 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1075 | if(purple_strequal(child2->name, "POBOX")) { |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1076 | purple_notify_user_info_add_pair_plaintext(user_info, _("P.O. Box"), text2); |
|
38256
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
31660
diff
changeset
|
1077 | } else if (purple_strequal(child2->name, "EXTADD") || purple_strequal(child2->name, "EXTADR")) { |
|
27998
889b1fbece5b
jabber: Handle "Extended Address" correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27965
diff
changeset
|
1078 | /* |
|
889b1fbece5b
jabber: Handle "Extended Address" correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27965
diff
changeset
|
1079 | * EXTADD is correct, EXTADR is generated by other |
|
889b1fbece5b
jabber: Handle "Extended Address" correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27965
diff
changeset
|
1080 | * clients. The next time someone reads this, remove |
|
889b1fbece5b
jabber: Handle "Extended Address" correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27965
diff
changeset
|
1081 | * EXTADR. |
|
889b1fbece5b
jabber: Handle "Extended Address" correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27965
diff
changeset
|
1082 | */ |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1083 | purple_notify_user_info_add_pair_plaintext(user_info, _("Extended Address"), text2); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1084 | } else if(purple_strequal(child2->name, "STREET")) { |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1085 | purple_notify_user_info_add_pair_plaintext(user_info, _("Street Address"), text2); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1086 | } else if(purple_strequal(child2->name, "LOCALITY")) { |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1087 | purple_notify_user_info_add_pair_plaintext(user_info, _("Locality"), text2); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1088 | } else if(purple_strequal(child2->name, "REGION")) { |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1089 | purple_notify_user_info_add_pair_plaintext(user_info, _("Region"), text2); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1090 | } else if(purple_strequal(child2->name, "PCODE")) { |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1091 | purple_notify_user_info_add_pair_plaintext(user_info, _("Postal Code"), text2); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1092 | } else if(purple_strequal(child2->name, "CTRY") |
|
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1093 | || purple_strequal(child2->name, "COUNTRY")) { |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1094 | purple_notify_user_info_add_pair_plaintext(user_info, _("Country"), text2); |
| 7014 | 1095 | } |
| 1096 | g_free(text2); | |
| 1097 | } | |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1098 | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1099 | if (address_line_added) |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1100 | purple_notify_user_info_add_section_break(user_info); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1101 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1102 | } else if(purple_strequal(child->name, "TEL")) { |
| 7014 | 1103 | char *number; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1104 | if((child2 = purple_xmlnode_get_child(child, "NUMBER"))) { |
| 7014 | 1105 | /* show what kind of number it is */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1106 | number = purple_xmlnode_get_data(child2); |
| 7014 | 1107 | if(number) { |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1108 | purple_notify_user_info_add_pair_plaintext(user_info, _("Telephone"), number); |
| 7014 | 1109 | g_free(number); |
| 1110 | } | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1111 | } else if((number = purple_xmlnode_get_data(child))) { |
| 15884 | 1112 | /* lots of clients (including purple) do this, but it's |
| 7014 | 1113 | * out of spec */ |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1114 | purple_notify_user_info_add_pair_plaintext(user_info, _("Telephone"), number); |
| 7014 | 1115 | g_free(number); |
| 1116 | } | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1117 | } else if(purple_strequal(child->name, "EMAIL")) { |
|
19931
229fb62285b0
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <markdoliner@pidgin.im>
parents:
19921
diff
changeset
|
1118 | char *userid, *escaped; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1119 | if((child2 = purple_xmlnode_get_child(child, "USERID"))) { |
| 7014 | 1120 | /* show what kind of email it is */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1121 | userid = purple_xmlnode_get_data(child2); |
| 7014 | 1122 | if(userid) { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1123 | char *mailto; |
|
19931
229fb62285b0
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <markdoliner@pidgin.im>
parents:
19921
diff
changeset
|
1124 | escaped = g_markup_escape_text(userid, -1); |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1125 | mailto = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", escaped, escaped); |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
31694
diff
changeset
|
1126 | purple_notify_user_info_add_pair_html(user_info, _("Email"), mailto); |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1127 | |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1128 | g_free(mailto); |
|
19931
229fb62285b0
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <markdoliner@pidgin.im>
parents:
19921
diff
changeset
|
1129 | g_free(escaped); |
| 7014 | 1130 | g_free(userid); |
| 1131 | } | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1132 | } else if((userid = purple_xmlnode_get_data(child))) { |
| 15884 | 1133 | /* lots of clients (including purple) do this, but it's |
| 7014 | 1134 | * out of spec */ |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1135 | char *mailto; |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1136 | |
|
19931
229fb62285b0
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <markdoliner@pidgin.im>
parents:
19921
diff
changeset
|
1137 | escaped = g_markup_escape_text(userid, -1); |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1138 | mailto = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", escaped, escaped); |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
31694
diff
changeset
|
1139 | purple_notify_user_info_add_pair_html(user_info, _("Email"), mailto); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1140 | |
|
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1141 | g_free(mailto); |
|
19931
229fb62285b0
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <markdoliner@pidgin.im>
parents:
19921
diff
changeset
|
1142 | g_free(escaped); |
| 7014 | 1143 | g_free(userid); |
| 1144 | } | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1145 | } else if(purple_strequal(child->name, "ORG")) { |
| 7014 | 1146 | for(child2 = child->child; child2; child2 = child2->next) |
| 1147 | { | |
| 1148 | char *text2; | |
| 1149 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1150 | if(child2->type != PURPLE_XMLNODE_TYPE_TAG) |
| 7014 | 1151 | continue; |
| 1152 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1153 | text2 = purple_xmlnode_get_data(child2); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1154 | if(text2 && purple_strequal(child2->name, "ORGNAME")) { |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1155 | purple_notify_user_info_add_pair_plaintext(user_info, _("Organization Name"), text2); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1156 | } else if(text2 && purple_strequal(child2->name, "ORGUNIT")) { |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1157 | purple_notify_user_info_add_pair_plaintext(user_info, _("Organization Unit"), text2); |
| 7014 | 1158 | } |
| 1159 | g_free(text2); | |
| 1160 | } | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1161 | } else if(text && purple_strequal(child->name, "TITLE")) { |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1162 | purple_notify_user_info_add_pair_plaintext(user_info, _("Job Title"), text); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1163 | } else if(text && purple_strequal(child->name, "ROLE")) { |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1164 | purple_notify_user_info_add_pair_plaintext(user_info, _("Role"), text); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1165 | } else if(text && purple_strequal(child->name, "DESC")) { |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1166 | purple_notify_user_info_add_pair_plaintext(user_info, _("Description"), text); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1167 | } else if(purple_strequal(child->name, "PHOTO") || |
|
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1168 | purple_strequal(child->name, "LOGO")) { |
| 10941 | 1169 | char *bintext = NULL; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1170 | PurpleXmlNode *binval; |
| 11361 | 1171 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1172 | if ((binval = purple_xmlnode_get_child(child, "BINVAL")) && |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1173 | (bintext = purple_xmlnode_get_data(binval))) { |
|
11127
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10941
diff
changeset
|
1174 | gsize size; |
|
11137
cf40226ddff7
[gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents:
11127
diff
changeset
|
1175 | guchar *data; |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
1176 | gboolean photo = purple_strequal(child->name, "PHOTO"); |
| 10189 | 1177 | |
|
38341
3da74e727e78
Remove purple_base64_encode/decode() wrappers
Mike Ruprecht <cmaiku@gmail.com>
parents:
38334
diff
changeset
|
1178 | data = g_base64_decode(bintext, &size); |
|
16587
50de12a4b81b
disapproval of revision 'f95b376c0d2f066996620c5bb595dc71b5ee22d9'
Richard Laager <rlaager@pidgin.im>
parents:
16585
diff
changeset
|
1179 | if (data) { |
|
35823
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
1180 | PurpleImage *img; |
|
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
1181 | guint img_id; |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1182 | char *img_text; |
|
25110
40b3fffdb00b
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <darkrain42@pidgin.im>
parents:
25109
diff
changeset
|
1183 | char *hash; |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1184 | |
|
39463
d47e230b9d75
Fix leaky calls to purple_image_new_from_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
1185 | img = purple_image_new_from_data(data, size); |
|
35823
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
1186 | img_id = purple_image_store_add(img); |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1187 | |
|
35823
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
1188 | jbi->vcard_images = g_slist_prepend(jbi->vcard_images, img); |
|
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
1189 | img_text = g_strdup_printf("<img src='" |
|
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
1190 | PURPLE_IMAGE_STORE_PROTOCOL "%u'>", img_id); |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1191 | |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
31694
diff
changeset
|
1192 | purple_notify_user_info_add_pair_html(user_info, (photo ? _("Photo") : _("Logo")), img_text); |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1193 | |
|
38327
c842a56b9967
jabber: Port to use GChecksum instead of PurpleHash
Mike Ruprecht <cmaiku@gmail.com>
parents:
37134
diff
changeset
|
1194 | hash = g_compute_checksum_for_data(G_CHECKSUM_SHA1, data, size); |
|
29368
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1195 | purple_buddy_icons_set_for_user(account, bare_jid, data, size, hash); |
|
25110
40b3fffdb00b
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <darkrain42@pidgin.im>
parents:
25109
diff
changeset
|
1196 | g_free(hash); |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1197 | g_free(img_text); |
|
16587
50de12a4b81b
disapproval of revision 'f95b376c0d2f066996620c5bb595dc71b5ee22d9'
Richard Laager <rlaager@pidgin.im>
parents:
16585
diff
changeset
|
1198 | } |
|
25110
40b3fffdb00b
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <darkrain42@pidgin.im>
parents:
25109
diff
changeset
|
1199 | g_free(bintext); |
| 10941 | 1200 | } |
| 7014 | 1201 | } |
| 1202 | g_free(text); | |
| 1203 | } | |
| 1204 | } | |
| 1205 | ||
|
22586
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1206 | if (serverside_alias) { |
|
29368
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1207 | PurpleBuddy *b; |
|
22586
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1208 | /* If we found a serverside alias, set it and tell the core */ |
|
35499
c4c5e0a670b1
Fix namespaces issues in libpurple.
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
1209 | purple_serv_got_alias(js->gc, bare_jid, serverside_alias); |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34699
diff
changeset
|
1210 | b = purple_blist_find_buddy(account, bare_jid); |
|
22586
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1211 | if (b) { |
|
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1212 | purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", serverside_alias); |
|
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1213 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1214 | |
|
22586
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1215 | g_free(serverside_alias); |
|
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1216 | } |
|
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1217 | |
| 13794 | 1218 | g_free(bare_jid); |
| 1219 | ||
| 1220 | jabber_buddy_info_show_if_ready(jbi); | |
| 1221 | } | |
| 1222 | ||
| 1223 | static void jabber_buddy_info_resource_free(gpointer data) | |
| 1224 | { | |
| 1225 | JabberBuddyInfoResource *jbri = data; | |
| 1226 | g_free(jbri); | |
| 1227 | } | |
| 1228 | ||
|
28114
091771455e05
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
28071
diff
changeset
|
1229 | static guint jbir_hash(gconstpointer v) |
|
091771455e05
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
28071
diff
changeset
|
1230 | { |
|
091771455e05
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
28071
diff
changeset
|
1231 | if (v) |
|
091771455e05
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
28071
diff
changeset
|
1232 | return g_str_hash(v); |
|
091771455e05
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
28071
diff
changeset
|
1233 | else |
|
091771455e05
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
28071
diff
changeset
|
1234 | return 0; |
|
091771455e05
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
28071
diff
changeset
|
1235 | } |
|
091771455e05
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
28071
diff
changeset
|
1236 | |
|
091771455e05
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
28071
diff
changeset
|
1237 | static gboolean jbir_equal(gconstpointer v1, gconstpointer v2) |
|
091771455e05
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
28071
diff
changeset
|
1238 | { |
|
091771455e05
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
28071
diff
changeset
|
1239 | const gchar *resource_1 = v1; |
|
091771455e05
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
28071
diff
changeset
|
1240 | const gchar *resource_2 = v2; |
|
091771455e05
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
28071
diff
changeset
|
1241 | |
|
091771455e05
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
28071
diff
changeset
|
1242 | return purple_strequal(resource_1, resource_2); |
|
091771455e05
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
28071
diff
changeset
|
1243 | } |
|
091771455e05
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
28071
diff
changeset
|
1244 | |
|
41967
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1245 | static void |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1246 | jabber_version_parse(G_GNUC_UNUSED JabberStream *js, const char *from, |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1247 | JabberIqType type, const char *id, PurpleXmlNode *packet, |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1248 | gpointer data) |
| 13794 | 1249 | { |
| 1250 | JabberBuddyInfo *jbi = data; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1251 | PurpleXmlNode *query; |
| 13794 | 1252 | char *resource_name; |
| 1253 | ||
| 1254 | g_return_if_fail(jbi != NULL); | |
| 1255 | ||
| 1256 | jabber_buddy_info_remove_id(jbi, id); | |
| 1257 | ||
| 1258 | if(!from) | |
| 1259 | return; | |
| 1260 | ||
| 1261 | resource_name = jabber_get_resource(from); | |
| 1262 | ||
| 1263 | if(resource_name) { | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1264 | if (type == JABBER_IQ_RESULT) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1265 | if((query = purple_xmlnode_get_child(packet, "query"))) { |
| 13794 | 1266 | JabberBuddyResource *jbr = jabber_buddy_find_resource(jbi->jb, resource_name); |
| 1267 | if(jbr) { | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1268 | PurpleXmlNode *node; |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1269 | if((node = purple_xmlnode_get_child(query, "name"))) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1270 | jbr->client.name = purple_xmlnode_get_data(node); |
| 13794 | 1271 | } |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1272 | if((node = purple_xmlnode_get_child(query, "version"))) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1273 | jbr->client.version = purple_xmlnode_get_data(node); |
| 13794 | 1274 | } |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1275 | if((node = purple_xmlnode_get_child(query, "os"))) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1276 | jbr->client.os = purple_xmlnode_get_data(node); |
| 13794 | 1277 | } |
| 1278 | } | |
| 1279 | } | |
| 1280 | } | |
| 1281 | g_free(resource_name); | |
| 10189 | 1282 | } |
| 13794 | 1283 | |
| 1284 | jabber_buddy_info_show_if_ready(jbi); | |
| 7014 | 1285 | } |
| 1286 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1287 | static void jabber_last_parse(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1288 | JabberIqType type, const char *id, |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1289 | PurpleXmlNode *packet, gpointer data) |
| 13794 | 1290 | { |
| 1291 | JabberBuddyInfo *jbi = data; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1292 | PurpleXmlNode *query; |
| 13794 | 1293 | char *resource_name; |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1294 | const char *seconds; |
| 13794 | 1295 | |
| 1296 | g_return_if_fail(jbi != NULL); | |
| 1297 | ||
| 1298 | jabber_buddy_info_remove_id(jbi, id); | |
| 1299 | ||
| 1300 | if(!from) | |
| 1301 | return; | |
| 1302 | ||
| 1303 | resource_name = jabber_get_resource(from); | |
| 1304 | ||
| 1305 | if(resource_name) { | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1306 | if (type == JABBER_IQ_RESULT) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1307 | if((query = purple_xmlnode_get_child(packet, "query"))) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1308 | seconds = purple_xmlnode_get_attrib(query, "seconds"); |
| 13794 | 1309 | if(seconds) { |
| 1310 | char *end = NULL; | |
| 1311 | long sec = strtol(seconds, &end, 10); | |
|
27135
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1312 | JabberBuddy *jb = NULL; |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1313 | char *resource = NULL; |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1314 | char *buddy_name = NULL; |
|
25493
8bf093c656a5
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <malu@pidgin.im>
parents:
25228
diff
changeset
|
1315 | JabberBuddyResource *jbr = NULL; |
|
26958
a955bd42f529
propagate from branch 'im.pidgin.pidgin' (head 36f75a1d52a6af5574bf847d60054a1392dcbc67)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
1316 | |
| 13794 | 1317 | if(end != seconds) { |
| 1318 | JabberBuddyInfoResource *jbir = g_hash_table_lookup(jbi->resources, resource_name); | |
| 1319 | if(jbir) { | |
| 1320 | jbir->idle_seconds = sec; | |
| 1321 | } | |
| 1322 | } | |
|
27155
53502d71efdd
Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents:
27135
diff
changeset
|
1323 | /* Update the idle time of the buddy resource, if we got it. |
|
53502d71efdd
Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents:
27135
diff
changeset
|
1324 | This will correct the value when a server doesn't mark |
|
27135
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1325 | delayed presence and we got the presence when signing on */ |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1326 | jb = jabber_buddy_find(js, from, FALSE); |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1327 | if (jb) { |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1328 | resource = jabber_get_resource(from); |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1329 | buddy_name = jabber_get_bare_jid(from); |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1330 | /* if the resource already has an idle time set, we |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1331 | must have gotten it originally from a presence. In |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1332 | this case we update it. Otherwise don't update it, to |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1333 | avoid setting an idle and not getting informed about |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1334 | the resource getting unidle */ |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1335 | if (resource && buddy_name) { |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1336 | jbr = jabber_buddy_find_resource(jb, resource); |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1337 | if (jbr) { |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1338 | if (jbr->idle) { |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1339 | if (sec) { |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1340 | jbr->idle = time(NULL) - sec; |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1341 | } else { |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1342 | jbr->idle = 0; |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1343 | } |
|
27134
c7e25dd005c4
Fix a NULL deref if the resource has gone offline by the time we're parsing this reply.
Paul Aurich <darkrain42@pidgin.im>
parents:
27110
diff
changeset
|
1344 | |
|
27155
53502d71efdd
Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents:
27135
diff
changeset
|
1345 | if (jbr == |
|
27135
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1346 | jabber_buddy_find_resource(jb, NULL)) { |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1347 | purple_protocol_got_user_idle(purple_connection_get_account(js->gc), |
|
27135
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1348 | buddy_name, jbr->idle, jbr->idle); |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1349 | } |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1350 | } |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1351 | } |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1352 | } |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1353 | g_free(resource); |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1354 | g_free(buddy_name); |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1355 | } |
| 13794 | 1356 | } |
| 1357 | } | |
| 1358 | } | |
| 1359 | g_free(resource_name); | |
| 1360 | } | |
| 1361 | ||
| 1362 | jabber_buddy_info_show_if_ready(jbi); | |
| 1363 | } | |
| 1364 | ||
|
41967
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1365 | static void |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1366 | jabber_last_offline_parse(G_GNUC_UNUSED JabberStream *js, |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1367 | G_GNUC_UNUSED const char *from, JabberIqType type, |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1368 | const char *id, PurpleXmlNode *packet, gpointer data) |
|
27069
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1369 | { |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1370 | JabberBuddyInfo *jbi = data; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1371 | PurpleXmlNode *query; |
|
27069
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1372 | const char *seconds; |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1373 | |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1374 | g_return_if_fail(jbi != NULL); |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1375 | |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1376 | jabber_buddy_info_remove_id(jbi, id); |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1377 | |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1378 | if (type == JABBER_IQ_RESULT) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1379 | if((query = purple_xmlnode_get_child(packet, "query"))) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1380 | seconds = purple_xmlnode_get_attrib(query, "seconds"); |
|
27069
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1381 | if(seconds) { |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1382 | char *end = NULL; |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1383 | long sec = strtol(seconds, &end, 10); |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1384 | if(end != seconds) { |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1385 | jbi->last_seconds = sec; |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1386 | } |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1387 | } |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1388 | jbi->last_message = purple_xmlnode_get_data(query); |
|
27069
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1389 | } |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1390 | } |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1391 | |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1392 | jabber_buddy_info_show_if_ready(jbi); |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1393 | } |
|
8eabf79a99fe
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <malu@pidgin.im>
parents:
27053
diff
changeset
|
1394 | |
|
41967
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1395 | static void |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1396 | jabber_time_parse(G_GNUC_UNUSED JabberStream *js, const char *from, |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1397 | JabberIqType type, const char *id, PurpleXmlNode *packet, |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1398 | gpointer data) |
|
25822
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1399 | { |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1400 | JabberBuddyInfo *jbi = data; |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1401 | JabberBuddyResource *jbr; |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1402 | char *resource_name; |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1403 | |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1404 | g_return_if_fail(jbi != NULL); |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1405 | |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1406 | jabber_buddy_info_remove_id(jbi, id); |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1407 | |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1408 | if (!from) |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1409 | return; |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1410 | |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1411 | resource_name = jabber_get_resource(from); |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1412 | jbr = resource_name ? jabber_buddy_find_resource(jbi->jb, resource_name) : NULL; |
|
25827
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1413 | g_free(resource_name); |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1414 | if (jbr) { |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1415 | if (type == JABBER_IQ_RESULT) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1416 | PurpleXmlNode *time = purple_xmlnode_get_child(packet, "time"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1417 | PurpleXmlNode *tzo = time ? purple_xmlnode_get_child(time, "tzo") : NULL; |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1418 | char *tzo_data = tzo ? purple_xmlnode_get_data(tzo) : NULL; |
|
25827
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1419 | if (tzo_data) { |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1420 | char *c = tzo_data; |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1421 | int hours, minutes; |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1422 | if (tzo_data[0] == 'Z' && tzo_data[1] == '\0') { |
|
41764
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
1423 | jbr->tz_off = g_time_zone_new_offset(0); |
|
25827
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1424 | } else { |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1425 | gboolean offset_positive = (tzo_data[0] == '+'); |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1426 | /* [+-]HH:MM */ |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1427 | if (((*c == '+' || *c == '-') && (c = c + 1)) && |
|
41764
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
1428 | sscanf(c, "%02d:%02d", &hours, &minutes) == 2) |
|
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
1429 | { |
|
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
1430 | gint32 tz_off = 60*60*hours + 60*minutes; |
|
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
1431 | if (!offset_positive) { |
|
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
1432 | tz_off *= -1; |
|
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
1433 | } |
|
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
1434 | |
|
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
1435 | jbr->tz_off = g_time_zone_new_offset(tz_off); |
|
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
1436 | |
|
25827
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1437 | } else { |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1438 | purple_debug_info("jabber", "Ignoring malformed timezone %s", |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1439 | tzo_data); |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1440 | } |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1441 | } |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1442 | |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1443 | g_free(tzo_data); |
|
25822
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1444 | } |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1445 | } |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1446 | } |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1447 | |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1448 | jabber_buddy_info_show_if_ready(jbi); |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1449 | } |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1450 | |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1451 | void jabber_buddy_remove_all_pending_buddy_info_requests(JabberStream *js) |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1452 | { |
| 40135 | 1453 | g_slist_free_full(js->pending_buddy_info_requests, (GDestroyNotify)jabber_buddy_info_destroy); |
| 1454 | js->pending_buddy_info_requests = NULL; | |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1455 | } |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1456 | |
| 13794 | 1457 | static gboolean jabber_buddy_get_info_timeout(gpointer data) |
| 1458 | { | |
| 1459 | JabberBuddyInfo *jbi = data; | |
| 1460 | ||
| 1461 | /* remove the pending callbacks */ | |
| 1462 | while(jbi->ids) { | |
| 1463 | char *id = jbi->ids->data; | |
| 1464 | jabber_iq_remove_callback_by_id(jbi->js, id); | |
|
40079
a37a1e349491
Replace g_[s]list_remove with g_[s]list_delete_link.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
40062
diff
changeset
|
1465 | jbi->ids = g_slist_delete_link(jbi->ids, jbi->ids); |
| 13794 | 1466 | g_free(id); |
| 1467 | } | |
| 1468 | ||
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1469 | jbi->js->pending_buddy_info_requests = g_slist_remove(jbi->js->pending_buddy_info_requests, jbi); |
| 13794 | 1470 | jbi->timeout_handle = 0; |
| 1471 | ||
| 1472 | jabber_buddy_info_show_if_ready(jbi); | |
| 1473 | ||
| 1474 | return FALSE; | |
| 1475 | } | |
| 1476 | ||
|
17029
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1477 | static gboolean _client_is_blacklisted(JabberBuddyResource *jbr, const char *ns) |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1478 | { |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1479 | /* can't be blacklisted if we don't know what you're running yet */ |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1480 | if(!jbr->client.name) |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1481 | return FALSE; |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1482 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1483 | if(purple_strequal(ns, NS_LAST_ACTIVITY)) { |
|
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1484 | if(purple_strequal(jbr->client.name, "Trillian")) { |
|
20350
ae3f3561e698
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20320
diff
changeset
|
1485 | /* verified by nwalp 2007/05/09 */ |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1486 | if(purple_strequal(jbr->client.version, "3.1.0.121") || |
|
20350
ae3f3561e698
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20320
diff
changeset
|
1487 | /* verified by nwalp 2007/09/19 */ |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1488 | purple_strequal(jbr->client.version, "3.1.7.0")) { |
|
17029
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1489 | return TRUE; |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1490 | } |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1491 | } |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1492 | } |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1493 | |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1494 | return FALSE; |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1495 | } |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1496 | |
|
27484
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1497 | static void |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1498 | dispatch_queries_for_resource(JabberStream *js, JabberBuddyInfo *jbi, |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1499 | gboolean is_bare_jid, const char *jid, |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1500 | JabberBuddyResource *jbr) |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1501 | { |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1502 | JabberIq *iq; |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1503 | JabberBuddyInfoResource *jbir; |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1504 | char *full_jid = NULL; |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1505 | const char *to; |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1506 | |
|
28114
091771455e05
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
28071
diff
changeset
|
1507 | if (is_bare_jid && jbr->name) { |
|
27484
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1508 | full_jid = g_strdup_printf("%s/%s", jid, jbr->name); |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1509 | to = full_jid; |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1510 | } else |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1511 | to = jid; |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1512 | |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1513 | jbir = g_new0(JabberBuddyInfoResource, 1); |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1514 | g_hash_table_insert(jbi->resources, g_strdup(jbr->name), jbir); |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1515 | |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1516 | if(!jbr->client.name) { |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1517 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:version"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1518 | purple_xmlnode_set_attrib(iq->node, "to", to); |
|
27484
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1519 | jabber_iq_set_callback(iq, jabber_version_parse, jbi); |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1520 | jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1521 | jabber_iq_send(iq); |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1522 | } |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1523 | |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1524 | /* this is to fix the feeling of irritation I get when trying |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1525 | * to get info on a friend running Trillian, which doesn't |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1526 | * respond (with an error or otherwise) to jabber:iq:last |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1527 | * requests. There are a number of Trillian users in my |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1528 | * office. */ |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28883
diff
changeset
|
1529 | if(!_client_is_blacklisted(jbr, NS_LAST_ACTIVITY)) { |
|
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28883
diff
changeset
|
1530 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_LAST_ACTIVITY); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1531 | purple_xmlnode_set_attrib(iq->node, "to", to); |
|
27484
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1532 | jabber_iq_set_callback(iq, jabber_last_parse, jbi); |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1533 | jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1534 | jabber_iq_send(iq); |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1535 | } |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1536 | |
|
41764
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
1537 | if (jbr->tz_off == NULL && |
|
41784
f864fee87775
Remove support for XEP 0115 Legacy Format
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41764
diff
changeset
|
1538 | (jbr->caps == NULL || |
|
f864fee87775
Remove support for XEP 0115 Legacy Format
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41764
diff
changeset
|
1539 | jabber_resource_has_capability(jbr, NS_ENTITY_TIME))) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1540 | PurpleXmlNode *child; |
|
27484
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1541 | iq = jabber_iq_new(js, JABBER_IQ_GET); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1542 | purple_xmlnode_set_attrib(iq->node, "to", to); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1543 | child = purple_xmlnode_new_child(iq->node, "time"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1544 | purple_xmlnode_set_namespace(child, NS_ENTITY_TIME); |
|
27484
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1545 | jabber_iq_set_callback(iq, jabber_time_parse, jbi); |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1546 | jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1547 | jabber_iq_send(iq); |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1548 | } |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1549 | |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1550 | g_free(full_jid); |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1551 | } |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1552 | |
| 13794 | 1553 | static void jabber_buddy_get_info_for_jid(JabberStream *js, const char *jid) |
| 7014 | 1554 | { |
| 1555 | JabberIq *iq; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1556 | PurpleXmlNode *vcard; |
| 13794 | 1557 | GList *resources; |
| 1558 | JabberBuddy *jb; | |
| 1559 | JabberBuddyInfo *jbi; | |
|
27485
9c49a24cec27
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27484
diff
changeset
|
1560 | const char *slash; |
|
27484
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1561 | gboolean is_bare_jid; |
| 13794 | 1562 | |
| 1563 | jb = jabber_buddy_find(js, jid, TRUE); | |
| 1564 | ||
| 1565 | /* invalid JID */ | |
| 1566 | if(!jb) | |
| 1567 | return; | |
| 1568 | ||
|
27485
9c49a24cec27
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27484
diff
changeset
|
1569 | slash = strchr(jid, '/'); |
|
9c49a24cec27
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27484
diff
changeset
|
1570 | is_bare_jid = (slash == NULL); |
|
27484
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1571 | |
| 13794 | 1572 | jbi = g_new0(JabberBuddyInfo, 1); |
| 1573 | jbi->jid = g_strdup(jid); | |
| 1574 | jbi->js = js; | |
| 1575 | jbi->jb = jb; | |
|
28114
091771455e05
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <darkrain42@pidgin.im>
parents:
28071
diff
changeset
|
1576 | jbi->resources = g_hash_table_new_full(jbir_hash, jbir_equal, g_free, jabber_buddy_info_resource_free); |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1577 | jbi->user_info = purple_notify_user_info_new(); |
| 7014 | 1578 | |
| 1579 | iq = jabber_iq_new(js, JABBER_IQ_GET); | |
| 1580 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1581 | purple_xmlnode_set_attrib(iq->node, "to", jid); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1582 | vcard = purple_xmlnode_new_child(iq->node, "vCard"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1583 | purple_xmlnode_set_namespace(vcard, "vcard-temp"); |
| 7014 | 1584 | |
| 13794 | 1585 | jabber_iq_set_callback(iq, jabber_vcard_parse, jbi); |
| 1586 | jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); | |
| 7014 | 1587 | |
| 1588 | jabber_iq_send(iq); | |
| 13794 | 1589 | |
|
27485
9c49a24cec27
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27484
diff
changeset
|
1590 | if (is_bare_jid) { |
|
29368
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1591 | if (jb->resources) { |
|
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1592 | for(resources = jb->resources; resources; resources = resources->next) { |
|
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1593 | JabberBuddyResource *jbr = resources->data; |
|
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1594 | dispatch_queries_for_resource(js, jbi, is_bare_jid, jid, jbr); |
|
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1595 | } |
|
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1596 | } else { |
|
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1597 | /* user is offline, send a jabber:iq:last to find out last time online */ |
|
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1598 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_LAST_ACTIVITY); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1599 | purple_xmlnode_set_attrib(iq->node, "to", jid); |
|
29368
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1600 | jabber_iq_set_callback(iq, jabber_last_offline_parse, jbi); |
|
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1601 | jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); |
|
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1602 | jabber_iq_send(iq); |
|
27485
9c49a24cec27
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27484
diff
changeset
|
1603 | } |
|
9c49a24cec27
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27484
diff
changeset
|
1604 | } else { |
|
9c49a24cec27
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27484
diff
changeset
|
1605 | JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, slash + 1); |
|
9c49a24cec27
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27484
diff
changeset
|
1606 | if (jbr) |
|
9c49a24cec27
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27484
diff
changeset
|
1607 | dispatch_queries_for_resource(js, jbi, is_bare_jid, jid, jbr); |
|
9c49a24cec27
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27484
diff
changeset
|
1608 | else |
|
9c49a24cec27
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27484
diff
changeset
|
1609 | purple_debug_warning("jabber", "jabber_buddy_get_info_for_jid() " |
|
9c49a24cec27
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27484
diff
changeset
|
1610 | "was passed JID %s, but there is no corresponding " |
|
9c49a24cec27
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27484
diff
changeset
|
1611 | "JabberBuddyResource!\n", jid); |
| 13794 | 1612 | } |
| 1613 | ||
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1614 | js->pending_buddy_info_requests = g_slist_prepend(js->pending_buddy_info_requests, jbi); |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
1615 | jbi->timeout_handle = g_timeout_add_seconds(30, jabber_buddy_get_info_timeout, jbi); |
| 7014 | 1616 | } |
| 1617 | ||
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
1618 | void |
|
41967
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1619 | jabber_buddy_get_info(G_GNUC_UNUSED PurpleProtocolServer *protocol_server, |
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
1620 | PurpleConnection *gc, const char *who) |
| 10189 | 1621 | { |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1622 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
24829
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1623 | JabberID *jid = jabber_id_new(who); |
|
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1624 | |
|
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1625 | if (!jid) |
|
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1626 | return; |
| 10189 | 1627 | |
|
25575
9fbf7bf38146
A JID can have no node (the part before the @), but a chat must have one,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25454
diff
changeset
|
1628 | if (jid->node && jabber_chat_find(js, jid->node, jid->domain)) { |
|
24829
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1629 | /* For a conversation, include the resource (indicates the user). */ |
|
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1630 | jabber_buddy_get_info_for_jid(js, who); |
|
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1631 | } else { |
|
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1632 | char *bare_jid = jabber_get_bare_jid(who); |
| 10189 | 1633 | jabber_buddy_get_info_for_jid(js, bare_jid); |
| 1634 | g_free(bare_jid); | |
| 1635 | } | |
|
24829
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1636 | |
|
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1637 | jabber_id_free(jid); |
| 10189 | 1638 | } |
| 1639 | ||
| 7014 | 1640 | static void jabber_buddy_set_invisibility(JabberStream *js, const char *who, |
| 1641 | gboolean invisible) | |
| 1642 | { | |
| 15884 | 1643 | PurplePresence *gpresence; |
| 1644 | PurpleAccount *account; | |
| 1645 | PurpleStatus *status; | |
| 7014 | 1646 | JabberBuddy *jb = jabber_buddy_find(js, who, TRUE); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1647 | PurpleXmlNode *presence; |
| 9954 | 1648 | JabberBuddyState state; |
| 14525 | 1649 | char *msg; |
| 9954 | 1650 | int priority; |
| 7014 | 1651 | |
| 15884 | 1652 | account = purple_connection_get_account(js->gc); |
| 1653 | gpresence = purple_account_get_presence(account); | |
| 1654 | status = purple_presence_get_active_status(gpresence); | |
|
9944
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9797
diff
changeset
|
1655 | |
| 15884 | 1656 | purple_status_to_jabber(status, &state, &msg, &priority); |
|
17770
e67998927a3c
Added the ability to define extensions to caps
Andreas Monitzer <am@adiumx.com>
parents:
17051
diff
changeset
|
1657 | presence = jabber_presence_create_js(js, state, msg, priority); |
| 9954 | 1658 | |
| 14525 | 1659 | g_free(msg); |
| 1660 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1661 | purple_xmlnode_set_attrib(presence, "to", who); |
| 7014 | 1662 | if(invisible) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1663 | purple_xmlnode_set_attrib(presence, "type", "invisible"); |
| 7014 | 1664 | jb->invisible |= JABBER_INVIS_BUDDY; |
| 1665 | } else { | |
| 1666 | jb->invisible &= ~JABBER_INVIS_BUDDY; | |
| 1667 | } | |
| 1668 | ||
| 1669 | jabber_send(js, presence); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1670 | purple_xmlnode_free(presence); |
| 7014 | 1671 | } |
| 1672 | ||
|
41967
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1673 | static void |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1674 | jabber_buddy_make_invisible(PurpleBlistNode *node, G_GNUC_UNUSED gpointer data) |
| 7014 | 1675 | { |
| 15884 | 1676 | PurpleBuddy *buddy; |
| 1677 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1678 | JabberStream *js; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1679 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33661
diff
changeset
|
1680 | g_return_if_fail(PURPLE_IS_BUDDY(node)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1681 | |
| 15884 | 1682 | buddy = (PurpleBuddy *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1683 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1684 | js = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1685 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1686 | jabber_buddy_set_invisibility(js, purple_buddy_get_name(buddy), TRUE); |
| 7014 | 1687 | } |
| 1688 | ||
|
41967
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1689 | static void |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1690 | jabber_buddy_make_visible(PurpleBlistNode *node, G_GNUC_UNUSED gpointer data) |
| 7014 | 1691 | { |
| 15884 | 1692 | PurpleBuddy *buddy; |
| 1693 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1694 | JabberStream *js; |
| 7014 | 1695 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33661
diff
changeset
|
1696 | g_return_if_fail(PURPLE_IS_BUDDY(node)); |
| 7014 | 1697 | |
| 15884 | 1698 | buddy = (PurpleBuddy *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1699 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1700 | js = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1701 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1702 | jabber_buddy_set_invisibility(js, purple_buddy_get_name(buddy), FALSE); |
| 7014 | 1703 | } |
| 1704 | ||
|
28058
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1705 | static void cancel_presence_notification(gpointer data) |
| 7014 | 1706 | { |
| 15884 | 1707 | PurpleBuddy *buddy; |
| 1708 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1709 | JabberStream *js; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1710 | |
|
28058
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1711 | buddy = data; |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1712 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1713 | js = purple_connection_get_protocol_data(gc); |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1714 | |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1715 | jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "unsubscribed"); |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1716 | } |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1717 | |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1718 | static void |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1719 | jabber_buddy_cancel_presence_notification(PurpleBlistNode *node, |
|
41967
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1720 | G_GNUC_UNUSED gpointer data) |
|
28058
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1721 | { |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1722 | PurpleBuddy *buddy; |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1723 | PurpleAccount *account; |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1724 | PurpleConnection *gc; |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1725 | const gchar *name; |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1726 | char *msg; |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1727 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33661
diff
changeset
|
1728 | g_return_if_fail(PURPLE_IS_BUDDY(node)); |
| 7014 | 1729 | |
| 15884 | 1730 | buddy = (PurpleBuddy *) node; |
|
28058
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1731 | name = purple_buddy_get_name(buddy); |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1732 | account = purple_buddy_get_account(buddy); |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1733 | gc = purple_account_get_connection(account); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1734 | |
|
28058
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1735 | msg = g_strdup_printf(_("%s will no longer be able to see your status " |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1736 | "updates. Do you want to continue?"), name); |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1737 | purple_request_yes_no(gc, NULL, _("Cancel Presence Notification"), |
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
1738 | msg, 0 /* Yes */, purple_request_cpar_from_account(account), buddy, |
|
28058
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1739 | cancel_presence_notification, NULL /* Do nothing */); |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1740 | g_free(msg); |
| 7014 | 1741 | } |
| 1742 | ||
|
41967
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1743 | static void |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1744 | jabber_buddy_rerequest_auth(PurpleBlistNode *node, G_GNUC_UNUSED gpointer data) |
| 7250 | 1745 | { |
| 15884 | 1746 | PurpleBuddy *buddy; |
| 1747 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1748 | JabberStream *js; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1749 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33661
diff
changeset
|
1750 | g_return_if_fail(PURPLE_IS_BUDDY(node)); |
| 7250 | 1751 | |
| 15884 | 1752 | buddy = (PurpleBuddy *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1753 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1754 | js = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1755 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1756 | jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "subscribe"); |
| 7250 | 1757 | } |
| 1758 | ||
|
41967
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1759 | static void |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1760 | jabber_buddy_unsubscribe(PurpleBlistNode *node, G_GNUC_UNUSED gpointer data) |
| 7014 | 1761 | { |
| 15884 | 1762 | PurpleBuddy *buddy; |
| 1763 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1764 | JabberStream *js; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1765 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33661
diff
changeset
|
1766 | g_return_if_fail(PURPLE_IS_BUDDY(node)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1767 | |
| 15884 | 1768 | buddy = (PurpleBuddy *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1769 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1770 | js = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1771 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1772 | jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "unsubscribe"); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1773 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1774 | |
|
41967
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1775 | static void |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1776 | jabber_buddy_login(PurpleBlistNode *node, G_GNUC_UNUSED gpointer data) |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1777 | { |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33661
diff
changeset
|
1778 | if(PURPLE_IS_BUDDY(node)) { |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1779 | /* simply create a directed presence of the current status */ |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1780 | PurpleBuddy *buddy = (PurpleBuddy *) node; |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1781 | PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1782 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1783 | PurpleAccount *account = purple_connection_get_account(gc); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1784 | PurplePresence *gpresence = purple_account_get_presence(account); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1785 | PurpleStatus *status = purple_presence_get_active_status(gpresence); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1786 | PurpleXmlNode *presence; |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1787 | JabberBuddyState state; |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1788 | char *msg; |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1789 | int priority; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1790 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1791 | purple_status_to_jabber(status, &state, &msg, &priority); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1792 | presence = jabber_presence_create_js(js, state, msg, priority); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1793 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1794 | g_free(msg); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1795 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1796 | purple_xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1797 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1798 | jabber_send(js, presence); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1799 | purple_xmlnode_free(presence); |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1800 | } |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1801 | } |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1802 | |
|
41967
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1803 | static void |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1804 | jabber_buddy_logout(PurpleBlistNode *node, G_GNUC_UNUSED gpointer data) |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1805 | { |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33661
diff
changeset
|
1806 | if(PURPLE_IS_BUDDY(node)) { |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1807 | /* simply create a directed unavailable presence */ |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1808 | PurpleBuddy *buddy = (PurpleBuddy *) node; |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1809 | PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1810 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1811 | PurpleXmlNode *presence; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1812 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1813 | presence = jabber_presence_create_js(js, JABBER_BUDDY_STATE_UNAVAILABLE, NULL, 0); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1814 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1815 | purple_xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1816 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1817 | jabber_send(js, presence); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1818 | purple_xmlnode_free(presence); |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1819 | } |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1820 | } |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1821 | |
| 15884 | 1822 | static GList *jabber_buddy_menu(PurpleBuddy *buddy) |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1823 | { |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1824 | PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1825 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1826 | const char *name = purple_buddy_get_name(buddy); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1827 | JabberBuddy *jb = jabber_buddy_find(js, name, TRUE); |
|
17816
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
1828 | GList *jbrs; |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1829 | |
| 7014 | 1830 | GList *m = NULL; |
|
39481
4db28449567d
Rename PurpleMenuAction to PurpleActionMenu
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
1831 | PurpleActionMenu *act; |
| 7395 | 1832 | |
| 1833 | if(!jb) | |
| 1834 | return m; | |
| 1835 | ||
|
29849
d7b910200dc5
jabber: Treat the version properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29811
diff
changeset
|
1836 | if (js->protocol_version.major == 0 && js->protocol_version.minor == 9 && |
|
d7b910200dc5
jabber: Treat the version properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29811
diff
changeset
|
1837 | jb != js->user_jb) { |
| 8166 | 1838 | if(jb->invisible & JABBER_INVIS_BUDDY) { |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
1839 | act = purple_action_menu_new(_("Un-hide From"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41311
diff
changeset
|
1840 | G_CALLBACK(jabber_buddy_make_visible), |
| 12919 | 1841 | NULL, NULL); |
| 8166 | 1842 | } else { |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
1843 | act = purple_action_menu_new(_("Temporarily Hide From"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41311
diff
changeset
|
1844 | G_CALLBACK(jabber_buddy_make_invisible), |
| 13019 | 1845 | NULL, NULL); |
| 8166 | 1846 | } |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1847 | m = g_list_append(m, act); |
| 7014 | 1848 | } |
| 1849 | ||
|
28071
a0706162fefd
jabber: Store the "own JabberBuddy" in the JabberStream* struct.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1850 | if(jb->subscription & JABBER_SUB_FROM && jb != js->user_jb) { |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
1851 | act = purple_action_menu_new(_("Cancel Presence Notification"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41311
diff
changeset
|
1852 | G_CALLBACK(jabber_buddy_cancel_presence_notification), |
| 12919 | 1853 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1854 | m = g_list_append(m, act); |
| 7014 | 1855 | } |
| 1856 | ||
| 1857 | if(!(jb->subscription & JABBER_SUB_TO)) { | |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
1858 | act = purple_action_menu_new(_("(Re-)Request authorization"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41311
diff
changeset
|
1859 | G_CALLBACK(jabber_buddy_rerequest_auth), |
| 12919 | 1860 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1861 | m = g_list_append(m, act); |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1862 | |
|
28071
a0706162fefd
jabber: Store the "own JabberBuddy" in the JabberStream* struct.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1863 | } else if (jb != js->user_jb) { |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1864 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1865 | /* shouldn't this just happen automatically when the buddy is |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1866 | removed? */ |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
1867 | act = purple_action_menu_new(_("Unsubscribe"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41311
diff
changeset
|
1868 | G_CALLBACK(jabber_buddy_unsubscribe), |
| 12919 | 1869 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1870 | m = g_list_append(m, act); |
| 7014 | 1871 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1872 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1873 | /* |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1874 | * This if-condition implements parts of XEP-0100: Gateway Interaction |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1875 | * |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1876 | * According to stpeter, there is no way to know if a jid on the roster is a gateway without sending a disco#info. |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1877 | * However, since the gateway might appear offline to us, we cannot get that information. Therefore, I just assume |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1878 | * that gateways on the roster can be identified by having no '@' in their jid. This is a faily safe assumption, since |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1879 | * people don't tend to have a server or other service there. |
|
29059
8225f2507058
strchr() is safe when searching for an ASCII character in UTF8 strings.
Paul Aurich <darkrain42@pidgin.im>
parents:
28984
diff
changeset
|
1880 | * |
|
8225f2507058
strchr() is safe when searching for an ASCII character in UTF8 strings.
Paul Aurich <darkrain42@pidgin.im>
parents:
28984
diff
changeset
|
1881 | * TODO: Use disco#info... |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1882 | */ |
|
29059
8225f2507058
strchr() is safe when searching for an ASCII character in UTF8 strings.
Paul Aurich <darkrain42@pidgin.im>
parents:
28984
diff
changeset
|
1883 | if (strchr(name, '@') == NULL) { |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
1884 | act = purple_action_menu_new(_("Log In"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41311
diff
changeset
|
1885 | G_CALLBACK(jabber_buddy_login), |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1886 | NULL, NULL); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1887 | m = g_list_append(m, act); |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
1888 | act = purple_action_menu_new(_("Log Out"), |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41311
diff
changeset
|
1889 | G_CALLBACK(jabber_buddy_logout), |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1890 | NULL, NULL); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1891 | m = g_list_append(m, act); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1892 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1893 | |
|
17816
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
1894 | /* add all ad hoc commands to the action menu */ |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
1895 | for(jbrs = jb->resources; jbrs; jbrs = g_list_next(jbrs)) { |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
1896 | JabberBuddyResource *jbr = jbrs->data; |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
1897 | GList *commands; |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
1898 | if (!jbr->commands) |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
1899 | continue; |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
1900 | for(commands = jbr->commands; commands; commands = g_list_next(commands)) { |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
1901 | JabberAdHocCommands *cmd = commands->data; |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41311
diff
changeset
|
1902 | act = purple_action_menu_new(cmd->name, G_CALLBACK(jabber_adhoc_execute_action), cmd, NULL); |
|
17816
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
1903 | m = g_list_append(m, act); |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
1904 | } |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
1905 | } |
| 7014 | 1906 | |
| 1907 | return m; | |
| 1908 | } | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1909 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1910 | GList * |
|
41967
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1911 | jabber_blist_node_menu(G_GNUC_UNUSED PurpleProtocolClient *client, |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41940
diff
changeset
|
1912 | PurpleBlistNode *node) |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1913 | { |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33661
diff
changeset
|
1914 | if(PURPLE_IS_BUDDY(node)) { |
| 15884 | 1915 | return jabber_buddy_menu((PurpleBuddy *) node); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1916 | } else { |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1917 | return NULL; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1918 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1919 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1920 | |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
1921 | gboolean |
|
28879
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28828
diff
changeset
|
1922 | jabber_resource_know_capabilities(const JabberBuddyResource *jbr) |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28828
diff
changeset
|
1923 | { |
|
41784
f864fee87775
Remove support for XEP 0115 Legacy Format
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41764
diff
changeset
|
1924 | return jbr->caps != NULL; |
|
28879
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28828
diff
changeset
|
1925 | } |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28828
diff
changeset
|
1926 | |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28828
diff
changeset
|
1927 | gboolean |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
1928 | jabber_resource_has_capability(const JabberBuddyResource *jbr, const gchar *cap) |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
1929 | { |
|
24802
eb481e98ac6a
Sprinkle jabber_resource_has_capability in places
Paul Aurich <darkrain42@pidgin.im>
parents:
24732
diff
changeset
|
1930 | const GList *node = NULL; |
| 13794 | 1931 | |
|
41784
f864fee87775
Remove support for XEP 0115 Legacy Format
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41764
diff
changeset
|
1932 | if (jbr->caps == NULL) { |
|
27696
2cd9b9331f06
Lower the severity of this message.
Paul Aurich <darkrain42@pidgin.im>
parents:
27619
diff
changeset
|
1933 | purple_debug_info("jabber", |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
1934 | "Unable to find caps: nothing known about buddy\n"); |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
1935 | return FALSE; |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
1936 | } |
| 13794 | 1937 | |
|
41784
f864fee87775
Remove support for XEP 0115 Legacy Format
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41764
diff
changeset
|
1938 | node = g_list_find_custom(jbr->caps->features, cap, (GCompareFunc)strcmp); |
|
24802
eb481e98ac6a
Sprinkle jabber_resource_has_capability in places
Paul Aurich <darkrain42@pidgin.im>
parents:
24732
diff
changeset
|
1939 | return (node != NULL); |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
1940 | } |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
1941 | |
|
25577
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
1942 | const gchar * |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
1943 | jabber_resource_get_identity_category_type(const JabberBuddyResource *jbr, |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
1944 | const gchar *category) |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
1945 | { |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
1946 | const GList *iter = NULL; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30014
diff
changeset
|
1947 | |
|
41784
f864fee87775
Remove support for XEP 0115 Legacy Format
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41764
diff
changeset
|
1948 | if (jbr->caps != NULL) { |
|
f864fee87775
Remove support for XEP 0115 Legacy Format
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41764
diff
changeset
|
1949 | for (iter = jbr->caps->identities ; iter ; iter = g_list_next(iter)) { |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30014
diff
changeset
|
1950 | const JabberIdentity *identity = |
|
27286
f637c4c27815
Fixup after propagating new caps stuff
Marcus Lundblad <malu@pidgin.im>
parents:
27285
diff
changeset
|
1951 | (JabberIdentity *) iter->data; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30014
diff
changeset
|
1952 | |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
1953 | if (purple_strequal(identity->category, category)) { |
|
25577
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
1954 | return identity->type; |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
1955 | } |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
1956 | } |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
1957 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30014
diff
changeset
|
1958 | |
|
25577
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
1959 | return NULL; |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
1960 | } |