Fri, 25 Nov 2022 23:40:58 -0600
Remove purple_markup_escape_text
This was originally added because g_markup_escape_text turns ' in to '
which isn't an element in HTML 4 and apparently it wasn't rendered right in
IE7. Those days are long gone, so there's no reason we need this anymore.
Testing Done:
Compiled and ran the unit tests
Reviewed at https://reviews.imfreedom.org/r/2096/
| 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 |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
442 | jabber_set_info(PurpleProtocolServer *protocol_server, PurpleConnection *gc, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
443 | const gchar *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 |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
536 | jabber_set_buddy_icon(PurpleProtocolServer *protocol_server, |
|
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 | ||
|
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
|
903 | static void jabber_vcard_save_mine(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
|
904 | 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
|
905 | PurpleXmlNode *packet, gpointer data) |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
906 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
907 | 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
|
908 | char *txt, *vcard_hash = NULL; |
|
28046
8b6fcc2c95b3
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <darkrain42@pidgin.im>
parents:
27998
diff
changeset
|
909 | PurpleAccount *account; |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
910 | |
|
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
|
911 | 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
|
912 | PurpleXmlNode *error; |
| 27417 | 913 | 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
|
914 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
915 | 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
|
916 | 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
|
917 | 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
|
918 | } |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
919 | |
|
28046
8b6fcc2c95b3
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <darkrain42@pidgin.im>
parents:
27998
diff
changeset
|
920 | 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
|
921 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
922 | 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
|
923 | (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
|
924 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
925 | 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
|
926 | 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
|
927 | g_free(txt); |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
928 | } else { |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
929 | /* 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
|
930 | } |
|
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 | 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
|
933 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
934 | 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
|
935 | (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
|
936 | gsize size; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
937 | 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
|
938 | if (bintext) { |
|
38341
3da74e727e78
Remove purple_base64_encode/decode() wrappers
Mike Ruprecht <cmaiku@gmail.com>
parents:
38334
diff
changeset
|
939 | 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
|
940 | 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
|
941 | |
|
28311
9c92aae99f62
jabber: Fix a crash when the vcard includes an empty BINVAL.
Paul Aurich <darkrain42@pidgin.im>
parents:
28290
diff
changeset
|
942 | if (data) { |
|
38327
c842a56b9967
jabber: Port to use GChecksum instead of PurpleHash
Mike Ruprecht <cmaiku@gmail.com>
parents:
37134
diff
changeset
|
943 | 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
|
944 | 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
|
945 | g_free(data); |
|
9c92aae99f62
jabber: Fix a crash when the vcard includes an empty BINVAL.
Paul Aurich <darkrain42@pidgin.im>
parents:
28290
diff
changeset
|
946 | } |
|
25477
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
947 | } |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
948 | } |
|
25477
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
949 | |
|
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
950 | /* 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
|
951 | 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
|
952 | 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
|
953 | } 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
|
954 | /* 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
|
955 | 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
|
956 | vcard_hash = NULL; |
|
4d43dd2afadb
jabber: The second half; advertise the vCard avatar, whatever it is.
Paul Aurich <darkrain42@pidgin.im>
parents:
28881
diff
changeset
|
957 | |
|
4d43dd2afadb
jabber: The second half; advertise the vCard avatar, whatever it is.
Paul Aurich <darkrain42@pidgin.im>
parents:
28881
diff
changeset
|
958 | /* 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
|
959 | 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
|
960 | } |
|
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 | 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
|
963 | } |
|
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 | 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
|
966 | { |
|
21957
0ce77f86c7f3
Fix XMPP buddy icons. Somehow a 'VCard' element got changed to a query
Sean Egan <seanegan@pidgin.im>
parents:
21681
diff
changeset
|
967 | 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
|
968 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
969 | 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
|
970 | 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
|
971 | 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
|
972 | |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
973 | 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
|
974 | } |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
975 | |
|
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
|
976 | 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
|
977 | 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
|
978 | PurpleXmlNode *packet, gpointer data) |
| 13794 | 979 | { |
| 980 | char *bare_jid; | |
| 981 | 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
|
982 | 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
|
983 | PurpleXmlNode *vcard; |
|
29368
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
984 | PurpleAccount *account; |
| 13794 | 985 | 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
|
986 | PurpleNotifyUserInfo *user_info; |
| 13794 | 987 | |
|
29368
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
988 | g_return_if_fail(jbi != NULL); |
| 13794 | 989 | |
|
14129
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
990 | jabber_buddy_info_remove_id(jbi, id); |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
991 | |
|
29368
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
992 | 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
|
993 | 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
|
994 | jabber_buddy_info_show_if_ready(jbi); |
| 13794 | 995 | return; |
|
29368
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
996 | } |
| 13794 | 997 | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
998 | 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
|
999 | account = purple_connection_get_account(js->gc); |
|
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1000 | bare_jid = jabber_get_bare_jid(from ? from : purple_account_get_username(account)); |
| 13794 | 1001 | |
|
29368
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1002 | /* 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
|
1003 | 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
|
1004 | (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
|
1005 | PurpleXmlNode *child; |
| 7014 | 1006 | for(child = vcard->child; child; child = child->next) |
| 1007 | { | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1008 | PurpleXmlNode *child2; |
| 7014 | 1009 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1010 | if(child->type != PURPLE_XMLNODE_TYPE_TAG) |
| 7014 | 1011 | continue; |
| 1012 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1013 | text = purple_xmlnode_get_data(child); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1014 | 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
|
1015 | 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
|
1016 | 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
|
1017 | |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1018 | 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
|
1019 | } else if(purple_strequal(child->name, "N")) { |
| 7014 | 1020 | for(child2 = child->child; child2; child2 = child2->next) |
| 1021 | { | |
| 1022 | char *text2; | |
| 1023 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1024 | if(child2->type != PURPLE_XMLNODE_TYPE_TAG) |
| 7014 | 1025 | continue; |
| 1026 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1027 | text2 = purple_xmlnode_get_data(child2); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1028 | 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
|
1029 | 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
|
1030 | } 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
|
1031 | 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
|
1032 | } 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
|
1033 | purple_notify_user_info_add_pair_plaintext(user_info, _("Middle Name"), text2); |
| 7014 | 1034 | } |
| 1035 | g_free(text2); | |
| 1036 | } | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1037 | } 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
|
1038 | /* 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
|
1039 | * 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
|
1040 | 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
|
1041 | 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
|
1042 | 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
|
1043 | |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1044 | 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
|
1045 | } |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1046 | } 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
|
1047 | 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
|
1048 | } else if(purple_strequal(child->name, "ADR")) { |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1049 | gboolean address_line_added = FALSE; |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1050 | |
| 7014 | 1051 | for(child2 = child->child; child2; child2 = child2->next) |
| 1052 | { | |
| 1053 | char *text2; | |
| 1054 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1055 | if(child2->type != PURPLE_XMLNODE_TYPE_TAG) |
| 7014 | 1056 | continue; |
| 1057 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1058 | text2 = purple_xmlnode_get_data(child2); |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1059 | if (text2 == NULL) |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1060 | continue; |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1061 | |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1062 | /* 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
|
1063 | * elements are empty. */ |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1064 | if (!address_line_added) |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1065 | { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1066 | purple_notify_user_info_add_section_header(user_info, _("Address")); |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1067 | address_line_added = TRUE; |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1068 | } |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1069 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1070 | 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
|
1071 | 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
|
1072 | } 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
|
1073 | /* |
|
889b1fbece5b
jabber: Handle "Extended Address" correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27965
diff
changeset
|
1074 | * EXTADD is correct, EXTADR is generated by other |
|
889b1fbece5b
jabber: Handle "Extended Address" correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27965
diff
changeset
|
1075 | * clients. The next time someone reads this, remove |
|
889b1fbece5b
jabber: Handle "Extended Address" correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27965
diff
changeset
|
1076 | * EXTADR. |
|
889b1fbece5b
jabber: Handle "Extended Address" correctly.
Paul Aurich <darkrain42@pidgin.im>
parents:
27965
diff
changeset
|
1077 | */ |
|
30537
9f833935ecd7
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <markdoliner@pidgin.im>
parents:
29965
diff
changeset
|
1078 | 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
|
1079 | } 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
|
1080 | 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
|
1081 | } 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
|
1082 | 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
|
1083 | } 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
|
1084 | 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
|
1085 | } 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
|
1086 | 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
|
1087 | } else if(purple_strequal(child2->name, "CTRY") |
|
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1088 | || 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
|
1089 | purple_notify_user_info_add_pair_plaintext(user_info, _("Country"), text2); |
| 7014 | 1090 | } |
| 1091 | g_free(text2); | |
| 1092 | } | |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1093 | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1094 | 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
|
1095 | 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
|
1096 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1097 | } else if(purple_strequal(child->name, "TEL")) { |
| 7014 | 1098 | char *number; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1099 | if((child2 = purple_xmlnode_get_child(child, "NUMBER"))) { |
| 7014 | 1100 | /* 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
|
1101 | number = purple_xmlnode_get_data(child2); |
| 7014 | 1102 | 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
|
1103 | purple_notify_user_info_add_pair_plaintext(user_info, _("Telephone"), number); |
| 7014 | 1104 | g_free(number); |
| 1105 | } | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1106 | } else if((number = purple_xmlnode_get_data(child))) { |
| 15884 | 1107 | /* lots of clients (including purple) do this, but it's |
| 7014 | 1108 | * 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
|
1109 | purple_notify_user_info_add_pair_plaintext(user_info, _("Telephone"), number); |
| 7014 | 1110 | g_free(number); |
| 1111 | } | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1112 | } 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
|
1113 | 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
|
1114 | if((child2 = purple_xmlnode_get_child(child, "USERID"))) { |
| 7014 | 1115 | /* 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
|
1116 | userid = purple_xmlnode_get_data(child2); |
| 7014 | 1117 | 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
|
1118 | 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
|
1119 | 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
|
1120 | 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
|
1121 | 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
|
1122 | |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1123 | 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
|
1124 | g_free(escaped); |
| 7014 | 1125 | g_free(userid); |
| 1126 | } | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1127 | } else if((userid = purple_xmlnode_get_data(child))) { |
| 15884 | 1128 | /* lots of clients (including purple) do this, but it's |
| 7014 | 1129 | * 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
|
1130 | 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
|
1131 | |
|
19931
229fb62285b0
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <markdoliner@pidgin.im>
parents:
19921
diff
changeset
|
1132 | 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
|
1133 | 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
|
1134 | 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
|
1135 | |
|
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1136 | 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
|
1137 | g_free(escaped); |
| 7014 | 1138 | g_free(userid); |
| 1139 | } | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1140 | } else if(purple_strequal(child->name, "ORG")) { |
| 7014 | 1141 | for(child2 = child->child; child2; child2 = child2->next) |
| 1142 | { | |
| 1143 | char *text2; | |
| 1144 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1145 | if(child2->type != PURPLE_XMLNODE_TYPE_TAG) |
| 7014 | 1146 | continue; |
| 1147 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1148 | text2 = purple_xmlnode_get_data(child2); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1149 | 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
|
1150 | 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
|
1151 | } 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
|
1152 | purple_notify_user_info_add_pair_plaintext(user_info, _("Organization Unit"), text2); |
| 7014 | 1153 | } |
| 1154 | g_free(text2); | |
| 1155 | } | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1156 | } 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
|
1157 | 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
|
1158 | } 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
|
1159 | 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
|
1160 | } 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
|
1161 | 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
|
1162 | } else if(purple_strequal(child->name, "PHOTO") || |
|
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1163 | purple_strequal(child->name, "LOGO")) { |
| 10941 | 1164 | 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
|
1165 | PurpleXmlNode *binval; |
| 11361 | 1166 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1167 | 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
|
1168 | (bintext = purple_xmlnode_get_data(binval))) { |
|
11127
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10941
diff
changeset
|
1169 | gsize size; |
|
11137
cf40226ddff7
[gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents:
11127
diff
changeset
|
1170 | guchar *data; |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
1171 | gboolean photo = purple_strequal(child->name, "PHOTO"); |
| 10189 | 1172 | |
|
38341
3da74e727e78
Remove purple_base64_encode/decode() wrappers
Mike Ruprecht <cmaiku@gmail.com>
parents:
38334
diff
changeset
|
1173 | data = g_base64_decode(bintext, &size); |
|
16587
50de12a4b81b
disapproval of revision 'f95b376c0d2f066996620c5bb595dc71b5ee22d9'
Richard Laager <rlaager@pidgin.im>
parents:
16585
diff
changeset
|
1174 | if (data) { |
|
35823
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
1175 | PurpleImage *img; |
|
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
1176 | 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
|
1177 | 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
|
1178 | 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
|
1179 | |
|
39463
d47e230b9d75
Fix leaky calls to purple_image_new_from_data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38854
diff
changeset
|
1180 | img = purple_image_new_from_data(data, size); |
|
35823
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
1181 | 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
|
1182 | |
|
35823
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
1183 | jbi->vcard_images = g_slist_prepend(jbi->vcard_images, img); |
|
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
1184 | img_text = g_strdup_printf("<img src='" |
|
268a9d3b3fd7
imgstore: unref xmpp
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35499
diff
changeset
|
1185 | 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
|
1186 | |
|
32191
a4668d9dc8d1
Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents:
31694
diff
changeset
|
1187 | 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
|
1188 | |
|
38327
c842a56b9967
jabber: Port to use GChecksum instead of PurpleHash
Mike Ruprecht <cmaiku@gmail.com>
parents:
37134
diff
changeset
|
1189 | 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
|
1190 | 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
|
1191 | 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
|
1192 | g_free(img_text); |
|
16587
50de12a4b81b
disapproval of revision 'f95b376c0d2f066996620c5bb595dc71b5ee22d9'
Richard Laager <rlaager@pidgin.im>
parents:
16585
diff
changeset
|
1193 | } |
|
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
|
1194 | g_free(bintext); |
| 10941 | 1195 | } |
| 7014 | 1196 | } |
| 1197 | g_free(text); | |
| 1198 | } | |
| 1199 | } | |
| 1200 | ||
|
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
|
1201 | 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
|
1202 | 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
|
1203 | /* 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
|
1204 | 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
|
1205 | 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
|
1206 | 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
|
1207 | 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
|
1208 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1209 | |
|
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
|
1210 | 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
|
1211 | } |
|
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 | |
| 13794 | 1213 | g_free(bare_jid); |
| 1214 | ||
| 1215 | jabber_buddy_info_show_if_ready(jbi); | |
| 1216 | } | |
| 1217 | ||
| 1218 | static void jabber_buddy_info_resource_free(gpointer data) | |
| 1219 | { | |
| 1220 | JabberBuddyInfoResource *jbri = data; | |
| 1221 | g_free(jbri); | |
| 1222 | } | |
| 1223 | ||
|
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
|
1224 | 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
|
1225 | { |
|
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
|
1226 | 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
|
1227 | 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
|
1228 | 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
|
1229 | 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
|
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 | |
|
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 | 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
|
1233 | { |
|
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 | 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
|
1235 | 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
|
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 | 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
|
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 | |
|
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
|
1240 | static void jabber_version_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
|
1241 | 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
|
1242 | PurpleXmlNode *packet, gpointer data) |
| 13794 | 1243 | { |
| 1244 | 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
|
1245 | PurpleXmlNode *query; |
| 13794 | 1246 | char *resource_name; |
| 1247 | ||
| 1248 | g_return_if_fail(jbi != NULL); | |
| 1249 | ||
| 1250 | jabber_buddy_info_remove_id(jbi, id); | |
| 1251 | ||
| 1252 | if(!from) | |
| 1253 | return; | |
| 1254 | ||
| 1255 | resource_name = jabber_get_resource(from); | |
| 1256 | ||
| 1257 | 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
|
1258 | 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
|
1259 | if((query = purple_xmlnode_get_child(packet, "query"))) { |
| 13794 | 1260 | JabberBuddyResource *jbr = jabber_buddy_find_resource(jbi->jb, resource_name); |
| 1261 | if(jbr) { | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1262 | PurpleXmlNode *node; |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1263 | 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
|
1264 | jbr->client.name = purple_xmlnode_get_data(node); |
| 13794 | 1265 | } |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1266 | 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
|
1267 | jbr->client.version = purple_xmlnode_get_data(node); |
| 13794 | 1268 | } |
|
34935
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, "os"))) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1270 | jbr->client.os = purple_xmlnode_get_data(node); |
| 13794 | 1271 | } |
| 1272 | } | |
| 1273 | } | |
| 1274 | } | |
| 1275 | g_free(resource_name); | |
| 10189 | 1276 | } |
| 13794 | 1277 | |
| 1278 | jabber_buddy_info_show_if_ready(jbi); | |
| 7014 | 1279 | } |
| 1280 | ||
|
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
|
1281 | 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
|
1282 | 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
|
1283 | PurpleXmlNode *packet, gpointer data) |
| 13794 | 1284 | { |
| 1285 | 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
|
1286 | PurpleXmlNode *query; |
| 13794 | 1287 | 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
|
1288 | const char *seconds; |
| 13794 | 1289 | |
| 1290 | g_return_if_fail(jbi != NULL); | |
| 1291 | ||
| 1292 | jabber_buddy_info_remove_id(jbi, id); | |
| 1293 | ||
| 1294 | if(!from) | |
| 1295 | return; | |
| 1296 | ||
| 1297 | resource_name = jabber_get_resource(from); | |
| 1298 | ||
| 1299 | 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
|
1300 | 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
|
1301 | 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
|
1302 | seconds = purple_xmlnode_get_attrib(query, "seconds"); |
| 13794 | 1303 | if(seconds) { |
| 1304 | char *end = NULL; | |
| 1305 | 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
|
1306 | JabberBuddy *jb = NULL; |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1307 | char *resource = NULL; |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1308 | 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
|
1309 | JabberBuddyResource *jbr = NULL; |
|
26958
a955bd42f529
propagate from branch 'im.pidgin.pidgin' (head 36f75a1d52a6af5574bf847d60054a1392dcbc67)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
1310 | |
| 13794 | 1311 | if(end != seconds) { |
| 1312 | JabberBuddyInfoResource *jbir = g_hash_table_lookup(jbi->resources, resource_name); | |
| 1313 | if(jbir) { | |
| 1314 | jbir->idle_seconds = sec; | |
| 1315 | } | |
| 1316 | } | |
|
27155
53502d71efdd
Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents:
27135
diff
changeset
|
1317 | /* 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
|
1318 | 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
|
1319 | 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
|
1320 | 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
|
1321 | if (jb) { |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1322 | 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
|
1323 | 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
|
1324 | /* 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
|
1325 | 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
|
1326 | 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
|
1327 | 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
|
1328 | the resource getting unidle */ |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1329 | if (resource && buddy_name) { |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1330 | 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
|
1331 | if (jbr) { |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1332 | if (jbr->idle) { |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1333 | if (sec) { |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1334 | 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
|
1335 | } else { |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1336 | jbr->idle = 0; |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1337 | } |
|
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
|
1338 | |
|
27155
53502d71efdd
Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents:
27135
diff
changeset
|
1339 | if (jbr == |
|
27135
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1340 | jabber_buddy_find_resource(jb, NULL)) { |
|
36545
23b59a16c808
Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents:
36543
diff
changeset
|
1341 | 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
|
1342 | 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
|
1343 | } |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1344 | } |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1345 | } |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1346 | } |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1347 | g_free(resource); |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1348 | g_free(buddy_name); |
|
32f298815b9e
This whole section was partially using spaces instead of tabs.
Paul Aurich <darkrain42@pidgin.im>
parents:
27134
diff
changeset
|
1349 | } |
| 13794 | 1350 | } |
| 1351 | } | |
| 1352 | } | |
| 1353 | g_free(resource_name); | |
| 1354 | } | |
| 1355 | ||
| 1356 | jabber_buddy_info_show_if_ready(jbi); | |
| 1357 | } | |
| 1358 | ||
|
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
|
1359 | static void jabber_last_offline_parse(JabberStream *js, const char *from, |
|
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
|
1360 | 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
|
1361 | 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
|
1362 | { |
|
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
|
1363 | 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
|
1364 | 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
|
1365 | 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
|
1366 | |
|
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
|
1367 | 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
|
1368 | |
|
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 | 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
|
1370 | |
|
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
|
1371 | 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
|
1372 | 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
|
1373 | 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
|
1374 | 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
|
1375 | 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
|
1376 | 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
|
1377 | 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
|
1378 | 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
|
1379 | } |
|
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
|
1380 | } |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1381 | 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
|
1382 | } |
|
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 | } |
|
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 | |
|
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 | 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
|
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 | |
|
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
|
1388 | static void jabber_time_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
|
1389 | 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
|
1390 | PurpleXmlNode *packet, gpointer data) |
|
25822
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1391 | { |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1392 | JabberBuddyInfo *jbi = data; |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1393 | JabberBuddyResource *jbr; |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1394 | char *resource_name; |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1395 | |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1396 | 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
|
1397 | |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1398 | 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
|
1399 | |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1400 | if (!from) |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1401 | return; |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1402 | |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1403 | 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
|
1404 | 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
|
1405 | 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
|
1406 | 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
|
1407 | 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
|
1408 | 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
|
1409 | 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
|
1410 | 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
|
1411 | 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
|
1412 | 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
|
1413 | 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
|
1414 | 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
|
1415 | 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
|
1416 | } else { |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1417 | 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
|
1418 | /* [+-]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
|
1419 | 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
|
1420 | 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
|
1421 | { |
|
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
1422 | 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
|
1423 | if (!offset_positive) { |
|
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
1424 | tz_off *= -1; |
|
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
1425 | } |
|
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
1426 | |
|
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
1427 | 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
|
1428 | |
|
25827
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1429 | } else { |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1430 | 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
|
1431 | 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
|
1432 | } |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1433 | } |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1434 | |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1435 | 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
|
1436 | } |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1437 | } |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1438 | } |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1439 | |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1440 | 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
|
1441 | } |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1442 | |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1443 | void jabber_buddy_remove_all_pending_buddy_info_requests(JabberStream *js) |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1444 | { |
| 40135 | 1445 | g_slist_free_full(js->pending_buddy_info_requests, (GDestroyNotify)jabber_buddy_info_destroy); |
| 1446 | js->pending_buddy_info_requests = NULL; | |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1447 | } |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1448 | |
| 13794 | 1449 | static gboolean jabber_buddy_get_info_timeout(gpointer data) |
| 1450 | { | |
| 1451 | JabberBuddyInfo *jbi = data; | |
| 1452 | ||
| 1453 | /* remove the pending callbacks */ | |
| 1454 | while(jbi->ids) { | |
| 1455 | char *id = jbi->ids->data; | |
| 1456 | 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
|
1457 | jbi->ids = g_slist_delete_link(jbi->ids, jbi->ids); |
| 13794 | 1458 | g_free(id); |
| 1459 | } | |
| 1460 | ||
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1461 | jbi->js->pending_buddy_info_requests = g_slist_remove(jbi->js->pending_buddy_info_requests, jbi); |
| 13794 | 1462 | jbi->timeout_handle = 0; |
| 1463 | ||
| 1464 | jabber_buddy_info_show_if_ready(jbi); | |
| 1465 | ||
| 1466 | return FALSE; | |
| 1467 | } | |
| 1468 | ||
|
17029
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1469 | 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
|
1470 | { |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1471 | /* 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
|
1472 | 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
|
1473 | return FALSE; |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1474 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1475 | if(purple_strequal(ns, NS_LAST_ACTIVITY)) { |
|
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1476 | if(purple_strequal(jbr->client.name, "Trillian")) { |
|
20350
ae3f3561e698
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20320
diff
changeset
|
1477 | /* verified by nwalp 2007/05/09 */ |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1478 | 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
|
1479 | /* verified by nwalp 2007/09/19 */ |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1480 | 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
|
1481 | return TRUE; |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1482 | } |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1483 | } |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1484 | } |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1485 | |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1486 | return FALSE; |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1487 | } |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1488 | |
|
27484
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1489 | static void |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1490 | 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
|
1491 | 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
|
1492 | JabberBuddyResource *jbr) |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1493 | { |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1494 | JabberIq *iq; |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1495 | JabberBuddyInfoResource *jbir; |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1496 | char *full_jid = NULL; |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1497 | const char *to; |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1498 | |
|
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
|
1499 | 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
|
1500 | 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
|
1501 | to = full_jid; |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1502 | } else |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1503 | to = jid; |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1504 | |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1505 | 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
|
1506 | 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
|
1507 | |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1508 | if(!jbr->client.name) { |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1509 | 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
|
1510 | 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
|
1511 | 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
|
1512 | 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
|
1513 | jabber_iq_send(iq); |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1514 | } |
|
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 | /* 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
|
1517 | * 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
|
1518 | * 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
|
1519 | * 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
|
1520 | * office. */ |
|
28984
1d84517d56eb
jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents:
28883
diff
changeset
|
1521 | 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
|
1522 | 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
|
1523 | 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
|
1524 | 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
|
1525 | 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
|
1526 | jabber_iq_send(iq); |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1527 | } |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1528 | |
|
41764
5d2bc2736da2
Remove PURPLE_NO_TZ_OFF
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41314
diff
changeset
|
1529 | 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
|
1530 | (jbr->caps == NULL || |
|
f864fee87775
Remove support for XEP 0115 Legacy Format
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41764
diff
changeset
|
1531 | 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
|
1532 | PurpleXmlNode *child; |
|
27484
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1533 | 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
|
1534 | 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
|
1535 | 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
|
1536 | 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
|
1537 | 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
|
1538 | 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
|
1539 | jabber_iq_send(iq); |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1540 | } |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1541 | |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1542 | g_free(full_jid); |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1543 | } |
|
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1544 | |
| 13794 | 1545 | static void jabber_buddy_get_info_for_jid(JabberStream *js, const char *jid) |
| 7014 | 1546 | { |
| 1547 | JabberIq *iq; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1548 | PurpleXmlNode *vcard; |
| 13794 | 1549 | GList *resources; |
| 1550 | JabberBuddy *jb; | |
| 1551 | 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
|
1552 | const char *slash; |
|
27484
9bbc40783bbb
Factor the per-resource IQs out into their own function.
Paul Aurich <darkrain42@pidgin.im>
parents:
27418
diff
changeset
|
1553 | gboolean is_bare_jid; |
| 13794 | 1554 | |
| 1555 | jb = jabber_buddy_find(js, jid, TRUE); | |
| 1556 | ||
| 1557 | /* invalid JID */ | |
| 1558 | if(!jb) | |
| 1559 | return; | |
| 1560 | ||
|
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
|
1561 | 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
|
1562 | 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
|
1563 | |
| 13794 | 1564 | jbi = g_new0(JabberBuddyInfo, 1); |
| 1565 | jbi->jid = g_strdup(jid); | |
| 1566 | jbi->js = js; | |
| 1567 | 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
|
1568 | 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
|
1569 | jbi->user_info = purple_notify_user_info_new(); |
| 7014 | 1570 | |
| 1571 | iq = jabber_iq_new(js, JABBER_IQ_GET); | |
| 1572 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1573 | 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
|
1574 | 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
|
1575 | purple_xmlnode_set_namespace(vcard, "vcard-temp"); |
| 7014 | 1576 | |
| 13794 | 1577 | jabber_iq_set_callback(iq, jabber_vcard_parse, jbi); |
| 1578 | jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); | |
| 7014 | 1579 | |
| 1580 | jabber_iq_send(iq); | |
| 13794 | 1581 | |
|
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
|
1582 | 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
|
1583 | if (jb->resources) { |
|
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1584 | 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
|
1585 | 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
|
1586 | 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
|
1587 | } |
|
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1588 | } else { |
|
22b6cd68c156
jabber: Fix getting info on your own JID, under some circumstances.
Paul Aurich <darkrain42@pidgin.im>
parents:
29184
diff
changeset
|
1589 | /* 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
|
1590 | 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
|
1591 | 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
|
1592 | 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
|
1593 | 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
|
1594 | 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
|
1595 | } |
|
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
|
1596 | } 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
|
1597 | 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
|
1598 | 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
|
1599 | 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
|
1600 | 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
|
1601 | 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
|
1602 | "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
|
1603 | "JabberBuddyResource!\n", jid); |
| 13794 | 1604 | } |
| 1605 | ||
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1606 | 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
|
1607 | jbi->timeout_handle = g_timeout_add_seconds(30, jabber_buddy_get_info_timeout, jbi); |
| 7014 | 1608 | } |
| 1609 | ||
|
40708
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
1610 | void |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
1611 | jabber_buddy_get_info(PurpleProtocolServer *protocol_server, |
|
53a26c29d26c
Move the PurpleProtocolServer interface to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40634
diff
changeset
|
1612 | PurpleConnection *gc, const char *who) |
| 10189 | 1613 | { |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1614 | 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
|
1615 | 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
|
1616 | |
|
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
|
1617 | 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
|
1618 | return; |
| 10189 | 1619 | |
|
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
|
1620 | 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
|
1621 | /* 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
|
1622 | 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
|
1623 | } 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
|
1624 | char *bare_jid = jabber_get_bare_jid(who); |
| 10189 | 1625 | jabber_buddy_get_info_for_jid(js, bare_jid); |
| 1626 | g_free(bare_jid); | |
| 1627 | } | |
|
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
|
1628 | |
|
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 | jabber_id_free(jid); |
| 10189 | 1630 | } |
| 1631 | ||
| 7014 | 1632 | static void jabber_buddy_set_invisibility(JabberStream *js, const char *who, |
| 1633 | gboolean invisible) | |
| 1634 | { | |
| 15884 | 1635 | PurplePresence *gpresence; |
| 1636 | PurpleAccount *account; | |
| 1637 | PurpleStatus *status; | |
| 7014 | 1638 | 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
|
1639 | PurpleXmlNode *presence; |
| 9954 | 1640 | JabberBuddyState state; |
| 14525 | 1641 | char *msg; |
| 9954 | 1642 | int priority; |
| 7014 | 1643 | |
| 15884 | 1644 | account = purple_connection_get_account(js->gc); |
| 1645 | gpresence = purple_account_get_presence(account); | |
| 1646 | status = purple_presence_get_active_status(gpresence); | |
|
9944
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9797
diff
changeset
|
1647 | |
| 15884 | 1648 | 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
|
1649 | presence = jabber_presence_create_js(js, state, msg, priority); |
| 9954 | 1650 | |
| 14525 | 1651 | g_free(msg); |
| 1652 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1653 | purple_xmlnode_set_attrib(presence, "to", who); |
| 7014 | 1654 | if(invisible) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1655 | purple_xmlnode_set_attrib(presence, "type", "invisible"); |
| 7014 | 1656 | jb->invisible |= JABBER_INVIS_BUDDY; |
| 1657 | } else { | |
| 1658 | jb->invisible &= ~JABBER_INVIS_BUDDY; | |
| 1659 | } | |
| 1660 | ||
| 1661 | 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
|
1662 | purple_xmlnode_free(presence); |
| 7014 | 1663 | } |
| 1664 | ||
| 15884 | 1665 | static void jabber_buddy_make_invisible(PurpleBlistNode *node, gpointer data) |
| 7014 | 1666 | { |
| 15884 | 1667 | PurpleBuddy *buddy; |
| 1668 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1669 | JabberStream *js; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1670 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33661
diff
changeset
|
1671 | g_return_if_fail(PURPLE_IS_BUDDY(node)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1672 | |
| 15884 | 1673 | buddy = (PurpleBuddy *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1674 | 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
|
1675 | js = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1676 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1677 | jabber_buddy_set_invisibility(js, purple_buddy_get_name(buddy), TRUE); |
| 7014 | 1678 | } |
| 1679 | ||
| 15884 | 1680 | static void jabber_buddy_make_visible(PurpleBlistNode *node, gpointer data) |
| 7014 | 1681 | { |
| 15884 | 1682 | PurpleBuddy *buddy; |
| 1683 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1684 | JabberStream *js; |
| 7014 | 1685 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33661
diff
changeset
|
1686 | g_return_if_fail(PURPLE_IS_BUDDY(node)); |
| 7014 | 1687 | |
| 15884 | 1688 | buddy = (PurpleBuddy *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1689 | 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
|
1690 | js = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1691 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1692 | jabber_buddy_set_invisibility(js, purple_buddy_get_name(buddy), FALSE); |
| 7014 | 1693 | } |
| 1694 | ||
|
28058
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1695 | static void cancel_presence_notification(gpointer data) |
| 7014 | 1696 | { |
| 15884 | 1697 | PurpleBuddy *buddy; |
| 1698 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1699 | JabberStream *js; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1700 | |
|
28058
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1701 | buddy = data; |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1702 | 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
|
1703 | 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
|
1704 | |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1705 | 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
|
1706 | } |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1707 | |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1708 | static void |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1709 | jabber_buddy_cancel_presence_notification(PurpleBlistNode *node, |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1710 | gpointer data) |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1711 | { |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1712 | PurpleBuddy *buddy; |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1713 | PurpleAccount *account; |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1714 | PurpleConnection *gc; |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1715 | const gchar *name; |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1716 | char *msg; |
|
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1717 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33661
diff
changeset
|
1718 | g_return_if_fail(PURPLE_IS_BUDDY(node)); |
| 7014 | 1719 | |
| 15884 | 1720 | buddy = (PurpleBuddy *) node; |
|
28058
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1721 | 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
|
1722 | 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
|
1723 | gc = purple_account_get_connection(account); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1724 | |
|
28058
52eb7bf6e375
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1725 | 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
|
1726 | "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
|
1727 | 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
|
1728 | 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
|
1729 | 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
|
1730 | g_free(msg); |
| 7014 | 1731 | } |
| 1732 | ||
| 15884 | 1733 | static void jabber_buddy_rerequest_auth(PurpleBlistNode *node, gpointer data) |
| 7250 | 1734 | { |
| 15884 | 1735 | PurpleBuddy *buddy; |
| 1736 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1737 | JabberStream *js; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1738 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33661
diff
changeset
|
1739 | g_return_if_fail(PURPLE_IS_BUDDY(node)); |
| 7250 | 1740 | |
| 15884 | 1741 | buddy = (PurpleBuddy *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1742 | 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
|
1743 | js = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1744 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1745 | jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "subscribe"); |
| 7250 | 1746 | } |
| 1747 | ||
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1748 | |
| 15884 | 1749 | static void jabber_buddy_unsubscribe(PurpleBlistNode *node, gpointer data) |
| 7014 | 1750 | { |
| 15884 | 1751 | PurpleBuddy *buddy; |
| 1752 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1753 | JabberStream *js; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1754 | |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33661
diff
changeset
|
1755 | g_return_if_fail(PURPLE_IS_BUDDY(node)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1756 | |
| 15884 | 1757 | buddy = (PurpleBuddy *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1758 | 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
|
1759 | js = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1760 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1761 | 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
|
1762 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1763 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1764 | static void jabber_buddy_login(PurpleBlistNode *node, gpointer data) { |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33661
diff
changeset
|
1765 | 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
|
1766 | /* 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
|
1767 | PurpleBuddy *buddy = (PurpleBuddy *) node; |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1768 | 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
|
1769 | 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
|
1770 | 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
|
1771 | 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
|
1772 | 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
|
1773 | PurpleXmlNode *presence; |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1774 | JabberBuddyState state; |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1775 | char *msg; |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1776 | 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
|
1777 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1778 | 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
|
1779 | 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
|
1780 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1781 | 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
|
1782 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1783 | 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
|
1784 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1785 | 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
|
1786 | 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
|
1787 | } |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1788 | } |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1789 | |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1790 | static void jabber_buddy_logout(PurpleBlistNode *node, gpointer data) { |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33661
diff
changeset
|
1791 | 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
|
1792 | /* 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
|
1793 | PurpleBuddy *buddy = (PurpleBuddy *) node; |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1794 | 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
|
1795 | 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
|
1796 | 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
|
1797 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1798 | 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
|
1799 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1800 | 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
|
1801 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1802 | 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
|
1803 | 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
|
1804 | } |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1805 | } |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1806 | |
| 15884 | 1807 | static GList *jabber_buddy_menu(PurpleBuddy *buddy) |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1808 | { |
|
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); |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1811 | 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
|
1812 | 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
|
1813 | GList *jbrs; |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1814 | |
| 7014 | 1815 | GList *m = NULL; |
|
39481
4db28449567d
Rename PurpleMenuAction to PurpleActionMenu
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
1816 | PurpleActionMenu *act; |
| 7395 | 1817 | |
| 1818 | if(!jb) | |
| 1819 | return m; | |
| 1820 | ||
|
29849
d7b910200dc5
jabber: Treat the version properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29811
diff
changeset
|
1821 | 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
|
1822 | jb != js->user_jb) { |
| 8166 | 1823 | 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
|
1824 | 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
|
1825 | G_CALLBACK(jabber_buddy_make_visible), |
| 12919 | 1826 | NULL, NULL); |
| 8166 | 1827 | } else { |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
1828 | 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
|
1829 | G_CALLBACK(jabber_buddy_make_invisible), |
| 13019 | 1830 | NULL, NULL); |
| 8166 | 1831 | } |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1832 | m = g_list_append(m, act); |
| 7014 | 1833 | } |
| 1834 | ||
|
28071
a0706162fefd
jabber: Store the "own JabberBuddy" in the JabberStream* struct.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1835 | 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
|
1836 | 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
|
1837 | G_CALLBACK(jabber_buddy_cancel_presence_notification), |
| 12919 | 1838 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1839 | m = g_list_append(m, act); |
| 7014 | 1840 | } |
| 1841 | ||
| 1842 | 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
|
1843 | 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
|
1844 | G_CALLBACK(jabber_buddy_rerequest_auth), |
| 12919 | 1845 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1846 | m = g_list_append(m, act); |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1847 | |
|
28071
a0706162fefd
jabber: Store the "own JabberBuddy" in the JabberStream* struct.
Paul Aurich <darkrain42@pidgin.im>
parents:
28046
diff
changeset
|
1848 | } else if (jb != js->user_jb) { |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1849 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1850 | /* shouldn't this just happen automatically when the buddy is |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1851 | removed? */ |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
1852 | 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
|
1853 | G_CALLBACK(jabber_buddy_unsubscribe), |
| 12919 | 1854 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1855 | m = g_list_append(m, act); |
| 7014 | 1856 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1857 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1858 | /* |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1859 | * 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
|
1860 | * |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1861 | * 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
|
1862 | * 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
|
1863 | * 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
|
1864 | * 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
|
1865 | * |
|
8225f2507058
strchr() is safe when searching for an ASCII character in UTF8 strings.
Paul Aurich <darkrain42@pidgin.im>
parents:
28984
diff
changeset
|
1866 | * 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
|
1867 | */ |
|
29059
8225f2507058
strchr() is safe when searching for an ASCII character in UTF8 strings.
Paul Aurich <darkrain42@pidgin.im>
parents:
28984
diff
changeset
|
1868 | if (strchr(name, '@') == NULL) { |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
1869 | 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
|
1870 | 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
|
1871 | NULL, NULL); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1872 | 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
|
1873 | 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
|
1874 | 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
|
1875 | NULL, NULL); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1876 | 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
|
1877 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1878 | |
|
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
|
1879 | /* 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
|
1880 | 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
|
1881 | 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
|
1882 | 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
|
1883 | 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
|
1884 | 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
|
1885 | 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
|
1886 | JabberAdHocCommands *cmd = commands->data; |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41311
diff
changeset
|
1887 | 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
|
1888 | 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
|
1889 | } |
|
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
|
1890 | } |
| 7014 | 1891 | |
| 1892 | return m; | |
| 1893 | } | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1894 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1895 | GList * |
|
40634
4d3018b00ad4
Fix the PurpleProtocolClient interface and split it out to its own file.
Gary Kramlich <grim@reaperworld.com>
parents:
40551
diff
changeset
|
1896 | jabber_blist_node_menu(PurpleProtocolClient *client, PurpleBlistNode *node) |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1897 | { |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33661
diff
changeset
|
1898 | if(PURPLE_IS_BUDDY(node)) { |
| 15884 | 1899 | return jabber_buddy_menu((PurpleBuddy *) node); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1900 | } else { |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1901 | return NULL; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1902 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1903 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1904 | |
| 12683 | 1905 | |
| 15884 | 1906 | static void user_search_result_add_buddy_cb(PurpleConnection *gc, GList *row, void *user_data) |
| 11675 | 1907 | { |
| 1908 | /* XXX find out the jid */ | |
| 15884 | 1909 | purple_blist_request_add_buddy(purple_connection_get_account(gc), |
| 11675 | 1910 | g_list_nth_data(row, 0), NULL, NULL); |
| 1911 | } | |
| 1912 | ||
|
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
|
1913 | static void user_search_result_cb(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
|
1914 | 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
|
1915 | PurpleXmlNode *packet, gpointer data) |
| 11675 | 1916 | { |
| 15884 | 1917 | PurpleNotifySearchResults *results; |
| 1918 | PurpleNotifySearchColumn *column; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1919 | PurpleXmlNode *x, *query, *item, *field; |
| 11675 | 1920 | |
| 1921 | /* XXX error checking? */ | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1922 | if(!(query = purple_xmlnode_get_child(packet, "query"))) |
| 11675 | 1923 | return; |
| 1924 | ||
| 15884 | 1925 | results = purple_notify_searchresults_new(); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1926 | if((x = purple_xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1927 | PurpleXmlNode *reported; |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1928 | GSList *column_vars = NULL; |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1929 | |
| 15884 | 1930 | purple_debug_info("jabber", "new-skool\n"); |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1931 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1932 | if((reported = purple_xmlnode_get_child(x, "reported"))) { |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1933 | PurpleXmlNode *field = purple_xmlnode_get_child(reported, "field"); |
| 11675 | 1934 | while(field) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1935 | const char *var = purple_xmlnode_get_attrib(field, "var"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1936 | const char *label = purple_xmlnode_get_attrib(field, "label"); |
| 11675 | 1937 | if(var) { |
| 15884 | 1938 | column = purple_notify_searchresults_column_new(label ? label : var); |
| 1939 | purple_notify_searchresults_column_add(results, column); | |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1940 | column_vars = g_slist_append(column_vars, (char *)var); |
| 11675 | 1941 | } |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1942 | field = purple_xmlnode_get_next_twin(field); |
| 11675 | 1943 | } |
| 1944 | } | |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1945 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1946 | item = purple_xmlnode_get_child(x, "item"); |
| 11675 | 1947 | while(item) { |
| 1948 | GList *row = NULL; | |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1949 | GSList *l; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1950 | PurpleXmlNode *valuenode; |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1951 | const char *var; |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1952 | |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1953 | for (l = column_vars; l != NULL; l = l->next) { |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1954 | /* |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1955 | * Build a row containing the strings that correspond |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1956 | * to each column of the search results. |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1957 | */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1958 | for (field = purple_xmlnode_get_child(item, "field"); |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1959 | field != NULL; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1960 | field = purple_xmlnode_get_next_twin(field)) |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1961 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1962 | if ((var = purple_xmlnode_get_attrib(field, "var")) && |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
1963 | purple_strequal(var, l->data) && |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1964 | (valuenode = purple_xmlnode_get_child(field, "value"))) |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1965 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1966 | char *value = purple_xmlnode_get_data(valuenode); |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1967 | row = g_list_append(row, value); |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1968 | break; |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1969 | } |
| 11675 | 1970 | } |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1971 | if (field == NULL) |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1972 | /* No data for this column */ |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1973 | row = g_list_append(row, NULL); |
| 11675 | 1974 | } |
| 15884 | 1975 | purple_notify_searchresults_row_add(results, row); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1976 | item = purple_xmlnode_get_next_twin(item); |
| 11675 | 1977 | } |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1978 | |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
1979 | g_slist_free(column_vars); |
| 11675 | 1980 | } else { |
| 1981 | /* old skool */ | |
| 15884 | 1982 | purple_debug_info("jabber", "old-skool\n"); |
| 11675 | 1983 | |
| 15884 | 1984 | column = purple_notify_searchresults_column_new(_("JID")); |
| 1985 | purple_notify_searchresults_column_add(results, column); | |
| 1986 | column = purple_notify_searchresults_column_new(_("First Name")); | |
| 1987 | purple_notify_searchresults_column_add(results, column); | |
| 1988 | column = purple_notify_searchresults_column_new(_("Last Name")); | |
| 1989 | purple_notify_searchresults_column_add(results, column); | |
| 1990 | column = purple_notify_searchresults_column_new(_("Nickname")); | |
| 1991 | purple_notify_searchresults_column_add(results, column); | |
|
23325
a374a26fe217
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@pidgin.im>
parents:
23026
diff
changeset
|
1992 | column = purple_notify_searchresults_column_new(_("Email")); |
| 15884 | 1993 | purple_notify_searchresults_column_add(results, column); |
| 11675 | 1994 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1995 | for(item = purple_xmlnode_get_child(query, "item"); item; item = purple_xmlnode_get_next_twin(item)) { |
| 11675 | 1996 | const char *jid; |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
1997 | PurpleXmlNode *node; |
| 11675 | 1998 | GList *row = NULL; |
| 1999 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2000 | if(!(jid = purple_xmlnode_get_attrib(item, "jid"))) |
| 11675 | 2001 | continue; |
| 2002 | ||
| 2003 | row = g_list_append(row, g_strdup(jid)); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2004 | node = purple_xmlnode_get_child(item, "first"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2005 | row = g_list_append(row, node ? purple_xmlnode_get_data(node) : NULL); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2006 | node = purple_xmlnode_get_child(item, "last"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2007 | row = g_list_append(row, node ? purple_xmlnode_get_data(node) : NULL); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2008 | node = purple_xmlnode_get_child(item, "nick"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2009 | row = g_list_append(row, node ? purple_xmlnode_get_data(node) : NULL); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2010 | node = purple_xmlnode_get_child(item, "email"); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2011 | row = g_list_append(row, node ? purple_xmlnode_get_data(node) : NULL); |
|
22622
1ecb840b5101
Fix a bunch of compiler warnings caused by my addition of G_GNUC_PRINTF()
Mark Doliner <markdoliner@pidgin.im>
parents:
22586
diff
changeset
|
2012 | purple_debug_info("jabber", "row=%p\n", row); |
| 15884 | 2013 | purple_notify_searchresults_row_add(results, row); |
| 11675 | 2014 | } |
| 2015 | } | |
| 2016 | ||
| 15884 | 2017 | purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD, |
| 11675 | 2018 | user_search_result_add_buddy_cb); |
| 2019 | ||
| 15884 | 2020 | purple_notify_searchresults(js->gc, NULL, NULL, _("The following are the results of your search"), results, NULL, NULL); |
| 11675 | 2021 | } |
| 2022 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2023 | static void user_search_x_data_cb(JabberStream *js, PurpleXmlNode *result, gpointer data) |
| 11675 | 2024 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2025 | PurpleXmlNode *query; |
| 11675 | 2026 | JabberIq *iq; |
| 13345 | 2027 | char *dir_server = data; |
|
21388
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2028 | const char *type; |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2029 | |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2030 | /* if they've cancelled the search, we're |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2031 | * just going to get an error if we send |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2032 | * a cancel, so skip it */ |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2033 | type = purple_xmlnode_get_attrib(result, "type"); |
| 38260 | 2034 | if(purple_strequal(type, "cancel")) { |
|
21388
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2035 | g_free(dir_server); |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2036 | return; |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2037 | } |
| 11675 | 2038 | |
| 2039 | iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:search"); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2040 | query = purple_xmlnode_get_child(iq->node, "query"); |
| 11675 | 2041 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2042 | purple_xmlnode_insert_child(query, result); |
| 11675 | 2043 | |
| 2044 | jabber_iq_set_callback(iq, user_search_result_cb, NULL); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2045 | purple_xmlnode_set_attrib(iq->node, "to", dir_server); |
| 11675 | 2046 | jabber_iq_send(iq); |
| 13345 | 2047 | g_free(dir_server); |
| 11675 | 2048 | } |
| 2049 | ||
| 2050 | struct user_search_info { | |
| 2051 | JabberStream *js; | |
| 2052 | char *directory_server; | |
| 2053 | }; | |
| 2054 | ||
| 15884 | 2055 | static void user_search_cancel_cb(struct user_search_info *usi, PurpleRequestFields *fields) |
| 11675 | 2056 | { |
| 2057 | g_free(usi->directory_server); | |
| 2058 | g_free(usi); | |
| 2059 | } | |
| 2060 | ||
| 15884 | 2061 | static void user_search_cb(struct user_search_info *usi, PurpleRequestFields *fields) |
| 11675 | 2062 | { |
| 2063 | JabberStream *js = usi->js; | |
| 2064 | JabberIq *iq; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2065 | PurpleXmlNode *query; |
| 11675 | 2066 | GList *groups, *flds; |
| 2067 | ||
| 2068 | iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:search"); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2069 | query = purple_xmlnode_get_child(iq->node, "query"); |
| 11675 | 2070 | |
| 15884 | 2071 | for(groups = purple_request_fields_get_groups(fields); groups; groups = groups->next) { |
| 2072 | for(flds = purple_request_field_group_get_fields(groups->data); | |
| 11675 | 2073 | flds; flds = flds->next) { |
| 15884 | 2074 | PurpleRequestField *field = flds->data; |
| 2075 | const char *id = purple_request_field_get_id(field); | |
| 2076 | const char *value = purple_request_field_string_get_value(field); | |
| 11675 | 2077 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
2078 | if(value && (purple_strequal(id, "first") || purple_strequal(id, "last") || purple_strequal(id, "nick") || purple_strequal(id, "email"))) { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2079 | PurpleXmlNode *y = purple_xmlnode_new_child(query, id); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2080 | purple_xmlnode_insert_data(y, value, -1); |
| 11675 | 2081 | } |
| 2082 | } | |
| 2083 | } | |
| 2084 | ||
| 2085 | jabber_iq_set_callback(iq, user_search_result_cb, NULL); | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2086 | purple_xmlnode_set_attrib(iq->node, "to", usi->directory_server); |
| 11675 | 2087 | jabber_iq_send(iq); |
| 2088 | ||
| 2089 | g_free(usi->directory_server); | |
| 2090 | g_free(usi); | |
| 2091 | } | |
| 2092 | ||
|
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
|
2093 | static void user_search_fields_result_cb(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
|
2094 | 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
|
2095 | PurpleXmlNode *packet, gpointer data) |
| 11675 | 2096 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2097 | PurpleXmlNode *query, *x; |
| 11675 | 2098 | |
|
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
|
2099 | if (!from) |
| 11675 | 2100 | return; |
| 2101 | ||
|
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
|
2102 | if (type == JABBER_IQ_ERROR) { |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20350
diff
changeset
|
2103 | char *msg = jabber_parse_error(js, packet, NULL); |
| 13794 | 2104 | |
|
13634
e9f9cef982d7
[gaim-migrate @ 16031]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13619
diff
changeset
|
2105 | if(!msg) |
|
e9f9cef982d7
[gaim-migrate @ 16031]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13619
diff
changeset
|
2106 | msg = g_strdup(_("Unknown error")); |
|
e9f9cef982d7
[gaim-migrate @ 16031]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13619
diff
changeset
|
2107 | |
| 15884 | 2108 | purple_notify_error(js->gc, _("Directory Query Failed"), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
2109 | _("Could not query the directory server."), msg, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
2110 | purple_request_cpar_from_connection(js->gc)); |
|
13634
e9f9cef982d7
[gaim-migrate @ 16031]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13619
diff
changeset
|
2111 | g_free(msg); |
|
e9f9cef982d7
[gaim-migrate @ 16031]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13619
diff
changeset
|
2112 | |
| 13345 | 2113 | return; |
| 2114 | } | |
| 2115 | ||
| 11675 | 2116 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2117 | if(!(query = purple_xmlnode_get_child(packet, "query"))) |
| 11675 | 2118 | return; |
| 2119 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2120 | if((x = purple_xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { |
| 13345 | 2121 | jabber_x_data_request(js, x, user_search_x_data_cb, g_strdup(from)); |
| 11675 | 2122 | return; |
| 2123 | } else { | |
| 2124 | struct user_search_info *usi; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2125 | PurpleXmlNode *instnode; |
|
13617
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2126 | char *instructions = NULL; |
| 15884 | 2127 | PurpleRequestFields *fields; |
| 2128 | PurpleRequestFieldGroup *group; | |
| 2129 | PurpleRequestField *field; | |
| 11675 | 2130 | |
| 2131 | /* old skool */ | |
| 15884 | 2132 | fields = purple_request_fields_new(); |
| 2133 | group = purple_request_field_group_new(NULL); | |
| 2134 | purple_request_fields_add_group(fields, group); | |
| 11675 | 2135 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2136 | if((instnode = purple_xmlnode_get_child(query, "instructions"))) |
|
13574
433001d94e3e
[gaim-migrate @ 15952]
Richard Laager <rlaager@pidgin.im>
parents:
13572
diff
changeset
|
2137 | { |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2138 | char *tmp = purple_xmlnode_get_data(instnode); |
| 13794 | 2139 | |
|
13617
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2140 | if(tmp) |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2141 | { |
| 13794 | 2142 | /* Try to translate the message (see static message |
|
13617
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2143 | list in jabber_user_dir_comments[]) */ |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2144 | instructions = g_strdup_printf(_("Server Instructions: %s"), _(tmp)); |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2145 | g_free(tmp); |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2146 | } |
|
13574
433001d94e3e
[gaim-migrate @ 15952]
Richard Laager <rlaager@pidgin.im>
parents:
13572
diff
changeset
|
2147 | } |
| 13794 | 2148 | |
|
13617
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2149 | if(!instructions) |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2150 | { |
| 11675 | 2151 | instructions = g_strdup(_("Fill in one or more fields to search " |
|
16961
b6955f946f8f
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@pidgin.im>
parents:
16799
diff
changeset
|
2152 | "for any matching XMPP users.")); |
|
13617
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2153 | } |
| 11675 | 2154 | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2155 | if(purple_xmlnode_get_child(query, "first")) { |
| 15884 | 2156 | field = purple_request_field_string_new("first", _("First Name"), |
| 11675 | 2157 | NULL, FALSE); |
| 15884 | 2158 | purple_request_field_group_add_field(group, field); |
| 11675 | 2159 | } |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2160 | if(purple_xmlnode_get_child(query, "last")) { |
| 15884 | 2161 | field = purple_request_field_string_new("last", _("Last Name"), |
| 11675 | 2162 | NULL, FALSE); |
| 15884 | 2163 | purple_request_field_group_add_field(group, field); |
| 11675 | 2164 | } |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2165 | if(purple_xmlnode_get_child(query, "nick")) { |
| 15884 | 2166 | field = purple_request_field_string_new("nick", _("Nickname"), |
| 11675 | 2167 | NULL, FALSE); |
| 15884 | 2168 | purple_request_field_group_add_field(group, field); |
| 11675 | 2169 | } |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2170 | if(purple_xmlnode_get_child(query, "email")) { |
|
23325
a374a26fe217
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@pidgin.im>
parents:
23026
diff
changeset
|
2171 | field = purple_request_field_string_new("email", _("Email Address"), |
| 11675 | 2172 | NULL, FALSE); |
| 15884 | 2173 | purple_request_field_group_add_field(group, field); |
| 11675 | 2174 | } |
| 2175 | ||
| 2176 | usi = g_new0(struct user_search_info, 1); | |
| 2177 | usi->js = js; | |
| 2178 | usi->directory_server = g_strdup(from); | |
| 2179 | ||
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
2180 | purple_request_fields(js->gc, _("Search for XMPP users"), |
|
16961
b6955f946f8f
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@pidgin.im>
parents:
16799
diff
changeset
|
2181 | _("Search for XMPP users"), instructions, fields, |
| 11675 | 2182 | _("Search"), G_CALLBACK(user_search_cb), |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
15884
diff
changeset
|
2183 | _("Cancel"), G_CALLBACK(user_search_cancel_cb), |
|
34332
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
2184 | purple_request_cpar_from_connection(js->gc), |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
2185 | usi); |
| 11675 | 2186 | |
| 2187 | g_free(instructions); | |
| 2188 | } | |
| 2189 | } | |
| 2190 | ||
|
41791
3bf884522663
xmpp: Remove unused prototypes and code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41789
diff
changeset
|
2191 | static void |
|
3bf884522663
xmpp: Remove unused prototypes and code
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41789
diff
changeset
|
2192 | jabber_user_search(JabberStream *js, const char *directory) |
| 11675 | 2193 | { |
| 2194 | JabberIq *iq; | |
| 2195 | ||
| 2196 | /* XXX: should probably better validate the directory we're given */ | |
| 2197 | if(!directory || !*directory) { | |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
2198 | purple_notify_error(js->gc, _("Invalid Directory"), |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
2199 | _("Invalid Directory"), NULL, |
|
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
2200 | purple_request_cpar_from_connection(js->gc)); |
| 11675 | 2201 | return; |
| 2202 | } | |
| 2203 | ||
|
31660
fd970a73f5ff
jabber: Remember the last-used user directory. Closes #12451
Keith Moyer <pidgin@keithmoyer.com>
parents:
31318
diff
changeset
|
2204 | /* If the value provided isn't the disco#info default, persist it. Otherwise, |
|
fd970a73f5ff
jabber: Remember the last-used user directory. Closes #12451
Keith Moyer <pidgin@keithmoyer.com>
parents:
31318
diff
changeset
|
2205 | make sure we aren't persisting an old value */ |
|
fd970a73f5ff
jabber: Remember the last-used user directory. Closes #12451
Keith Moyer <pidgin@keithmoyer.com>
parents:
31318
diff
changeset
|
2206 | if(js->user_directories && js->user_directories->data && |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38256
diff
changeset
|
2207 | purple_strequal(directory, js->user_directories->data)) { |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32277
diff
changeset
|
2208 | purple_account_set_string(purple_connection_get_account(js->gc), "user_directory", ""); |
|
31660
fd970a73f5ff
jabber: Remember the last-used user directory. Closes #12451
Keith Moyer <pidgin@keithmoyer.com>
parents:
31318
diff
changeset
|
2209 | } |
|
fd970a73f5ff
jabber: Remember the last-used user directory. Closes #12451
Keith Moyer <pidgin@keithmoyer.com>
parents:
31318
diff
changeset
|
2210 | else { |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32277
diff
changeset
|
2211 | purple_account_set_string(purple_connection_get_account(js->gc), "user_directory", directory); |
|
31660
fd970a73f5ff
jabber: Remember the last-used user directory. Closes #12451
Keith Moyer <pidgin@keithmoyer.com>
parents:
31318
diff
changeset
|
2212 | } |
|
fd970a73f5ff
jabber: Remember the last-used user directory. Closes #12451
Keith Moyer <pidgin@keithmoyer.com>
parents:
31318
diff
changeset
|
2213 | |
| 11675 | 2214 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:search"); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
2215 | purple_xmlnode_set_attrib(iq->node, "to", directory); |
| 11675 | 2216 | |
| 2217 | jabber_iq_set_callback(iq, user_search_fields_result_cb, NULL); | |
| 2218 | ||
| 2219 | jabber_iq_send(iq); | |
| 2220 | } | |
| 2221 | ||
|
41789
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2222 | void |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2223 | jabber_user_search_begin(G_GNUC_UNUSED GSimpleAction *action, |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2224 | GVariant *parameter, G_GNUC_UNUSED gpointer data) |
| 11675 | 2225 | { |
|
41789
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2226 | const char *account_id = NULL; |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2227 | PurpleAccountManager *manager = NULL; |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2228 | PurpleAccount *account = NULL; |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2229 | PurpleConnection *connection = NULL; |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2230 | JabberStream *js = NULL; |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2231 | const char *def_val = NULL; |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2232 | |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2233 | 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
|
2234 | g_critical("XMPP User Search 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
|
2235 | 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
|
2236 | } |
| 11675 | 2237 | |
|
41789
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2238 | 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
|
2239 | 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
|
2240 | 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
|
2241 | 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
|
2242 | |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2243 | js = purple_connection_get_protocol_data(connection); |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2244 | def_val = purple_account_get_string(account, "user_directory", ""); |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2245 | if(*def_val == '\0' && js->user_directories) { |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2246 | def_val = js->user_directories->data; |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2247 | } |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2248 | |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2249 | purple_request_input(connection, _("Enter a User Directory"), |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2250 | _("Enter a User Directory"), |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2251 | _("Select a user directory to search"), |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2252 | def_val, FALSE, FALSE, NULL, |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2253 | _("Search Directory"), G_CALLBACK(jabber_user_search), |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2254 | _("Cancel"), NULL, |
|
7e73a8cc44e2
xmpp: Port static actions to PurpleProtocolActionsInterface
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41784
diff
changeset
|
2255 | NULL, js); |
| 11675 | 2256 | } |
| 13794 | 2257 | |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2258 | 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
|
2259 | 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
|
2260 | { |
|
41784
f864fee87775
Remove support for XEP 0115 Legacy Format
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41764
diff
changeset
|
2261 | 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
|
2262 | } |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28828
diff
changeset
|
2263 | |
|
27cc8217e86e
jabber: Determine if a buddy can receive a file transfer (when we have
Marcus Lundblad <malu@pidgin.im>
parents:
28828
diff
changeset
|
2264 | gboolean |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2265 | 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
|
2266 | { |
|
24802
eb481e98ac6a
Sprinkle jabber_resource_has_capability in places
Paul Aurich <darkrain42@pidgin.im>
parents:
24732
diff
changeset
|
2267 | const GList *node = NULL; |
| 13794 | 2268 | |
|
41784
f864fee87775
Remove support for XEP 0115 Legacy Format
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41764
diff
changeset
|
2269 | if (jbr->caps == NULL) { |
|
27696
2cd9b9331f06
Lower the severity of this message.
Paul Aurich <darkrain42@pidgin.im>
parents:
27619
diff
changeset
|
2270 | 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
|
2271 | "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
|
2272 | return FALSE; |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2273 | } |
| 13794 | 2274 | |
|
41784
f864fee87775
Remove support for XEP 0115 Legacy Format
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41764
diff
changeset
|
2275 | 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
|
2276 | return (node != NULL); |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2277 | } |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2278 | |
|
25577
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
2279 | const gchar * |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
2280 | 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
|
2281 | const gchar *category) |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
2282 | { |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
2283 | const GList *iter = NULL; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30014
diff
changeset
|
2284 | |
|
41784
f864fee87775
Remove support for XEP 0115 Legacy Format
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41764
diff
changeset
|
2285 | if (jbr->caps != NULL) { |
|
f864fee87775
Remove support for XEP 0115 Legacy Format
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41764
diff
changeset
|
2286 | 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
|
2287 | const JabberIdentity *identity = |
|
27286
f637c4c27815
Fixup after propagating new caps stuff
Marcus Lundblad <malu@pidgin.im>
parents:
27285
diff
changeset
|
2288 | (JabberIdentity *) iter->data; |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30014
diff
changeset
|
2289 | |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
2290 | 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
|
2291 | return identity->type; |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
2292 | } |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
2293 | } |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
2294 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30014
diff
changeset
|
2295 | |
|
25577
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
2296 | return NULL; |
|
ca0b40451bbc
Set a value "type" in the ui_info hash table
Marcus Lundblad <malu@pidgin.im>
parents:
25575
diff
changeset
|
2297 | } |