Mercurial > pidgin
annotate libpurple/protocols/jabber/buddy.c @ 25162:7dcba13d0e28
Move structures and function definitions in to caps.c and stop any other code from killing JabberCapsClientInfo structures (owned by the hash table)
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sat, 22 Nov 2008 01:05:42 +0000 |
parents | 6d6e10476c52 |
children | b1b1b75a922e |
rev | line source |
---|---|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
15822 | 2 * purple - Jabber Protocol Plugin |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
4 * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
6 * 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
|
7 * 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
|
8 * 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
|
9 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * 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
|
12 * 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
|
13 * 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
|
14 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * 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
|
17 * along with this program; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18257
diff
changeset
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 #include "internal.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 #include "cipher.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 #include "imgstore.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 #include "prpl.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "request.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "xmlnode.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "buddy.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "chat.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "jabber.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "iq.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "presence.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #include "xdata.h" |
17853
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
37 #include "pep.h" |
17882
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:
17874
diff
changeset
|
38 #include "adhoccommands.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 |
23686
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23358
diff
changeset
|
40 #define MAX_HTTP_BUDDYICON_BYTES (200 * 1024) |
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23358
diff
changeset
|
41 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 typedef struct { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 long idle_seconds; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 } JabberBuddyInfoResource; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 typedef struct { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 JabberBuddy *jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 char *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 GSList *ids; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 GHashTable *resources; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 int timeout_handle; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 GSList *vcard_imgids; |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
54 PurpleNotifyUserInfo *user_info; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 } JabberBuddyInfo; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 void jabber_buddy_free(JabberBuddy *jb) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 g_return_if_fail(jb != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 |
22794
cc8903c59d6b
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents:
22780
diff
changeset
|
61 g_free(jb->error_msg); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 while(jb->resources) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 jabber_buddy_resource_free(jb->resources->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 g_free(jb); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 } |
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 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
|
69 gboolean create) |
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 *jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 const char *realname; |
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 if (js->buddies == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 return NULL; |
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(!(realname = jabber_normalize(js->gc->account, name))) |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 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
|
81 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 if(!jb && create) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 jb = g_new0(JabberBuddy, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 g_hash_table_insert(js->buddies, g_strdup(realname), jb); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 return jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 |
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 JabberBuddyResource *jabber_buddy_find_resource(JabberBuddy *jb, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 const char *resource) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 JabberBuddyResource *jbr = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 if(!jb) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 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
|
101 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 if(!jbr && !resource) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 jbr = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 } else if(!resource) { |
22414
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
105 if(((JabberBuddyResource *)l->data)->priority > jbr->priority) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 jbr = l->data; |
22414
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
107 else if(((JabberBuddyResource *)l->data)->priority == jbr->priority) { |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
108 /* Determine if this resource is more available than the one we've currently chosen */ |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
109 switch(((JabberBuddyResource *)l->data)->state) { |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
110 case JABBER_BUDDY_STATE_ONLINE: |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
111 case JABBER_BUDDY_STATE_CHAT: |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
112 /* This resource is online/chatty. Prefer to one which isn't either. */ |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
113 if ((jbr->state != JABBER_BUDDY_STATE_ONLINE) && (jbr->state != JABBER_BUDDY_STATE_CHAT)) |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
114 jbr = l->data; |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
115 break; |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
116 case JABBER_BUDDY_STATE_AWAY: |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
117 case JABBER_BUDDY_STATE_DND: |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
118 case JABBER_BUDDY_STATE_UNAVAILABLE: |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
119 /* This resource is away/dnd/unavailable. Prefer to one which is extended away or unknown. */ |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
120 if ((jbr->state == JABBER_BUDDY_STATE_XA) || |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
121 (jbr->state == JABBER_BUDDY_STATE_UNKNOWN) || (jbr->state == JABBER_BUDDY_STATE_ERROR)) |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
122 jbr = l->data; |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
123 break; |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
124 case JABBER_BUDDY_STATE_XA: |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
125 /* This resource is extended away. That's better than unknown. */ |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
126 if ((jbr->state == JABBER_BUDDY_STATE_UNKNOWN) || (jbr->state == JABBER_BUDDY_STATE_ERROR)) |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
127 jbr = l->data; |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
128 break; |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
129 case JABBER_BUDDY_STATE_UNKNOWN: |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
130 case JABBER_BUDDY_STATE_ERROR: |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
131 /* These are never preferable. */ |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
132 break; |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
133 } |
67f62f55fc5a
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evan.s@dreskin.net>
parents:
22295
diff
changeset
|
134 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 } else if(((JabberBuddyResource *)l->data)->name) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 if(!strcmp(((JabberBuddyResource *)l->data)->name, resource)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 jbr = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 return jbr; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 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
|
147 int priority, JabberBuddyState state, const char *status) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 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
|
150 if(!jbr) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 jbr = g_new0(JabberBuddyResource, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 jbr->jb = jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 jbr->name = g_strdup(resource); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 jbr->capabilities = JABBER_CAP_XHTML; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 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
|
156 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 jbr->priority = priority; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 jbr->state = state; |
22780 | 159 g_free(jbr->status); |
160 jbr->status = status != NULL ? g_markup_escape_text(status, -1) : NULL; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 return jbr; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 void jabber_buddy_resource_free(JabberBuddyResource *jbr) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 g_return_if_fail(jbr != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 jbr->jb->resources = g_list_remove(jbr->jb->resources, jbr); |
17882
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:
17874
diff
changeset
|
170 |
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:
17874
diff
changeset
|
171 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:
17874
diff
changeset
|
172 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:
17874
diff
changeset
|
173 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:
17874
diff
changeset
|
174 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:
17874
diff
changeset
|
175 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:
17874
diff
changeset
|
176 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:
17874
diff
changeset
|
177 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:
17874
diff
changeset
|
178 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 |
25162
7dcba13d0e28
Move structures and function definitions in to caps.c and stop any other code from killing JabberCapsClientInfo structures (owned by the hash table)
Paul Aurich <paul@darkrain42.org>
parents:
25147
diff
changeset
|
180 /* jbr->caps is owned by the caps code */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 g_free(jbr->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 g_free(jbr->status); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 g_free(jbr->thread_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 g_free(jbr->client.name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 g_free(jbr->client.version); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 g_free(jbr->client.os); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 g_free(jbr); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 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
|
191 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 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
|
193 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 if(!jbr) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 return; |
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 jabber_buddy_resource_free(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 const char *jabber_buddy_get_status_msg(JabberBuddy *jb) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 JabberBuddyResource *jbr; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 if(!jb) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 jbr = jabber_buddy_find_resource(jb, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 if(!jbr) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 return NULL; |
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 return jbr->status; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
215 /******* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 * 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
|
217 * 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
|
218 * 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
|
219 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 * 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
|
221 * _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
|
222 * 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
|
223 * replace vcard-temp |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 * --Nathan |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 *******/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 /*---------------------------------------*/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 /* Jabber "set info" (vCard) support */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 /*---------------------------------------*/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 * V-Card format: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 * <vCard prodid='' version='' xmlns=''> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 * <FN></FN> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 * <N> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 * <FAMILY/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 * <GIVEN/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 * </N> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 * <NICKNAME/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 * <URL/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 * <ADR> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 * <STREET/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 * <EXTADD/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 * <LOCALITY/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 * <REGION/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 * <PCODE/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 * <COUNTRY/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 * </ADR> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 * <TEL/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 * <EMAIL/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 * <ORG> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 * <ORGNAME/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 * <ORGUNIT/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 * </ORG> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 * <TITLE/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 * <ROLE/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 * <DESC/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 * <BDAY/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 * </vCard> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 * See also: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 * 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
|
265 * 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
|
266 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 |
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 * 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
|
270 * and attributes. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 * 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
|
273 * 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
|
274 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
275 * 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
|
276 * 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
|
277 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 * 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
|
279 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 * 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
|
281 * 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
|
282 * "automagically" construct the appropriate XML node tree. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 * Thoughts on future direction/expansion |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 * This is a "simple" vCard. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 * 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
|
289 * 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
|
290 * "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
|
291 * 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
|
292 * array. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 * 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
|
295 * construction routines. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 struct vcard_template { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 char *label; /* label text pointer */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 char *text; /* entry text pointer */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 int visible; /* should entry field be "visible?" */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 int editable; /* should entry field be editable? */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 char *tag; /* tag text */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 char *ptag; /* parent tag "path" text */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 char *url; /* vCard display format if URL */ |
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
|
306 } const vcard_template_data[] = { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 {N_("Full Name"), NULL, TRUE, TRUE, "FN", NULL, NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 {N_("Family Name"), NULL, TRUE, TRUE, "FAMILY", "N", NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 {N_("Given Name"), NULL, TRUE, TRUE, "GIVEN", "N", NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 {N_("Nickname"), NULL, TRUE, TRUE, "NICKNAME", NULL, NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 {N_("URL"), NULL, TRUE, TRUE, "URL", NULL, "<A HREF=\"%s\">%s</A>"}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 {N_("Street Address"), NULL, TRUE, TRUE, "STREET", "ADR", NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 {N_("Extended Address"), NULL, TRUE, TRUE, "EXTADD", "ADR", NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 {N_("Locality"), NULL, TRUE, TRUE, "LOCALITY", "ADR", NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 {N_("Region"), NULL, TRUE, TRUE, "REGION", "ADR", NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 {N_("Postal Code"), NULL, TRUE, TRUE, "PCODE", "ADR", NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 {N_("Country"), NULL, TRUE, TRUE, "CTRY", "ADR", NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 {N_("Telephone"), NULL, TRUE, TRUE, "NUMBER", "TEL", NULL}, |
23180
e0bcb8cfda74
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@wiktel.com>
parents:
22861
diff
changeset
|
319 {N_("Email"), NULL, TRUE, TRUE, "USERID", "EMAIL", "<A HREF=\"mailto:%s\">%s</A>"}, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 {N_("Organization Name"), NULL, TRUE, TRUE, "ORGNAME", "ORG", NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 {N_("Organization Unit"), NULL, TRUE, TRUE, "ORGUNIT", "ORG", NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 {N_("Title"), NULL, TRUE, TRUE, "TITLE", NULL, NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 {N_("Role"), NULL, TRUE, TRUE, "ROLE", NULL, NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 {N_("Birthday"), NULL, TRUE, TRUE, "BDAY", NULL, NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 {N_("Description"), NULL, TRUE, TRUE, "DESC", NULL, NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 {"", NULL, TRUE, TRUE, "N", NULL, NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 {"", NULL, TRUE, TRUE, "ADR", NULL, NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 {"", NULL, TRUE, TRUE, "ORG", NULL, NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 {NULL, NULL, 0, 0, NULL, NULL, NULL} |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 * The "vCard" tag's attribute list... |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 struct tag_attr { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 char *attr; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 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
|
338 } const vcard_tag_attr_list[] = { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 {"prodid", "-//HandGen//NONSGML vGen v1.0//EN"}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 {"version", "2.0", }, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 {"xmlns", "vcard-temp", }, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 {NULL, NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
343 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 * 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
|
348 * nodes as necessary |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
350 * Returns pointer to inserted node |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
351 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 * 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
|
353 * 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
|
354 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
355 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
|
356 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 xmlnode *x = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
358 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 * 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
|
361 * from the vCard template struct. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
362 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
363 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
|
364 const struct vcard_template *vc_tp = vcard_template_data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
365 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 while(vc_tp->label != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
367 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
|
368 parent_tag = vc_tp->ptag; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
369 break; |
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 ++vc_tp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 } |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
375 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 * If we have a parent tag... |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
378 if(parent_tag != NULL ) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 * 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
|
381 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 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
|
383 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 * Descend? |
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 char *grand_parent = g_strdup(parent_tag); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 char *parent; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 if((parent = strrchr(grand_parent, '/')) != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 *(parent++) = '\0'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 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
|
392 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 x = xmlnode_new_child(start, grand_parent); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
394 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 g_free(grand_parent); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 } else { |
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 * 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
|
399 * Note: may be the "root" node! |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 xmlnode *y; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 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
|
403 return(y); |
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
408 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 * 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
|
410 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
411 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
|
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 * Send vCard info to Jabber server |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
416 */ |
15822 | 417 void jabber_set_info(PurpleConnection *gc, const char *info) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 { |
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
|
419 PurpleStoredImage *img; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 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
|
423 const struct tag_attr *tag_attr; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 |
18163
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
425 /* 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
|
426 * 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
|
427 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
|
428 return; |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
429 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
430 g_free(js->avatar_hash); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 js->avatar_hash = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 |
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 * 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
|
435 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 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
|
437 |
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
|
438 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
|
439 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
|
440 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
|
441 vc_node = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 |
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
|
444 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
|
445 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
|
446 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
|
447 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
|
448 gchar *enc; |
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
|
449 int i; |
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
|
450 unsigned char hashval[20]; |
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
|
451 char *p, hash[41]; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
452 |
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
|
453 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
|
454 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
|
455 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
|
456 xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
457 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 |
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
|
459 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
|
460 avatar_len = purple_imgstore_get_size(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
|
461 /* have to get rid of the old PHOTO if it exists */ |
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
|
462 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
|
463 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
|
464 } |
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
|
465 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
|
466 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
|
467 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
|
468 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
|
469 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
|
470 |
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
|
471 purple_cipher_digest_region("sha1", 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
|
472 avatar_len, sizeof(hashval), |
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
|
473 hashval, NULL); |
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
|
474 |
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
|
475 purple_imgstore_unref(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
|
476 |
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
|
477 p = hash; |
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
|
478 for(i=0; i<20; i++, p+=2) |
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
|
479 snprintf(p, 3, "%02x", hashval[i]); |
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
|
480 js->avatar_hash = g_strdup(hash); |
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
|
481 |
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 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
|
483 g_free(enc); |
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 } |
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 |
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
|
486 if (vc_node != NULL) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
487 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
|
488 xmlnode_insert_child(iq->node, vc_node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
489 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
490 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
491 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
492 |
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
|
493 void jabber_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
494 { |
17853
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
495 if(((JabberStream*)gc->proto_data)->pep) { |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
496 /* XEP-0084: User Avatars */ |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
497 if(img) { |
22794
cc8903c59d6b
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents:
22780
diff
changeset
|
498 /* |
cc8903c59d6b
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents:
22780
diff
changeset
|
499 * TODO: This is pretty gross. The Jabber PRPL really shouldn't |
cc8903c59d6b
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents:
22780
diff
changeset
|
500 * do voodoo to try to determine the image type, height |
cc8903c59d6b
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents:
22780
diff
changeset
|
501 * and width. |
cc8903c59d6b
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents:
22780
diff
changeset
|
502 */ |
17853
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
503 /* A PNG header, including the IHDR, but nothing else */ |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
504 const struct { |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
505 guchar signature[8]; /* must be hex 89 50 4E 47 0D 0A 1A 0A */ |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
506 struct { |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
507 guint32 length; /* must be 0x0d */ |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
508 guchar type[4]; /* must be 'I' 'H' 'D' 'R' */ |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
509 guint32 width; |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
510 guint32 height; |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
511 guchar bitdepth; |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
512 guchar colortype; |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
513 guchar compression; |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
514 guchar filter; |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
515 guchar interlace; |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
516 } ihdr; |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
517 } *png = purple_imgstore_get_data(img); /* ATTN: this is in network byte order! */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
518 |
17853
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
519 /* check if the data is a valid png file (well, at least to some extend) */ |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
520 if(png->signature[0] == 0x89 && |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
521 png->signature[1] == 0x50 && |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
522 png->signature[2] == 0x4e && |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
523 png->signature[3] == 0x47 && |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
524 png->signature[4] == 0x0d && |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
525 png->signature[5] == 0x0a && |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
526 png->signature[6] == 0x1a && |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
527 png->signature[7] == 0x0a && |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
528 ntohl(png->ihdr.length) == 0x0d && |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
529 png->ihdr.type[0] == 'I' && |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
530 png->ihdr.type[1] == 'H' && |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
531 png->ihdr.type[2] == 'D' && |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
532 png->ihdr.type[3] == 'R') { |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
533 /* parse PNG header to get the size of the image (yes, this is required) */ |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
534 guint32 width = ntohl(png->ihdr.width); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
535 guint32 height = ntohl(png->ihdr.height); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
536 xmlnode *publish, *item, *data, *metadata, *info; |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
537 char *lengthstring, *widthstring, *heightstring; |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
538 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
539 /* compute the sha1 hash */ |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
540 PurpleCipherContext *ctx; |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
541 unsigned char digest[20]; |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
542 char *hash; |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
543 char *base64avatar; |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
544 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
545 ctx = purple_cipher_context_new_by_name("sha1", NULL); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
546 purple_cipher_context_append(ctx, purple_imgstore_get_data(img), purple_imgstore_get_size(img)); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
547 purple_cipher_context_digest(ctx, sizeof(digest), digest, NULL); |
22861 | 548 purple_cipher_context_destroy(ctx); |
17853
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
549 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
550 /* convert digest to a string */ |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
551 hash = g_strdup_printf("%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x%x",digest[0],digest[1],digest[2],digest[3],digest[4],digest[5],digest[6],digest[7],digest[8],digest[9],digest[10],digest[11],digest[12],digest[13],digest[14],digest[15],digest[16],digest[17],digest[18],digest[19]); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
552 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
553 publish = xmlnode_new("publish"); |
17854
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
554 xmlnode_set_attrib(publish,"node",AVATARNAMESPACEDATA); |
17853
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
555 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
556 item = xmlnode_new_child(publish, "item"); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
557 xmlnode_set_attrib(item, "id", hash); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
558 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
559 data = xmlnode_new_child(item, "data"); |
17854
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
560 xmlnode_set_namespace(data,AVATARNAMESPACEDATA); |
17853
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
561 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
562 base64avatar = purple_base64_encode(purple_imgstore_get_data(img), purple_imgstore_get_size(img)); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
563 xmlnode_insert_data(data,base64avatar,-1); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
564 g_free(base64avatar); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
565 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
566 /* publish the avatar itself */ |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
567 jabber_pep_publish((JabberStream*)gc->proto_data, publish); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
568 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
569 /* next step: publish the metadata */ |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
570 publish = xmlnode_new("publish"); |
17854
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
571 xmlnode_set_attrib(publish,"node",AVATARNAMESPACEMETA); |
17853
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
572 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
573 item = xmlnode_new_child(publish, "item"); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
574 xmlnode_set_attrib(item, "id", hash); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
575 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
576 metadata = xmlnode_new_child(item, "metadata"); |
17854
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
577 xmlnode_set_namespace(metadata,AVATARNAMESPACEMETA); |
17853
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
578 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
579 info = xmlnode_new_child(metadata, "info"); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
580 xmlnode_set_attrib(info, "id", hash); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
581 xmlnode_set_attrib(info, "type", "image/png"); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
582 lengthstring = g_strdup_printf("%u", (unsigned)purple_imgstore_get_size(img)); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
583 xmlnode_set_attrib(info, "bytes", lengthstring); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
584 g_free(lengthstring); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
585 widthstring = g_strdup_printf("%u", width); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
586 xmlnode_set_attrib(info, "width", widthstring); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
587 g_free(widthstring); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
588 heightstring = g_strdup_printf("%u", height); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
589 xmlnode_set_attrib(info, "height", heightstring); |
21596
637037d3748c
Fix a double-free and a leak at the same time.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21560
diff
changeset
|
590 g_free(heightstring); |
17853
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
591 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
592 /* publish the metadata */ |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
593 jabber_pep_publish((JabberStream*)gc->proto_data, publish); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
594 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
595 g_free(hash); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
596 } else { /* if(img) */ |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
597 /* remove the metadata */ |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
598 xmlnode *metadata, *item; |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
599 xmlnode *publish = xmlnode_new("publish"); |
17854
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
600 xmlnode_set_attrib(publish,"node",AVATARNAMESPACEMETA); |
17853
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
601 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
602 item = xmlnode_new_child(publish, "item"); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
603 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
604 metadata = xmlnode_new_child(item, "metadata"); |
17854
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
605 xmlnode_set_namespace(metadata,AVATARNAMESPACEMETA); |
17853
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
606 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
607 xmlnode_new_child(metadata, "stop"); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
608 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
609 /* publish the metadata */ |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
610 jabber_pep_publish((JabberStream*)gc->proto_data, publish); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
611 } |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
612 } else { |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
613 purple_debug(PURPLE_DEBUG_ERROR, "jabber", |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
614 "jabber_set_buddy_icon received non-png data"); |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
615 } |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
616 } |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
617 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
618 /* even when the image is not png, we can still publish the vCard, since this |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
619 one doesn't require a specific image type */ |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
620 |
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
621 /* publish vCard for those poor older clients */ |
15822 | 622 jabber_set_info(gc, purple_account_get_user_info(gc->account)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
623 |
25147
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
24369
diff
changeset
|
624 jabber_presence_send(gc->proto_data, FALSE); |
15373
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
628 * 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
|
629 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
630 * Formats GSList data into XML-encoded string and returns a pointer |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
631 * to said string. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
632 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
633 * g_free()'ing the returned string space is the responsibility of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
634 * the caller. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 static void |
15822 | 637 jabber_format_info(PurpleConnection *gc, PurpleRequestFields *fields) |
15373
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 xmlnode *vc_node; |
15822 | 640 PurpleRequestField *field; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 const char *text; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
642 char *p; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 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
|
644 const struct tag_attr *tag_attr; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
646 vc_node = xmlnode_new("vCard"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
647 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 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
|
649 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
|
650 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 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
|
652 if (*vc_tp->label == '\0') |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 |
15822 | 655 field = purple_request_fields_get_field(fields, vc_tp->tag); |
656 text = purple_request_field_string_get_value(field); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
658 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
659 if (text != NULL && *text != '\0') { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 xmlnode *xp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 |
15822 | 662 purple_debug(PURPLE_DEBUG_INFO, "jabber", |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
663 "Setting %s to '%s'\n", vc_tp->tag, text); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
664 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 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
|
666 NULL, vc_tp->tag)) != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
668 xmlnode_insert_data(xp, text, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
669 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
670 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
673 p = xmlnode_to_str(vc_node, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
674 xmlnode_free(vc_node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
675 |
15822 | 676 purple_account_set_user_info(purple_connection_get_account(gc), p); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 serv_set_info(gc, p); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
679 g_free(p); |
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 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
683 * This gets executed by the proto action |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
684 * |
15822 | 685 * Creates a new PurpleRequestFields struct, gets the XML-formatted user_info |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 * 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
|
687 * calls the set_vcard dialog. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
688 */ |
15822 | 689 void jabber_setup_set_info(PurplePluginAction *action) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
690 { |
15822 | 691 PurpleConnection *gc = (PurpleConnection *) action->context; |
692 PurpleRequestFields *fields; | |
693 PurpleRequestFieldGroup *group; | |
694 PurpleRequestField *field; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
695 const struct vcard_template *vc_tp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
696 const char *user_info; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
697 char *cdata = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
698 xmlnode *x_vc_data = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
699 |
15822 | 700 fields = purple_request_fields_new(); |
701 group = purple_request_field_group_new(NULL); | |
702 purple_request_fields_add_group(fields, group); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
703 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
704 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
705 * Get existing, XML-formatted, user info |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
706 */ |
15822 | 707 if((user_info = purple_account_get_user_info(gc->account)) != NULL) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
708 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
|
709 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
710 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
711 * 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
|
712 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
713 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
|
714 xmlnode *data_node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
715 if((vc_tp->label)[0] == '\0') |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
716 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
717 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 if (x_vc_data != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
719 if(vc_tp->ptag == NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
720 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
|
721 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
722 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
|
723 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
|
724 g_free(tag); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
725 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
726 if(data_node) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 cdata = xmlnode_get_data(data_node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
728 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
729 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
730 if(strcmp(vc_tp->tag, "DESC") == 0) { |
15822 | 731 field = purple_request_field_string_new(vc_tp->tag, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
732 _(vc_tp->label), cdata, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
733 TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
734 } else { |
15822 | 735 field = purple_request_field_string_new(vc_tp->tag, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
736 _(vc_tp->label), cdata, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
737 FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
738 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
739 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
740 g_free(cdata); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
741 cdata = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
742 |
15822 | 743 purple_request_field_group_add_field(group, field); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
744 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
745 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
746 if(x_vc_data != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
747 xmlnode_free(x_vc_data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
748 |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
749 purple_request_fields(gc, _("Edit XMPP vCard"), |
16904
56042b2f8b64
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@wiktel.com>
parents:
16719
diff
changeset
|
750 _("Edit XMPP vCard"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
751 _("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
|
752 "information with which you feel comfortable."), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
753 fields, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
754 _("Save"), G_CALLBACK(jabber_format_info), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
755 _("Cancel"), NULL, |
16439
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:
15822
diff
changeset
|
756 purple_connection_get_account(gc), NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
757 gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
758 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
759 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
760 /*---------------------------------------*/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
761 /* End Jabber "set info" (vCard) support */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
762 /*---------------------------------------*/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
763 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
764 /****** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
765 * 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
|
766 ******/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
767 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
768 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
|
769 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
770 /* 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
|
771 if (jbi->timeout_handle > 0) |
15822 | 772 purple_timeout_remove(jbi->timeout_handle); |
15665
6eda87b08cdf
Don't access the list element after it has been freed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15626
diff
changeset
|
773 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
774 g_free(jbi->jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
775 g_hash_table_destroy(jbi->resources); |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
776 purple_notify_user_info_destroy(jbi->user_info); |
15665
6eda87b08cdf
Don't access the list element after it has been freed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15626
diff
changeset
|
777 g_free(jbi); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
778 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
779 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
780 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
|
781 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
782 char *resource_name, *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
783 JabberBuddyResource *jbr; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
784 JabberBuddyInfoResource *jbir = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
785 GList *resources; |
15822 | 786 PurpleNotifyUserInfo *user_info; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
787 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
788 /* not yet */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
789 if(jbi->ids) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
790 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
791 |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
792 user_info = jbi->user_info; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
793 resource_name = jabber_get_resource(jbi->jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
794 |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
795 /* 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:
23180
diff
changeset
|
796 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:
23180
diff
changeset
|
797 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:
23180
diff
changeset
|
798 |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
799 /* Prepend the primary buddy info to user_info so that it goes before the vcard. */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
800 if(resource_name) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
801 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
|
802 jbir = g_hash_table_lookup(jbi->resources, resource_name); |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
803 if(jbr && jbr->client.name) { |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
804 tmp = g_strdup_printf("%s%s%s", jbr->client.name, |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
805 (jbr->client.version ? " " : ""), |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
806 (jbr->client.version ? jbr->client.version : "")); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
807 purple_notify_user_info_add_pair(user_info, _("Client"), tmp); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
808 g_free(tmp); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
809 |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
810 if(jbr->client.os) { |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
811 purple_notify_user_info_prepend_pair(user_info, _("Operating System"), jbr->client.os); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
812 } |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
813 } |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
814 if(jbir) { |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
815 if(jbir->idle_seconds > 0) { |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
816 char *idle = purple_str_seconds_to_string(jbir->idle_seconds); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
817 purple_notify_user_info_prepend_pair(user_info, _("Idle"), idle); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
818 g_free(idle); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
819 } |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
820 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
821 if(jbr) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
822 char *purdy = NULL; |
23261
b4ed2512be3b
Remove compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23251
diff
changeset
|
823 const char *status_name = jabber_buddy_state_get_name(jbr->state); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
824 if(jbr->status) |
15822 | 825 purdy = purple_strdup_withhtml(jbr->status); |
23251
4f49d4b25e24
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evan.s@dreskin.net>
parents:
23224
diff
changeset
|
826 if(status_name && purdy && !strcmp(status_name, purdy)) |
4f49d4b25e24
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evan.s@dreskin.net>
parents:
23224
diff
changeset
|
827 status_name = NULL; |
4f49d4b25e24
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evan.s@dreskin.net>
parents:
23224
diff
changeset
|
828 |
4f49d4b25e24
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evan.s@dreskin.net>
parents:
23224
diff
changeset
|
829 tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""), |
4f49d4b25e24
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evan.s@dreskin.net>
parents:
23224
diff
changeset
|
830 ((status_name && purdy) ? ": " : ""), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
831 (purdy ? purdy : "")); |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
832 purple_notify_user_info_prepend_pair(user_info, _("Status"), tmp); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
833 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
834 g_free(purdy); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
835 } else { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
836 purple_notify_user_info_prepend_pair(user_info, _("Status"), _("Unknown")); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
837 } |
19724
36d5d5048b53
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
838 #if 0 |
36d5d5048b53
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
839 /* #if 0 this for now; I think this would be far more useful if we limited this to a particular set of features |
36d5d5048b53
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
840 * of particular interest (-vv jumps out as one). As it is now, I don't picture people getting all excited: "Oh sweet crap! |
36d5d5048b53
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
841 * So-and-so supports 'jabber:x:data' AND 'Collaborative Data Objects'!" |
36d5d5048b53
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
842 */ |
36d5d5048b53
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
843 |
18698
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
844 if(jbr && jbr->caps) { |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
845 GString *tmp = g_string_new(""); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
846 GList *iter; |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
847 for(iter = jbr->caps->features; iter; iter = g_list_next(iter)) { |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
848 const char *feature = iter->data; |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
849 |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
850 if(!strcmp(feature, "jabber:iq:last")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
851 feature = _("Last Activity"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
852 else if(!strcmp(feature, "http://jabber.org/protocol/disco#info")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
853 feature = _("Service Discovery Info"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
854 else if(!strcmp(feature, "http://jabber.org/protocol/disco#items")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
855 feature = _("Service Discovery Items"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
856 else if(!strcmp(feature, "http://jabber.org/protocol/address")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
857 feature = _("Extended Stanza Addressing"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
858 else if(!strcmp(feature, "http://jabber.org/protocol/muc")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
859 feature = _("Multi-User Chat"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
860 else if(!strcmp(feature, "http://jabber.org/protocol/muc#user")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
861 feature = _("Multi-User Chat Extended Presence Information"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
862 else if(!strcmp(feature, "http://jabber.org/protocol/ibb")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
863 feature = _("In-Band Bytestreams"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
864 else if(!strcmp(feature, "http://jabber.org/protocol/commands")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
865 feature = _("Ad-Hoc Commands"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
866 else if(!strcmp(feature, "http://jabber.org/protocol/pubsub")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
867 feature = _("PubSub Service"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
868 else if(!strcmp(feature, "http://jabber.org/protocol/bytestreams")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
869 feature = _("SOCKS5 Bytestreams"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
870 else if(!strcmp(feature, "jabber:x:oob")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
871 feature = _("Out of Band Data"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
872 else if(!strcmp(feature, "http://jabber.org/protocol/xhtml-im")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
873 feature = _("XHTML-IM"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
874 else if(!strcmp(feature, "jabber:iq:register")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
875 feature = _("In-Band Registration"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
876 else if(!strcmp(feature, "http://jabber.org/protocol/geoloc")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
877 feature = _("User Location"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
878 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0084.html")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
879 feature = _("User Avatar"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
880 else if(!strcmp(feature, "http://jabber.org/protocol/chatstates")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
881 feature = _("Chat State Notifications"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
882 else if(!strcmp(feature, "jabber:iq:version")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
883 feature = _("Software Version"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
884 else if(!strcmp(feature, "http://jabber.org/protocol/si")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
885 feature = _("Stream Initiation"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
886 else if(!strcmp(feature, "http://jabber.org/protocol/si/profile/file-transfer")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
887 feature = _("File Transfer"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
888 else if(!strcmp(feature, "http://jabber.org/protocol/mood")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
889 feature = _("User Mood"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
890 else if(!strcmp(feature, "http://jabber.org/protocol/activity")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
891 feature = _("User Activity"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
892 else if(!strcmp(feature, "http://jabber.org/protocol/caps")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
893 feature = _("Entity Capabilities"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
894 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0116.html")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
895 feature = _("Encrypted Session Negotiations"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
896 else if(!strcmp(feature, "http://jabber.org/protocol/tune")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
897 feature = _("User Tune"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
898 else if(!strcmp(feature, "http://jabber.org/protocol/rosterx")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
899 feature = _("Roster Item Exchange"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
900 else if(!strcmp(feature, "http://jabber.org/protocol/reach")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
901 feature = _("Reachability Address"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
902 else if(!strcmp(feature, "http://jabber.org/protocol/profile")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
903 feature = _("User Profile"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
904 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0166.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
905 feature = _("Jingle"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
906 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0167.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
907 feature = _("Jingle Audio"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
908 else if(!strcmp(feature, "http://jabber.org/protocol/nick")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
909 feature = _("User Nickname"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
910 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0176.html#ns-udp")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
911 feature = _("Jingle ICE UDP"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
912 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0176.html#ns-tcp")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
913 feature = _("Jingle ICE TCP"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
914 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0177.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
915 feature = _("Jingle Raw UDP"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
916 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0180.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
917 feature = _("Jingle Video"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
918 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0181.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
919 feature = _("Jingle DTMF"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
920 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0184.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
921 feature = _("Message Receipts"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
922 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0189.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
923 feature = _("Public Key Publishing"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
924 else if(!strcmp(feature, "http://jabber.org/protocol/chatting")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
925 feature = _("User Chatting"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
926 else if(!strcmp(feature, "http://jabber.org/protocol/browsing")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
927 feature = _("User Browsing"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
928 else if(!strcmp(feature, "http://jabber.org/protocol/gaming")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
929 feature = _("User Gaming"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
930 else if(!strcmp(feature, "http://jabber.org/protocol/viewing")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
931 feature = _("User Viewing"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
932 else if(!strcmp(feature, "urn:xmpp:ping") || !strcmp(feature, "http://www.xmpp.org/extensions/xep-0199.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
933 feature = _("Ping"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
934 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0200.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
935 feature = _("Stanza Encryption"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
936 else if(!strcmp(feature, "urn:xmpp:time")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
937 feature = _("Entity Time"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
938 else if(!strcmp(feature, "urn:xmpp:delay")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
939 feature = _("Delayed Delivery"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
940 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0204.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
941 feature = _("Collaborative Data Objects"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
942 else if(!strcmp(feature, "http://jabber.org/protocol/fileshare")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
943 feature = _("File Repository and Sharing"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
944 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0215.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
945 feature = _("STUN Service Discovery for Jingle"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
946 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0116.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
947 feature = _("Simplified Encrypted Session Negotiation"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
948 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0219.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
949 feature = _("Hop Check"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
950 else if(g_str_has_suffix(feature, "+notify")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
951 feature = NULL; |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
952 if(feature) |
19724
36d5d5048b53
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
953 g_string_append_printf(tmp, "%s<br/>", feature); |
18698
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
954 } |
19724
36d5d5048b53
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
955 |
18698
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
956 if(strlen(tmp->str) > 0) |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
957 purple_notify_user_info_prepend_pair(user_info, _("Capabilities"), tmp->str); |
18698
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
958 |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
959 g_string_free(tmp, TRUE); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
960 } |
19724
36d5d5048b53
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
961 #endif |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
962 } else { |
23224
e166f9e91d6d
Use g_list_length(jbi->jb->resources) here, as it's clearer since that's
Evan Schoenberg <evan.s@dreskin.net>
parents:
23221
diff
changeset
|
963 gboolean multiple_resources = jbi->jb->resources && (g_list_length(jbi->jb->resources) > 1); |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
964 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
965 for(resources = jbi->jb->resources; resources; resources = resources->next) { |
23261
b4ed2512be3b
Remove compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23251
diff
changeset
|
966 char *purdy = NULL; |
b4ed2512be3b
Remove compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23251
diff
changeset
|
967 const char *status_name = NULL; |
b4ed2512be3b
Remove compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23251
diff
changeset
|
968 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
969 jbr = resources->data; |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
970 |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
971 if(jbr->client.name) { |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
972 tmp = g_strdup_printf("%s%s%s", jbr->client.name, |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
973 (jbr->client.version ? " " : ""), |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
974 (jbr->client.version ? jbr->client.version : "")); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
975 purple_notify_user_info_prepend_pair(user_info, |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
976 _("Client"), tmp); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
977 g_free(tmp); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
978 |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
979 if(jbr->client.os) { |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
980 purple_notify_user_info_prepend_pair(user_info, _("Operating System"), jbr->client.os); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
981 } |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
982 } |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
983 |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
984 if(jbr->name && (jbir = g_hash_table_lookup(jbi->resources, jbr->name))) { |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
985 if(jbir->idle_seconds > 0) { |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
986 char *idle = purple_str_seconds_to_string(jbir->idle_seconds); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
987 purple_notify_user_info_prepend_pair(user_info, _("Idle"), idle); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
988 g_free(idle); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
989 } |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
990 } |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
991 |
23251
4f49d4b25e24
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evan.s@dreskin.net>
parents:
23224
diff
changeset
|
992 status_name = jabber_buddy_state_get_name(jbr->state); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
993 if(jbr->status) |
15822 | 994 purdy = purple_strdup_withhtml(jbr->status); |
23251
4f49d4b25e24
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evan.s@dreskin.net>
parents:
23224
diff
changeset
|
995 if(status_name && purdy && !strcmp(status_name, purdy)) |
4f49d4b25e24
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evan.s@dreskin.net>
parents:
23224
diff
changeset
|
996 status_name = NULL; |
4f49d4b25e24
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evan.s@dreskin.net>
parents:
23224
diff
changeset
|
997 |
4f49d4b25e24
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evan.s@dreskin.net>
parents:
23224
diff
changeset
|
998 tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""), |
4f49d4b25e24
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evan.s@dreskin.net>
parents:
23224
diff
changeset
|
999 ((status_name && purdy) ? ": " : ""), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1000 (purdy ? purdy : "")); |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1001 purple_notify_user_info_prepend_pair(user_info, _("Status"), tmp); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1002 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1003 g_free(purdy); |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1004 |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1005 if(multiple_resources) { |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1006 tmp = g_strdup_printf("%d", jbr->priority); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1007 purple_notify_user_info_prepend_pair(user_info, _("Priority"), tmp); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1008 g_free(tmp); |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1009 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1010 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1011 if(jbr->name) |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1012 purple_notify_user_info_prepend_pair(user_info, _("Resource"), jbr->name); |
19724
36d5d5048b53
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
1013 #if 0 |
18698
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1014 if(jbr && jbr->caps) { |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1015 GString *tmp = g_string_new(""); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1016 GList *iter; |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1017 for(iter = jbr->caps->features; iter; iter = g_list_next(iter)) { |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1018 const char *feature = iter->data; |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1019 |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1020 if(!strcmp(feature, "jabber:iq:last")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1021 feature = _("Last Activity"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1022 else if(!strcmp(feature, "http://jabber.org/protocol/disco#info")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1023 feature = _("Service Discovery Info"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1024 else if(!strcmp(feature, "http://jabber.org/protocol/disco#items")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1025 feature = _("Service Discovery Items"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1026 else if(!strcmp(feature, "http://jabber.org/protocol/address")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1027 feature = _("Extended Stanza Addressing"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1028 else if(!strcmp(feature, "http://jabber.org/protocol/muc")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1029 feature = _("Multi-User Chat"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1030 else if(!strcmp(feature, "http://jabber.org/protocol/muc#user")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1031 feature = _("Multi-User Chat Extended Presence Information"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1032 else if(!strcmp(feature, "http://jabber.org/protocol/ibb")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1033 feature = _("In-Band Bytestreams"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1034 else if(!strcmp(feature, "http://jabber.org/protocol/commands")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1035 feature = _("Ad-Hoc Commands"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1036 else if(!strcmp(feature, "http://jabber.org/protocol/pubsub")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1037 feature = _("PubSub Service"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1038 else if(!strcmp(feature, "http://jabber.org/protocol/bytestreams")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1039 feature = _("SOCKS5 Bytestreams"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1040 else if(!strcmp(feature, "jabber:x:oob")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1041 feature = _("Out of Band Data"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1042 else if(!strcmp(feature, "http://jabber.org/protocol/xhtml-im")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1043 feature = _("XHTML-IM"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1044 else if(!strcmp(feature, "jabber:iq:register")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1045 feature = _("In-Band Registration"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1046 else if(!strcmp(feature, "http://jabber.org/protocol/geoloc")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1047 feature = _("User Location"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1048 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0084.html")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1049 feature = _("User Avatar"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1050 else if(!strcmp(feature, "http://jabber.org/protocol/chatstates")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1051 feature = _("Chat State Notifications"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1052 else if(!strcmp(feature, "jabber:iq:version")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1053 feature = _("Software Version"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1054 else if(!strcmp(feature, "http://jabber.org/protocol/si")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1055 feature = _("Stream Initiation"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1056 else if(!strcmp(feature, "http://jabber.org/protocol/si/profile/file-transfer")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1057 feature = _("File Transfer"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1058 else if(!strcmp(feature, "http://jabber.org/protocol/mood")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1059 feature = _("User Mood"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1060 else if(!strcmp(feature, "http://jabber.org/protocol/activity")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1061 feature = _("User Activity"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1062 else if(!strcmp(feature, "http://jabber.org/protocol/caps")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1063 feature = _("Entity Capabilities"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1064 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0116.html")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1065 feature = _("Encrypted Session Negotiations"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1066 else if(!strcmp(feature, "http://jabber.org/protocol/tune")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1067 feature = _("User Tune"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1068 else if(!strcmp(feature, "http://jabber.org/protocol/rosterx")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1069 feature = _("Roster Item Exchange"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1070 else if(!strcmp(feature, "http://jabber.org/protocol/reach")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1071 feature = _("Reachability Address"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1072 else if(!strcmp(feature, "http://jabber.org/protocol/profile")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1073 feature = _("User Profile"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1074 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0166.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1075 feature = _("Jingle"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1076 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0167.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1077 feature = _("Jingle Audio"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1078 else if(!strcmp(feature, "http://jabber.org/protocol/nick")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1079 feature = _("User Nickname"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1080 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0176.html#ns-udp")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1081 feature = _("Jingle ICE UDP"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1082 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0176.html#ns-tcp")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1083 feature = _("Jingle ICE TCP"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1084 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0177.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1085 feature = _("Jingle Raw UDP"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1086 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0180.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1087 feature = _("Jingle Video"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1088 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0181.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1089 feature = _("Jingle DTMF"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1090 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0184.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1091 feature = _("Message Receipts"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1092 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0189.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1093 feature = _("Public Key Publishing"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1094 else if(!strcmp(feature, "http://jabber.org/protocol/chatting")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1095 feature = _("User Chatting"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1096 else if(!strcmp(feature, "http://jabber.org/protocol/browsing")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1097 feature = _("User Browsing"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1098 else if(!strcmp(feature, "http://jabber.org/protocol/gaming")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1099 feature = _("User Gaming"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1100 else if(!strcmp(feature, "http://jabber.org/protocol/viewing")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1101 feature = _("User Viewing"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1102 else if(!strcmp(feature, "urn:xmpp:ping") || !strcmp(feature, "http://www.xmpp.org/extensions/xep-0199.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1103 feature = _("Ping"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1104 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0200.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1105 feature = _("Stanza Encryption"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1106 else if(!strcmp(feature, "urn:xmpp:time")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1107 feature = _("Entity Time"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1108 else if(!strcmp(feature, "urn:xmpp:delay")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1109 feature = _("Delayed Delivery"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1110 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0204.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1111 feature = _("Collaborative Data Objects"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1112 else if(!strcmp(feature, "http://jabber.org/protocol/fileshare")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1113 feature = _("File Repository and Sharing"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1114 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0215.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1115 feature = _("STUN Service Discovery for Jingle"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1116 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0116.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1117 feature = _("Simplified Encrypted Session Negotiation"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1118 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0219.html#ns")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1119 feature = _("Hop Check"); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1120 else if(g_str_has_suffix(feature, "+notify")) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1121 feature = NULL; |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1122 |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1123 if(feature) |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1124 g_string_append_printf(tmp, "%s\n", feature); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1125 } |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1126 if(strlen(tmp->str) > 0) |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1127 purple_notify_user_info_prepend_pair(user_info, _("Capabilities"), tmp->str); |
18698
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1128 |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1129 g_string_free(tmp, TRUE); |
b5546f8f8c71
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <pidgin@monitzer.com>
parents:
18684
diff
changeset
|
1130 } |
19724
36d5d5048b53
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
1131 #endif |
15373
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1134 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1135 g_free(resource_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1136 |
15822 | 1137 purple_notify_userinfo(jbi->js->gc, jbi->jid, user_info, NULL, NULL); |
15373
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 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:
15822
diff
changeset
|
1140 purple_imgstore_unref_by_id(GPOINTER_TO_INT(jbi->vcard_imgids->data)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1141 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
|
1142 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1143 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1144 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
|
1145 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1146 jabber_buddy_info_destroy(jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1147 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1148 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1149 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
|
1150 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1151 GSList *l = jbi->ids; |
15665
6eda87b08cdf
Don't access the list element after it has been freed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15626
diff
changeset
|
1152 char *comp_id; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1153 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1154 if(!id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1155 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1156 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1157 while(l) { |
15665
6eda87b08cdf
Don't access the list element after it has been freed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15626
diff
changeset
|
1158 comp_id = l->data; |
6eda87b08cdf
Don't access the list element after it has been freed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15626
diff
changeset
|
1159 if(!strcmp(id, comp_id)) { |
6eda87b08cdf
Don't access the list element after it has been freed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15626
diff
changeset
|
1160 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:
15626
diff
changeset
|
1161 g_free(comp_id); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1162 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1163 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1164 l = l->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1165 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1166 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1167 |
18163
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1168 static void jabber_vcard_save_mine(JabberStream *js, xmlnode *packet, gpointer data) |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1169 { |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1170 xmlnode *vcard; |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1171 char *txt; |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1172 PurpleStoredImage *img; |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1173 |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1174 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
|
1175 (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
|
1176 { |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1177 txt = xmlnode_to_str(vcard, NULL); |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1178 purple_account_set_user_info(purple_connection_get_account(js->gc), txt); |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1179 |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1180 g_free(txt); |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1181 } else { |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1182 /* 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
|
1183 } |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1184 |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1185 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
|
1186 |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1187 if(NULL != (img = purple_buddy_icons_find_account_icon(js->gc->account))) { |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1188 jabber_set_buddy_icon(js->gc, img); |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1189 purple_imgstore_unref(img); |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1190 } |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1191 } |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1192 |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1193 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
|
1194 { |
21842
ce3d42470adf
Fix XMPP buddy icons. Somehow a 'VCard' element got changed to a query
Sean Egan <seanegan@gmail.com>
parents:
21596
diff
changeset
|
1195 JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET); |
ce3d42470adf
Fix XMPP buddy icons. Somehow a 'VCard' element got changed to a query
Sean Egan <seanegan@gmail.com>
parents:
21596
diff
changeset
|
1196 |
ce3d42470adf
Fix XMPP buddy icons. Somehow a 'VCard' element got changed to a query
Sean Egan <seanegan@gmail.com>
parents:
21596
diff
changeset
|
1197 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
|
1198 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
|
1199 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
|
1200 |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1201 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
|
1202 } |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1203 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1204 static void jabber_vcard_parse(JabberStream *js, xmlnode *packet, gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1205 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1206 const char *id, *from; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1207 char *bare_jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1208 char *text; |
22450
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:
22414
diff
changeset
|
1209 char *serverside_alias = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1210 xmlnode *vcard; |
15822 | 1211 PurpleBuddy *b; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1212 JabberBuddyInfo *jbi = data; |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1213 PurpleNotifyUserInfo *user_info; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1214 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1215 from = xmlnode_get_attrib(packet, "from"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1216 id = xmlnode_get_attrib(packet, "id"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1217 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1218 if(!jbi) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1219 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1220 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1221 jabber_buddy_info_remove_id(jbi, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1222 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1223 if(!from) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1224 return; |
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 if(!jabber_buddy_find(js, from, FALSE)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1227 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1228 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1229 /* XXX: handle the error case */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1230 |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1231 user_info = jbi->user_info; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1232 bare_jid = jabber_get_bare_jid(from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1233 |
15822 | 1234 b = purple_find_buddy(js->gc->account, bare_jid); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1235 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1236 if((vcard = xmlnode_get_child(packet, "vCard")) || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1237 (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
|
1238 xmlnode *child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1239 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
|
1240 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1241 xmlnode *child2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1242 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1243 if(child->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1244 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1245 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1246 text = xmlnode_get_data(child); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1247 if(text && !strcmp(child->name, "FN")) { |
22450
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:
22414
diff
changeset
|
1248 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:
22414
diff
changeset
|
1249 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:
22414
diff
changeset
|
1250 |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1251 purple_notify_user_info_add_pair(user_info, _("Full Name"), text); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1252 } else if(!strcmp(child->name, "N")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1253 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
|
1254 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1255 char *text2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1256 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1257 if(child2->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1258 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1259 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1260 text2 = xmlnode_get_data(child2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1261 if(text2 && !strcmp(child2->name, "FAMILY")) { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1262 purple_notify_user_info_add_pair(user_info, _("Family Name"), text2); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1263 } else if(text2 && !strcmp(child2->name, "GIVEN")) { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1264 purple_notify_user_info_add_pair(user_info, _("Given Name"), text2); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1265 } else if(text2 && !strcmp(child2->name, "MIDDLE")) { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1266 purple_notify_user_info_add_pair(user_info, _("Middle Name"), text2); |
15373
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_free(text2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1269 } |
22450
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:
22414
diff
changeset
|
1270 } else if(text && !strcmp(child->name, "NICKNAME")) { |
24003
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:
23686
diff
changeset
|
1271 /* 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:
23686
diff
changeset
|
1272 * 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:
23686
diff
changeset
|
1273 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:
23686
diff
changeset
|
1274 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:
23686
diff
changeset
|
1275 serverside_alias = g_strdup(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:
23686
diff
changeset
|
1276 |
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:
23686
diff
changeset
|
1277 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:
23686
diff
changeset
|
1278 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1279 } else if(text && !strcmp(child->name, "BDAY")) { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1280 purple_notify_user_info_add_pair(user_info, _("Birthday"), text); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1281 } else if(!strcmp(child->name, "ADR")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1282 gboolean address_line_added = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1283 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1284 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
|
1285 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1286 char *text2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1287 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1288 if(child2->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1289 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1290 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1291 text2 = xmlnode_get_data(child2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1292 if (text2 == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1293 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1294 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1295 /* 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
|
1296 * elements are empty. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1297 if (!address_line_added) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1298 { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1299 purple_notify_user_info_add_section_header(user_info, _("Address")); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1300 address_line_added = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1301 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1302 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1303 if(!strcmp(child2->name, "POBOX")) { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1304 purple_notify_user_info_add_pair(user_info, _("P.O. Box"), text2); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1305 } else if(!strcmp(child2->name, "EXTADR")) { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1306 purple_notify_user_info_add_pair(user_info, _("Extended Address"), text2); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1307 } else if(!strcmp(child2->name, "STREET")) { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1308 purple_notify_user_info_add_pair(user_info, _("Street Address"), text2); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1309 } else if(!strcmp(child2->name, "LOCALITY")) { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1310 purple_notify_user_info_add_pair(user_info, _("Locality"), text2); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1311 } else if(!strcmp(child2->name, "REGION")) { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1312 purple_notify_user_info_add_pair(user_info, _("Region"), text2); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1313 } else if(!strcmp(child2->name, "PCODE")) { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1314 purple_notify_user_info_add_pair(user_info, _("Postal Code"), text2); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1315 } else if(!strcmp(child2->name, "CTRY") |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1316 || !strcmp(child2->name, "COUNTRY")) { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1317 purple_notify_user_info_add_pair(user_info, _("Country"), text2); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1318 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1319 g_free(text2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1320 } |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1321 |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1322 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:
23180
diff
changeset
|
1323 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:
23180
diff
changeset
|
1324 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1325 } else if(!strcmp(child->name, "TEL")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1326 char *number; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1327 if((child2 = xmlnode_get_child(child, "NUMBER"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1328 /* show what kind of number it is */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1329 number = xmlnode_get_data(child2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1330 if(number) { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1331 purple_notify_user_info_add_pair(user_info, _("Telephone"), number); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1332 g_free(number); |
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 } else if((number = xmlnode_get_data(child))) { |
15822 | 1335 /* lots of clients (including purple) do this, but it's |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1336 * out of spec */ |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1337 purple_notify_user_info_add_pair(user_info, _("Telephone"), number); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1338 g_free(number); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1339 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1340 } else if(!strcmp(child->name, "EMAIL")) { |
19730
1b8af105614d
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <mark@kingant.net>
parents:
19724
diff
changeset
|
1341 char *userid, *escaped; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1342 if((child2 = xmlnode_get_child(child, "USERID"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1343 /* show what kind of email it is */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1344 userid = xmlnode_get_data(child2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1345 if(userid) { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1346 char *mailto; |
19730
1b8af105614d
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <mark@kingant.net>
parents:
19724
diff
changeset
|
1347 escaped = g_markup_escape_text(userid, -1); |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1348 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:
23180
diff
changeset
|
1349 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:
23180
diff
changeset
|
1350 |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1351 g_free(mailto); |
19730
1b8af105614d
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <mark@kingant.net>
parents:
19724
diff
changeset
|
1352 g_free(escaped); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1353 g_free(userid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1354 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1355 } else if((userid = xmlnode_get_data(child))) { |
15822 | 1356 /* lots of clients (including purple) do this, but it's |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1357 * out of spec */ |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1358 char *mailto; |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1359 |
19730
1b8af105614d
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <mark@kingant.net>
parents:
19724
diff
changeset
|
1360 escaped = g_markup_escape_text(userid, -1); |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1361 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:
23180
diff
changeset
|
1362 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:
23180
diff
changeset
|
1363 |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1364 g_free(mailto); |
19730
1b8af105614d
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <mark@kingant.net>
parents:
19724
diff
changeset
|
1365 g_free(escaped); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1366 g_free(userid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1367 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1368 } else if(!strcmp(child->name, "ORG")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1369 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
|
1370 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1371 char *text2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1372 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1373 if(child2->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1374 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1375 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1376 text2 = xmlnode_get_data(child2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1377 if(text2 && !strcmp(child2->name, "ORGNAME")) { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1378 purple_notify_user_info_add_pair(user_info, _("Organization Name"), text2); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1379 } else if(text2 && !strcmp(child2->name, "ORGUNIT")) { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1380 purple_notify_user_info_add_pair(user_info, _("Organization Unit"), text2); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1381 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1382 g_free(text2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1383 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1384 } else if(text && !strcmp(child->name, "TITLE")) { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1385 purple_notify_user_info_add_pair(user_info, _("Title"), text); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1386 } else if(text && !strcmp(child->name, "ROLE")) { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1387 purple_notify_user_info_add_pair(user_info, _("Role"), text); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1388 } else if(text && !strcmp(child->name, "DESC")) { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1389 purple_notify_user_info_add_pair(user_info, _("Description"), text); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1390 } else if(!strcmp(child->name, "PHOTO") || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1391 !strcmp(child->name, "LOGO")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1392 char *bintext = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1393 xmlnode *binval; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1394 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1395 if( ((binval = xmlnode_get_child(child, "BINVAL")) && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1396 (bintext = xmlnode_get_data(binval))) || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1397 (bintext = xmlnode_get_data(child))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1398 gsize size; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1399 guchar *data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1400 int i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1401 unsigned char hashval[20]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1402 char *p, hash[41]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1403 gboolean photo = (strcmp(child->name, "PHOTO") == 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1404 |
15822 | 1405 data = purple_base64_decode(bintext, &size); |
16507
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16506
diff
changeset
|
1406 if (data) { |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1407 char *img_text; |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1408 |
16507
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16506
diff
changeset
|
1409 jbi->vcard_imgids = g_slist_prepend(jbi->vcard_imgids, GINT_TO_POINTER(purple_imgstore_add_with_id(g_memdup(data, size), size, "logo.png"))); |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1410 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:
23180
diff
changeset
|
1411 |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1412 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:
23180
diff
changeset
|
1413 |
16507
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16506
diff
changeset
|
1414 purple_cipher_digest_region("sha1", (guchar *)data, size, |
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16506
diff
changeset
|
1415 sizeof(hashval), hashval, NULL); |
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16506
diff
changeset
|
1416 p = hash; |
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16506
diff
changeset
|
1417 for(i=0; i<20; i++, p+=2) |
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16506
diff
changeset
|
1418 snprintf(p, 3, "%02x", hashval[i]); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1419 |
16507
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16506
diff
changeset
|
1420 purple_buddy_icons_set_for_user(js->gc->account, bare_jid, |
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16506
diff
changeset
|
1421 data, size, hash); |
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16506
diff
changeset
|
1422 g_free(bintext); |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1423 g_free(img_text); |
16507
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16506
diff
changeset
|
1424 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1425 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1426 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1427 g_free(text); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1428 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1429 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1430 |
22450
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:
22414
diff
changeset
|
1431 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:
22414
diff
changeset
|
1432 /* 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:
22414
diff
changeset
|
1433 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:
22414
diff
changeset
|
1434 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:
22414
diff
changeset
|
1435 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:
22414
diff
changeset
|
1436 } |
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:
22414
diff
changeset
|
1437 |
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:
22414
diff
changeset
|
1438 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:
22414
diff
changeset
|
1439 } |
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:
22414
diff
changeset
|
1440 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1441 g_free(bare_jid); |
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 jabber_buddy_info_show_if_ready(jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1444 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1445 |
17854
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1446 typedef struct _JabberBuddyAvatarUpdateURLInfo { |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1447 JabberStream *js; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1448 char *from; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1449 char *id; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1450 } JabberBuddyAvatarUpdateURLInfo; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1451 |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1452 static void do_buddy_avatar_update_fromurl(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message) { |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1453 JabberBuddyAvatarUpdateURLInfo *info = user_data; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1454 if(!url_text) { |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1455 purple_debug(PURPLE_DEBUG_ERROR, "jabber", |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1456 "do_buddy_avatar_update_fromurl got error \"%s\"", error_message); |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1457 return; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1458 } |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1459 |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1460 purple_buddy_icons_set_for_user(purple_connection_get_account(info->js->gc), info->from, (void*)url_text, len, info->id); |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1461 g_free(info->from); |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1462 g_free(info->id); |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1463 g_free(info); |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1464 } |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1465 |
17855
0f0e98978d66
Turns out the example in XEP-0084 is wrong. Fixed my implementation to not try to work around an issue that isn't one.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17854
diff
changeset
|
1466 static void do_buddy_avatar_update_data(JabberStream *js, const char *from, xmlnode *items) { |
0f0e98978d66
Turns out the example in XEP-0084 is wrong. Fixed my implementation to not try to work around an issue that isn't one.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17854
diff
changeset
|
1467 xmlnode *item, *data; |
17854
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1468 const char *checksum; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1469 char *b64data; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1470 void *img; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1471 size_t size; |
17855
0f0e98978d66
Turns out the example in XEP-0084 is wrong. Fixed my implementation to not try to work around an issue that isn't one.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17854
diff
changeset
|
1472 if(!items) |
0f0e98978d66
Turns out the example in XEP-0084 is wrong. Fixed my implementation to not try to work around an issue that isn't one.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17854
diff
changeset
|
1473 return; |
0f0e98978d66
Turns out the example in XEP-0084 is wrong. Fixed my implementation to not try to work around an issue that isn't one.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17854
diff
changeset
|
1474 |
0f0e98978d66
Turns out the example in XEP-0084 is wrong. Fixed my implementation to not try to work around an issue that isn't one.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17854
diff
changeset
|
1475 item = xmlnode_get_child(items, "item"); |
17854
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1476 if(!item) |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1477 return; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1478 |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1479 data = xmlnode_get_child_with_namespace(item,"data",AVATARNAMESPACEDATA); |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1480 if(!data) |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1481 return; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1482 |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1483 checksum = xmlnode_get_attrib(item,"id"); |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1484 if(!checksum) |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1485 return; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1486 |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1487 b64data = xmlnode_get_data(data); |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1488 if(!b64data) |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1489 return; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1490 |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1491 img = purple_base64_decode(b64data, &size); |
20058
5103485b4b26
Plug some memory leaks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19755
diff
changeset
|
1492 if(!img) { |
5103485b4b26
Plug some memory leaks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19755
diff
changeset
|
1493 g_free(b64data); |
17854
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1494 return; |
20058
5103485b4b26
Plug some memory leaks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19755
diff
changeset
|
1495 } |
17854
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1496 |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1497 purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, img, size, checksum); |
20058
5103485b4b26
Plug some memory leaks.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19755
diff
changeset
|
1498 g_free(b64data); |
17854
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1499 } |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1500 |
17853
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
1501 void jabber_buddy_avatar_update_metadata(JabberStream *js, const char *from, xmlnode *items) { |
17854
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1502 PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(js->gc), from); |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1503 const char *checksum; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1504 xmlnode *item, *metadata; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1505 if(!buddy) |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1506 return; |
17853
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
1507 |
17854
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1508 checksum = purple_buddy_icons_get_checksum_for_user(buddy); |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1509 item = xmlnode_get_child(items,"item"); |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1510 metadata = xmlnode_get_child_with_namespace(item, "metadata", AVATARNAMESPACEMETA); |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1511 if(!metadata) |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1512 return; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1513 /* check if we have received a stop */ |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1514 if(xmlnode_get_child(metadata, "stop")) { |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1515 purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, NULL, 0, NULL); |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1516 } else { |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1517 xmlnode *info, *goodinfo = NULL; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1518 |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1519 /* iterate over all info nodes to get one we can use */ |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1520 for(info = metadata->child; info; info = info->next) { |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1521 if(info->type == XMLNODE_TYPE_TAG && !strcmp(info->name,"info")) { |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1522 const char *type = xmlnode_get_attrib(info,"type"); |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1523 const char *id = xmlnode_get_attrib(info,"id"); |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1524 |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1525 if(checksum && id && !strcmp(id, checksum)) { |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1526 /* we already have that avatar, so we don't have to do anything */ |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1527 goodinfo = NULL; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1528 break; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1529 } |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1530 /* We'll only pick the png one for now. It's a very nice image format anyways. */ |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1531 if(type && id && !goodinfo && !strcmp(type, "image/png")) |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1532 goodinfo = info; |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1533 } |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1534 } |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1535 if(goodinfo) { |
23686
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23358
diff
changeset
|
1536 const char *url = xmlnode_get_attrib(goodinfo, "url"); |
17854
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1537 const char *id = xmlnode_get_attrib(goodinfo,"id"); |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1538 |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1539 /* the avatar might either be stored in a pep node, or on a HTTP/HTTPS URL */ |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1540 if(!url) |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1541 jabber_pep_request_item(js, from, AVATARNAMESPACEDATA, id, do_buddy_avatar_update_data); |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1542 else { |
23686
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23358
diff
changeset
|
1543 PurpleUtilFetchUrlData *url_data; |
17854
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1544 JabberBuddyAvatarUpdateURLInfo *info = g_new0(JabberBuddyAvatarUpdateURLInfo, 1); |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1545 info->js = js; |
23686
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23358
diff
changeset
|
1546 |
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23358
diff
changeset
|
1547 url_data = purple_util_fetch_url_len(url, TRUE, NULL, TRUE, |
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23358
diff
changeset
|
1548 MAX_HTTP_BUDDYICON_BYTES, |
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23358
diff
changeset
|
1549 do_buddy_avatar_update_fromurl, info); |
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23358
diff
changeset
|
1550 if (url_data) { |
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23358
diff
changeset
|
1551 info->from = g_strdup(from); |
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23358
diff
changeset
|
1552 info->id = g_strdup(id); |
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23358
diff
changeset
|
1553 js->url_datas = g_slist_prepend(js->url_datas, url_data); |
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23358
diff
changeset
|
1554 } else |
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23358
diff
changeset
|
1555 g_free(info); |
3c3032be12de
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23358
diff
changeset
|
1556 |
17854
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1557 } |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1558 } |
5ab3c6bb95b4
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17853
diff
changeset
|
1559 } |
17853
7754d39d70c5
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17836
diff
changeset
|
1560 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1561 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1562 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
|
1563 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1564 JabberBuddyInfoResource *jbri = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1565 g_free(jbri); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1568 static void jabber_version_parse(JabberStream *js, xmlnode *packet, gpointer data) |
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 JabberBuddyInfo *jbi = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1571 const char *type, *id, *from; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1572 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1573 char *resource_name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1574 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1575 g_return_if_fail(jbi != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1576 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1577 type = xmlnode_get_attrib(packet, "type"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1578 id = xmlnode_get_attrib(packet, "id"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1579 from = xmlnode_get_attrib(packet, "from"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1580 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1581 jabber_buddy_info_remove_id(jbi, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1582 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1583 if(!from) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1584 return; |
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 resource_name = jabber_get_resource(from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1587 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1588 if(resource_name) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1589 if(type && !strcmp(type, "result")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1590 if((query = xmlnode_get_child(packet, "query"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1591 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
|
1592 if(jbr) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1593 xmlnode *node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1594 if((node = xmlnode_get_child(query, "name"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1595 jbr->client.name = xmlnode_get_data(node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1596 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1597 if((node = xmlnode_get_child(query, "version"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1598 jbr->client.version = xmlnode_get_data(node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1599 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1600 if((node = xmlnode_get_child(query, "os"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1601 jbr->client.os = xmlnode_get_data(node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1602 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1603 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1604 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1605 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1606 g_free(resource_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1607 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1608 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1609 jabber_buddy_info_show_if_ready(jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1610 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1611 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1612 static void jabber_last_parse(JabberStream *js, xmlnode *packet, gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1613 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1614 JabberBuddyInfo *jbi = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1615 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1616 char *resource_name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1617 const char *type, *id, *from, *seconds; |
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 g_return_if_fail(jbi != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1620 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1621 type = xmlnode_get_attrib(packet, "type"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1622 id = xmlnode_get_attrib(packet, "id"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1623 from = xmlnode_get_attrib(packet, "from"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1624 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1625 jabber_buddy_info_remove_id(jbi, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1626 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1627 if(!from) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1628 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1629 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1630 resource_name = jabber_get_resource(from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1631 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1632 if(resource_name) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1633 if(type && !strcmp(type, "result")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1634 if((query = xmlnode_get_child(packet, "query"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1635 seconds = xmlnode_get_attrib(query, "seconds"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1636 if(seconds) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1637 char *end = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1638 long sec = strtol(seconds, &end, 10); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1639 if(end != seconds) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1640 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
|
1641 if(jbir) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1642 jbir->idle_seconds = sec; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1643 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1644 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1645 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1646 } |
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 g_free(resource_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1649 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1650 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1651 jabber_buddy_info_show_if_ready(jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1652 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1653 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1654 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
|
1655 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1656 if (js->pending_buddy_info_requests) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1657 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1658 JabberBuddyInfo *jbi; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1659 GSList *l = js->pending_buddy_info_requests; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1660 while (l) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1661 jbi = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1662 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1663 g_slist_free(jbi->ids); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1664 jabber_buddy_info_destroy(jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1665 |
15665
6eda87b08cdf
Don't access the list element after it has been freed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15626
diff
changeset
|
1666 l = l->next; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1667 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1668 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1669 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
|
1670 js->pending_buddy_info_requests = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1671 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1672 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1673 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1674 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
|
1675 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1676 JabberBuddyInfo *jbi = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1677 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1678 /* remove the pending callbacks */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1679 while(jbi->ids) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1680 char *id = jbi->ids->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1681 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
|
1682 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
|
1683 g_free(id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1684 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1685 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1686 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
|
1687 jbi->timeout_handle = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1688 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1689 jabber_buddy_info_show_if_ready(jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1690 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1691 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1692 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1693 |
16979
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1694 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:
16951
diff
changeset
|
1695 { |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1696 /* 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:
16951
diff
changeset
|
1697 if(!jbr->client.name) |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1698 return FALSE; |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1699 |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1700 if(!strcmp(ns, "jabber:iq:last")) { |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1701 if(!strcmp(jbr->client.name, "Trillian")) { |
20092
ab3c87375b17
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20058
diff
changeset
|
1702 /* verified by nwalp 2007/05/09 */ |
ab3c87375b17
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20058
diff
changeset
|
1703 if(!strcmp(jbr->client.version, "3.1.0.121") || |
ab3c87375b17
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20058
diff
changeset
|
1704 /* verified by nwalp 2007/09/19 */ |
ab3c87375b17
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20058
diff
changeset
|
1705 !strcmp(jbr->client.version, "3.1.7.0")) { |
16979
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1706 return TRUE; |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1707 } |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1708 } |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1709 } |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1710 |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1711 return FALSE; |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1712 } |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1713 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1714 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
|
1715 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1716 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1717 xmlnode *vcard; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1718 GList *resources; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1719 JabberBuddy *jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1720 JabberBuddyInfo *jbi; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1721 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1722 jb = jabber_buddy_find(js, jid, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1723 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1724 /* invalid JID */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1725 if(!jb) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1726 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1727 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1728 jbi = g_new0(JabberBuddyInfo, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1729 jbi->jid = g_strdup(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1730 jbi->js = js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1731 jbi->jb = jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1732 jbi->resources = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, jabber_buddy_info_resource_free); |
23206
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1733 jbi->user_info = purple_notify_user_info_new(); |
15373
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 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
|
1736 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1737 xmlnode_set_attrib(iq->node, "to", jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1738 vcard = xmlnode_new_child(iq->node, "vCard"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1739 xmlnode_set_namespace(vcard, "vcard-temp"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1740 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1741 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
|
1742 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
|
1743 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1744 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1745 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1746 for(resources = jb->resources; resources; resources = resources->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1747 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1748 JabberBuddyResource *jbr = resources->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1749 JabberBuddyInfoResource *jbir; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1750 char *full_jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1751 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1752 if ((strchr(jid, '/') == NULL) && (jbr->name != NULL)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1753 full_jid = g_strdup_printf("%s/%s", jid, jbr->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1754 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1755 full_jid = g_strdup(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1756 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1757 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1758 if (jbr->name != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1759 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1760 jbir = g_new0(JabberBuddyInfoResource, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1761 g_hash_table_insert(jbi->resources, g_strdup(jbr->name), jbir); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1762 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1763 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1764 if(!jbr->client.name) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1765 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:version"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1766 xmlnode_set_attrib(iq->node, "to", full_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1767 jabber_iq_set_callback(iq, jabber_version_parse, jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1768 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
|
1769 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1770 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1771 |
16979
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1772 /* this is to fix the feeling of irritation I get when trying |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1773 * to get info on a friend running Trillian, which doesn't |
16995 | 1774 * respond (with an error or otherwise) to jabber:iq:last |
16979
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1775 * requests. There are a number of Trillian users in my |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1776 * office. */ |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1777 if(!_client_is_blacklisted(jbr, "jabber:iq:last")) { |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1778 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:last"); |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1779 xmlnode_set_attrib(iq->node, "to", full_jid); |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1780 jabber_iq_set_callback(iq, jabber_last_parse, jbi); |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1781 jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1782 jabber_iq_send(iq); |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1783 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1784 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1785 g_free(full_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1786 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1787 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1788 js->pending_buddy_info_requests = g_slist_prepend(js->pending_buddy_info_requests, jbi); |
15822 | 1789 jbi->timeout_handle = purple_timeout_add(30000, jabber_buddy_get_info_timeout, jbi); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1790 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1791 |
15822 | 1792 void jabber_buddy_get_info(PurpleConnection *gc, const char *who) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1793 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1794 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1795 char *bare_jid = jabber_get_bare_jid(who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1796 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1797 if(bare_jid) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1798 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
|
1799 g_free(bare_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1800 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1801 } |
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 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
|
1804 gboolean invisible) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1805 { |
15822 | 1806 PurplePresence *gpresence; |
1807 PurpleAccount *account; | |
1808 PurpleStatus *status; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1809 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
|
1810 xmlnode *presence; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1811 JabberBuddyState state; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1812 char *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1813 int priority; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1814 |
15822 | 1815 account = purple_connection_get_account(js->gc); |
1816 gpresence = purple_account_get_presence(account); | |
1817 status = purple_presence_get_active_status(gpresence); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1818 |
15822 | 1819 purple_status_to_jabber(status, &state, &msg, &priority); |
17836
95affacf6f82
Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents:
16995
diff
changeset
|
1820 presence = jabber_presence_create_js(js, state, msg, priority); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1821 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1822 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1823 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1824 xmlnode_set_attrib(presence, "to", who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1825 if(invisible) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1826 xmlnode_set_attrib(presence, "type", "invisible"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1827 jb->invisible |= JABBER_INVIS_BUDDY; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1828 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1829 jb->invisible &= ~JABBER_INVIS_BUDDY; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1830 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1831 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1832 jabber_send(js, presence); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1833 xmlnode_free(presence); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1834 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1835 |
15822 | 1836 static void jabber_buddy_make_invisible(PurpleBlistNode *node, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1837 { |
15822 | 1838 PurpleBuddy *buddy; |
1839 PurpleConnection *gc; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1840 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1841 |
15822 | 1842 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1843 |
15822 | 1844 buddy = (PurpleBuddy *) node; |
1845 gc = purple_account_get_connection(buddy->account); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1846 js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1847 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1848 jabber_buddy_set_invisibility(js, buddy->name, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1849 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1850 |
15822 | 1851 static void jabber_buddy_make_visible(PurpleBlistNode *node, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1852 { |
15822 | 1853 PurpleBuddy *buddy; |
1854 PurpleConnection *gc; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1855 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1856 |
15822 | 1857 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1858 |
15822 | 1859 buddy = (PurpleBuddy *) node; |
1860 gc = purple_account_get_connection(buddy->account); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1861 js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1862 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1863 jabber_buddy_set_invisibility(js, buddy->name, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1864 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1865 |
15822 | 1866 static void jabber_buddy_cancel_presence_notification(PurpleBlistNode *node, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1867 gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1868 { |
15822 | 1869 PurpleBuddy *buddy; |
1870 PurpleConnection *gc; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1871 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1872 |
15822 | 1873 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1874 |
15822 | 1875 buddy = (PurpleBuddy *) node; |
1876 gc = purple_account_get_connection(buddy->account); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1877 js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1878 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1879 /* I wonder if we should prompt the user before doing this */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1880 jabber_presence_subscription_set(js, buddy->name, "unsubscribed"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1881 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1882 |
15822 | 1883 static void jabber_buddy_rerequest_auth(PurpleBlistNode *node, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1884 { |
15822 | 1885 PurpleBuddy *buddy; |
1886 PurpleConnection *gc; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1887 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1888 |
15822 | 1889 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1890 |
15822 | 1891 buddy = (PurpleBuddy *) node; |
1892 gc = purple_account_get_connection(buddy->account); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1893 js = gc->proto_data; |
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 jabber_presence_subscription_set(js, buddy->name, "subscribe"); |
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 |
15822 | 1899 static void jabber_buddy_unsubscribe(PurpleBlistNode *node, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1900 { |
15822 | 1901 PurpleBuddy *buddy; |
1902 PurpleConnection *gc; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1903 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1904 |
15822 | 1905 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1906 |
15822 | 1907 buddy = (PurpleBuddy *) node; |
1908 gc = purple_account_get_connection(buddy->account); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1909 js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1910 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1911 jabber_presence_subscription_set(js, buddy->name, "unsubscribe"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1912 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1913 |
17874
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1914 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:
17873
diff
changeset
|
1915 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:
17873
diff
changeset
|
1916 /* 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:
17873
diff
changeset
|
1917 PurpleBuddy *buddy = (PurpleBuddy *) node; |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1918 PurpleConnection *gc = purple_account_get_connection(buddy->account); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1919 JabberStream *js = gc->proto_data; |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1920 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:
17873
diff
changeset
|
1921 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:
17873
diff
changeset
|
1922 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:
17873
diff
changeset
|
1923 xmlnode *presence; |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1924 JabberBuddyState state; |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1925 char *msg; |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1926 int priority; |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1927 |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1928 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:
17873
diff
changeset
|
1929 presence = jabber_presence_create_js(js, state, msg, priority); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1930 |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1931 g_free(msg); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1932 |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1933 xmlnode_set_attrib(presence, "to", buddy->name); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1934 |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1935 jabber_send(js, presence); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1936 xmlnode_free(presence); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1937 } |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1938 } |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1939 |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1940 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:
17873
diff
changeset
|
1941 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:
17873
diff
changeset
|
1942 /* simply create a directed unavailable presence */ |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1943 PurpleBuddy *buddy = (PurpleBuddy *) node; |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1944 JabberStream *js = purple_account_get_connection(buddy->account)->proto_data; |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1945 xmlnode *presence; |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1946 |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1947 presence = jabber_presence_create_js(js, JABBER_BUDDY_STATE_UNAVAILABLE, NULL, 0); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1948 |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1949 xmlnode_set_attrib(presence, "to", buddy->name); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1950 |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1951 jabber_send(js, presence); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1952 xmlnode_free(presence); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1953 } |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1954 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1955 |
15822 | 1956 static GList *jabber_buddy_menu(PurpleBuddy *buddy) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1957 { |
15822 | 1958 PurpleConnection *gc = purple_account_get_connection(buddy->account); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1959 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1960 JabberBuddy *jb = jabber_buddy_find(js, buddy->name, TRUE); |
17882
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:
17874
diff
changeset
|
1961 GList *jbrs; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1962 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1963 GList *m = NULL; |
15822 | 1964 PurpleMenuAction *act; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1965 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1966 if(!jb) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1967 return m; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1968 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1969 /* XXX: fix the NOT ME below */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1970 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1971 if(js->protocol_version == JABBER_PROTO_0_9 /* && NOT ME */) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1972 if(jb->invisible & JABBER_INVIS_BUDDY) { |
15822 | 1973 act = purple_menu_action_new(_("Un-hide From"), |
1974 PURPLE_CALLBACK(jabber_buddy_make_visible), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1975 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1976 } else { |
15822 | 1977 act = purple_menu_action_new(_("Temporarily Hide From"), |
1978 PURPLE_CALLBACK(jabber_buddy_make_invisible), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1979 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1980 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1981 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1982 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1983 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1984 if(jb->subscription & JABBER_SUB_FROM /* && NOT ME */) { |
15822 | 1985 act = purple_menu_action_new(_("Cancel Presence Notification"), |
1986 PURPLE_CALLBACK(jabber_buddy_cancel_presence_notification), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1987 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1988 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1989 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1990 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1991 if(!(jb->subscription & JABBER_SUB_TO)) { |
15822 | 1992 act = purple_menu_action_new(_("(Re-)Request authorization"), |
1993 PURPLE_CALLBACK(jabber_buddy_rerequest_auth), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1994 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1995 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1996 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1997 } else /* if(NOT ME) */{ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1998 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1999 /* 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
|
2000 removed? */ |
15822 | 2001 act = purple_menu_action_new(_("Unsubscribe"), |
2002 PURPLE_CALLBACK(jabber_buddy_unsubscribe), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2003 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2004 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2005 } |
17874
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
2006 |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
2007 /* |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
2008 * 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:
17873
diff
changeset
|
2009 * |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
2010 * 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:
17873
diff
changeset
|
2011 * 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:
17873
diff
changeset
|
2012 * 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:
17873
diff
changeset
|
2013 * 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:
17873
diff
changeset
|
2014 */ |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
2015 if (g_utf8_strchr(buddy->name, -1, '@') == NULL) { |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
2016 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:
17873
diff
changeset
|
2017 PURPLE_CALLBACK(jabber_buddy_login), |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
2018 NULL, NULL); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
2019 m = g_list_append(m, act); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
2020 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:
17873
diff
changeset
|
2021 PURPLE_CALLBACK(jabber_buddy_logout), |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
2022 NULL, NULL); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
2023 m = g_list_append(m, act); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
2024 } |
17882
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:
17874
diff
changeset
|
2025 |
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:
17874
diff
changeset
|
2026 /* 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:
17874
diff
changeset
|
2027 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:
17874
diff
changeset
|
2028 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:
17874
diff
changeset
|
2029 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:
17874
diff
changeset
|
2030 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:
17874
diff
changeset
|
2031 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:
17874
diff
changeset
|
2032 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:
17874
diff
changeset
|
2033 JabberAdHocCommands *cmd = commands->data; |
17884
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:
17882
diff
changeset
|
2034 act = purple_menu_action_new(cmd->name, PURPLE_CALLBACK(jabber_adhoc_execute_action), cmd, NULL); |
17882
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:
17874
diff
changeset
|
2035 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:
17874
diff
changeset
|
2036 } |
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:
17874
diff
changeset
|
2037 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2038 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2039 return m; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2040 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2041 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2042 GList * |
15822 | 2043 jabber_blist_node_menu(PurpleBlistNode *node) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2044 { |
15822 | 2045 if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
2046 return jabber_buddy_menu((PurpleBuddy *) node); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2047 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2048 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2049 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2050 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2051 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2052 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2053 const char * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2054 jabber_buddy_state_get_name(JabberBuddyState state) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2055 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2056 switch(state) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2057 case JABBER_BUDDY_STATE_UNKNOWN: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2058 return _("Unknown"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2059 case JABBER_BUDDY_STATE_ERROR: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2060 return _("Error"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2061 case JABBER_BUDDY_STATE_UNAVAILABLE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2062 return _("Offline"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2063 case JABBER_BUDDY_STATE_ONLINE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2064 return _("Available"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2065 case JABBER_BUDDY_STATE_CHAT: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2066 return _("Chatty"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2067 case JABBER_BUDDY_STATE_AWAY: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2068 return _("Away"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2069 case JABBER_BUDDY_STATE_XA: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2070 return _("Extended Away"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2071 case JABBER_BUDDY_STATE_DND: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2072 return _("Do Not Disturb"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2073 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2074 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2075 return _("Unknown"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2076 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2077 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2078 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
|
2079 if(!id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2080 return JABBER_BUDDY_STATE_UNKNOWN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2081 if(!strcmp(id, "available")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2082 return JABBER_BUDDY_STATE_ONLINE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2083 if(!strcmp(id, "freeforchat")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2084 return JABBER_BUDDY_STATE_CHAT; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2085 if(!strcmp(id, "away")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2086 return JABBER_BUDDY_STATE_AWAY; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2087 if(!strcmp(id, "extended_away")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2088 return JABBER_BUDDY_STATE_XA; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2089 if(!strcmp(id, "dnd")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2090 return JABBER_BUDDY_STATE_DND; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2091 if(!strcmp(id, "offline")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2092 return JABBER_BUDDY_STATE_UNAVAILABLE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2093 if(!strcmp(id, "error")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2094 return JABBER_BUDDY_STATE_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2095 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2096 return JABBER_BUDDY_STATE_UNKNOWN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2097 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2098 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2099 JabberBuddyState jabber_buddy_show_get_state(const char *id) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2100 if(!id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2101 return JABBER_BUDDY_STATE_UNKNOWN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2102 if(!strcmp(id, "available")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2103 return JABBER_BUDDY_STATE_ONLINE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2104 if(!strcmp(id, "chat")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2105 return JABBER_BUDDY_STATE_CHAT; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2106 if(!strcmp(id, "away")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2107 return JABBER_BUDDY_STATE_AWAY; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2108 if(!strcmp(id, "xa")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2109 return JABBER_BUDDY_STATE_XA; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2110 if(!strcmp(id, "dnd")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2111 return JABBER_BUDDY_STATE_DND; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2112 if(!strcmp(id, "offline")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2113 return JABBER_BUDDY_STATE_UNAVAILABLE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2114 if(!strcmp(id, "error")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2115 return JABBER_BUDDY_STATE_ERROR; |
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 return JABBER_BUDDY_STATE_UNKNOWN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2118 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2119 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2120 const char *jabber_buddy_state_get_show(JabberBuddyState state) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2121 switch(state) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2122 case JABBER_BUDDY_STATE_CHAT: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2123 return "chat"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2124 case JABBER_BUDDY_STATE_AWAY: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2125 return "away"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2126 case JABBER_BUDDY_STATE_XA: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2127 return "xa"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2128 case JABBER_BUDDY_STATE_DND: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2129 return "dnd"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2130 case JABBER_BUDDY_STATE_ONLINE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2131 return "available"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2132 case JABBER_BUDDY_STATE_UNKNOWN: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2133 case JABBER_BUDDY_STATE_ERROR: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2134 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2135 case JABBER_BUDDY_STATE_UNAVAILABLE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2136 return "offline"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2137 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2138 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2139 } |
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 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
|
2142 switch(state) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2143 case JABBER_BUDDY_STATE_CHAT: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2144 return "freeforchat"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2145 case JABBER_BUDDY_STATE_AWAY: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2146 return "away"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2147 case JABBER_BUDDY_STATE_XA: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2148 return "extended_away"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2149 case JABBER_BUDDY_STATE_DND: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2150 return "dnd"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2151 case JABBER_BUDDY_STATE_ONLINE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2152 return "available"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2153 case JABBER_BUDDY_STATE_UNKNOWN: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2154 return "available"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2155 case JABBER_BUDDY_STATE_ERROR: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2156 return "error"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2157 case JABBER_BUDDY_STATE_UNAVAILABLE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2158 return "offline"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2159 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2160 return NULL; |
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 |
15822 | 2163 static void user_search_result_add_buddy_cb(PurpleConnection *gc, GList *row, void *user_data) |
15373
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 /* XXX find out the jid */ |
15822 | 2166 purple_blist_request_add_buddy(purple_connection_get_account(gc), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2167 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
|
2168 } |
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 static void user_search_result_cb(JabberStream *js, xmlnode *packet, gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2171 { |
15822 | 2172 PurpleNotifySearchResults *results; |
2173 PurpleNotifySearchColumn *column; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2174 xmlnode *x, *query, *item, *field; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2175 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2176 /* XXX error checking? */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2177 if(!(query = xmlnode_get_child(packet, "query"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2178 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2179 |
15822 | 2180 results = purple_notify_searchresults_new(); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2181 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
|
2182 xmlnode *reported; |
19755
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2183 GSList *column_vars = NULL; |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2184 |
15822 | 2185 purple_debug_info("jabber", "new-skool\n"); |
19755
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2186 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2187 if((reported = xmlnode_get_child(x, "reported"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2188 xmlnode *field = xmlnode_get_child(reported, "field"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2189 while(field) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2190 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
|
2191 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
|
2192 if(var) { |
15822 | 2193 column = purple_notify_searchresults_column_new(label ? label : var); |
2194 purple_notify_searchresults_column_add(results, column); | |
19755
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2195 column_vars = g_slist_append(column_vars, (char *)var); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2196 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2197 field = xmlnode_get_next_twin(field); |
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 } |
19755
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2200 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2201 item = xmlnode_get_child(x, "item"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2202 while(item) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2203 GList *row = NULL; |
19755
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2204 GSList *l; |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2205 xmlnode *valuenode; |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2206 const char *var; |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2207 |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2208 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:
19730
diff
changeset
|
2209 /* |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2210 * 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:
19730
diff
changeset
|
2211 * 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:
19730
diff
changeset
|
2212 */ |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2213 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:
19730
diff
changeset
|
2214 field != NULL; |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2215 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:
19730
diff
changeset
|
2216 { |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2217 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:
19730
diff
changeset
|
2218 !strcmp(var, l->data) && |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2219 (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:
19730
diff
changeset
|
2220 { |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2221 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:
19730
diff
changeset
|
2222 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:
19730
diff
changeset
|
2223 break; |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2224 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2225 } |
19755
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2226 if (field == NULL) |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2227 /* No data for this column */ |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2228 row = g_list_append(row, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2229 } |
15822 | 2230 purple_notify_searchresults_row_add(results, row); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2231 item = xmlnode_get_next_twin(item); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2232 } |
19755
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2233 |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2234 g_slist_free(column_vars); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2235 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2236 /* old skool */ |
15822 | 2237 purple_debug_info("jabber", "old-skool\n"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2238 |
15822 | 2239 column = purple_notify_searchresults_column_new(_("JID")); |
2240 purple_notify_searchresults_column_add(results, column); | |
2241 column = purple_notify_searchresults_column_new(_("First Name")); | |
2242 purple_notify_searchresults_column_add(results, column); | |
2243 column = purple_notify_searchresults_column_new(_("Last Name")); | |
2244 purple_notify_searchresults_column_add(results, column); | |
2245 column = purple_notify_searchresults_column_new(_("Nickname")); | |
2246 purple_notify_searchresults_column_add(results, column); | |
23180
e0bcb8cfda74
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@wiktel.com>
parents:
22861
diff
changeset
|
2247 column = purple_notify_searchresults_column_new(_("Email")); |
15822 | 2248 purple_notify_searchresults_column_add(results, column); |
15373
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 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
|
2251 const char *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2252 xmlnode *node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2253 GList *row = NULL; |
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(!(jid = xmlnode_get_attrib(item, "jid"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2256 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2257 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2258 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
|
2259 node = xmlnode_get_child(item, "first"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2260 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
|
2261 node = xmlnode_get_child(item, "last"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2262 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
|
2263 node = xmlnode_get_child(item, "nick"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2264 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
|
2265 node = xmlnode_get_child(item, "email"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2266 row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); |
22486
3225c99785b8
Fix a bunch of compiler warnings caused by my addition of G_GNUC_PRINTF()
Mark Doliner <mark@kingant.net>
parents:
22450
diff
changeset
|
2267 purple_debug_info("jabber", "row=%p\n", row); |
15822 | 2268 purple_notify_searchresults_row_add(results, row); |
15373
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2271 |
15822 | 2272 purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2273 user_search_result_add_buddy_cb); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2274 |
15822 | 2275 purple_notify_searchresults(js->gc, NULL, NULL, _("The following are the results of your search"), results, NULL, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2276 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2277 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2278 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
|
2279 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2280 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2281 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2282 char *dir_server = data; |
21120
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2283 const char *type; |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2284 |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2285 /* 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
|
2286 * 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
|
2287 * a cancel, so skip it */ |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2288 type = xmlnode_get_attrib(result, "type"); |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2289 if(type && !strcmp(type, "cancel")) { |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2290 g_free(dir_server); |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2291 return; |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2292 } |
15373
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 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
|
2295 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2296 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2297 xmlnode_insert_child(query, result); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2298 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2299 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
|
2300 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
|
2301 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2302 g_free(dir_server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2303 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2304 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2305 struct user_search_info { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2306 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2307 char *directory_server; |
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 |
15822 | 2310 static void user_search_cancel_cb(struct user_search_info *usi, PurpleRequestFields *fields) |
15373
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 g_free(usi->directory_server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2313 g_free(usi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2314 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2315 |
15822 | 2316 static void user_search_cb(struct user_search_info *usi, PurpleRequestFields *fields) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2317 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2318 JabberStream *js = usi->js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2319 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2320 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2321 GList *groups, *flds; |
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 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
|
2324 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2325 |
15822 | 2326 for(groups = purple_request_fields_get_groups(fields); groups; groups = groups->next) { |
2327 for(flds = purple_request_field_group_get_fields(groups->data); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2328 flds; flds = flds->next) { |
15822 | 2329 PurpleRequestField *field = flds->data; |
2330 const char *id = purple_request_field_get_id(field); | |
2331 const char *value = purple_request_field_string_get_value(field); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2332 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2333 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
|
2334 xmlnode *y = xmlnode_new_child(query, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2335 xmlnode_insert_data(y, value, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2336 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2337 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2338 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2339 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2340 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
|
2341 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
|
2342 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2343 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2344 g_free(usi->directory_server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2345 g_free(usi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2346 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2347 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2348 #if 0 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2349 /* 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
|
2350 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2351 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2352 * 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
|
2353 * comments for Jabber User Directories |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2354 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2355 * See discussion thread "Search comment for Jabber is not translatable" |
15822 | 2356 * in purple-i18n@lists.sourceforge.net (March 2006) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2357 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2358 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
|
2359 /* 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
|
2360 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
|
2361 "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
|
2362 NULL |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2363 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2364 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2365 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2366 static void user_search_fields_result_cb(JabberStream *js, xmlnode *packet, gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2367 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2368 xmlnode *query, *x; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2369 const char *from, *type; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2370 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2371 if(!(from = xmlnode_get_attrib(packet, "from"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2372 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2373 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2374 if(!(type = xmlnode_get_attrib(packet, "type")) || !strcmp(type, "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
|
2375 char *msg = jabber_parse_error(js, packet, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2376 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2377 if(!msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2378 msg = g_strdup(_("Unknown error")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2379 |
15822 | 2380 purple_notify_error(js->gc, _("Directory Query Failed"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2381 _("Could not query the directory server."), msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2382 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2383 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2384 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2385 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2386 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2387 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2388 if(!(query = xmlnode_get_child(packet, "query"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2389 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2390 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2391 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
|
2392 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
|
2393 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2394 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2395 struct user_search_info *usi; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2396 xmlnode *instnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2397 char *instructions = NULL; |
15822 | 2398 PurpleRequestFields *fields; |
2399 PurpleRequestFieldGroup *group; | |
2400 PurpleRequestField *field; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2401 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2402 /* old skool */ |
15822 | 2403 fields = purple_request_fields_new(); |
2404 group = purple_request_field_group_new(NULL); | |
2405 purple_request_fields_add_group(fields, group); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2406 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2407 if((instnode = xmlnode_get_child(query, "instructions"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2408 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2409 char *tmp = xmlnode_get_data(instnode); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2410 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2411 if(tmp) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2412 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2413 /* 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
|
2414 list in jabber_user_dir_comments[]) */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2415 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
|
2416 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2417 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2418 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2419 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2420 if(!instructions) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2421 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2422 instructions = g_strdup(_("Fill in one or more fields to search " |
16904
56042b2f8b64
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@wiktel.com>
parents:
16719
diff
changeset
|
2423 "for any matching XMPP users.")); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2424 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2425 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2426 if(xmlnode_get_child(query, "first")) { |
15822 | 2427 field = purple_request_field_string_new("first", _("First Name"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2428 NULL, FALSE); |
15822 | 2429 purple_request_field_group_add_field(group, field); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2430 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2431 if(xmlnode_get_child(query, "last")) { |
15822 | 2432 field = purple_request_field_string_new("last", _("Last Name"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2433 NULL, FALSE); |
15822 | 2434 purple_request_field_group_add_field(group, field); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2435 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2436 if(xmlnode_get_child(query, "nick")) { |
15822 | 2437 field = purple_request_field_string_new("nick", _("Nickname"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2438 NULL, FALSE); |
15822 | 2439 purple_request_field_group_add_field(group, field); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2440 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2441 if(xmlnode_get_child(query, "email")) { |
23180
e0bcb8cfda74
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@wiktel.com>
parents:
22861
diff
changeset
|
2442 field = purple_request_field_string_new("email", _("Email Address"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2443 NULL, FALSE); |
15822 | 2444 purple_request_field_group_add_field(group, field); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2445 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2446 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2447 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
|
2448 usi->js = js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2449 usi->directory_server = g_strdup(from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2450 |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2451 purple_request_fields(js->gc, _("Search for XMPP users"), |
16904
56042b2f8b64
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@wiktel.com>
parents:
16719
diff
changeset
|
2452 _("Search for XMPP users"), instructions, fields, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2453 _("Search"), G_CALLBACK(user_search_cb), |
16439
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:
15822
diff
changeset
|
2454 _("Cancel"), G_CALLBACK(user_search_cancel_cb), |
17864
58a145802f0a
Fixed weird bug that caused not supplying the account when searching for users.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17855
diff
changeset
|
2455 purple_connection_get_account(js->gc), NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2456 usi); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2457 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2458 g_free(instructions); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2459 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2460 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2461 |
17873
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:
17864
diff
changeset
|
2462 void jabber_user_search(JabberStream *js, const char *directory) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2463 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2464 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2465 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2466 /* 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
|
2467 if(!directory || !*directory) { |
15822 | 2468 purple_notify_error(js->gc, _("Invalid Directory"), _("Invalid Directory"), NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2469 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2470 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2471 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2472 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
|
2473 xmlnode_set_attrib(iq->node, "to", directory); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2474 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2475 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
|
2476 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2477 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2478 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2479 |
15822 | 2480 void jabber_user_search_begin(PurplePluginAction *action) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2481 { |
15822 | 2482 PurpleConnection *gc = (PurpleConnection *) action->context; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2483 JabberStream *js = gc->proto_data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2484 |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2485 purple_request_input(gc, _("Enter a User Directory"), _("Enter a User Directory"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2486 _("Select a user directory to search"), |
16951
88444e60ea95
Removes 'jabber.org' defaults from XMPP. I think we had agreed this was a good idea.
Sean Egan <seanegan@gmail.com>
parents:
16904
diff
changeset
|
2487 js->user_directories ? js->user_directories->data : NULL, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2488 FALSE, FALSE, NULL, |
17873
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:
17864
diff
changeset
|
2489 _("Search Directory"), PURPLE_CALLBACK(jabber_user_search), |
16439
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:
15822
diff
changeset
|
2490 _("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:
15822
diff
changeset
|
2491 NULL, NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2492 js); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2493 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2494 |
23777
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2495 gboolean |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2496 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:
23251
diff
changeset
|
2497 { |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2498 const GList *iter = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2499 |
23777
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2500 if (!jbr->caps) { |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2501 purple_debug_error("jabber", |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2502 "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:
23251
diff
changeset
|
2503 return FALSE; |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2504 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2505 |
23777
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2506 for (iter = jbr->caps->features ; iter ; iter = g_list_next(iter)) { |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2507 if (strcmp(iter->data, cap) == 0) { |
24369
f4cb55854e87
Make jabber_resource_have_capability polute the log a little less...
Marcus Lundblad <ml@update.uu.se>
parents:
24056
diff
changeset
|
2508 purple_debug_info("jabber", "Found cap: %s\n", (char *)iter->data); |
23777
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2509 return TRUE; |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2510 } |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2511 } |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2512 |
24369
f4cb55854e87
Make jabber_resource_have_capability polute the log a little less...
Marcus Lundblad <ml@update.uu.se>
parents:
24056
diff
changeset
|
2513 purple_debug_info("jabber", "Cap %s not found\n", cap); |
23777
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2514 return FALSE; |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2515 } |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2516 |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2517 gboolean |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2518 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:
23251
diff
changeset
|
2519 { |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2520 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:
23251
diff
changeset
|
2521 |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2522 if (!jbr) { |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2523 purple_debug_error("jabber", |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2524 "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:
23251
diff
changeset
|
2525 return FALSE; |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2526 } |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2527 |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2528 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:
23251
diff
changeset
|
2529 } |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2530 |