Mercurial > pidgin.yaz
annotate libpurple/protocols/jabber/buddy.c @ 29091:b0fb53868142
jabber: Handle the case where the server success-with-data is sent as a challenge/response pair.
This should also make it easier to feed C/R pairs via the tester.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Wed, 11 Nov 2009 20:32:09 +0000 |
parents | fa7f3426ed13 |
children | 738cd1adb3cf |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
15823 | 2 * purple - Jabber Protocol Plugin |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
28398
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
28382
diff
changeset
|
4 * Purple is the legal property of its developers, whose names are too numerous |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
28382
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
28382
diff
changeset
|
6 * source distribution. |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18257
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 #include "internal.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 #include "imgstore.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 #include "prpl.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "request.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "xmlnode.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "buddy.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "chat.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "jabber.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "iq.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #include "presence.h" |
25815
5dd25c58b65e
Migrate the XMPP User Avatar (XEP-0084) code to its own file
Paul Aurich <paul@darkrain42.org>
parents:
24920
diff
changeset
|
37 #include "useravatar.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #include "xdata.h" |
17580
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17563
diff
changeset
|
39 #include "pep.h" |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
40 #include "adhoccommands.h" |
28740
51d507e6c8f3
jabber: Add an "Initiate Chat" blist context menu option for GTalk accounts.
eion@robbmob.com
parents:
28682
diff
changeset
|
41 #include "google.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 typedef struct { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 long idle_seconds; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 } JabberBuddyInfoResource; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 typedef struct { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 JabberBuddy *jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 char *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 GSList *ids; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 GHashTable *resources; |
27152
d570d1e10382
Use guint for a timeout handle here, too.
Paul Aurich <paul@darkrain42.org>
parents:
27149
diff
changeset
|
53 guint timeout_handle; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 GSList *vcard_imgids; |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
55 PurpleNotifyUserInfo *user_info; |
26925
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
56 long last_seconds; |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
57 gchar *last_message; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 } JabberBuddyInfo; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 void jabber_buddy_free(JabberBuddy *jb) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 g_return_if_fail(jb != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 |
22770
cc8903c59d6b
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents:
22756
diff
changeset
|
64 g_free(jb->error_msg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 while(jb->resources) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 jabber_buddy_resource_free(jb->resources->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 g_free(jb); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 JabberBuddy *jabber_buddy_find(JabberStream *js, const char *name, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 gboolean create) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 JabberBuddy *jb; |
27149
01c91af62ab3
Plug a leak from changing this to use jabber_get_bare_jid instead of normalize.
Paul Aurich <paul@darkrain42.org>
parents:
27067
diff
changeset
|
75 char *realname; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 if (js->buddies == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 |
26956
eeee4309d3d8
Support custom smileys in MUCs (when all participants support BoB and a maximum
Marcus Lundblad <ml@update.uu.se>
parents:
26936
diff
changeset
|
80 if(!(realname = jabber_get_bare_jid(name))) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 jb = g_hash_table_lookup(js->buddies, realname); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 if(!jb && create) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 jb = g_new0(JabberBuddy, 1); |
27149
01c91af62ab3
Plug a leak from changing this to use jabber_get_bare_jid instead of normalize.
Paul Aurich <paul@darkrain42.org>
parents:
27067
diff
changeset
|
87 g_hash_table_insert(js->buddies, realname, jb); |
01c91af62ab3
Plug a leak from changing this to use jabber_get_bare_jid instead of normalize.
Paul Aurich <paul@darkrain42.org>
parents:
27067
diff
changeset
|
88 } else |
01c91af62ab3
Plug a leak from changing this to use jabber_get_bare_jid instead of normalize.
Paul Aurich <paul@darkrain42.org>
parents:
27067
diff
changeset
|
89 g_free(realname); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 return jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 |
28031
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
94 static gint resource_compare_cb(gconstpointer a, gconstpointer b) |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
95 { |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
96 const JabberBuddyResource *jbra = a; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
97 const JabberBuddyResource *jbrb = b; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
98 JabberBuddyState state_a, state_b; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
99 |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
100 if (jbra->priority != jbrb->priority) |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
101 return jbra->priority > jbrb->priority ? 1 : -1; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
102 |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
103 /* Fold the states for easier comparison */ |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
104 switch (jbra->state) { |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
105 case JABBER_BUDDY_STATE_ONLINE: |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
106 case JABBER_BUDDY_STATE_CHAT: |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
107 state_a = JABBER_BUDDY_STATE_ONLINE; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
108 break; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
109 case JABBER_BUDDY_STATE_AWAY: |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
110 case JABBER_BUDDY_STATE_DND: |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
111 state_a = JABBER_BUDDY_STATE_AWAY; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
112 break; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
113 case JABBER_BUDDY_STATE_XA: |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
114 state_a = JABBER_BUDDY_STATE_XA; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
115 break; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
116 case JABBER_BUDDY_STATE_UNAVAILABLE: |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
117 state_a = JABBER_BUDDY_STATE_UNAVAILABLE; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
118 break; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
119 default: |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
120 state_a = JABBER_BUDDY_STATE_UNKNOWN; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
121 break; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
122 } |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
123 |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
124 switch (jbrb->state) { |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
125 case JABBER_BUDDY_STATE_ONLINE: |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
126 case JABBER_BUDDY_STATE_CHAT: |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
127 state_b = JABBER_BUDDY_STATE_ONLINE; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
128 break; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
129 case JABBER_BUDDY_STATE_AWAY: |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
130 case JABBER_BUDDY_STATE_DND: |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
131 state_b = JABBER_BUDDY_STATE_AWAY; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
132 break; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
133 case JABBER_BUDDY_STATE_XA: |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
134 state_b = JABBER_BUDDY_STATE_XA; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
135 break; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
136 case JABBER_BUDDY_STATE_UNAVAILABLE: |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
137 state_b = JABBER_BUDDY_STATE_UNAVAILABLE; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
138 break; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
139 default: |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
140 state_b = JABBER_BUDDY_STATE_UNKNOWN; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
141 break; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
142 } |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
143 |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
144 if (state_a == state_b) { |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
145 if (jbra->idle == jbrb->idle) |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
146 return 0; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
147 else if ((jbra->idle && !jbrb->idle) || |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
148 (jbra->idle && jbrb->idle && jbra->idle < jbrb->idle)) |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
149 return -1; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
150 else |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
151 return 1; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
152 } |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
153 |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
154 if (state_a == JABBER_BUDDY_STATE_ONLINE) |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
155 return 1; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
156 else if (state_a == JABBER_BUDDY_STATE_AWAY && |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
157 (state_b == JABBER_BUDDY_STATE_XA || |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
158 state_b == JABBER_BUDDY_STATE_UNAVAILABLE || |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
159 state_b == JABBER_BUDDY_STATE_UNKNOWN)) |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
160 return 1; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
161 else if (state_a == JABBER_BUDDY_STATE_XA && |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
162 (state_b == JABBER_BUDDY_STATE_UNAVAILABLE || |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
163 state_b == JABBER_BUDDY_STATE_UNKNOWN)) |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
164 return 1; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
165 else if (state_a == JABBER_BUDDY_STATE_UNAVAILABLE && |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
166 state_b == JABBER_BUDDY_STATE_UNKNOWN) |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
167 return 1; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
168 |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
169 return -1; |
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
170 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 JabberBuddyResource *jabber_buddy_find_resource(JabberBuddy *jb, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 const char *resource) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 JabberBuddyResource *jbr = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
177 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 if(!jb) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 for(l = jb->resources; l; l = l->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 { |
25802 | 183 JabberBuddyResource *tmp = (JabberBuddyResource *) l->data; |
184 if (!jbr && !resource) { | |
185 jbr = tmp; | |
186 } else if (!resource) { | |
28031
02dd3b637d66
jabber: Move the jbr comparison logic to a GCompareFunc
Paul Aurich <paul@darkrain42.org>
parents:
27669
diff
changeset
|
187 if (resource_compare_cb(tmp, jbr) > 0) |
25802 | 188 jbr = tmp; |
189 } else if(tmp->name) { | |
190 if(!strcmp(tmp->name, resource)) { | |
191 jbr = tmp; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 return jbr; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 JabberBuddyResource *jabber_buddy_track_resource(JabberBuddy *jb, const char *resource, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 int priority, JabberBuddyState state, const char *status) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, resource); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 if(!jbr) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 jbr = g_new0(JabberBuddyResource, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 jbr->jb = jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 jbr->name = g_strdup(resource); |
27584
95c56191d26c
For contacts who advertise Entity Caps, check for XHTML-IM support. Refs #4650.
Paul Aurich <paul@darkrain42.org>
parents:
27513
diff
changeset
|
208 jbr->capabilities = JABBER_CAP_NONE; |
25938
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
209 jbr->tz_off = PURPLE_NO_TZ_OFF; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 jb->resources = g_list_append(jb->resources, jbr); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 jbr->priority = priority; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 jbr->state = state; |
22756 | 214 g_free(jbr->status); |
27563
7a2891487a00
Don't pre-escape jbr->status. Almost every place required it in unescaped
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27513
diff
changeset
|
215 jbr->status = g_strdup(status); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
217 return jbr; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
218 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 void jabber_buddy_resource_free(JabberBuddyResource *jbr) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 g_return_if_fail(jbr != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 jbr->jb->resources = g_list_remove(jbr->jb->resources, jbr); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25438
diff
changeset
|
225 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
226 while(jbr->commands) { |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
227 JabberAdHocCommands *cmd = jbr->commands->data; |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
228 g_free(cmd->jid); |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
229 g_free(cmd->node); |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
230 g_free(cmd->name); |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
231 g_free(cmd); |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
232 jbr->commands = g_list_delete_link(jbr->commands, jbr->commands); |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
233 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 |
25784
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
235 if (jbr->caps.exts) { |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
236 g_list_foreach(jbr->caps.exts, (GFunc)g_free, NULL); |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
237 g_list_free(jbr->caps.exts); |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
238 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 g_free(jbr->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 g_free(jbr->status); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 g_free(jbr->thread_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 g_free(jbr->client.name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 g_free(jbr->client.version); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 g_free(jbr->client.os); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 g_free(jbr); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 void jabber_buddy_remove_resource(JabberBuddy *jb, const char *resource) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, resource); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 if(!jbr) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 jabber_buddy_resource_free(jbr); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 /******* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 * This is the old vCard stuff taken from the old prpl. vCards, by definition |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 * are a temporary thing until jabber can get its act together and come up |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 * with a format for user information, hence the namespace of 'vcard-temp' |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 * Since I don't feel like putting that much work into something that's |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 * _supposed_ to go away, i'm going to just copy the kludgy old code here, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 * and make it purdy when jabber comes up with a standards-track JEP to |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
266 * replace vcard-temp |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 * --Nathan |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 *******/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 /*---------------------------------------*/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 /* Jabber "set info" (vCard) support */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 /*---------------------------------------*/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
275 * V-Card format: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 * <vCard prodid='' version='' xmlns=''> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 * <FN></FN> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 * <N> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 * <FAMILY/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 * <GIVEN/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 * </N> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 * <NICKNAME/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 * <URL/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 * <ADR> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 * <STREET/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 * <EXTADD/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 * <LOCALITY/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 * <REGION/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 * <PCODE/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 * <COUNTRY/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 * </ADR> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 * <TEL/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 * <EMAIL/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 * <ORG> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 * <ORGNAME/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 * <ORGUNIT/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 * </ORG> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 * <TITLE/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 * <ROLE/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 * <DESC/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 * <BDAY/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 * </vCard> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 * See also: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 * http://docs.jabber.org/proto/html/vcard-temp.html |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 * http://www.vcard-xml.org/dtd/vCard-XML-v2-20010520.dtd |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 * Cross-reference user-friendly V-Card entry labels to vCard XML tags |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 * and attributes. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 * Order is (or should be) unimportant. For example: we have no way of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 * knowing in what order real data will arrive. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 * Format: Label, Pre-set text, "visible" flag, "editable" flag, XML tag |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 * name, XML tag's parent tag "path" (relative to vCard node). |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 * List is terminated by a NULL label pointer. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 * Entries with no label text, but with XML tag and parent tag |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 * entries, are used by V-Card XML construction routines to |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 * "automagically" construct the appropriate XML node tree. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 * Thoughts on future direction/expansion |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 * This is a "simple" vCard. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 * It is possible for nodes other than the "vCard" node to have |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 * attributes. Should that prove necessary/desirable, add an |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 * "attributes" pointer to the vcard_template struct, create the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 * necessary tag_attr structs, and add 'em to the vcard_dflt_data |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 * array. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 * The above changes will (obviously) require changes to the vCard |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 * construction routines. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 struct vcard_template { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 char *label; /* label text pointer */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
343 char *tag; /* tag text */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 char *ptag; /* parent tag "path" text */ |
21015
787b3897ba9f
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@hxbc.us>
parents:
20276
diff
changeset
|
345 } const vcard_template_data[] = { |
26308
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
346 {N_("Full Name"), "FN", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
347 {N_("Family Name"), "FAMILY", "N"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
348 {N_("Given Name"), "GIVEN", "N"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
349 {N_("Nickname"), "NICKNAME", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
350 {N_("URL"), "URL", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
351 {N_("Street Address"), "STREET", "ADR"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
352 {N_("Extended Address"), "EXTADD", "ADR"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
353 {N_("Locality"), "LOCALITY", "ADR"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
354 {N_("Region"), "REGION", "ADR"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
355 {N_("Postal Code"), "PCODE", "ADR"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
356 {N_("Country"), "CTRY", "ADR"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
357 {N_("Telephone"), "NUMBER", "TEL"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
358 {N_("Email"), "USERID", "EMAIL"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
359 {N_("Organization Name"), "ORGNAME", "ORG"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
360 {N_("Organization Unit"), "ORGUNIT", "ORG"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
361 {N_("Title"), "TITLE", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
362 {N_("Role"), "ROLE", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
363 {N_("Birthday"), "BDAY", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
364 {N_("Description"), "DESC", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
365 {"", "N", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
366 {"", "ADR", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
367 {"", "ORG", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25443
diff
changeset
|
368 {NULL, NULL, NULL} |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
369 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 * The "vCard" tag's attribute list... |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
373 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 struct tag_attr { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
375 char *attr; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 char *value; |
21015
787b3897ba9f
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@hxbc.us>
parents:
20276
diff
changeset
|
377 } const vcard_tag_attr_list[] = { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
378 {"prodid", "-//HandGen//NONSGML vGen v1.0//EN"}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 {"version", "2.0", }, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 {"xmlns", "vcard-temp", }, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 {NULL, NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 * Insert a tag node into an xmlnode tree, recursively inserting parent tag |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 * nodes as necessary |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 * Returns pointer to inserted node |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 * Note to hackers: this code is designed to be re-entrant (it's recursive--it |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
392 * calls itself), so don't put any "static"s in here! |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
394 static xmlnode *insert_tag_to_parent_tag(xmlnode *start, const char *parent_tag, const char *new_tag) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 xmlnode *x = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
397 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 * If the parent tag wasn't specified, see if we can get it |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 * from the vCard template struct. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 if(parent_tag == NULL) { |
21015
787b3897ba9f
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@hxbc.us>
parents:
20276
diff
changeset
|
403 const struct vcard_template *vc_tp = vcard_template_data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
404 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 while(vc_tp->label != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 if(strcmp(vc_tp->tag, new_tag) == 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 parent_tag = vc_tp->ptag; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
408 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 ++vc_tp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
411 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
412 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
413 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
415 * If we have a parent tag... |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
416 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
417 if(parent_tag != NULL ) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 * Try to get the parent node for a tag |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 if((x = xmlnode_get_child(start, parent_tag)) == NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 * Descend? |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 char *grand_parent = g_strdup(parent_tag); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 char *parent; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 if((parent = strrchr(grand_parent, '/')) != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 *(parent++) = '\0'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
430 x = insert_tag_to_parent_tag(start, grand_parent, parent); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 x = xmlnode_new_child(start, grand_parent); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
433 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 g_free(grand_parent); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 * We found *something* to be the parent node. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 * Note: may be the "root" node! |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 xmlnode *y; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 if((y = xmlnode_get_child(x, new_tag)) != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 return(y); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
444 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
445 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
446 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
447 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
448 * insert the new tag into its parent node |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
449 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
450 return(xmlnode_new_child((x == NULL? start : x), new_tag)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
451 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
452 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
453 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
454 * Send vCard info to Jabber server |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
455 */ |
15823 | 456 void jabber_set_info(PurpleConnection *gc, const char *info) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
457 { |
22295
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
458 PurpleStoredImage *img; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 JabberIq *iq; |
25286
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
23986
diff
changeset
|
460 JabberStream *js = purple_connection_get_protocol_data(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
461 xmlnode *vc_node; |
21015
787b3897ba9f
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@hxbc.us>
parents:
20276
diff
changeset
|
462 const struct tag_attr *tag_attr; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
463 |
18163
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
464 /* if we have't grabbed the remote vcard yet, we can't |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
465 * assume that what we have here is correct */ |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
466 if(!js->vcard_fetched) |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
467 return; |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
468 |
28112
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
469 if (js->vcard_timer) { |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
470 purple_timeout_remove(js->vcard_timer); |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
471 js->vcard_timer = 0; |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
472 } |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
473 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 g_free(js->avatar_hash); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 js->avatar_hash = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
477 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 * Send only if there's actually any *information* to send |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
479 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
480 vc_node = info ? xmlnode_from_str(info, -1) : NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
481 |
22295
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
482 if (vc_node && (!vc_node->name || |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
483 g_ascii_strncasecmp(vc_node->name, "vCard", 5))) { |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
484 xmlnode_free(vc_node); |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
485 vc_node = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
486 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
487 |
22295
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
488 if ((img = purple_buddy_icons_find_account_icon(gc->account))) { |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
489 gconstpointer avatar_data; |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
490 gsize avatar_len; |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
491 xmlnode *photo, *binval, *type; |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
492 gchar *enc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
493 |
22295
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
494 if(!vc_node) { |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
495 vc_node = xmlnode_new("vCard"); |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
496 for(tag_attr = vcard_tag_attr_list; tag_attr->attr != NULL; ++tag_attr) |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
497 xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 |
22295
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
500 avatar_data = purple_imgstore_get_data(img); |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
501 avatar_len = purple_imgstore_get_size(img); |
24915
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
24914
diff
changeset
|
502 /* Get rid of an old PHOTO if one exists. |
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
24914
diff
changeset
|
503 * TODO: This may want to be modified to remove all old PHOTO |
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
24914
diff
changeset
|
504 * children, at the moment some people have managed to get |
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
24914
diff
changeset
|
505 * multiple PHOTO entries in their vCard. */ |
22295
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
506 if((photo = xmlnode_get_child(vc_node, "PHOTO"))) { |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
507 xmlnode_free(photo); |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
508 } |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
509 photo = xmlnode_new_child(vc_node, "PHOTO"); |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
510 type = xmlnode_new_child(photo, "TYPE"); |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
511 xmlnode_insert_data(type, "image/png", -1); |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
512 binval = xmlnode_new_child(photo, "BINVAL"); |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
513 enc = purple_base64_encode(avatar_data, avatar_len); |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
514 |
24641
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24640
diff
changeset
|
515 js->avatar_hash = jabber_calculate_data_sha1sum(avatar_data, avatar_len); |
22295
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
516 |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
517 xmlnode_insert_data(binval, enc, -1); |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
518 g_free(enc); |
28217
5a38fab8c199
This was a memory leak, right?
Mark Doliner <mark@kingant.net>
parents:
28182
diff
changeset
|
519 purple_imgstore_unref(img); |
24915
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
24914
diff
changeset
|
520 } else if (vc_node) { |
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
24914
diff
changeset
|
521 xmlnode *photo; |
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
24914
diff
changeset
|
522 /* TODO: Remove all PHOTO children? (see above note) */ |
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
24914
diff
changeset
|
523 if ((photo = xmlnode_get_child(vc_node, "PHOTO"))) { |
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
24914
diff
changeset
|
524 xmlnode_free(photo); |
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
24914
diff
changeset
|
525 } |
22295
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
526 } |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
527 |
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
528 if (vc_node != NULL) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
529 iq = jabber_iq_new(js, JABBER_IQ_SET); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
530 xmlnode_insert_child(iq->node, vc_node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
531 jabber_iq_send(iq); |
25818
370d8eba2ce0
Send presence updates from jabber_set_info, not jabber_set_buddy_icon.
Paul Aurich <paul@darkrain42.org>
parents:
25817
diff
changeset
|
532 |
370d8eba2ce0
Send presence updates from jabber_set_info, not jabber_set_buddy_icon.
Paul Aurich <paul@darkrain42.org>
parents:
25817
diff
changeset
|
533 /* Send presence to update vcard-temp:x:update */ |
26817
3912f55a1633
propagate from branch 'im.pidgin.pidgin' (head fbb4fe5da444943eecc76bdcd6c8ba967790b6c8)
Paul Aurich <paul@darkrain42.org>
diff
changeset
|
534 jabber_presence_send(js, FALSE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
535 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
536 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 |
16390
4fc51a87ce42
Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@wiktel.com>
parents:
16386
diff
changeset
|
538 void jabber_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
539 { |
25832
2d92bbe6807b
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <paul@darkrain42.org>
parents:
25822
diff
changeset
|
540 PurpleAccount *account = purple_connection_get_account(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 |
26791
80437c891f92
Publish only 'new' xmlns of avatars and delete old.
Paul Aurich <paul@darkrain42.org>
parents:
26788
diff
changeset
|
542 /* Publish the avatar as specified in XEP-0084 */ |
80437c891f92
Publish only 'new' xmlns of avatars and delete old.
Paul Aurich <paul@darkrain42.org>
parents:
26788
diff
changeset
|
543 jabber_avatar_set(gc->proto_data, img); |
80437c891f92
Publish only 'new' xmlns of avatars and delete old.
Paul Aurich <paul@darkrain42.org>
parents:
26788
diff
changeset
|
544 /* Set the image in our vCard */ |
25832
2d92bbe6807b
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <paul@darkrain42.org>
parents:
25822
diff
changeset
|
545 jabber_set_info(gc, purple_account_get_user_info(account)); |
24914
c07b0aa88a35
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <paul@darkrain42.org>
parents:
24641
diff
changeset
|
546 |
25832
2d92bbe6807b
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <paul@darkrain42.org>
parents:
25822
diff
changeset
|
547 /* TODO: Fake image to ourselves, since a number of servers do not echo |
2d92bbe6807b
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <paul@darkrain42.org>
parents:
25822
diff
changeset
|
548 * back our presence to us. To do this without uselessly copying the data |
2d92bbe6807b
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <paul@darkrain42.org>
parents:
25822
diff
changeset
|
549 * of the image, we need purple_buddy_icons_set_for_user_image (i.e. takes |
2d92bbe6807b
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <paul@darkrain42.org>
parents:
25822
diff
changeset
|
550 * an existing icon/stored image). */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
551 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
554 * This is the callback from the "ok clicked" for "set vCard" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
555 * |
24920
ca4ccf646993
Correct a comment, I don't imagine anyone will actually need this but better
Etan Reisner <pidgin@unreliablesource.net>
parents:
24915
diff
changeset
|
556 * Sets the vCard with data from PurpleRequestFields. |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 static void |
15823 | 559 jabber_format_info(PurpleConnection *gc, PurpleRequestFields *fields) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 xmlnode *vc_node; |
15823 | 562 PurpleRequestField *field; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 const char *text; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 char *p; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 const struct vcard_template *vc_tp; |
21015
787b3897ba9f
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@hxbc.us>
parents:
20276
diff
changeset
|
566 const struct tag_attr *tag_attr; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 vc_node = xmlnode_new("vCard"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
569 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
570 for(tag_attr = vcard_tag_attr_list; tag_attr->attr != NULL; ++tag_attr) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 for (vc_tp = vcard_template_data; vc_tp->label != NULL; vc_tp++) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 if (*vc_tp->label == '\0') |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
576 |
15823 | 577 field = purple_request_fields_get_field(fields, vc_tp->tag); |
578 text = purple_request_field_string_get_value(field); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
580 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
581 if (text != NULL && *text != '\0') { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
582 xmlnode *xp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
583 |
28889
fa7f3426ed13
jabber: Convert to purple_debug_* convenience functions.
Paul Aurich <paul@darkrain42.org>
parents:
28740
diff
changeset
|
584 purple_debug_info("jabber", "Setting %s to '%s'\n", vc_tp->tag, text); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
586 if ((xp = insert_tag_to_parent_tag(vc_node, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
587 NULL, vc_tp->tag)) != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
588 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
589 xmlnode_insert_data(xp, text, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
590 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
591 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
592 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
594 p = xmlnode_to_str(vc_node, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
595 xmlnode_free(vc_node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 |
15823 | 597 purple_account_set_user_info(purple_connection_get_account(gc), p); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
598 serv_set_info(gc, p); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 g_free(p); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
601 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
604 * This gets executed by the proto action |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
605 * |
15823 | 606 * Creates a new PurpleRequestFields struct, gets the XML-formatted user_info |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 * string (if any) into GSLists for the (multi-entry) edit dialog and |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
608 * calls the set_vcard dialog. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
609 */ |
15823 | 610 void jabber_setup_set_info(PurplePluginAction *action) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 { |
15823 | 612 PurpleConnection *gc = (PurpleConnection *) action->context; |
613 PurpleRequestFields *fields; | |
614 PurpleRequestFieldGroup *group; | |
615 PurpleRequestField *field; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
616 const struct vcard_template *vc_tp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
617 const char *user_info; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
618 char *cdata = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
619 xmlnode *x_vc_data = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
620 |
15823 | 621 fields = purple_request_fields_new(); |
622 group = purple_request_field_group_new(NULL); | |
623 purple_request_fields_add_group(fields, group); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
624 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
625 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
626 * Get existing, XML-formatted, user info |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 */ |
15823 | 628 if((user_info = purple_account_get_user_info(gc->account)) != NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
629 x_vc_data = xmlnode_from_str(user_info, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
630 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
631 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
632 * Set up GSLists for edit with labels from "template," data from user info |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
633 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
634 for(vc_tp = vcard_template_data; vc_tp->label != NULL; ++vc_tp) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 xmlnode *data_node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 if((vc_tp->label)[0] == '\0') |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
638 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 if (x_vc_data != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 if(vc_tp->ptag == NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 data_node = xmlnode_get_child(x_vc_data, vc_tp->tag); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
642 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 gchar *tag = g_strdup_printf("%s/%s", vc_tp->ptag, vc_tp->tag); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
644 data_node = xmlnode_get_child(x_vc_data, tag); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 g_free(tag); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 if(data_node) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 cdata = xmlnode_get_data(data_node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
649 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
650 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 if(strcmp(vc_tp->tag, "DESC") == 0) { |
15823 | 652 field = purple_request_field_string_new(vc_tp->tag, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 _(vc_tp->label), cdata, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 } else { |
15823 | 656 field = purple_request_field_string_new(vc_tp->tag, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 _(vc_tp->label), cdata, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
658 FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
659 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 g_free(cdata); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 cdata = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
663 |
15823 | 664 purple_request_field_group_add_field(group, field); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
666 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 if(x_vc_data != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
668 xmlnode_free(x_vc_data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
669 |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
670 purple_request_fields(gc, _("Edit XMPP vCard"), |
16915
56042b2f8b64
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@wiktel.com>
parents:
16728
diff
changeset
|
671 _("Edit XMPP vCard"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 _("All items below are optional. Enter only the " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
673 "information with which you feel comfortable."), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
674 fields, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
675 _("Save"), G_CALLBACK(jabber_format_info), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
676 _("Cancel"), NULL, |
16442
08db93bbd798
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 <evan.s@dreskin.net>
parents:
15823
diff
changeset
|
677 purple_connection_get_account(gc), NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
678 gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
679 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
680 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
681 /*---------------------------------------*/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
682 /* End Jabber "set info" (vCard) support */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 /*---------------------------------------*/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
684 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
685 /****** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 * end of that ancient crap that needs to die |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
687 ******/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
688 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
689 static void jabber_buddy_info_destroy(JabberBuddyInfo *jbi) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
690 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
691 /* Remove the timeout, which would otherwise trigger jabber_buddy_get_info_timeout() */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
692 if (jbi->timeout_handle > 0) |
15823 | 693 purple_timeout_remove(jbi->timeout_handle); |
15666
6eda87b08cdf
Don't access the list element after it has been freed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15627
diff
changeset
|
694 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
695 g_free(jbi->jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
696 g_hash_table_destroy(jbi->resources); |
26925
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
697 g_free(jbi->last_message); |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
698 purple_notify_user_info_destroy(jbi->user_info); |
15666
6eda87b08cdf
Don't access the list element after it has been freed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15627
diff
changeset
|
699 g_free(jbi); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
700 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
701 |
27406
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
702 static void |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
703 add_jbr_info(JabberBuddyInfo *jbi, const char *resource, |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
704 JabberBuddyResource *jbr) |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
705 { |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
706 JabberBuddyInfoResource *jbir; |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
707 PurpleNotifyUserInfo *user_info; |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
708 |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
709 jbir = g_hash_table_lookup(jbi->resources, resource); |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
710 user_info = jbi->user_info; |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
711 |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
712 if (jbr && jbr->client.name) { |
27407 | 713 char *tmp = |
714 g_strdup_printf("%s%s%s", jbr->client.name, | |
715 (jbr->client.version ? " " : ""), | |
716 (jbr->client.version ? jbr->client.version : "")); | |
27406
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
717 purple_notify_user_info_prepend_pair(user_info, _("Client"), tmp); |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
718 g_free(tmp); |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
719 |
27407 | 720 if (jbr->client.os) |
27406
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
721 purple_notify_user_info_prepend_pair(user_info, _("Operating System"), jbr->client.os); |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
722 } |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
723 |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
724 if (jbr && jbr->tz_off != PURPLE_NO_TZ_OFF) { |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
725 time_t now_t; |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
726 struct tm *now; |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
727 char *timestamp; |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
728 time(&now_t); |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
729 now_t += jbr->tz_off; |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
730 now = gmtime(&now_t); |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
731 |
27407 | 732 timestamp = |
733 g_strdup_printf("%s %c%02d%02d", purple_time_format(now), | |
734 jbr->tz_off < 0 ? '-' : '+', | |
735 abs(jbr->tz_off / (60*60)), | |
736 abs((jbr->tz_off % (60*60)) / 60)); | |
27406
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
737 purple_notify_user_info_prepend_pair(user_info, _("Local Time"), timestamp); |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
738 g_free(timestamp); |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
739 } |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
740 |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
741 if (jbir && jbir->idle_seconds > 0) { |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
742 char *idle = purple_str_seconds_to_string(jbir->idle_seconds); |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
743 purple_notify_user_info_prepend_pair(user_info, _("Idle"), idle); |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
744 g_free(idle); |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
745 } |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
746 |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
747 if (jbr) { |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
748 char *purdy = NULL; |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
749 char *tmp; |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
750 char priority[12]; |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
751 const char *status_name = jabber_buddy_state_get_name(jbr->state); |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
752 |
27407 | 753 if (jbr->status) { |
28360
cc70e2bc4de5
jabber: Escape status messages with a '<' or '>' in the Get Info dialog.
Paul Aurich <paul@darkrain42.org>
parents:
28349
diff
changeset
|
754 tmp = purple_markup_escape_text(jbr->status, -1); |
cc70e2bc4de5
jabber: Escape status messages with a '<' or '>' in the Get Info dialog.
Paul Aurich <paul@darkrain42.org>
parents:
28349
diff
changeset
|
755 purdy = purple_strdup_withhtml(tmp); |
cc70e2bc4de5
jabber: Escape status messages with a '<' or '>' in the Get Info dialog.
Paul Aurich <paul@darkrain42.org>
parents:
28349
diff
changeset
|
756 g_free(tmp); |
27407 | 757 |
758 if (purple_strequal(status_name, purdy)) | |
759 status_name = NULL; | |
760 } | |
27406
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
761 |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
762 tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""), |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
763 ((status_name && purdy) ? ": " : ""), |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
764 (purdy ? purdy : "")); |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
765 purple_notify_user_info_prepend_pair(user_info, _("Status"), tmp); |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
766 |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
767 g_snprintf(priority, sizeof(priority), "%d", jbr->priority); |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
768 purple_notify_user_info_prepend_pair(user_info, _("Priority"), priority); |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
769 |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
770 g_free(tmp); |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
771 g_free(purdy); |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
772 } else { |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
773 purple_notify_user_info_prepend_pair(user_info, _("Status"), _("Unknown")); |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
774 } |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
775 } |
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
776 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
777 static void jabber_buddy_info_show_if_ready(JabberBuddyInfo *jbi) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
778 { |
27406
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
779 char *resource_name; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
780 JabberBuddyResource *jbr; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
781 GList *resources; |
15823 | 782 PurpleNotifyUserInfo *user_info; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
783 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
784 /* not yet */ |
27407 | 785 if (jbi->ids) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
786 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
787 |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
788 user_info = jbi->user_info; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
789 resource_name = jabber_get_resource(jbi->jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
790 |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
791 /* If we have one or more pairs from the vcard, put a section break above it */ |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
792 if (purple_notify_user_info_get_entries(user_info)) |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
793 purple_notify_user_info_prepend_section_break(user_info); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
794 |
27407 | 795 /* Add the information about the user's resource(s) */ |
796 if (resource_name) { | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
797 jbr = jabber_buddy_find_resource(jbi->jb, resource_name); |
27406
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
798 add_jbr_info(jbi, resource_name, jbr); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
799 } else { |
27406
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
800 for (resources = jbi->jb->resources; resources; resources = resources->next) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
801 jbr = resources->data; |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
802 |
26912
6028712210ca
Add a section break between resources in "Get info"
Marcus Lundblad <ml@update.uu.se>
parents:
26817
diff
changeset
|
803 /* put a section break between resources, this is not needed if |
6028712210ca
Add a section break between resources in "Get info"
Marcus Lundblad <ml@update.uu.se>
parents:
26817
diff
changeset
|
804 we are at the first, because one was already added for the vcard |
6028712210ca
Add a section break between resources in "Get info"
Marcus Lundblad <ml@update.uu.se>
parents:
26817
diff
changeset
|
805 section */ |
27407 | 806 if (resources != jbi->jb->resources) |
26912
6028712210ca
Add a section break between resources in "Get info"
Marcus Lundblad <ml@update.uu.se>
parents:
26817
diff
changeset
|
807 purple_notify_user_info_prepend_section_break(user_info); |
6028712210ca
Add a section break between resources in "Get info"
Marcus Lundblad <ml@update.uu.se>
parents:
26817
diff
changeset
|
808 |
27406
77fc855ed8b7
Factor out the duplicated code for displaying XMPP Get Info
Paul Aurich <paul@darkrain42.org>
parents:
27405
diff
changeset
|
809 add_jbr_info(jbi, jbr->name, jbr); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
810 |
27407 | 811 if (jbr->name) |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
812 purple_notify_user_info_prepend_pair(user_info, _("Resource"), jbr->name); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
813 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
814 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
815 |
26925
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
816 if (!jbi->jb->resources) { |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
817 /* the buddy is offline */ |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26995
diff
changeset
|
818 gchar *status = |
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26995
diff
changeset
|
819 g_strdup_printf("%s%s%s", _("Offline"), |
27407 | 820 jbi->last_message ? ": " : "", |
821 jbi->last_message ? jbi->last_message : ""); | |
26925
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
822 if (jbi->last_seconds > 0) { |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
823 char *last = purple_str_seconds_to_string(jbi->last_seconds); |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
824 gchar *message = g_strdup_printf(_("%s ago"), last); |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26995
diff
changeset
|
825 purple_notify_user_info_prepend_pair(user_info, |
27408
41cc041a0733
Change "Logged off" to "Logged Off" to match the rest of the labels
Paul Aurich <paul@darkrain42.org>
parents:
27407
diff
changeset
|
826 _("Logged Off"), message); |
26925
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
827 g_free(last); |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
828 g_free(message); |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
829 } |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
830 purple_notify_user_info_prepend_pair(user_info, _("Status"), status); |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
831 g_free(status); |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
832 } |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
833 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
834 g_free(resource_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
835 |
15823 | 836 purple_notify_userinfo(jbi->js->gc, jbi->jid, user_info, NULL, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
837 |
27407 | 838 while (jbi->vcard_imgids) { |
16375
391a79778f89
Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@wiktel.com>
parents:
15823
diff
changeset
|
839 purple_imgstore_unref_by_id(GPOINTER_TO_INT(jbi->vcard_imgids->data)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
840 jbi->vcard_imgids = g_slist_delete_link(jbi->vcard_imgids, jbi->vcard_imgids); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
841 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
842 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
843 jbi->js->pending_buddy_info_requests = g_slist_remove(jbi->js->pending_buddy_info_requests, jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
844 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
845 jabber_buddy_info_destroy(jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
846 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
847 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
848 static void jabber_buddy_info_remove_id(JabberBuddyInfo *jbi, const char *id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
849 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
850 GSList *l = jbi->ids; |
15666
6eda87b08cdf
Don't access the list element after it has been freed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15627
diff
changeset
|
851 char *comp_id; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
852 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
853 if(!id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
854 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
855 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
856 while(l) { |
15666
6eda87b08cdf
Don't access the list element after it has been freed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15627
diff
changeset
|
857 comp_id = l->data; |
6eda87b08cdf
Don't access the list element after it has been freed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15627
diff
changeset
|
858 if(!strcmp(id, comp_id)) { |
6eda87b08cdf
Don't access the list element after it has been freed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15627
diff
changeset
|
859 jbi->ids = g_slist_remove(jbi->ids, comp_id); |
6eda87b08cdf
Don't access the list element after it has been freed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15627
diff
changeset
|
860 g_free(comp_id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
861 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
862 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
863 l = l->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
864 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
865 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
866 |
28112
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
867 static gboolean |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
868 set_own_vcard_cb(gpointer data) |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
869 { |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
870 JabberStream *js = data; |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
871 PurpleAccount *account = purple_connection_get_account(js->gc); |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
872 |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
873 js->vcard_timer = 0; |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
874 |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
875 jabber_set_info(js->gc, purple_account_get_user_info(account)); |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
876 |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
877 return FALSE; |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
878 } |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
879 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
880 static void jabber_vcard_save_mine(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
881 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
882 xmlnode *packet, gpointer data) |
18163
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
883 { |
25817
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25815
diff
changeset
|
884 xmlnode *vcard, *photo, *binval; |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25815
diff
changeset
|
885 char *txt, *vcard_hash = NULL; |
28112
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
886 PurpleAccount *account; |
18163
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
887 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
888 if (type == JABBER_IQ_ERROR) { |
27274
291724375feb
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 <paul@darkrain42.org>
parents:
27273
diff
changeset
|
889 xmlnode *error; |
27273 | 890 purple_debug_warning("jabber", "Server returned error while retrieving vCard\n"); |
27274
291724375feb
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 <paul@darkrain42.org>
parents:
27273
diff
changeset
|
891 |
291724375feb
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 <paul@darkrain42.org>
parents:
27273
diff
changeset
|
892 error = xmlnode_get_child(packet, "error"); |
291724375feb
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 <paul@darkrain42.org>
parents:
27273
diff
changeset
|
893 if (!error || !xmlnode_get_child(error, "item-not-found")) |
291724375feb
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 <paul@darkrain42.org>
parents:
27273
diff
changeset
|
894 return; |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
895 } |
18163
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
896 |
28112
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
897 account = purple_connection_get_account(js->gc); |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
898 |
18163
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
899 if((vcard = xmlnode_get_child(packet, "vCard")) || |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
900 (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
901 { |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
902 txt = xmlnode_to_str(vcard, NULL); |
28112
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
903 purple_account_set_user_info(account, txt); |
18163
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
904 g_free(txt); |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
905 } else { |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
906 /* if we have no vCard, then lets not overwrite what we might have locally */ |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
907 } |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
908 |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
909 js->vcard_fetched = TRUE; |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
910 |
25817
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25815
diff
changeset
|
911 if (vcard && (photo = xmlnode_get_child(vcard, "PHOTO")) && |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25815
diff
changeset
|
912 (binval = xmlnode_get_child(photo, "BINVAL"))) { |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25815
diff
changeset
|
913 gsize size; |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25815
diff
changeset
|
914 char *bintext = xmlnode_get_data(binval); |
28382
d4847cef4a84
jabber: Fix a crash when the vcard includes an empty BINVAL.
Paul Aurich <paul@darkrain42.org>
parents:
28360
diff
changeset
|
915 if (bintext) { |
d4847cef4a84
jabber: Fix a crash when the vcard includes an empty BINVAL.
Paul Aurich <paul@darkrain42.org>
parents:
28360
diff
changeset
|
916 guchar *data = purple_base64_decode(bintext, &size); |
d4847cef4a84
jabber: Fix a crash when the vcard includes an empty BINVAL.
Paul Aurich <paul@darkrain42.org>
parents:
28360
diff
changeset
|
917 g_free(bintext); |
25817
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25815
diff
changeset
|
918 |
28382
d4847cef4a84
jabber: Fix a crash when the vcard includes an empty BINVAL.
Paul Aurich <paul@darkrain42.org>
parents:
28360
diff
changeset
|
919 if (data) { |
d4847cef4a84
jabber: Fix a crash when the vcard includes an empty BINVAL.
Paul Aurich <paul@darkrain42.org>
parents:
28360
diff
changeset
|
920 vcard_hash = jabber_calculate_data_sha1sum(data, size); |
d4847cef4a84
jabber: Fix a crash when the vcard includes an empty BINVAL.
Paul Aurich <paul@darkrain42.org>
parents:
28360
diff
changeset
|
921 g_free(data); |
d4847cef4a84
jabber: Fix a crash when the vcard includes an empty BINVAL.
Paul Aurich <paul@darkrain42.org>
parents:
28360
diff
changeset
|
922 } |
25817
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25815
diff
changeset
|
923 } |
18163
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
924 } |
25817
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25815
diff
changeset
|
925 |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25815
diff
changeset
|
926 /* Republish our vcard if the photo is different than the server's */ |
26788
fbb2b8e2d91e
Use purple_strequal and g_str_equal
Paul Aurich <paul@darkrain42.org>
parents:
26787
diff
changeset
|
927 if (!purple_strequal(vcard_hash, js->initial_avatar_hash)) { |
28112
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
928 /* |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
929 * Google Talk has developed the behavior that it will not accept |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
930 * a vcard set in the first 10 seconds (or so) of the connection; |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
931 * it returns an error (namespaces trimmed): |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
932 * <error code="500" type="wait"><internal-server-error/></error>. |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
933 */ |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
934 if (js->googletalk) |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
935 js->vcard_timer = purple_timeout_add_seconds(10, set_own_vcard_cb, |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
936 js); |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
937 else |
1ea1aee71848
jabber: Fix setting Google Talk avatar at login.
Paul Aurich <paul@darkrain42.org>
parents:
28069
diff
changeset
|
938 jabber_set_info(js->gc, purple_account_get_user_info(account)); |
25832
2d92bbe6807b
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <paul@darkrain42.org>
parents:
25822
diff
changeset
|
939 } else if (js->initial_avatar_hash) { |
25817
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25815
diff
changeset
|
940 /* Our photo is in the vcard, so advertise vcard-temp updates */ |
25832
2d92bbe6807b
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <paul@darkrain42.org>
parents:
25822
diff
changeset
|
941 js->avatar_hash = g_strdup(js->initial_avatar_hash); |
25817
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25815
diff
changeset
|
942 } |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25815
diff
changeset
|
943 |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25815
diff
changeset
|
944 g_free(vcard_hash); |
18163
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
945 } |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
946 |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
947 void jabber_vcard_fetch_mine(JabberStream *js) |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
948 { |
21842
ce3d42470adf
Fix XMPP buddy icons. Somehow a 'VCard' element got changed to a query
Sean Egan <seanegan@gmail.com>
parents:
21596
diff
changeset
|
949 JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25438
diff
changeset
|
950 |
21842
ce3d42470adf
Fix XMPP buddy icons. Somehow a 'VCard' element got changed to a query
Sean Egan <seanegan@gmail.com>
parents:
21596
diff
changeset
|
951 xmlnode *vcard = xmlnode_new_child(iq->node, "vCard"); |
ce3d42470adf
Fix XMPP buddy icons. Somehow a 'VCard' element got changed to a query
Sean Egan <seanegan@gmail.com>
parents:
21596
diff
changeset
|
952 xmlnode_set_namespace(vcard, "vcard-temp"); |
18163
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
953 jabber_iq_set_callback(iq, jabber_vcard_save_mine, NULL); |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
954 |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
955 jabber_iq_send(iq); |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
956 } |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
957 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
958 static void jabber_vcard_parse(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
959 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
960 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
961 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
962 char *bare_jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
963 char *text; |
22439
b53bacc6eb6e
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 <evan.s@dreskin.net>
parents:
22404
diff
changeset
|
964 char *serverside_alias = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
965 xmlnode *vcard; |
15823 | 966 PurpleBuddy *b; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
967 JabberBuddyInfo *jbi = data; |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
968 PurpleNotifyUserInfo *user_info; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
969 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
970 if(!jbi) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
971 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
972 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
973 jabber_buddy_info_remove_id(jbi, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
974 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
975 if(!from) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
976 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
977 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
978 if(!jabber_buddy_find(js, from, FALSE)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
979 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
980 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
981 /* XXX: handle the error case */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
982 |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
983 user_info = jbi->user_info; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
984 bare_jid = jabber_get_bare_jid(from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
985 |
15823 | 986 b = purple_find_buddy(js->gc->account, bare_jid); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
987 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
988 if((vcard = xmlnode_get_child(packet, "vCard")) || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
989 (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
990 xmlnode *child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
991 for(child = vcard->child; child; child = child->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
992 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
993 xmlnode *child2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
994 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
995 if(child->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
996 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
997 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
998 text = xmlnode_get_data(child); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
999 if(text && !strcmp(child->name, "FN")) { |
22439
b53bacc6eb6e
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 <evan.s@dreskin.net>
parents:
22404
diff
changeset
|
1000 if (!serverside_alias) |
b53bacc6eb6e
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 <evan.s@dreskin.net>
parents:
22404
diff
changeset
|
1001 serverside_alias = g_strdup(text); |
b53bacc6eb6e
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 <evan.s@dreskin.net>
parents:
22404
diff
changeset
|
1002 |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1003 purple_notify_user_info_add_pair(user_info, _("Full Name"), text); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1004 } else if(!strcmp(child->name, "N")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1005 for(child2 = child->child; child2; child2 = child2->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1006 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1007 char *text2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1008 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1009 if(child2->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1010 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1011 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1012 text2 = xmlnode_get_data(child2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1013 if(text2 && !strcmp(child2->name, "FAMILY")) { |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1014 purple_notify_user_info_add_pair(user_info, _("Family Name"), text2); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1015 } else if(text2 && !strcmp(child2->name, "GIVEN")) { |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1016 purple_notify_user_info_add_pair(user_info, _("Given Name"), text2); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1017 } else if(text2 && !strcmp(child2->name, "MIDDLE")) { |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1018 purple_notify_user_info_add_pair(user_info, _("Middle Name"), text2); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1019 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1020 g_free(text2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1021 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25438
diff
changeset
|
1022 } else if(text && !strcmp(child->name, "NICKNAME")) { |
23933
32828b3c0d4f
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 <evan.s@dreskin.net>
parents:
23744
diff
changeset
|
1023 /* Prefer the Nickcname to the Full Name as the serverside alias if it's not just part of the jid. |
32828b3c0d4f
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 <evan.s@dreskin.net>
parents:
23744
diff
changeset
|
1024 * Ignore it if it's part of the jid. */ |
32828b3c0d4f
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 <evan.s@dreskin.net>
parents:
23744
diff
changeset
|
1025 if (strstr(bare_jid, text) == NULL) { |
32828b3c0d4f
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 <evan.s@dreskin.net>
parents:
23744
diff
changeset
|
1026 g_free(serverside_alias); |
32828b3c0d4f
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 <evan.s@dreskin.net>
parents:
23744
diff
changeset
|
1027 serverside_alias = g_strdup(text); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25438
diff
changeset
|
1028 |
23933
32828b3c0d4f
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 <evan.s@dreskin.net>
parents:
23744
diff
changeset
|
1029 purple_notify_user_info_add_pair(user_info, _("Nickname"), text); |
32828b3c0d4f
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 <evan.s@dreskin.net>
parents:
23744
diff
changeset
|
1030 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1031 } else if(text && !strcmp(child->name, "BDAY")) { |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1032 purple_notify_user_info_add_pair(user_info, _("Birthday"), text); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1033 } else if(!strcmp(child->name, "ADR")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1034 gboolean address_line_added = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1035 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1036 for(child2 = child->child; child2; child2 = child2->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1037 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1038 char *text2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1039 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1040 if(child2->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1041 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1042 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1043 text2 = xmlnode_get_data(child2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1044 if (text2 == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1045 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1046 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1047 /* We do this here so that it's not added if all the child |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1048 * elements are empty. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1049 if (!address_line_added) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1050 { |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1051 purple_notify_user_info_add_section_header(user_info, _("Address")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1052 address_line_added = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1053 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1054 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1055 if(!strcmp(child2->name, "POBOX")) { |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1056 purple_notify_user_info_add_pair(user_info, _("P.O. Box"), text2); |
28069
82ac0bef7d89
jabber: Handle "Extended Address" correctly.
Paul Aurich <paul@darkrain42.org>
parents:
28031
diff
changeset
|
1057 } else if (g_str_equal(child2->name, "EXTADD") || g_str_equal(child2->name, "EXTADR")) { |
82ac0bef7d89
jabber: Handle "Extended Address" correctly.
Paul Aurich <paul@darkrain42.org>
parents:
28031
diff
changeset
|
1058 /* |
82ac0bef7d89
jabber: Handle "Extended Address" correctly.
Paul Aurich <paul@darkrain42.org>
parents:
28031
diff
changeset
|
1059 * EXTADD is correct, EXTADR is generated by other |
82ac0bef7d89
jabber: Handle "Extended Address" correctly.
Paul Aurich <paul@darkrain42.org>
parents:
28031
diff
changeset
|
1060 * clients. The next time someone reads this, remove |
82ac0bef7d89
jabber: Handle "Extended Address" correctly.
Paul Aurich <paul@darkrain42.org>
parents:
28031
diff
changeset
|
1061 * EXTADR. |
82ac0bef7d89
jabber: Handle "Extended Address" correctly.
Paul Aurich <paul@darkrain42.org>
parents:
28031
diff
changeset
|
1062 */ |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1063 purple_notify_user_info_add_pair(user_info, _("Extended Address"), text2); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1064 } else if(!strcmp(child2->name, "STREET")) { |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1065 purple_notify_user_info_add_pair(user_info, _("Street Address"), text2); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1066 } else if(!strcmp(child2->name, "LOCALITY")) { |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1067 purple_notify_user_info_add_pair(user_info, _("Locality"), text2); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1068 } else if(!strcmp(child2->name, "REGION")) { |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1069 purple_notify_user_info_add_pair(user_info, _("Region"), text2); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1070 } else if(!strcmp(child2->name, "PCODE")) { |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1071 purple_notify_user_info_add_pair(user_info, _("Postal Code"), text2); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1072 } else if(!strcmp(child2->name, "CTRY") |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1073 || !strcmp(child2->name, "COUNTRY")) { |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1074 purple_notify_user_info_add_pair(user_info, _("Country"), text2); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1075 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1076 g_free(text2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1077 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25438
diff
changeset
|
1078 |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1079 if (address_line_added) |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1080 purple_notify_user_info_add_section_break(user_info); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1081 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1082 } else if(!strcmp(child->name, "TEL")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1083 char *number; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1084 if((child2 = xmlnode_get_child(child, "NUMBER"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1085 /* show what kind of number it is */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1086 number = xmlnode_get_data(child2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1087 if(number) { |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1088 purple_notify_user_info_add_pair(user_info, _("Telephone"), number); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1089 g_free(number); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1090 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1091 } else if((number = xmlnode_get_data(child))) { |
15823 | 1092 /* lots of clients (including purple) do this, but it's |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1093 * out of spec */ |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1094 purple_notify_user_info_add_pair(user_info, _("Telephone"), number); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1095 g_free(number); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1096 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1097 } else if(!strcmp(child->name, "EMAIL")) { |
19729
1b8af105614d
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <mark@kingant.net>
parents:
19723
diff
changeset
|
1098 char *userid, *escaped; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1099 if((child2 = xmlnode_get_child(child, "USERID"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1100 /* show what kind of email it is */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1101 userid = xmlnode_get_data(child2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1102 if(userid) { |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1103 char *mailto; |
19729
1b8af105614d
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <mark@kingant.net>
parents:
19723
diff
changeset
|
1104 escaped = g_markup_escape_text(userid, -1); |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1105 mailto = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", escaped, escaped); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1106 purple_notify_user_info_add_pair(user_info, _("Email"), mailto); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1107 |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1108 g_free(mailto); |
19729
1b8af105614d
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <mark@kingant.net>
parents:
19723
diff
changeset
|
1109 g_free(escaped); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1110 g_free(userid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1111 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1112 } else if((userid = xmlnode_get_data(child))) { |
15823 | 1113 /* lots of clients (including purple) do this, but it's |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1114 * out of spec */ |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1115 char *mailto; |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1116 |
19729
1b8af105614d
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <mark@kingant.net>
parents:
19723
diff
changeset
|
1117 escaped = g_markup_escape_text(userid, -1); |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1118 mailto = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", escaped, escaped); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1119 purple_notify_user_info_add_pair(user_info, _("Email"), mailto); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25438
diff
changeset
|
1120 |
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25438
diff
changeset
|
1121 g_free(mailto); |
19729
1b8af105614d
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <mark@kingant.net>
parents:
19723
diff
changeset
|
1122 g_free(escaped); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1123 g_free(userid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1124 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1125 } else if(!strcmp(child->name, "ORG")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1126 for(child2 = child->child; child2; child2 = child2->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1127 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1128 char *text2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1129 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1130 if(child2->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1131 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1132 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1133 text2 = xmlnode_get_data(child2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1134 if(text2 && !strcmp(child2->name, "ORGNAME")) { |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1135 purple_notify_user_info_add_pair(user_info, _("Organization Name"), text2); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1136 } else if(text2 && !strcmp(child2->name, "ORGUNIT")) { |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1137 purple_notify_user_info_add_pair(user_info, _("Organization Unit"), text2); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1138 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1139 g_free(text2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1140 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1141 } else if(text && !strcmp(child->name, "TITLE")) { |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1142 purple_notify_user_info_add_pair(user_info, _("Title"), text); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1143 } else if(text && !strcmp(child->name, "ROLE")) { |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1144 purple_notify_user_info_add_pair(user_info, _("Role"), text); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1145 } else if(text && !strcmp(child->name, "DESC")) { |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1146 purple_notify_user_info_add_pair(user_info, _("Description"), text); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1147 } else if(!strcmp(child->name, "PHOTO") || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1148 !strcmp(child->name, "LOGO")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1149 char *bintext = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1150 xmlnode *binval; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1151 |
28682
d9eb51a3a3a2
jabber: Don't try to pull a photo out of the <PHOTO/> cdata.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
1152 if ((binval = xmlnode_get_child(child, "BINVAL")) && |
d9eb51a3a3a2
jabber: Don't try to pull a photo out of the <PHOTO/> cdata.
Paul Aurich <paul@darkrain42.org>
parents:
28398
diff
changeset
|
1153 (bintext = xmlnode_get_data(binval))) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1154 gsize size; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1155 guchar *data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1156 gboolean photo = (strcmp(child->name, "PHOTO") == 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1157 |
15823 | 1158 data = purple_base64_decode(bintext, &size); |
16515
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16514
diff
changeset
|
1159 if (data) { |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1160 char *img_text; |
24641
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24640
diff
changeset
|
1161 char *hash; |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1162 |
16515
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16514
diff
changeset
|
1163 jbi->vcard_imgids = g_slist_prepend(jbi->vcard_imgids, GINT_TO_POINTER(purple_imgstore_add_with_id(g_memdup(data, size), size, "logo.png"))); |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1164 img_text = g_strdup_printf("<img id='%d'>", GPOINTER_TO_INT(jbi->vcard_imgids->data)); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1165 |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1166 purple_notify_user_info_add_pair(user_info, (photo ? _("Photo") : _("Logo")), img_text); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1167 |
24641
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24640
diff
changeset
|
1168 hash = jabber_calculate_data_sha1sum(data, size); |
16515
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16514
diff
changeset
|
1169 purple_buddy_icons_set_for_user(js->gc->account, bare_jid, |
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16514
diff
changeset
|
1170 data, size, hash); |
24641
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24640
diff
changeset
|
1171 g_free(hash); |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1172 g_free(img_text); |
16515
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16514
diff
changeset
|
1173 } |
24641
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24640
diff
changeset
|
1174 g_free(bintext); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1175 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1176 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1177 g_free(text); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1178 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1179 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1180 |
22439
b53bacc6eb6e
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 <evan.s@dreskin.net>
parents:
22404
diff
changeset
|
1181 if (serverside_alias) { |
b53bacc6eb6e
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 <evan.s@dreskin.net>
parents:
22404
diff
changeset
|
1182 /* If we found a serverside alias, set it and tell the core */ |
b53bacc6eb6e
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 <evan.s@dreskin.net>
parents:
22404
diff
changeset
|
1183 serv_got_alias(js->gc, from, serverside_alias); |
b53bacc6eb6e
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 <evan.s@dreskin.net>
parents:
22404
diff
changeset
|
1184 if (b) { |
b53bacc6eb6e
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 <evan.s@dreskin.net>
parents:
22404
diff
changeset
|
1185 purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", serverside_alias); |
b53bacc6eb6e
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 <evan.s@dreskin.net>
parents:
22404
diff
changeset
|
1186 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25438
diff
changeset
|
1187 |
22439
b53bacc6eb6e
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 <evan.s@dreskin.net>
parents:
22404
diff
changeset
|
1188 g_free(serverside_alias); |
b53bacc6eb6e
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 <evan.s@dreskin.net>
parents:
22404
diff
changeset
|
1189 } |
b53bacc6eb6e
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 <evan.s@dreskin.net>
parents:
22404
diff
changeset
|
1190 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1191 g_free(bare_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1192 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1193 jabber_buddy_info_show_if_ready(jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1194 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1195 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1196 static void jabber_buddy_info_resource_free(gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1197 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1198 JabberBuddyInfoResource *jbri = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1199 g_free(jbri); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1200 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1201 |
28182
0c90b164a735
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <paul@darkrain42.org>
parents:
28132
diff
changeset
|
1202 static guint jbir_hash(gconstpointer v) |
0c90b164a735
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <paul@darkrain42.org>
parents:
28132
diff
changeset
|
1203 { |
0c90b164a735
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <paul@darkrain42.org>
parents:
28132
diff
changeset
|
1204 if (v) |
0c90b164a735
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <paul@darkrain42.org>
parents:
28132
diff
changeset
|
1205 return g_str_hash(v); |
0c90b164a735
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <paul@darkrain42.org>
parents:
28132
diff
changeset
|
1206 else |
0c90b164a735
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <paul@darkrain42.org>
parents:
28132
diff
changeset
|
1207 return 0; |
0c90b164a735
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <paul@darkrain42.org>
parents:
28132
diff
changeset
|
1208 } |
0c90b164a735
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <paul@darkrain42.org>
parents:
28132
diff
changeset
|
1209 |
0c90b164a735
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <paul@darkrain42.org>
parents:
28132
diff
changeset
|
1210 static gboolean jbir_equal(gconstpointer v1, gconstpointer v2) |
0c90b164a735
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <paul@darkrain42.org>
parents:
28132
diff
changeset
|
1211 { |
0c90b164a735
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <paul@darkrain42.org>
parents:
28132
diff
changeset
|
1212 const gchar *resource_1 = v1; |
0c90b164a735
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <paul@darkrain42.org>
parents:
28132
diff
changeset
|
1213 const gchar *resource_2 = v2; |
0c90b164a735
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <paul@darkrain42.org>
parents:
28132
diff
changeset
|
1214 |
0c90b164a735
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <paul@darkrain42.org>
parents:
28132
diff
changeset
|
1215 return purple_strequal(resource_1, resource_2); |
0c90b164a735
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <paul@darkrain42.org>
parents:
28132
diff
changeset
|
1216 } |
0c90b164a735
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <paul@darkrain42.org>
parents:
28132
diff
changeset
|
1217 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
1218 static void jabber_version_parse(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
1219 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
1220 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1221 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1222 JabberBuddyInfo *jbi = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1223 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1224 char *resource_name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1225 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1226 g_return_if_fail(jbi != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1227 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1228 jabber_buddy_info_remove_id(jbi, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1229 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1230 if(!from) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1231 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1232 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1233 resource_name = jabber_get_resource(from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1234 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1235 if(resource_name) { |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
1236 if (type == JABBER_IQ_RESULT) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1237 if((query = xmlnode_get_child(packet, "query"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1238 JabberBuddyResource *jbr = jabber_buddy_find_resource(jbi->jb, resource_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1239 if(jbr) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1240 xmlnode *node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1241 if((node = xmlnode_get_child(query, "name"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1242 jbr->client.name = xmlnode_get_data(node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1243 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1244 if((node = xmlnode_get_child(query, "version"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1245 jbr->client.version = xmlnode_get_data(node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1246 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1247 if((node = xmlnode_get_child(query, "os"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1248 jbr->client.os = xmlnode_get_data(node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1249 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1250 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1251 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1252 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1253 g_free(resource_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1254 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1255 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1256 jabber_buddy_info_show_if_ready(jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1257 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1258 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
1259 static void jabber_last_parse(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
1260 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
1261 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1262 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1263 JabberBuddyInfo *jbi = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1264 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1265 char *resource_name; |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
1266 const char *seconds; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1267 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1268 g_return_if_fail(jbi != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1269 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1270 jabber_buddy_info_remove_id(jbi, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1271 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1272 if(!from) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1273 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1274 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1275 resource_name = jabber_get_resource(from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1276 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1277 if(resource_name) { |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
1278 if (type == JABBER_IQ_RESULT) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1279 if((query = xmlnode_get_child(packet, "query"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1280 seconds = xmlnode_get_attrib(query, "seconds"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1281 if(seconds) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1282 char *end = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1283 long sec = strtol(seconds, &end, 10); |
26995
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1284 JabberBuddy *jb = NULL; |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1285 char *resource = NULL; |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1286 char *buddy_name = NULL; |
25952
6185767dc03c
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <ml@update.uu.se>
parents:
25804
diff
changeset
|
1287 JabberBuddyResource *jbr = NULL; |
26817
3912f55a1633
propagate from branch 'im.pidgin.pidgin' (head fbb4fe5da444943eecc76bdcd6c8ba967790b6c8)
Paul Aurich <paul@darkrain42.org>
diff
changeset
|
1288 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1289 if(end != seconds) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1290 JabberBuddyInfoResource *jbir = g_hash_table_lookup(jbi->resources, resource_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1291 if(jbir) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1292 jbir->idle_seconds = sec; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1293 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1294 } |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26995
diff
changeset
|
1295 /* Update the idle time of the buddy resource, if we got it. |
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26995
diff
changeset
|
1296 This will correct the value when a server doesn't mark |
26995
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1297 delayed presence and we got the presence when signing on */ |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1298 jb = jabber_buddy_find(js, from, FALSE); |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1299 if (jb) { |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1300 resource = jabber_get_resource(from); |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1301 buddy_name = jabber_get_bare_jid(from); |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1302 /* if the resource already has an idle time set, we |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1303 must have gotten it originally from a presence. In |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1304 this case we update it. Otherwise don't update it, to |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1305 avoid setting an idle and not getting informed about |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1306 the resource getting unidle */ |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1307 if (resource && buddy_name) { |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1308 jbr = jabber_buddy_find_resource(jb, resource); |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1309 if (jbr) { |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1310 if (jbr->idle) { |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1311 if (sec) { |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1312 jbr->idle = time(NULL) - sec; |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1313 } else { |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1314 jbr->idle = 0; |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1315 } |
26994
ed5aec1cff44
Fix a NULL deref if the resource has gone offline by the time we're parsing this reply.
Paul Aurich <paul@darkrain42.org>
parents:
26956
diff
changeset
|
1316 |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26995
diff
changeset
|
1317 if (jbr == |
26995
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1318 jabber_buddy_find_resource(jb, NULL)) { |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26995
diff
changeset
|
1319 purple_prpl_got_user_idle(js->gc->account, |
26995
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1320 buddy_name, jbr->idle, jbr->idle); |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1321 } |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1322 } |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1323 } |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1324 } |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1325 g_free(resource); |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1326 g_free(buddy_name); |
56460ebd1558
This whole section was partially using spaces instead of tabs.
Paul Aurich <paul@darkrain42.org>
parents:
26994
diff
changeset
|
1327 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1328 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1329 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1330 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1331 g_free(resource_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1332 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1333 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1334 jabber_buddy_info_show_if_ready(jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1335 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1336 |
26925
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1337 static void jabber_last_offline_parse(JabberStream *js, const char *from, |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1338 JabberIqType type, const char *id, |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1339 xmlnode *packet, gpointer data) |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1340 { |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1341 JabberBuddyInfo *jbi = data; |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1342 xmlnode *query; |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1343 const char *seconds; |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1344 |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1345 g_return_if_fail(jbi != NULL); |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1346 |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1347 jabber_buddy_info_remove_id(jbi, id); |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1348 |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1349 if(!from) |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1350 return; |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1351 |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1352 if (type == JABBER_IQ_RESULT) { |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1353 if((query = xmlnode_get_child(packet, "query"))) { |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1354 seconds = xmlnode_get_attrib(query, "seconds"); |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1355 if(seconds) { |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1356 char *end = NULL; |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1357 long sec = strtol(seconds, &end, 10); |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1358 if(end != seconds) { |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1359 jbi->last_seconds = sec; |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1360 } |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1361 } |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1362 jbi->last_message = xmlnode_get_data(query); |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1363 } |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1364 } |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1365 |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1366 jabber_buddy_info_show_if_ready(jbi); |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1367 } |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1368 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
1369 static void jabber_time_parse(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
1370 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
1371 xmlnode *packet, gpointer data) |
25938
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1372 { |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1373 JabberBuddyInfo *jbi = data; |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1374 JabberBuddyResource *jbr; |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1375 char *resource_name; |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1376 |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1377 g_return_if_fail(jbi != NULL); |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1378 |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1379 jabber_buddy_info_remove_id(jbi, id); |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1380 |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1381 if (!from) |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1382 return; |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1383 |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1384 resource_name = jabber_get_resource(from); |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1385 jbr = resource_name ? jabber_buddy_find_resource(jbi->jb, resource_name) : NULL; |
25943
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1386 g_free(resource_name); |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1387 if (jbr) { |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
1388 if (type == JABBER_IQ_RESULT) { |
25938
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1389 xmlnode *time = xmlnode_get_child(packet, "time"); |
25939
150282919040
Actually display the buddy's local time.
Paul Aurich <paul@darkrain42.org>
parents:
25938
diff
changeset
|
1390 xmlnode *tzo = time ? xmlnode_get_child(time, "tzo") : NULL; |
25943
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1391 char *tzo_data = tzo ? xmlnode_get_data(tzo) : NULL; |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1392 if (tzo_data) { |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1393 char *c = tzo_data; |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1394 int hours, minutes; |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1395 if (tzo_data[0] == 'Z' && tzo_data[1] == '\0') { |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1396 jbr->tz_off = 0; |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1397 } else { |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1398 gboolean offset_positive = (tzo_data[0] == '+'); |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1399 /* [+-]HH:MM */ |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1400 if (((*c == '+' || *c == '-') && (c = c + 1)) && |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1401 sscanf(c, "%02d:%02d", &hours, &minutes) == 2) { |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1402 jbr->tz_off = 60*60*hours + 60*minutes; |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1403 if (!offset_positive) |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1404 jbr->tz_off *= -1; |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1405 } else { |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1406 purple_debug_info("jabber", "Ignoring malformed timezone %s", |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1407 tzo_data); |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1408 } |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1409 } |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1410 |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25941
diff
changeset
|
1411 g_free(tzo_data); |
25938
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1412 } |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1413 } |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1414 } |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1415 |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1416 jabber_buddy_info_show_if_ready(jbi); |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1417 } |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
24984
diff
changeset
|
1418 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1419 void jabber_buddy_remove_all_pending_buddy_info_requests(JabberStream *js) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1420 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1421 if (js->pending_buddy_info_requests) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1422 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1423 JabberBuddyInfo *jbi; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1424 GSList *l = js->pending_buddy_info_requests; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1425 while (l) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1426 jbi = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1427 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1428 g_slist_free(jbi->ids); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1429 jabber_buddy_info_destroy(jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1430 |
15666
6eda87b08cdf
Don't access the list element after it has been freed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15627
diff
changeset
|
1431 l = l->next; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1432 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1433 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1434 g_slist_free(js->pending_buddy_info_requests); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1435 js->pending_buddy_info_requests = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1436 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1437 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1438 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1439 static gboolean jabber_buddy_get_info_timeout(gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1440 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1441 JabberBuddyInfo *jbi = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1442 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1443 /* remove the pending callbacks */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1444 while(jbi->ids) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1445 char *id = jbi->ids->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1446 jabber_iq_remove_callback_by_id(jbi->js, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1447 jbi->ids = g_slist_remove(jbi->ids, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1448 g_free(id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1449 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1450 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1451 jbi->js->pending_buddy_info_requests = g_slist_remove(jbi->js->pending_buddy_info_requests, jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1452 jbi->timeout_handle = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1453 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1454 jabber_buddy_info_show_if_ready(jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1455 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1456 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1457 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1458 |
16990
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16962
diff
changeset
|
1459 static gboolean _client_is_blacklisted(JabberBuddyResource *jbr, const char *ns) |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16962
diff
changeset
|
1460 { |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16962
diff
changeset
|
1461 /* can't be blacklisted if we don't know what you're running yet */ |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16962
diff
changeset
|
1462 if(!jbr->client.name) |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16962
diff
changeset
|
1463 return FALSE; |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16962
diff
changeset
|
1464 |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16962
diff
changeset
|
1465 if(!strcmp(ns, "jabber:iq:last")) { |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16962
diff
changeset
|
1466 if(!strcmp(jbr->client.name, "Trillian")) { |
20092
ab3c87375b17
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20058
diff
changeset
|
1467 /* verified by nwalp 2007/05/09 */ |
ab3c87375b17
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20058
diff
changeset
|
1468 if(!strcmp(jbr->client.version, "3.1.0.121") || |
ab3c87375b17
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20058
diff
changeset
|
1469 /* verified by nwalp 2007/09/19 */ |
ab3c87375b17
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20058
diff
changeset
|
1470 !strcmp(jbr->client.version, "3.1.7.0")) { |
16990
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16962
diff
changeset
|
1471 return TRUE; |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16962
diff
changeset
|
1472 } |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16962
diff
changeset
|
1473 } |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16962
diff
changeset
|
1474 } |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16962
diff
changeset
|
1475 |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16962
diff
changeset
|
1476 return FALSE; |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16962
diff
changeset
|
1477 } |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16962
diff
changeset
|
1478 |
27333
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1479 static void |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1480 dispatch_queries_for_resource(JabberStream *js, JabberBuddyInfo *jbi, |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1481 gboolean is_bare_jid, const char *jid, |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1482 JabberBuddyResource *jbr) |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1483 { |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1484 JabberIq *iq; |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1485 JabberBuddyInfoResource *jbir; |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1486 char *full_jid = NULL; |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1487 const char *to; |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1488 |
28182
0c90b164a735
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <paul@darkrain42.org>
parents:
28132
diff
changeset
|
1489 if (is_bare_jid && jbr->name) { |
27333
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1490 full_jid = g_strdup_printf("%s/%s", jid, jbr->name); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1491 to = full_jid; |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1492 } else |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1493 to = jid; |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1494 |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1495 jbir = g_new0(JabberBuddyInfoResource, 1); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1496 g_hash_table_insert(jbi->resources, g_strdup(jbr->name), jbir); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1497 |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1498 if(!jbr->client.name) { |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1499 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:version"); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1500 xmlnode_set_attrib(iq->node, "to", to); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1501 jabber_iq_set_callback(iq, jabber_version_parse, jbi); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1502 jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1503 jabber_iq_send(iq); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1504 } |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1505 |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1506 /* this is to fix the feeling of irritation I get when trying |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1507 * to get info on a friend running Trillian, which doesn't |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1508 * respond (with an error or otherwise) to jabber:iq:last |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1509 * requests. There are a number of Trillian users in my |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1510 * office. */ |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1511 if(!_client_is_blacklisted(jbr, "jabber:iq:last")) { |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1512 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:last"); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1513 xmlnode_set_attrib(iq->node, "to", to); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1514 jabber_iq_set_callback(iq, jabber_last_parse, jbi); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1515 jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1516 jabber_iq_send(iq); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1517 } |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1518 |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1519 if (jbr->tz_off == PURPLE_NO_TZ_OFF && |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1520 (!jbr->caps.info || |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1521 jabber_resource_has_capability(jbr, "urn:xmpp:time"))) { |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1522 xmlnode *child; |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1523 iq = jabber_iq_new(js, JABBER_IQ_GET); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1524 xmlnode_set_attrib(iq->node, "to", to); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1525 child = xmlnode_new_child(iq->node, "time"); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1526 xmlnode_set_namespace(child, "urn:xmpp:time"); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1527 jabber_iq_set_callback(iq, jabber_time_parse, jbi); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1528 jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1529 jabber_iq_send(iq); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1530 } |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1531 |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1532 g_free(full_jid); |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1533 } |
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1534 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1535 static void jabber_buddy_get_info_for_jid(JabberStream *js, const char *jid) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1536 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1537 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1538 xmlnode *vcard; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1539 GList *resources; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1540 JabberBuddy *jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1541 JabberBuddyInfo *jbi; |
27334
ea9df9bfa921
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <paul@darkrain42.org>
parents:
27333
diff
changeset
|
1542 const char *slash; |
27333
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1543 gboolean is_bare_jid; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1544 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1545 jb = jabber_buddy_find(js, jid, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1546 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1547 /* invalid JID */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1548 if(!jb) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1549 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1550 |
27334
ea9df9bfa921
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <paul@darkrain42.org>
parents:
27333
diff
changeset
|
1551 slash = strchr(jid, '/'); |
ea9df9bfa921
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <paul@darkrain42.org>
parents:
27333
diff
changeset
|
1552 is_bare_jid = (slash == NULL); |
27333
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1553 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1554 jbi = g_new0(JabberBuddyInfo, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1555 jbi->jid = g_strdup(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1556 jbi->js = js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1557 jbi->jb = jb; |
28182
0c90b164a735
jabber: Fix a crash due to a contact having a resource with jbr->name == NULL
Paul Aurich <paul@darkrain42.org>
parents:
28132
diff
changeset
|
1558 jbi->resources = g_hash_table_new_full(jbir_hash, jbir_equal, g_free, jabber_buddy_info_resource_free); |
23208
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23182
diff
changeset
|
1559 jbi->user_info = purple_notify_user_info_new(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1560 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1561 iq = jabber_iq_new(js, JABBER_IQ_GET); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1562 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1563 xmlnode_set_attrib(iq->node, "to", jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1564 vcard = xmlnode_new_child(iq->node, "vCard"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1565 xmlnode_set_namespace(vcard, "vcard-temp"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1566 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1567 jabber_iq_set_callback(iq, jabber_vcard_parse, jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1568 jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1569 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1570 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1571 |
27334
ea9df9bfa921
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <paul@darkrain42.org>
parents:
27333
diff
changeset
|
1572 if (is_bare_jid) { |
ea9df9bfa921
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <paul@darkrain42.org>
parents:
27333
diff
changeset
|
1573 for(resources = jb->resources; resources; resources = resources->next) { |
ea9df9bfa921
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <paul@darkrain42.org>
parents:
27333
diff
changeset
|
1574 JabberBuddyResource *jbr = resources->data; |
ea9df9bfa921
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <paul@darkrain42.org>
parents:
27333
diff
changeset
|
1575 dispatch_queries_for_resource(js, jbi, is_bare_jid, jid, jbr); |
ea9df9bfa921
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <paul@darkrain42.org>
parents:
27333
diff
changeset
|
1576 } |
ea9df9bfa921
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <paul@darkrain42.org>
parents:
27333
diff
changeset
|
1577 } else { |
ea9df9bfa921
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <paul@darkrain42.org>
parents:
27333
diff
changeset
|
1578 JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, slash + 1); |
ea9df9bfa921
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <paul@darkrain42.org>
parents:
27333
diff
changeset
|
1579 if (jbr) |
ea9df9bfa921
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <paul@darkrain42.org>
parents:
27333
diff
changeset
|
1580 dispatch_queries_for_resource(js, jbi, is_bare_jid, jid, jbr); |
ea9df9bfa921
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <paul@darkrain42.org>
parents:
27333
diff
changeset
|
1581 else |
ea9df9bfa921
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <paul@darkrain42.org>
parents:
27333
diff
changeset
|
1582 purple_debug_warning("jabber", "jabber_buddy_get_info_for_jid() " |
ea9df9bfa921
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <paul@darkrain42.org>
parents:
27333
diff
changeset
|
1583 "was passed JID %s, but there is no corresponding " |
ea9df9bfa921
If get_info_for_jid is passed a full JID, don't spam that JID with IQs.
Paul Aurich <paul@darkrain42.org>
parents:
27333
diff
changeset
|
1584 "JabberBuddyResource!\n", jid); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1585 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1586 |
27333
c408e4dc3101
Factor the per-resource IQs out into their own function.
Paul Aurich <paul@darkrain42.org>
parents:
27274
diff
changeset
|
1587 if (!jb->resources && is_bare_jid) { |
26925
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1588 /* user is offline, send a jabber:iq:last to find out last time online */ |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1589 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:last"); |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1590 xmlnode_set_attrib(iq->node, "to", jid); |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1591 jabber_iq_set_callback(iq, jabber_last_offline_parse, jbi); |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1592 jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1593 jabber_iq_send(iq); |
9ce0c5bc922c
Show when a user was last online (as seen by the server) when doing "Get Info"
Marcus Lundblad <ml@update.uu.se>
parents:
26912
diff
changeset
|
1594 } |
27014
a8537bbcfb79
Remove trailing whitespace that has snuck in.
Paul Aurich <paul@darkrain42.org>
parents:
26995
diff
changeset
|
1595 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1596 js->pending_buddy_info_requests = g_slist_prepend(js->pending_buddy_info_requests, jbi); |
25861
7f552614ec8a
applied changes from a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
Ethan Blanton <elb@pidgin.im>
parents:
25069
diff
changeset
|
1597 jbi->timeout_handle = purple_timeout_add_seconds(30, jabber_buddy_get_info_timeout, jbi); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1598 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1599 |
15823 | 1600 void jabber_buddy_get_info(PurpleConnection *gc, const char *who) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1601 { |
25286
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
23986
diff
changeset
|
1602 JabberStream *js = purple_connection_get_protocol_data(gc); |
24510
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24507
diff
changeset
|
1603 JabberID *jid = jabber_id_new(who); |
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24507
diff
changeset
|
1604 |
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24507
diff
changeset
|
1605 if (!jid) |
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24507
diff
changeset
|
1606 return; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1607 |
25069
d7dcdba13b88
A JID can have no node (the part before the @), but a chat must have one,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24984
diff
changeset
|
1608 if (jid->node && jabber_chat_find(js, jid->node, jid->domain)) { |
24510
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24507
diff
changeset
|
1609 /* For a conversation, include the resource (indicates the user). */ |
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24507
diff
changeset
|
1610 jabber_buddy_get_info_for_jid(js, who); |
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24507
diff
changeset
|
1611 } else { |
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24507
diff
changeset
|
1612 char *bare_jid = jabber_get_bare_jid(who); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1613 jabber_buddy_get_info_for_jid(js, bare_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1614 g_free(bare_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1615 } |
24510
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24507
diff
changeset
|
1616 |
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24507
diff
changeset
|
1617 jabber_id_free(jid); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1618 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1619 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1620 static void jabber_buddy_set_invisibility(JabberStream *js, const char *who, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1621 gboolean invisible) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1622 { |
15823 | 1623 PurplePresence *gpresence; |
1624 PurpleAccount *account; | |
1625 PurpleStatus *status; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1626 JabberBuddy *jb = jabber_buddy_find(js, who, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1627 xmlnode *presence; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1628 JabberBuddyState state; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1629 char *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1630 int priority; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1631 |
15823 | 1632 account = purple_connection_get_account(js->gc); |
1633 gpresence = purple_account_get_presence(account); | |
1634 status = purple_presence_get_active_status(gpresence); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1635 |
15823 | 1636 purple_status_to_jabber(status, &state, &msg, &priority); |
17563
95affacf6f82
Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents:
17006
diff
changeset
|
1637 presence = jabber_presence_create_js(js, state, msg, priority); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1638 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1639 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1640 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1641 xmlnode_set_attrib(presence, "to", who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1642 if(invisible) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1643 xmlnode_set_attrib(presence, "type", "invisible"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1644 jb->invisible |= JABBER_INVIS_BUDDY; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1645 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1646 jb->invisible &= ~JABBER_INVIS_BUDDY; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1647 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1648 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1649 jabber_send(js, presence); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1650 xmlnode_free(presence); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1651 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1652 |
15823 | 1653 static void jabber_buddy_make_invisible(PurpleBlistNode *node, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1654 { |
15823 | 1655 PurpleBuddy *buddy; |
1656 PurpleConnection *gc; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1657 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1658 |
15823 | 1659 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1660 |
15823 | 1661 buddy = (PurpleBuddy *) node; |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23986
diff
changeset
|
1662 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
25286
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
23986
diff
changeset
|
1663 js = purple_connection_get_protocol_data(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1664 |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23986
diff
changeset
|
1665 jabber_buddy_set_invisibility(js, purple_buddy_get_name(buddy), TRUE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1666 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1667 |
15823 | 1668 static void jabber_buddy_make_visible(PurpleBlistNode *node, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1669 { |
15823 | 1670 PurpleBuddy *buddy; |
1671 PurpleConnection *gc; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1672 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1673 |
15823 | 1674 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1675 |
15823 | 1676 buddy = (PurpleBuddy *) node; |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23986
diff
changeset
|
1677 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
25286
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
23986
diff
changeset
|
1678 js = purple_connection_get_protocol_data(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1679 |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23986
diff
changeset
|
1680 jabber_buddy_set_invisibility(js, purple_buddy_get_name(buddy), FALSE); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1681 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1682 |
28327
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1683 static void cancel_presence_notification(gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1684 { |
15823 | 1685 PurpleBuddy *buddy; |
1686 PurpleConnection *gc; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1687 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1688 |
28327
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1689 buddy = data; |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1690 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1691 js = purple_connection_get_protocol_data(gc); |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1692 |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1693 jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "unsubscribed"); |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1694 } |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1695 |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1696 static void |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1697 jabber_buddy_cancel_presence_notification(PurpleBlistNode *node, |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1698 gpointer data) |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1699 { |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1700 PurpleBuddy *buddy; |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1701 PurpleAccount *account; |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1702 PurpleConnection *gc; |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1703 const gchar *name; |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1704 char *msg; |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1705 |
15823 | 1706 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1707 |
15823 | 1708 buddy = (PurpleBuddy *) node; |
28327
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1709 name = purple_buddy_get_name(buddy); |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1710 account = purple_buddy_get_account(buddy); |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1711 gc = purple_account_get_connection(account); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1712 |
28327
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1713 msg = g_strdup_printf(_("%s will no longer be able to see your status " |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1714 "updates. Do you want to continue?"), name); |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1715 purple_request_yes_no(gc, NULL, _("Cancel Presence Notification"), |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1716 msg, 0 /* Yes */, account, name, NULL, buddy, |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1717 cancel_presence_notification, NULL /* Do nothing */); |
b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1718 g_free(msg); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1719 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1720 |
15823 | 1721 static void jabber_buddy_rerequest_auth(PurpleBlistNode *node, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1722 { |
15823 | 1723 PurpleBuddy *buddy; |
1724 PurpleConnection *gc; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1725 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1726 |
15823 | 1727 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1728 |
15823 | 1729 buddy = (PurpleBuddy *) node; |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23986
diff
changeset
|
1730 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
25286
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
23986
diff
changeset
|
1731 js = purple_connection_get_protocol_data(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1732 |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23986
diff
changeset
|
1733 jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "subscribe"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1734 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1735 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1736 |
15823 | 1737 static void jabber_buddy_unsubscribe(PurpleBlistNode *node, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1738 { |
15823 | 1739 PurpleBuddy *buddy; |
1740 PurpleConnection *gc; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1741 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1742 |
15823 | 1743 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1744 |
15823 | 1745 buddy = (PurpleBuddy *) node; |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23986
diff
changeset
|
1746 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
25286
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
23986
diff
changeset
|
1747 js = purple_connection_get_protocol_data(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1748 |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23986
diff
changeset
|
1749 jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "unsubscribe"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1750 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1751 |
17601
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1752 static void jabber_buddy_login(PurpleBlistNode *node, gpointer data) { |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1753 if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1754 /* simply create a directed presence of the current status */ |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1755 PurpleBuddy *buddy = (PurpleBuddy *) node; |
25286
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
23986
diff
changeset
|
1756 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
23986
diff
changeset
|
1757 JabberStream *js = purple_connection_get_protocol_data(gc); |
17601
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1758 PurpleAccount *account = purple_connection_get_account(gc); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1759 PurplePresence *gpresence = purple_account_get_presence(account); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1760 PurpleStatus *status = purple_presence_get_active_status(gpresence); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1761 xmlnode *presence; |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1762 JabberBuddyState state; |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1763 char *msg; |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1764 int priority; |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25438
diff
changeset
|
1765 |
17601
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1766 purple_status_to_jabber(status, &state, &msg, &priority); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1767 presence = jabber_presence_create_js(js, state, msg, priority); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25438
diff
changeset
|
1768 |
17601
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1769 g_free(msg); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25438
diff
changeset
|
1770 |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23986
diff
changeset
|
1771 xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25438
diff
changeset
|
1772 |
17601
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1773 jabber_send(js, presence); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1774 xmlnode_free(presence); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1775 } |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1776 } |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1777 |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1778 static void jabber_buddy_logout(PurpleBlistNode *node, gpointer data) { |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1779 if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1780 /* simply create a directed unavailable presence */ |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1781 PurpleBuddy *buddy = (PurpleBuddy *) node; |
25286
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
23986
diff
changeset
|
1782 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
23986
diff
changeset
|
1783 JabberStream *js = purple_connection_get_protocol_data(gc); |
17601
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1784 xmlnode *presence; |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25438
diff
changeset
|
1785 |
17601
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1786 presence = jabber_presence_create_js(js, JABBER_BUDDY_STATE_UNAVAILABLE, NULL, 0); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25438
diff
changeset
|
1787 |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23986
diff
changeset
|
1788 xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25438
diff
changeset
|
1789 |
17601
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1790 jabber_send(js, presence); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1791 xmlnode_free(presence); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1792 } |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1793 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1794 |
15823 | 1795 static GList *jabber_buddy_menu(PurpleBuddy *buddy) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1796 { |
25286
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
23986
diff
changeset
|
1797 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
23986
diff
changeset
|
1798 JabberStream *js = purple_connection_get_protocol_data(gc); |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23986
diff
changeset
|
1799 const char *name = purple_buddy_get_name(buddy); |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23986
diff
changeset
|
1800 JabberBuddy *jb = jabber_buddy_find(js, name, TRUE); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
1801 GList *jbrs; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1802 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1803 GList *m = NULL; |
15823 | 1804 PurpleMenuAction *act; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1805 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1806 if(!jb) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1807 return m; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1808 |
28132
eb2d17945ce3
jabber: Store the "own JabberBuddy" in the JabberStream* struct.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1809 if (js->protocol_version == JABBER_PROTO_0_9 && jb != js->user_jb) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1810 if(jb->invisible & JABBER_INVIS_BUDDY) { |
15823 | 1811 act = purple_menu_action_new(_("Un-hide From"), |
1812 PURPLE_CALLBACK(jabber_buddy_make_visible), | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1813 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1814 } else { |
15823 | 1815 act = purple_menu_action_new(_("Temporarily Hide From"), |
1816 PURPLE_CALLBACK(jabber_buddy_make_invisible), | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1817 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1818 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1819 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1820 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1821 |
28132
eb2d17945ce3
jabber: Store the "own JabberBuddy" in the JabberStream* struct.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1822 if(jb->subscription & JABBER_SUB_FROM && jb != js->user_jb) { |
15823 | 1823 act = purple_menu_action_new(_("Cancel Presence Notification"), |
1824 PURPLE_CALLBACK(jabber_buddy_cancel_presence_notification), | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1825 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1826 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1827 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1828 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1829 if(!(jb->subscription & JABBER_SUB_TO)) { |
15823 | 1830 act = purple_menu_action_new(_("(Re-)Request authorization"), |
1831 PURPLE_CALLBACK(jabber_buddy_rerequest_auth), | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1832 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1833 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1834 |
28132
eb2d17945ce3
jabber: Store the "own JabberBuddy" in the JabberStream* struct.
Paul Aurich <paul@darkrain42.org>
parents:
28112
diff
changeset
|
1835 } else if (jb != js->user_jb) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1836 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1837 /* shouldn't this just happen automatically when the buddy is |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1838 removed? */ |
15823 | 1839 act = purple_menu_action_new(_("Unsubscribe"), |
1840 PURPLE_CALLBACK(jabber_buddy_unsubscribe), | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1841 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1842 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1843 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25438
diff
changeset
|
1844 |
28740
51d507e6c8f3
jabber: Add an "Initiate Chat" blist context menu option for GTalk accounts.
eion@robbmob.com
parents:
28682
diff
changeset
|
1845 if (js->googletalk) { |
51d507e6c8f3
jabber: Add an "Initiate Chat" blist context menu option for GTalk accounts.
eion@robbmob.com
parents:
28682
diff
changeset
|
1846 act = purple_menu_action_new(_("Initiate _Chat"), |
51d507e6c8f3
jabber: Add an "Initiate Chat" blist context menu option for GTalk accounts.
eion@robbmob.com
parents:
28682
diff
changeset
|
1847 PURPLE_CALLBACK(google_buddy_node_chat), |
51d507e6c8f3
jabber: Add an "Initiate Chat" blist context menu option for GTalk accounts.
eion@robbmob.com
parents:
28682
diff
changeset
|
1848 NULL, NULL); |
51d507e6c8f3
jabber: Add an "Initiate Chat" blist context menu option for GTalk accounts.
eion@robbmob.com
parents:
28682
diff
changeset
|
1849 m = g_list_append(m, act); |
51d507e6c8f3
jabber: Add an "Initiate Chat" blist context menu option for GTalk accounts.
eion@robbmob.com
parents:
28682
diff
changeset
|
1850 } |
51d507e6c8f3
jabber: Add an "Initiate Chat" blist context menu option for GTalk accounts.
eion@robbmob.com
parents:
28682
diff
changeset
|
1851 |
17601
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1852 /* |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1853 * This if-condition implements parts of XEP-0100: Gateway Interaction |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1854 * |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1855 * According to stpeter, there is no way to know if a jid on the roster is a gateway without sending a disco#info. |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1856 * However, since the gateway might appear offline to us, we cannot get that information. Therefore, I just assume |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1857 * that gateways on the roster can be identified by having no '@' in their jid. This is a faily safe assumption, since |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1858 * people don't tend to have a server or other service there. |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1859 */ |
24120
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23986
diff
changeset
|
1860 if (g_utf8_strchr(name, -1, '@') == NULL) { |
17601
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1861 act = purple_menu_action_new(_("Log In"), |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1862 PURPLE_CALLBACK(jabber_buddy_login), |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1863 NULL, NULL); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1864 m = g_list_append(m, act); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1865 act = purple_menu_action_new(_("Log Out"), |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1866 PURPLE_CALLBACK(jabber_buddy_logout), |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1867 NULL, NULL); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1868 m = g_list_append(m, act); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17600
diff
changeset
|
1869 } |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25438
diff
changeset
|
1870 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
1871 /* add all ad hoc commands to the action menu */ |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
1872 for(jbrs = jb->resources; jbrs; jbrs = g_list_next(jbrs)) { |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
1873 JabberBuddyResource *jbr = jbrs->data; |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
1874 GList *commands; |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
1875 if (!jbr->commands) |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
1876 continue; |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
1877 for(commands = jbr->commands; commands; commands = g_list_next(commands)) { |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
1878 JabberAdHocCommands *cmd = commands->data; |
17611
feac55968392
Now all ad-hoc commands have to be sent through jabber_adhoc_execute to be properly executed (including the form steps). This cleans up the code a bit, and avoids DOS attacks by flooding the client with malicious ad-hoc command forms that were not requested.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17609
diff
changeset
|
1879 act = purple_menu_action_new(cmd->name, PURPLE_CALLBACK(jabber_adhoc_execute_action), cmd, NULL); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
1880 m = g_list_append(m, act); |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
1881 } |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
17601
diff
changeset
|
1882 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1883 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1884 return m; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1885 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1886 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1887 GList * |
15823 | 1888 jabber_blist_node_menu(PurpleBlistNode *node) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1889 { |
15823 | 1890 if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
1891 return jabber_buddy_menu((PurpleBuddy *) node); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1892 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1893 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1894 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1895 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1896 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1897 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1898 const char * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1899 jabber_buddy_state_get_name(JabberBuddyState state) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1900 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1901 switch(state) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1902 case JABBER_BUDDY_STATE_UNKNOWN: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1903 return _("Unknown"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1904 case JABBER_BUDDY_STATE_ERROR: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1905 return _("Error"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1906 case JABBER_BUDDY_STATE_UNAVAILABLE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1907 return _("Offline"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1908 case JABBER_BUDDY_STATE_ONLINE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1909 return _("Available"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1910 case JABBER_BUDDY_STATE_CHAT: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1911 return _("Chatty"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1912 case JABBER_BUDDY_STATE_AWAY: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1913 return _("Away"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1914 case JABBER_BUDDY_STATE_XA: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1915 return _("Extended Away"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1916 case JABBER_BUDDY_STATE_DND: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1917 return _("Do Not Disturb"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1918 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1919 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1920 return _("Unknown"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1921 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1922 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1923 JabberBuddyState jabber_buddy_status_id_get_state(const char *id) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1924 if(!id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1925 return JABBER_BUDDY_STATE_UNKNOWN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1926 if(!strcmp(id, "available")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1927 return JABBER_BUDDY_STATE_ONLINE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1928 if(!strcmp(id, "freeforchat")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1929 return JABBER_BUDDY_STATE_CHAT; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1930 if(!strcmp(id, "away")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1931 return JABBER_BUDDY_STATE_AWAY; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1932 if(!strcmp(id, "extended_away")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1933 return JABBER_BUDDY_STATE_XA; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1934 if(!strcmp(id, "dnd")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1935 return JABBER_BUDDY_STATE_DND; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1936 if(!strcmp(id, "offline")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1937 return JABBER_BUDDY_STATE_UNAVAILABLE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1938 if(!strcmp(id, "error")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1939 return JABBER_BUDDY_STATE_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1940 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1941 return JABBER_BUDDY_STATE_UNKNOWN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1942 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1943 |
27445
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1944 const struct { |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1945 const char *name; |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1946 JabberBuddyState state; |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1947 } show_state_pairs[] = { |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1948 { "available", JABBER_BUDDY_STATE_ONLINE }, |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1949 { "chat", JABBER_BUDDY_STATE_CHAT }, |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1950 { "away", JABBER_BUDDY_STATE_AWAY }, |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1951 { "xa", JABBER_BUDDY_STATE_XA }, |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1952 { "dnd", JABBER_BUDDY_STATE_DND }, |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1953 { "offline", JABBER_BUDDY_STATE_UNAVAILABLE }, |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1954 { "error", JABBER_BUDDY_STATE_ERROR }, |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1955 { NULL, JABBER_BUDDY_STATE_UNKNOWN } |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1956 }; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1957 |
27445
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1958 JabberBuddyState jabber_buddy_show_get_state(const char *id) |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1959 { |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1960 int i; |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1961 |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1962 g_return_val_if_fail(id != NULL, JABBER_BUDDY_STATE_UNKNOWN); |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1963 |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1964 for (i = 0; show_state_pairs[i].name; ++i) |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1965 if (g_str_equal(id, show_state_pairs[i].name)) |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1966 return show_state_pairs[i].state; |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1967 |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1968 purple_debug_warning("jabber", "Invalid value of presence <show/> " |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1969 "attribute: %s\n", id); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1970 return JABBER_BUDDY_STATE_UNKNOWN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1971 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1972 |
27445
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1973 const char * |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1974 jabber_buddy_state_get_show(JabberBuddyState state) |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1975 { |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1976 int i; |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1977 |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1978 for (i = 0; show_state_pairs[i].name; ++i) |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1979 if (state == show_state_pairs[i].state) |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1980 return show_state_pairs[i].name; |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1981 |
eff7db4db632
Various minor changes to jabber_presence_parse. No functionality changes.
Paul Aurich <paul@darkrain42.org>
parents:
27408
diff
changeset
|
1982 /* purple_debug_warning("jabber", "Unknown buddy state: %d\n", state); */ |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1983 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1984 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1985 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1986 const char *jabber_buddy_state_get_status_id(JabberBuddyState state) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1987 switch(state) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1988 case JABBER_BUDDY_STATE_CHAT: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1989 return "freeforchat"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1990 case JABBER_BUDDY_STATE_AWAY: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1991 return "away"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1992 case JABBER_BUDDY_STATE_XA: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1993 return "extended_away"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1994 case JABBER_BUDDY_STATE_DND: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1995 return "dnd"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1996 case JABBER_BUDDY_STATE_ONLINE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1997 return "available"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1998 case JABBER_BUDDY_STATE_UNKNOWN: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1999 return "available"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2000 case JABBER_BUDDY_STATE_ERROR: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2001 return "error"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2002 case JABBER_BUDDY_STATE_UNAVAILABLE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2003 return "offline"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2004 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2005 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2006 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2007 |
15823 | 2008 static void user_search_result_add_buddy_cb(PurpleConnection *gc, GList *row, void *user_data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2009 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2010 /* XXX find out the jid */ |
15823 | 2011 purple_blist_request_add_buddy(purple_connection_get_account(gc), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2012 g_list_nth_data(row, 0), NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2013 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2014 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2015 static void user_search_result_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2016 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2017 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2018 { |
15823 | 2019 PurpleNotifySearchResults *results; |
2020 PurpleNotifySearchColumn *column; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2021 xmlnode *x, *query, *item, *field; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2022 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2023 /* XXX error checking? */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2024 if(!(query = xmlnode_get_child(packet, "query"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2025 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2026 |
15823 | 2027 results = purple_notify_searchresults_new(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2028 if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2029 xmlnode *reported; |
19931
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2030 GSList *column_vars = NULL; |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2031 |
15823 | 2032 purple_debug_info("jabber", "new-skool\n"); |
19931
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2033 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2034 if((reported = xmlnode_get_child(x, "reported"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2035 xmlnode *field = xmlnode_get_child(reported, "field"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2036 while(field) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2037 const char *var = xmlnode_get_attrib(field, "var"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2038 const char *label = xmlnode_get_attrib(field, "label"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2039 if(var) { |
15823 | 2040 column = purple_notify_searchresults_column_new(label ? label : var); |
2041 purple_notify_searchresults_column_add(results, column); | |
19931
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2042 column_vars = g_slist_append(column_vars, (char *)var); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2043 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2044 field = xmlnode_get_next_twin(field); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2045 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2046 } |
19931
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2047 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2048 item = xmlnode_get_child(x, "item"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2049 while(item) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2050 GList *row = NULL; |
19931
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2051 GSList *l; |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2052 xmlnode *valuenode; |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2053 const char *var; |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2054 |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2055 for (l = column_vars; l != NULL; l = l->next) { |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2056 /* |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2057 * Build a row containing the strings that correspond |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2058 * to each column of the search results. |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2059 */ |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2060 for (field = xmlnode_get_child(item, "field"); |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2061 field != NULL; |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2062 field = xmlnode_get_next_twin(field)) |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2063 { |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2064 if ((var = xmlnode_get_attrib(field, "var")) && |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2065 !strcmp(var, l->data) && |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2066 (valuenode = xmlnode_get_child(field, "value"))) |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2067 { |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2068 char *value = xmlnode_get_data(valuenode); |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2069 row = g_list_append(row, value); |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2070 break; |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2071 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2072 } |
19931
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2073 if (field == NULL) |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2074 /* No data for this column */ |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2075 row = g_list_append(row, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2076 } |
15823 | 2077 purple_notify_searchresults_row_add(results, row); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2078 item = xmlnode_get_next_twin(item); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2079 } |
19931
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2080 |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19729
diff
changeset
|
2081 g_slist_free(column_vars); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2082 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2083 /* old skool */ |
15823 | 2084 purple_debug_info("jabber", "old-skool\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2085 |
15823 | 2086 column = purple_notify_searchresults_column_new(_("JID")); |
2087 purple_notify_searchresults_column_add(results, column); | |
2088 column = purple_notify_searchresults_column_new(_("First Name")); | |
2089 purple_notify_searchresults_column_add(results, column); | |
2090 column = purple_notify_searchresults_column_new(_("Last Name")); | |
2091 purple_notify_searchresults_column_add(results, column); | |
2092 column = purple_notify_searchresults_column_new(_("Nickname")); | |
2093 purple_notify_searchresults_column_add(results, column); | |
23182
e0bcb8cfda74
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@wiktel.com>
parents:
22834
diff
changeset
|
2094 column = purple_notify_searchresults_column_new(_("Email")); |
15823 | 2095 purple_notify_searchresults_column_add(results, column); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2096 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2097 for(item = xmlnode_get_child(query, "item"); item; item = xmlnode_get_next_twin(item)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2098 const char *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2099 xmlnode *node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2100 GList *row = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2101 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2102 if(!(jid = xmlnode_get_attrib(item, "jid"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2103 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2104 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2105 row = g_list_append(row, g_strdup(jid)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2106 node = xmlnode_get_child(item, "first"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2107 row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2108 node = xmlnode_get_child(item, "last"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2109 row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2110 node = xmlnode_get_child(item, "nick"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2111 row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2112 node = xmlnode_get_child(item, "email"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2113 row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); |
22475
3225c99785b8
Fix a bunch of compiler warnings caused by my addition of G_GNUC_PRINTF()
Mark Doliner <mark@kingant.net>
parents:
22439
diff
changeset
|
2114 purple_debug_info("jabber", "row=%p\n", row); |
15823 | 2115 purple_notify_searchresults_row_add(results, row); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2116 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2117 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2118 |
15823 | 2119 purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2120 user_search_result_add_buddy_cb); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2121 |
15823 | 2122 purple_notify_searchresults(js->gc, NULL, NULL, _("The following are the results of your search"), results, NULL, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2123 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2124 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2125 static void user_search_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2126 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2127 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2128 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2129 char *dir_server = data; |
21120
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2130 const char *type; |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2131 |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2132 /* if they've cancelled the search, we're |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2133 * just going to get an error if we send |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2134 * a cancel, so skip it */ |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2135 type = xmlnode_get_attrib(result, "type"); |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2136 if(type && !strcmp(type, "cancel")) { |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2137 g_free(dir_server); |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2138 return; |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2139 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2140 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2141 iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:search"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2142 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2143 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2144 xmlnode_insert_child(query, result); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2145 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2146 jabber_iq_set_callback(iq, user_search_result_cb, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2147 xmlnode_set_attrib(iq->node, "to", dir_server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2148 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2149 g_free(dir_server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2150 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2151 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2152 struct user_search_info { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2153 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2154 char *directory_server; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2155 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2156 |
15823 | 2157 static void user_search_cancel_cb(struct user_search_info *usi, PurpleRequestFields *fields) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2158 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2159 g_free(usi->directory_server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2160 g_free(usi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2161 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2162 |
15823 | 2163 static void user_search_cb(struct user_search_info *usi, PurpleRequestFields *fields) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2164 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2165 JabberStream *js = usi->js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2166 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2167 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2168 GList *groups, *flds; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2169 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2170 iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:search"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2171 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2172 |
15823 | 2173 for(groups = purple_request_fields_get_groups(fields); groups; groups = groups->next) { |
2174 for(flds = purple_request_field_group_get_fields(groups->data); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2175 flds; flds = flds->next) { |
15823 | 2176 PurpleRequestField *field = flds->data; |
2177 const char *id = purple_request_field_get_id(field); | |
2178 const char *value = purple_request_field_string_get_value(field); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2179 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2180 if(value && (!strcmp(id, "first") || !strcmp(id, "last") || !strcmp(id, "nick") || !strcmp(id, "email"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2181 xmlnode *y = xmlnode_new_child(query, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2182 xmlnode_insert_data(y, value, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2183 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2184 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2185 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2186 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2187 jabber_iq_set_callback(iq, user_search_result_cb, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2188 xmlnode_set_attrib(iq->node, "to", usi->directory_server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2189 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2190 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2191 g_free(usi->directory_server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2192 g_free(usi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2193 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2194 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2195 #if 0 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2196 /* This is for gettext only -- it will see this even though there's an #if 0. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2197 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2198 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2199 * An incomplete list of server generated original language search |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2200 * comments for Jabber User Directories |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2201 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2202 * See discussion thread "Search comment for Jabber is not translatable" |
15823 | 2203 * in purple-i18n@lists.sourceforge.net (March 2006) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2204 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2205 static const char * jabber_user_dir_comments [] = { |
19489
b0733d5d7621
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18698
diff
changeset
|
2206 /* current comment from Jabber User Directory users.jabber.org */ |
b0733d5d7621
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18698
diff
changeset
|
2207 N_("Find a contact by entering the search criteria in the given fields. " |
b0733d5d7621
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18698
diff
changeset
|
2208 "Note: Each field supports wild card searches (%)"), |
b0733d5d7621
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18698
diff
changeset
|
2209 NULL |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2210 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2211 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2212 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2213 static void user_search_fields_result_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2214 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2215 xmlnode *packet, gpointer data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2216 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2217 xmlnode *query, *x; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2218 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2219 if (!from) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2220 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2221 |
26547
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
2222 if (type == JABBER_IQ_ERROR) { |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
20092
diff
changeset
|
2223 char *msg = jabber_parse_error(js, packet, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2224 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2225 if(!msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2226 msg = g_strdup(_("Unknown error")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2227 |
15823 | 2228 purple_notify_error(js->gc, _("Directory Query Failed"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2229 _("Could not query the directory server."), msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2230 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2231 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2232 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2233 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2234 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2235 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2236 if(!(query = xmlnode_get_child(packet, "query"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2237 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2238 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2239 if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2240 jabber_x_data_request(js, x, user_search_x_data_cb, g_strdup(from)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2241 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2242 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2243 struct user_search_info *usi; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2244 xmlnode *instnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2245 char *instructions = NULL; |
15823 | 2246 PurpleRequestFields *fields; |
2247 PurpleRequestFieldGroup *group; | |
2248 PurpleRequestField *field; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2249 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2250 /* old skool */ |
15823 | 2251 fields = purple_request_fields_new(); |
2252 group = purple_request_field_group_new(NULL); | |
2253 purple_request_fields_add_group(fields, group); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2254 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2255 if((instnode = xmlnode_get_child(query, "instructions"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2256 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2257 char *tmp = xmlnode_get_data(instnode); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2258 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2259 if(tmp) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2260 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2261 /* Try to translate the message (see static message |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2262 list in jabber_user_dir_comments[]) */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2263 instructions = g_strdup_printf(_("Server Instructions: %s"), _(tmp)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2264 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2265 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2266 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2267 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2268 if(!instructions) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2269 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2270 instructions = g_strdup(_("Fill in one or more fields to search " |
16915
56042b2f8b64
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@wiktel.com>
parents:
16728
diff
changeset
|
2271 "for any matching XMPP users.")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2272 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2273 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2274 if(xmlnode_get_child(query, "first")) { |
15823 | 2275 field = purple_request_field_string_new("first", _("First Name"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2276 NULL, FALSE); |
15823 | 2277 purple_request_field_group_add_field(group, field); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2278 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2279 if(xmlnode_get_child(query, "last")) { |
15823 | 2280 field = purple_request_field_string_new("last", _("Last Name"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2281 NULL, FALSE); |
15823 | 2282 purple_request_field_group_add_field(group, field); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2283 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2284 if(xmlnode_get_child(query, "nick")) { |
15823 | 2285 field = purple_request_field_string_new("nick", _("Nickname"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2286 NULL, FALSE); |
15823 | 2287 purple_request_field_group_add_field(group, field); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2288 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2289 if(xmlnode_get_child(query, "email")) { |
23182
e0bcb8cfda74
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@wiktel.com>
parents:
22834
diff
changeset
|
2290 field = purple_request_field_string_new("email", _("Email Address"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2291 NULL, FALSE); |
15823 | 2292 purple_request_field_group_add_field(group, field); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2293 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2294 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2295 usi = g_new0(struct user_search_info, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2296 usi->js = js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2297 usi->directory_server = g_strdup(from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2298 |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2299 purple_request_fields(js->gc, _("Search for XMPP users"), |
16915
56042b2f8b64
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@wiktel.com>
parents:
16728
diff
changeset
|
2300 _("Search for XMPP users"), instructions, fields, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2301 _("Search"), G_CALLBACK(user_search_cb), |
16442
08db93bbd798
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 <evan.s@dreskin.net>
parents:
15823
diff
changeset
|
2302 _("Cancel"), G_CALLBACK(user_search_cancel_cb), |
17591
58a145802f0a
Fixed weird bug that caused not supplying the account when searching for users.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17582
diff
changeset
|
2303 purple_connection_get_account(js->gc), NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2304 usi); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2305 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2306 g_free(instructions); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2307 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2308 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2309 |
17600
3f2b5e2ab5c5
Exposed the user search function, so that directory searches can be performed directly when the jid is known.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17591
diff
changeset
|
2310 void jabber_user_search(JabberStream *js, const char *directory) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2311 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2312 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2313 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2314 /* XXX: should probably better validate the directory we're given */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2315 if(!directory || !*directory) { |
15823 | 2316 purple_notify_error(js->gc, _("Invalid Directory"), _("Invalid Directory"), NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2317 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2318 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2319 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2320 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:search"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2321 xmlnode_set_attrib(iq->node, "to", directory); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2322 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2323 jabber_iq_set_callback(iq, user_search_fields_result_cb, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2324 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2325 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2326 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2327 |
15823 | 2328 void jabber_user_search_begin(PurplePluginAction *action) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2329 { |
15823 | 2330 PurpleConnection *gc = (PurpleConnection *) action->context; |
25286
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
23986
diff
changeset
|
2331 JabberStream *js = purple_connection_get_protocol_data(gc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2332 |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2333 purple_request_input(gc, _("Enter a User Directory"), _("Enter a User Directory"), |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2334 _("Select a user directory to search"), |
16962
88444e60ea95
Removes 'jabber.org' defaults from XMPP. I think we had agreed this was a good idea.
Sean Egan <seanegan@gmail.com>
parents:
16915
diff
changeset
|
2335 js->user_directories ? js->user_directories->data : NULL, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2336 FALSE, FALSE, NULL, |
17600
3f2b5e2ab5c5
Exposed the user search function, so that directory searches can be performed directly when the jid is known.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17591
diff
changeset
|
2337 _("Search Directory"), PURPLE_CALLBACK(jabber_user_search), |
16442
08db93bbd798
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 <evan.s@dreskin.net>
parents:
15823
diff
changeset
|
2338 _("Cancel"), NULL, |
08db93bbd798
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 <evan.s@dreskin.net>
parents:
15823
diff
changeset
|
2339 NULL, NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2340 js); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2341 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2342 |
23445
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2343 gboolean |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2344 jabber_resource_has_capability(const JabberBuddyResource *jbr, const gchar *cap) |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2345 { |
25770
b1b1b75a922e
Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents:
25758
diff
changeset
|
2346 const GList *node = NULL; |
25784
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
2347 const JabberCapsNodeExts *exts; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2348 |
25784
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
2349 if (!jbr->caps.info) { |
27513
b118127843cc
Lower the severity of this message.
Paul Aurich <paul@darkrain42.org>
parents:
27445
diff
changeset
|
2350 purple_debug_info("jabber", |
23445
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2351 "Unable to find caps: nothing known about buddy\n"); |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2352 return FALSE; |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2353 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2354 |
25784
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
2355 node = g_list_find_custom(jbr->caps.info->features, cap, (GCompareFunc)strcmp); |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
2356 if (!node && jbr->caps.exts && jbr->caps.info->exts) { |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
2357 const GList *ext; |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
2358 exts = jbr->caps.info->exts; |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
2359 /* Walk through all the enabled caps, checking each list for the cap. |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
2360 * Don't check it twice, though. */ |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
2361 for (ext = jbr->caps.exts; ext && !node; ext = ext->next) { |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
2362 GList *features = g_hash_table_lookup(exts->exts, ext->data); |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
2363 if (features) |
05693f6885a4
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <paul@darkrain42.org>
parents:
25782
diff
changeset
|
2364 node = g_list_find_custom(features, cap, (GCompareFunc)strcmp); |
23445
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2365 } |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2366 } |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2367 |
25770
b1b1b75a922e
Sprinkle jabber_resource_has_capability in places
Paul Aurich <paul@darkrain42.org>
parents:
25758
diff
changeset
|
2368 return (node != NULL); |
23445
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2369 } |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2370 |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2371 gboolean |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2372 jabber_buddy_has_capability(const JabberBuddy *jb, const gchar *cap) |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2373 { |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2374 JabberBuddyResource *jbr = jabber_buddy_find_resource((JabberBuddy*)jb, NULL); |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2375 |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2376 if (!jbr) { |
24984
c814641afcf2
This happens anytime you IM an offline user, and is totally not an error
Mark Doliner <mark@kingant.net>
parents:
24920
diff
changeset
|
2377 purple_debug_info("jabber", |
23445
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2378 "Unable to find caps: buddy might be offline\n"); |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2379 return FALSE; |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2380 } |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2381 |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2382 return jabber_resource_has_capability(jbr, cap); |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2383 } |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23253
diff
changeset
|
2384 |
25836
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25069
diff
changeset
|
2385 const gchar * |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25069
diff
changeset
|
2386 jabber_resource_get_identity_category_type(const JabberBuddyResource *jbr, |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25069
diff
changeset
|
2387 const gchar *category) |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25069
diff
changeset
|
2388 { |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25069
diff
changeset
|
2389 const GList *iter = NULL; |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25069
diff
changeset
|
2390 |
27064
007dff3cb9e4
Fixup after propagating new caps stuff
Marcus Lundblad <ml@update.uu.se>
parents:
27063
diff
changeset
|
2391 if (jbr->caps.info) { |
007dff3cb9e4
Fixup after propagating new caps stuff
Marcus Lundblad <ml@update.uu.se>
parents:
27063
diff
changeset
|
2392 for (iter = jbr->caps.info->identities ; iter ; iter = g_list_next(iter)) { |
007dff3cb9e4
Fixup after propagating new caps stuff
Marcus Lundblad <ml@update.uu.se>
parents:
27063
diff
changeset
|
2393 const JabberIdentity *identity = |
007dff3cb9e4
Fixup after propagating new caps stuff
Marcus Lundblad <ml@update.uu.se>
parents:
27063
diff
changeset
|
2394 (JabberIdentity *) iter->data; |
25836
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25069
diff
changeset
|
2395 |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25069
diff
changeset
|
2396 if (strcmp(identity->category, category) == 0) { |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25069
diff
changeset
|
2397 return identity->type; |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25069
diff
changeset
|
2398 } |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25069
diff
changeset
|
2399 } |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25069
diff
changeset
|
2400 } |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25069
diff
changeset
|
2401 |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25069
diff
changeset
|
2402 return NULL; |
1d3274111180
Set a value "type" in the ui_info hash table
Marcus Lundblad <ml@update.uu.se>
parents:
25069
diff
changeset
|
2403 } |