Mercurial > pidgin
annotate libpurple/protocols/jabber/buddy.c @ 26706:fbb2b8e2d91e
Use purple_strequal and g_str_equal
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sun, 26 Apr 2009 23:24:45 +0000 |
parents | fef989505ea2 |
children | 80437c891f92 |
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 "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 #include "imgstore.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 #include "prpl.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 #include "notify.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 #include "request.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "xmlnode.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "buddy.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "chat.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "jabber.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "iq.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "presence.h" |
25351
5dd25c58b65e
Migrate the XMPP User Avatar (XEP-0084) code to its own file
Paul Aurich <paul@darkrain42.org>
parents:
25285
diff
changeset
|
35 #include "useravatar.h" |
15373
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 typedef struct { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 long idle_seconds; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 } JabberBuddyInfoResource; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 typedef struct { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 JabberBuddy *jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 char *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 GSList *ids; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 GHashTable *resources; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 int timeout_handle; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 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
|
52 PurpleNotifyUserInfo *user_info; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 } JabberBuddyInfo; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 void jabber_buddy_free(JabberBuddy *jb) |
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 g_return_if_fail(jb != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 |
22794
cc8903c59d6b
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents:
22780
diff
changeset
|
59 g_free(jb->error_msg); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 while(jb->resources) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 jabber_buddy_resource_free(jb->resources->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 g_free(jb); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 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
|
67 gboolean create) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 JabberBuddy *jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 const char *realname; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 if (js->buddies == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
75 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
|
76 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 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
|
79 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 if(!jb && create) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 jb = g_new0(JabberBuddy, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 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
|
83 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 return jb; |
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 |
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 JabberBuddyResource *jabber_buddy_find_resource(JabberBuddy *jb, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 const char *resource) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 JabberBuddyResource *jbr = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 if(!jb) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 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
|
99 { |
25209 | 100 JabberBuddyResource *tmp = (JabberBuddyResource *) l->data; |
101 if (!jbr && !resource) { | |
102 jbr = tmp; | |
103 } else if (!resource) { | |
104 if (tmp->priority > jbr->priority) | |
105 jbr = tmp; | |
106 else if (tmp->priority == jbr->priority) { | |
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 /* Determine if this resource is more available than the one we've currently chosen */ |
25209 | 108 switch(tmp->state) { |
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
|
109 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
|
110 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
|
111 /* This resource is online/chatty. Prefer to one which isn't either. */ |
25209 | 112 if (((jbr->state != JABBER_BUDDY_STATE_ONLINE) && (jbr->state != JABBER_BUDDY_STATE_CHAT)) |
113 || (jbr->idle && !tmp->idle) | |
114 || (jbr->idle && tmp->idle && tmp->idle > jbr->idle)) | |
115 jbr = tmp; | |
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
|
116 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
|
117 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
|
118 case JABBER_BUDDY_STATE_DND: |
24562
df9f962aa907
This technically doesn't matter due to behavior elsewhere in the prpl, but
Paul Aurich <paul@darkrain42.org>
parents:
24552
diff
changeset
|
119 /* This resource is away/dnd. Prefer to one which is extended away, unavailable, or unknown. */ |
25209 | 120 if (((jbr->state == JABBER_BUDDY_STATE_XA) || (jbr->state == JABBER_BUDDY_STATE_UNAVAILABLE) || |
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
|
121 (jbr->state == JABBER_BUDDY_STATE_UNKNOWN) || (jbr->state == JABBER_BUDDY_STATE_ERROR)) |
25209 | 122 || (jbr->idle && !tmp->idle) |
123 || (jbr->idle && tmp->idle && tmp->idle > jbr->idle)) | |
124 jbr = tmp; | |
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
|
125 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
|
126 case JABBER_BUDDY_STATE_XA: |
24562
df9f962aa907
This technically doesn't matter due to behavior elsewhere in the prpl, but
Paul Aurich <paul@darkrain42.org>
parents:
24552
diff
changeset
|
127 /* This resource is extended away. That's better than unavailable or unknown. */ |
df9f962aa907
This technically doesn't matter due to behavior elsewhere in the prpl, but
Paul Aurich <paul@darkrain42.org>
parents:
24552
diff
changeset
|
128 if ((jbr->state == JABBER_BUDDY_STATE_UNAVAILABLE) || (jbr->state == JABBER_BUDDY_STATE_UNKNOWN) || (jbr->state == JABBER_BUDDY_STATE_ERROR)) |
25209 | 129 jbr = tmp; |
24562
df9f962aa907
This technically doesn't matter due to behavior elsewhere in the prpl, but
Paul Aurich <paul@darkrain42.org>
parents:
24552
diff
changeset
|
130 break; |
df9f962aa907
This technically doesn't matter due to behavior elsewhere in the prpl, but
Paul Aurich <paul@darkrain42.org>
parents:
24552
diff
changeset
|
131 case JABBER_BUDDY_STATE_UNAVAILABLE: |
df9f962aa907
This technically doesn't matter due to behavior elsewhere in the prpl, but
Paul Aurich <paul@darkrain42.org>
parents:
24552
diff
changeset
|
132 /* This resource is unavailable. That's better than unknown. */ |
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
|
133 if ((jbr->state == JABBER_BUDDY_STATE_UNKNOWN) || (jbr->state == JABBER_BUDDY_STATE_ERROR)) |
25209 | 134 jbr = tmp; |
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
|
135 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
|
136 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
|
137 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
|
138 /* 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
|
139 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
|
140 } |
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
|
141 } |
25209 | 142 } else if(tmp->name) { |
143 if(!strcmp(tmp->name, resource)) { | |
144 jbr = tmp; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 } |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 return jbr; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 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
|
154 int priority, JabberBuddyState state, const char *status) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 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
|
157 if(!jbr) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 jbr = g_new0(JabberBuddyResource, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 jbr->jb = jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 jbr->name = g_strdup(resource); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 jbr->capabilities = JABBER_CAP_XHTML; |
25653
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
162 jbr->tz_off = PURPLE_NO_TZ_OFF; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 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
|
164 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 jbr->priority = priority; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 jbr->state = state; |
22780 | 167 g_free(jbr->status); |
168 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
|
169 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 return jbr; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 void jabber_buddy_resource_free(JabberBuddyResource *jbr) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 g_return_if_fail(jbr != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
177 jbr->jb->resources = g_list_remove(jbr->jb->resources, jbr); |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
178 |
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
|
179 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
|
180 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
|
181 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
|
182 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
|
183 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
|
184 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
|
185 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
|
186 } |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
187 |
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
|
188 jabber_caps_free_clientinfo(jbr->caps); |
15373
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 g_free(jbr->name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 g_free(jbr->status); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 g_free(jbr->thread_id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 g_free(jbr->client.name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 g_free(jbr->client.version); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 g_free(jbr->client.os); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 g_free(jbr); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 } |
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 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
|
200 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 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
|
202 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 if(!jbr) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 jabber_buddy_resource_free(jbr); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 } |
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 /******* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 * 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
|
211 * 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
|
212 * 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
|
213 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 * 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
|
215 * _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
|
216 * 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
|
217 * replace vcard-temp |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
218 * --Nathan |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 /*---------------------------------------*/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 /* Jabber "set info" (vCard) support */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 /*---------------------------------------*/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 |
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 * V-Card format: |
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 * <vCard prodid='' version='' xmlns=''> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 * <FN></FN> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 * <N> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 * <FAMILY/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 * <GIVEN/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 * </N> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 * <NICKNAME/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 * <URL/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 * <ADR> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 * <STREET/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 * <EXTADD/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 * <LOCALITY/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 * <REGION/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 * <PCODE/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 * <COUNTRY/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 * </ADR> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 * <TEL/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 * <EMAIL/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 * <ORG> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 * <ORGNAME/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 * <ORGUNIT/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 * </ORG> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 * <TITLE/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 * <ROLE/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 * <DESC/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 * <BDAY/> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 * </vCard> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 * See also: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 * 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
|
259 * 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
|
260 */ |
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 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 * 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
|
264 * and attributes. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
266 * 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
|
267 * 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
|
268 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 * 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
|
270 * 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
|
271 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 * 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
|
273 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 * 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
|
275 * 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
|
276 * "automagically" construct the appropriate XML node tree. |
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 * Thoughts on future direction/expansion |
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 * This is a "simple" vCard. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 * 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
|
283 * 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
|
284 * "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
|
285 * 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
|
286 * array. |
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 * 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
|
289 * construction routines. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 struct vcard_template { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 char *label; /* label text pointer */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 char *tag; /* tag text */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 char *ptag; /* parent tag "path" text */ |
21015
787b3897ba9f
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@hxbc.us>
parents:
20276
diff
changeset
|
296 } const vcard_template_data[] = { |
26226
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
297 {N_("Full Name"), "FN", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
298 {N_("Family Name"), "FAMILY", "N"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
299 {N_("Given Name"), "GIVEN", "N"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
300 {N_("Nickname"), "NICKNAME", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
301 {N_("URL"), "URL", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
302 {N_("Street Address"), "STREET", "ADR"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
303 {N_("Extended Address"), "EXTADD", "ADR"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
304 {N_("Locality"), "LOCALITY", "ADR"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
305 {N_("Region"), "REGION", "ADR"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
306 {N_("Postal Code"), "PCODE", "ADR"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
307 {N_("Country"), "CTRY", "ADR"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
308 {N_("Telephone"), "NUMBER", "TEL"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
309 {N_("Email"), "USERID", "EMAIL"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
310 {N_("Organization Name"), "ORGNAME", "ORG"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
311 {N_("Organization Unit"), "ORGUNIT", "ORG"}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
312 {N_("Title"), "TITLE", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
313 {N_("Role"), "ROLE", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
314 {N_("Birthday"), "BDAY", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
315 {N_("Description"), "DESC", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
316 {"", "N", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
317 {"", "ADR", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
318 {"", "ORG", NULL}, |
5c6cf6d1e65f
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <mark@kingant.net>
parents:
25952
diff
changeset
|
319 {NULL, NULL, NULL} |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 * The "vCard" tag's attribute list... |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 struct tag_attr { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 char *attr; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 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
|
328 } const vcard_tag_attr_list[] = { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 {"prodid", "-//HandGen//NONSGML vGen v1.0//EN"}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 {"version", "2.0", }, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 {"xmlns", "vcard-temp", }, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 {NULL, NULL}, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 }; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 * 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
|
338 * nodes as necessary |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 * Returns pointer to inserted node |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 * 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
|
343 * 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
|
344 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 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
|
346 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 xmlnode *x = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 |
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 * 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
|
351 * from the vCard template struct. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 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
|
354 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
|
355 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 while(vc_tp->label != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 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
|
358 parent_tag = vc_tp->ptag; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 ++vc_tp; |
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
364 |
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 * If we have a parent tag... |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
367 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
368 if(parent_tag != NULL ) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
369 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 * 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
|
371 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 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
|
373 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 * Descend? |
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 char *grand_parent = g_strdup(parent_tag); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 char *parent; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
378 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 if((parent = strrchr(grand_parent, '/')) != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 *(parent++) = '\0'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 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
|
382 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 x = xmlnode_new_child(start, grand_parent); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 g_free(grand_parent); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 * 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
|
389 * Note: may be the "root" node! |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 xmlnode *y; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
392 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
|
393 return(y); |
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 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
397 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 * 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
|
400 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 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
|
402 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
403 |
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 * Send vCard info to Jabber server |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 */ |
15822 | 407 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
|
408 { |
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
|
409 PurpleStoredImage *img; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 JabberIq *iq; |
25795
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
24056
diff
changeset
|
411 JabberStream *js = purple_connection_get_protocol_data(gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
412 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
|
413 const struct tag_attr *tag_attr; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 |
18163
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
415 /* 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
|
416 * 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
|
417 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
|
418 return; |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
419 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 g_free(js->avatar_hash); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 js->avatar_hash = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 * 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
|
425 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 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
|
427 |
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
|
428 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
|
429 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
|
430 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
|
431 vc_node = NULL; |
15373
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 |
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
|
434 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
|
435 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
|
436 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
|
437 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
|
438 gchar *enc; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 |
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
|
440 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
|
441 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
|
442 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
|
443 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
|
444 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
445 |
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
|
446 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
|
447 avatar_len = purple_imgstore_get_size(img); |
25280
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
25279
diff
changeset
|
448 /* Get rid of an old PHOTO if one exists. |
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
25279
diff
changeset
|
449 * TODO: This may want to be modified to remove all old PHOTO |
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
25279
diff
changeset
|
450 * children, at the moment some people have managed to get |
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
25279
diff
changeset
|
451 * multiple PHOTO entries in their vCard. */ |
22295
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
452 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
|
453 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
|
454 } |
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 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
|
456 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
|
457 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
|
458 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
|
459 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
|
460 |
24693
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24692
diff
changeset
|
461 js->avatar_hash = jabber_calculate_data_sha1sum(avatar_data, avatar_len); |
22295
bb124c3e668c
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <stu@nosnilmot.com>
parents:
21842
diff
changeset
|
462 |
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_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
|
464 g_free(enc); |
25280
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
25279
diff
changeset
|
465 } else if (vc_node) { |
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
25279
diff
changeset
|
466 xmlnode *photo; |
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
25279
diff
changeset
|
467 /* TODO: Remove all PHOTO children? (see above note) */ |
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
25279
diff
changeset
|
468 if ((photo = xmlnode_get_child(vc_node, "PHOTO"))) { |
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
25279
diff
changeset
|
469 xmlnode_free(photo); |
1e121a3eceeb
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <paul@darkrain42.org>
parents:
25279
diff
changeset
|
470 } |
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
|
471 } |
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 |
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 if (vc_node != NULL) { |
25354
370d8eba2ce0
Send presence updates from jabber_set_info, not jabber_set_buddy_icon.
Paul Aurich <paul@darkrain42.org>
parents:
25353
diff
changeset
|
474 PurpleAccount *account = purple_connection_get_account(js->gc); |
370d8eba2ce0
Send presence updates from jabber_set_info, not jabber_set_buddy_icon.
Paul Aurich <paul@darkrain42.org>
parents:
25353
diff
changeset
|
475 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 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
|
477 xmlnode_insert_child(iq->node, vc_node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 jabber_iq_send(iq); |
25354
370d8eba2ce0
Send presence updates from jabber_set_info, not jabber_set_buddy_icon.
Paul Aurich <paul@darkrain42.org>
parents:
25353
diff
changeset
|
479 |
370d8eba2ce0
Send presence updates from jabber_set_info, not jabber_set_buddy_icon.
Paul Aurich <paul@darkrain42.org>
parents:
25353
diff
changeset
|
480 /* Send presence to update vcard-temp:x:update */ |
370d8eba2ce0
Send presence updates from jabber_set_info, not jabber_set_buddy_icon.
Paul Aurich <paul@darkrain42.org>
parents:
25353
diff
changeset
|
481 jabber_presence_send(account, purple_account_get_active_status(account)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
482 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
483 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
484 |
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
|
485 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
|
486 { |
25426
2d92bbe6807b
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <paul@darkrain42.org>
parents:
25402
diff
changeset
|
487 PurpleAccount *account = purple_connection_get_account(gc); |
25356
c0a27a44ebd6
Support both XEP-0084 namespaces for fetching our own avatars at login
Paul Aurich <paul@darkrain42.org>
parents:
25354
diff
changeset
|
488 jabber_avatar_set(gc->proto_data, img, NULL); |
25279
c07b0aa88a35
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <paul@darkrain42.org>
parents:
24693
diff
changeset
|
489 /* vCard avatars do not have an image type requirement so update our |
c07b0aa88a35
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <paul@darkrain42.org>
parents:
24693
diff
changeset
|
490 * vCard avatar regardless of image type for those poor older clients |
c07b0aa88a35
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <paul@darkrain42.org>
parents:
24693
diff
changeset
|
491 */ |
25426
2d92bbe6807b
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <paul@darkrain42.org>
parents:
25402
diff
changeset
|
492 jabber_set_info(gc, purple_account_get_user_info(account)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
493 |
25426
2d92bbe6807b
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <paul@darkrain42.org>
parents:
25402
diff
changeset
|
494 /* TODO: Fake image to ourselves, since a number of servers do not echo |
2d92bbe6807b
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <paul@darkrain42.org>
parents:
25402
diff
changeset
|
495 * back our presence to us. To do this without uselessly copying the data |
2d92bbe6807b
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <paul@darkrain42.org>
parents:
25402
diff
changeset
|
496 * of the image, we need purple_buddy_icons_set_for_user_image (i.e. takes |
2d92bbe6807b
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <paul@darkrain42.org>
parents:
25402
diff
changeset
|
497 * an existing icon/stored image). */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
498 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
501 * 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
|
502 * |
25285
ca4ccf646993
Correct a comment, I don't imagine anyone will actually need this but better
Etan Reisner <pidgin@unreliablesource.net>
parents:
25280
diff
changeset
|
503 * Sets the vCard with data from PurpleRequestFields. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
504 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
505 static void |
15822 | 506 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
|
507 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
508 xmlnode *vc_node; |
15822 | 509 PurpleRequestField *field; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
510 const char *text; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
511 char *p; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
512 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
|
513 const struct tag_attr *tag_attr; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
514 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
515 vc_node = xmlnode_new("vCard"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
516 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
517 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
|
518 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
|
519 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
520 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
|
521 if (*vc_tp->label == '\0') |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
522 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
523 |
15822 | 524 field = purple_request_fields_get_field(fields, vc_tp->tag); |
525 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
|
526 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
527 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
528 if (text != NULL && *text != '\0') { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
529 xmlnode *xp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
530 |
15822 | 531 purple_debug(PURPLE_DEBUG_INFO, "jabber", |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
532 "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
|
533 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
534 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
|
535 NULL, vc_tp->tag)) != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
536 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
537 xmlnode_insert_data(xp, text, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
538 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
539 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
540 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
542 p = xmlnode_to_str(vc_node, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
543 xmlnode_free(vc_node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
544 |
15822 | 545 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
|
546 serv_set_info(gc, p); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
547 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
548 g_free(p); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
549 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
550 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
551 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 * This gets executed by the proto action |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
553 * |
15822 | 554 * 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
|
555 * 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
|
556 * calls the set_vcard dialog. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 */ |
15822 | 558 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
|
559 { |
15822 | 560 PurpleConnection *gc = (PurpleConnection *) action->context; |
561 PurpleRequestFields *fields; | |
562 PurpleRequestFieldGroup *group; | |
563 PurpleRequestField *field; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 const struct vcard_template *vc_tp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 const char *user_info; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
566 char *cdata = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 xmlnode *x_vc_data = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 |
15822 | 569 fields = purple_request_fields_new(); |
570 group = purple_request_field_group_new(NULL); | |
571 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
|
572 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 * Get existing, XML-formatted, user info |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
575 */ |
15822 | 576 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
|
577 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
|
578 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
580 * 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
|
581 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
582 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
|
583 xmlnode *data_node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 if((vc_tp->label)[0] == '\0') |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
586 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
587 if (x_vc_data != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
588 if(vc_tp->ptag == NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
589 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
|
590 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
591 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
|
592 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
|
593 g_free(tag); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
594 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
595 if(data_node) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 cdata = xmlnode_get_data(data_node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
597 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
598 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 if(strcmp(vc_tp->tag, "DESC") == 0) { |
15822 | 600 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
|
601 _(vc_tp->label), cdata, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
603 } else { |
15822 | 604 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
|
605 _(vc_tp->label), cdata, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
606 FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
607 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
608 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
609 g_free(cdata); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
610 cdata = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 |
15822 | 612 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
|
613 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
614 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
615 if(x_vc_data != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
616 xmlnode_free(x_vc_data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
617 |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
618 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
|
619 _("Edit XMPP vCard"), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
620 _("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
|
621 "information with which you feel comfortable."), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
622 fields, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
623 _("Save"), G_CALLBACK(jabber_format_info), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
624 _("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
|
625 purple_connection_get_account(gc), NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
626 gc); |
15373
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 |
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 /* End Jabber "set info" (vCard) support */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
631 /*---------------------------------------*/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
632 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
633 /****** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
634 * 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
|
635 ******/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 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
|
638 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 /* 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
|
640 if (jbi->timeout_handle > 0) |
15822 | 641 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
|
642 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 g_free(jbi->jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
644 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
|
645 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
|
646 g_free(jbi); |
15373
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
649 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
|
650 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 char *resource_name, *tmp; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 JabberBuddyResource *jbr; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 JabberBuddyInfoResource *jbir = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 GList *resources; |
15822 | 655 PurpleNotifyUserInfo *user_info; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
656 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 /* not yet */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
658 if(jbi->ids) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
659 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 |
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
|
661 user_info = jbi->user_info; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 resource_name = jabber_get_resource(jbi->jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
663 |
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
|
664 /* 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
|
665 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
|
666 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
|
667 |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
668 /* 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
|
669 if(resource_name) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
670 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
|
671 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
|
672 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
|
673 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
|
674 (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
|
675 (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
|
676 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
|
677 g_free(tmp); |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
678 |
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
|
679 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
|
680 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
|
681 } |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
682 } |
25653
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
683 if (jbr && jbr->tz_off != PURPLE_NO_TZ_OFF) { |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
684 time_t now_t; |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
685 struct tm *now; |
25658
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
686 char *timestamp; |
25653
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
687 time(&now_t); |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
688 now_t += jbr->tz_off; |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
689 now = gmtime(&now_t); |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
690 |
25659
481e07d69a10
Format the time as "localtimeformat [+-]HHMM". Iterative development is fun.
Paul Aurich <paul@darkrain42.org>
parents:
25658
diff
changeset
|
691 timestamp = g_strdup_printf("%s %c%02d%02d", purple_time_format(now), |
481e07d69a10
Format the time as "localtimeformat [+-]HHMM". Iterative development is fun.
Paul Aurich <paul@darkrain42.org>
parents:
25658
diff
changeset
|
692 jbr->tz_off < 0 ? '-' : '+', |
481e07d69a10
Format the time as "localtimeformat [+-]HHMM". Iterative development is fun.
Paul Aurich <paul@darkrain42.org>
parents:
25658
diff
changeset
|
693 abs(jbr->tz_off / (60*60)), |
481e07d69a10
Format the time as "localtimeformat [+-]HHMM". Iterative development is fun.
Paul Aurich <paul@darkrain42.org>
parents:
25658
diff
changeset
|
694 abs((jbr->tz_off % (60*60)) / 60)); |
25658
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
695 purple_notify_user_info_prepend_pair(user_info, _("Local Time"), timestamp); |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
696 g_free(timestamp); |
25653
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
697 } |
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
|
698 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
|
699 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
|
700 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
|
701 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
|
702 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
|
703 } |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
704 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
705 if(jbr) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
706 char *purdy = NULL; |
23261
b4ed2512be3b
Remove compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23251
diff
changeset
|
707 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
|
708 if(jbr->status) |
15822 | 709 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
|
710 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
|
711 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
|
712 |
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
|
713 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
|
714 ((status_name && purdy) ? ": " : ""), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
715 (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
|
716 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
|
717 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
718 g_free(purdy); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
719 } 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
|
720 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
|
721 } |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
722 #if 0 |
19724
36d5d5048b53
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
723 /* #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
|
724 * 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
|
725 * 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
|
726 */ |
36d5d5048b53
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
727 |
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
|
728 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
|
729 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
|
730 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
|
731 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
|
732 const char *feature = iter->data; |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
733 |
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
|
734 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
|
735 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
|
736 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
|
737 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
|
738 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
|
739 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
|
740 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
|
741 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
|
742 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
|
743 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
|
744 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
|
745 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
|
746 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
|
747 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
|
748 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
|
749 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
|
750 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
|
751 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
|
752 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
|
753 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
|
754 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
|
755 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
|
756 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
|
757 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
|
758 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
|
759 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
|
760 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
|
761 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
|
762 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
|
763 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
|
764 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
|
765 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
|
766 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
|
767 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
|
768 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
|
769 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
|
770 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
|
771 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
|
772 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
|
773 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
|
774 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
|
775 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
|
776 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
|
777 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
|
778 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
|
779 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
|
780 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
|
781 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
|
782 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
|
783 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
|
784 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
|
785 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
|
786 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
|
787 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
|
788 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
|
789 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
|
790 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
|
791 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
|
792 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
|
793 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
|
794 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
|
795 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
|
796 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
|
797 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
|
798 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
|
799 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
|
800 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
|
801 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
|
802 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
|
803 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
|
804 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
|
805 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
|
806 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
|
807 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
|
808 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
|
809 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
|
810 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
|
811 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
|
812 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
|
813 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
|
814 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
|
815 feature = _("User Viewing"); |
26466
cde07a2e4531
Do not advertise support for old XEP-0199 (Ping) namespace
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
816 else if(!strcmp(feature, "urn:xmpp:ping")) |
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
|
817 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
|
818 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
|
819 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
|
820 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
|
821 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
|
822 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
|
823 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
|
824 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
|
825 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
|
826 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
|
827 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
|
828 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
|
829 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
|
830 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
|
831 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
|
832 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
|
833 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
|
834 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
|
835 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
|
836 if(feature) |
19724
36d5d5048b53
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
837 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
|
838 } |
19724
36d5d5048b53
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
839 |
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
|
840 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
|
841 purple_notify_user_info_prepend_pair(user_info, _("Capabilities"), tmp->str); |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
842 |
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
|
843 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
|
844 } |
19724
36d5d5048b53
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
845 #endif |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
846 } else { |
24552
f10aba5592c6
The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@wiktel.com>
parents:
24369
diff
changeset
|
847 gboolean multiple_resources = jbi->jb->resources && jbi->jb->resources->next; |
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
|
848 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
849 for(resources = jbi->jb->resources; resources; resources = resources->next) { |
23261
b4ed2512be3b
Remove compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23251
diff
changeset
|
850 char *purdy = NULL; |
b4ed2512be3b
Remove compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23251
diff
changeset
|
851 const char *status_name = NULL; |
b4ed2512be3b
Remove compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23251
diff
changeset
|
852 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
853 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
|
854 |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
855 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
|
856 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
|
857 (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
|
858 (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
|
859 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
|
860 _("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
|
861 g_free(tmp); |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
862 |
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
|
863 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
|
864 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
|
865 } |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
866 } |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
867 |
25653
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
868 if (jbr->tz_off != PURPLE_NO_TZ_OFF) { |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
869 time_t now_t; |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
870 struct tm *now; |
25658
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
871 char *timestamp; |
25653
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
872 time(&now_t); |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
873 now_t += jbr->tz_off; |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
874 now = gmtime(&now_t); |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
875 |
25659
481e07d69a10
Format the time as "localtimeformat [+-]HHMM". Iterative development is fun.
Paul Aurich <paul@darkrain42.org>
parents:
25658
diff
changeset
|
876 timestamp = g_strdup_printf("%s %c%02d%02d", purple_time_format(now), |
481e07d69a10
Format the time as "localtimeformat [+-]HHMM". Iterative development is fun.
Paul Aurich <paul@darkrain42.org>
parents:
25658
diff
changeset
|
877 jbr->tz_off < 0 ? '-' : '+', |
481e07d69a10
Format the time as "localtimeformat [+-]HHMM". Iterative development is fun.
Paul Aurich <paul@darkrain42.org>
parents:
25658
diff
changeset
|
878 abs(jbr->tz_off / (60*60)), |
481e07d69a10
Format the time as "localtimeformat [+-]HHMM". Iterative development is fun.
Paul Aurich <paul@darkrain42.org>
parents:
25658
diff
changeset
|
879 abs((jbr->tz_off % (60*60)) / 60)); |
25658
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
880 purple_notify_user_info_prepend_pair(user_info, _("Local Time"), timestamp); |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
881 g_free(timestamp); |
25653
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
882 } |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
883 |
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
|
884 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
|
885 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
|
886 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
|
887 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
|
888 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
|
889 } |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
890 } |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
891 |
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
|
892 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
|
893 if(jbr->status) |
15822 | 894 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
|
895 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
|
896 status_name = NULL; |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
897 |
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
|
898 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
|
899 ((status_name && purdy) ? ": " : ""), |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
900 (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
|
901 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
|
902 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
903 g_free(purdy); |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
904 |
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
|
905 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
|
906 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
|
907 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
|
908 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
|
909 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
910 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
911 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
|
912 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
|
913 #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
|
914 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
|
915 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
|
916 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
|
917 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
|
918 const char *feature = iter->data; |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
919 |
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
|
920 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
|
921 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
|
922 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
|
923 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
|
924 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
|
925 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
|
926 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
|
927 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
|
928 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
|
929 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
|
930 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
|
931 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
|
932 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
|
933 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
|
934 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
|
935 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
|
936 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
|
937 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
|
938 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
|
939 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
|
940 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
|
941 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
|
942 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
|
943 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
|
944 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
|
945 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
|
946 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
|
947 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
|
948 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
|
949 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
|
950 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
|
951 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
|
952 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
|
953 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
|
954 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
|
955 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
|
956 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
|
957 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
|
958 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
|
959 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
|
960 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
|
961 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
|
962 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
|
963 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
|
964 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
|
965 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
|
966 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
|
967 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
|
968 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
|
969 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
|
970 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
|
971 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
|
972 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
|
973 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
|
974 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
|
975 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
|
976 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
|
977 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
|
978 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
|
979 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
|
980 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
|
981 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
|
982 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
|
983 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
|
984 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
|
985 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
|
986 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
|
987 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
|
988 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
|
989 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
|
990 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
|
991 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
|
992 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
|
993 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
|
994 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
|
995 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
|
996 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
|
997 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
|
998 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
|
999 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
|
1000 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
|
1001 feature = _("User Viewing"); |
26466
cde07a2e4531
Do not advertise support for old XEP-0199 (Ping) namespace
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
1002 else if(!strcmp(feature, "urn:xmpp:ping")) |
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
|
1003 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
|
1004 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
|
1005 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
|
1006 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
|
1007 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
|
1008 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
|
1009 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
|
1010 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
|
1011 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
|
1012 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
|
1013 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
|
1014 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
|
1015 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
|
1016 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
|
1017 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
|
1018 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
|
1019 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
|
1020 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
|
1021 feature = NULL; |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
1022 |
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
|
1023 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
|
1024 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
|
1025 } |
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 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
|
1027 purple_notify_user_info_prepend_pair(user_info, _("Capabilities"), tmp->str); |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
1028 |
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
|
1029 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
|
1030 } |
19724
36d5d5048b53
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@gmail.com>
parents:
19697
diff
changeset
|
1031 #endif |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1032 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1033 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1034 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1035 g_free(resource_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1036 |
15822 | 1037 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
|
1038 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1039 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
|
1040 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
|
1041 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
|
1042 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1043 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1044 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
|
1045 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1046 jabber_buddy_info_destroy(jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1047 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1048 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1049 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
|
1050 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1051 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
|
1052 char *comp_id; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1053 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1054 if(!id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1055 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1056 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1057 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
|
1058 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
|
1059 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
|
1060 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
|
1061 g_free(comp_id); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1062 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1063 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1064 l = l->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1065 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1066 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1067 |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1068 static void jabber_vcard_save_mine(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1069 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1070 xmlnode *packet, gpointer data) |
18163
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1071 { |
25353
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1072 xmlnode *vcard, *photo, *binval; |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1073 char *txt, *vcard_hash = NULL; |
18163
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1074 |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1075 if (type == JABBER_IQ_ERROR) { |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1076 purple_debug_warning("jabber", "Server returned error while retrieving vCard"); |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1077 return; |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1078 } |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1079 |
18163
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1080 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
|
1081 (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
|
1082 { |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1083 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
|
1084 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
|
1085 |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1086 g_free(txt); |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1087 } else { |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1088 /* 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
|
1089 } |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1090 |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1091 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
|
1092 |
25353
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1093 if (vcard && (photo = xmlnode_get_child(vcard, "PHOTO")) && |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1094 (binval = xmlnode_get_child(photo, "BINVAL"))) { |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1095 gsize size; |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1096 char *bintext = xmlnode_get_data(binval); |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1097 guchar *data = purple_base64_decode(bintext, &size); |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1098 g_free(bintext); |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1099 |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1100 if (data) { |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1101 vcard_hash = jabber_calculate_data_sha1sum(data, size); |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1102 g_free(data); |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1103 } |
18163
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1104 } |
25353
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1105 |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1106 /* Republish our vcard if the photo is different than the server's */ |
26706
fbb2b8e2d91e
Use purple_strequal and g_str_equal
Paul Aurich <paul@darkrain42.org>
parents:
26705
diff
changeset
|
1107 if (!purple_strequal(vcard_hash, js->initial_avatar_hash)) { |
25353
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1108 PurpleAccount *account = purple_connection_get_account(js->gc); |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1109 jabber_set_info(js->gc, purple_account_get_user_info(account)); |
25426
2d92bbe6807b
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <paul@darkrain42.org>
parents:
25402
diff
changeset
|
1110 } else if (js->initial_avatar_hash) { |
25353
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1111 /* Our photo is in the vcard, so advertise vcard-temp updates */ |
25426
2d92bbe6807b
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <paul@darkrain42.org>
parents:
25402
diff
changeset
|
1112 js->avatar_hash = g_strdup(js->initial_avatar_hash); |
25353
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1113 } |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1114 |
9195955395b6
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <paul@darkrain42.org>
parents:
25351
diff
changeset
|
1115 g_free(vcard_hash); |
18163
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1116 } |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1117 |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1118 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
|
1119 { |
21842
ce3d42470adf
Fix XMPP buddy icons. Somehow a 'VCard' element got changed to a query
Sean Egan <seanegan@gmail.com>
parents:
21596
diff
changeset
|
1120 JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET); |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
1121 |
21842
ce3d42470adf
Fix XMPP buddy icons. Somehow a 'VCard' element got changed to a query
Sean Egan <seanegan@gmail.com>
parents:
21596
diff
changeset
|
1122 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
|
1123 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
|
1124 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
|
1125 |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1126 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
|
1127 } |
703872bf33c6
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18124
diff
changeset
|
1128 |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1129 static void jabber_vcard_parse(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1130 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1131 xmlnode *packet, gpointer data) |
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 char *bare_jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1134 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
|
1135 char *serverside_alias = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1136 xmlnode *vcard; |
15822 | 1137 PurpleBuddy *b; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1138 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
|
1139 PurpleNotifyUserInfo *user_info; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1140 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1141 if(!jbi) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1142 return; |
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 jabber_buddy_info_remove_id(jbi, id); |
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 if(!from) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1147 return; |
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 if(!jabber_buddy_find(js, from, FALSE)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1150 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1151 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1152 /* XXX: handle the error case */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1153 |
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
|
1154 user_info = jbi->user_info; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1155 bare_jid = jabber_get_bare_jid(from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1156 |
15822 | 1157 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
|
1158 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1159 if((vcard = xmlnode_get_child(packet, "vCard")) || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1160 (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
|
1161 xmlnode *child; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1162 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
|
1163 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1164 xmlnode *child2; |
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 if(child->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1167 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1168 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1169 text = xmlnode_get_data(child); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1170 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
|
1171 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
|
1172 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
|
1173 |
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
|
1174 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
|
1175 } else if(!strcmp(child->name, "N")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1176 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
|
1177 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1178 char *text2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1179 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1180 if(child2->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1181 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1182 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1183 text2 = xmlnode_get_data(child2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1184 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
|
1185 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
|
1186 } 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
|
1187 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
|
1188 } 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
|
1189 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
|
1190 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1191 g_free(text2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1192 } |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
1193 } 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
|
1194 /* 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
|
1195 * 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
|
1196 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
|
1197 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
|
1198 serverside_alias = g_strdup(text); |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
1199 |
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
|
1200 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
|
1201 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1202 } 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
|
1203 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
|
1204 } else if(!strcmp(child->name, "ADR")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1205 gboolean address_line_added = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1206 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1207 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
|
1208 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1209 char *text2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1210 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1211 if(child2->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1212 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1213 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1214 text2 = xmlnode_get_data(child2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1215 if (text2 == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1216 continue; |
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 /* 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
|
1219 * elements are empty. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1220 if (!address_line_added) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1221 { |
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
|
1222 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
|
1223 address_line_added = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1224 } |
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(!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
|
1227 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
|
1228 } 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
|
1229 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
|
1230 } 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
|
1231 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
|
1232 } 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
|
1233 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
|
1234 } 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
|
1235 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
|
1236 } 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
|
1237 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
|
1238 } else if(!strcmp(child2->name, "CTRY") |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1239 || !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
|
1240 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
|
1241 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1242 g_free(text2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1243 } |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
1244 |
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
|
1245 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
|
1246 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
|
1247 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1248 } else if(!strcmp(child->name, "TEL")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1249 char *number; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1250 if((child2 = xmlnode_get_child(child, "NUMBER"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1251 /* show what kind of number it is */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1252 number = xmlnode_get_data(child2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1253 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
|
1254 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
|
1255 g_free(number); |
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 } else if((number = xmlnode_get_data(child))) { |
15822 | 1258 /* 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
|
1259 * 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
|
1260 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
|
1261 g_free(number); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1262 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1263 } 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
|
1264 char *userid, *escaped; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1265 if((child2 = xmlnode_get_child(child, "USERID"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1266 /* show what kind of email it is */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1267 userid = xmlnode_get_data(child2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1268 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
|
1269 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
|
1270 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
|
1271 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
|
1272 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
|
1273 |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1274 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
|
1275 g_free(escaped); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1276 g_free(userid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1277 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1278 } else if((userid = xmlnode_get_data(child))) { |
15822 | 1279 /* 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
|
1280 * 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
|
1281 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
|
1282 |
19730
1b8af105614d
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <mark@kingant.net>
parents:
19724
diff
changeset
|
1283 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
|
1284 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
|
1285 purple_notify_user_info_add_pair(user_info, _("Email"), mailto); |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
1286 |
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
1287 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
|
1288 g_free(escaped); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1289 g_free(userid); |
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 } else if(!strcmp(child->name, "ORG")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1292 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
|
1293 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1294 char *text2; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1295 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1296 if(child2->type != XMLNODE_TYPE_TAG) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1297 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1298 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1299 text2 = xmlnode_get_data(child2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1300 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
|
1301 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
|
1302 } 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
|
1303 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
|
1304 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1305 g_free(text2); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1306 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1307 } 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
|
1308 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
|
1309 } 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
|
1310 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
|
1311 } 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
|
1312 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
|
1313 } else if(!strcmp(child->name, "PHOTO") || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1314 !strcmp(child->name, "LOGO")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1315 char *bintext = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1316 xmlnode *binval; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1317 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1318 if( ((binval = xmlnode_get_child(child, "BINVAL")) && |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1319 (bintext = xmlnode_get_data(binval))) || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1320 (bintext = xmlnode_get_data(child))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1321 gsize size; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1322 guchar *data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1323 gboolean photo = (strcmp(child->name, "PHOTO") == 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1324 |
15822 | 1325 data = purple_base64_decode(bintext, &size); |
16507
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16506
diff
changeset
|
1326 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
|
1327 char *img_text; |
24693
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24692
diff
changeset
|
1328 char *hash; |
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
|
1329 |
16507
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16506
diff
changeset
|
1330 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
|
1331 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
|
1332 |
646e96069fcd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evan.s@dreskin.net>
parents:
23180
diff
changeset
|
1333 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
|
1334 |
24693
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24692
diff
changeset
|
1335 hash = jabber_calculate_data_sha1sum(data, size); |
16507
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16506
diff
changeset
|
1336 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
|
1337 data, size, hash); |
24693
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24692
diff
changeset
|
1338 g_free(hash); |
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
|
1339 g_free(img_text); |
16507
e340dc515178
disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
Richard Laager <rlaager@wiktel.com>
parents:
16506
diff
changeset
|
1340 } |
24693
61e0924de04a
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <paul@darkrain42.org>
parents:
24692
diff
changeset
|
1341 g_free(bintext); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1342 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1343 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1344 g_free(text); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1345 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1346 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1347 |
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
|
1348 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
|
1349 /* 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
|
1350 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
|
1351 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
|
1352 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
|
1353 } |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
1354 |
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
|
1355 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
|
1356 } |
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
|
1357 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1358 g_free(bare_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1359 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1360 jabber_buddy_info_show_if_ready(jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1361 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1362 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1363 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
|
1364 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1365 JabberBuddyInfoResource *jbri = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1366 g_free(jbri); |
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 |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1369 static void jabber_version_parse(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1370 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1371 xmlnode *packet, gpointer data) |
15373
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 JabberBuddyInfo *jbi = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1374 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1375 char *resource_name; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1376 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1377 g_return_if_fail(jbi != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1378 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1379 jabber_buddy_info_remove_id(jbi, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1380 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1381 if(!from) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1382 return; |
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 resource_name = jabber_get_resource(from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1385 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1386 if(resource_name) { |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1387 if (type == JABBER_IQ_RESULT) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1388 if((query = xmlnode_get_child(packet, "query"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1389 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
|
1390 if(jbr) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1391 xmlnode *node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1392 if((node = xmlnode_get_child(query, "name"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1393 jbr->client.name = xmlnode_get_data(node); |
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((node = xmlnode_get_child(query, "version"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1396 jbr->client.version = xmlnode_get_data(node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1397 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1398 if((node = xmlnode_get_child(query, "os"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1399 jbr->client.os = xmlnode_get_data(node); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1400 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1401 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1402 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1403 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1404 g_free(resource_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1405 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1406 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1407 jabber_buddy_info_show_if_ready(jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1408 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1409 |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1410 static void jabber_last_parse(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1411 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1412 xmlnode *packet, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1413 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1414 JabberBuddyInfo *jbi = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1415 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1416 char *resource_name; |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1417 const char *seconds; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1418 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1419 g_return_if_fail(jbi != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1420 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1421 jabber_buddy_info_remove_id(jbi, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1422 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1423 if(!from) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1424 return; |
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 resource_name = jabber_get_resource(from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1427 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1428 if(resource_name) { |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1429 if (type == JABBER_IQ_RESULT) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1430 if((query = xmlnode_get_child(packet, "query"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1431 seconds = xmlnode_get_attrib(query, "seconds"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1432 if(seconds) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1433 char *end = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1434 long sec = strtol(seconds, &end, 10); |
25251
6185767dc03c
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <ml@update.uu.se>
parents:
25227
diff
changeset
|
1435 JabberBuddy *jb = NULL; |
6185767dc03c
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <ml@update.uu.se>
parents:
25227
diff
changeset
|
1436 char *resource = NULL; |
6185767dc03c
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <ml@update.uu.se>
parents:
25227
diff
changeset
|
1437 char *buddy_name = NULL; |
6185767dc03c
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <ml@update.uu.se>
parents:
25227
diff
changeset
|
1438 JabberBuddyResource *jbr = NULL; |
6185767dc03c
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <ml@update.uu.se>
parents:
25227
diff
changeset
|
1439 |
6185767dc03c
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <ml@update.uu.se>
parents:
25227
diff
changeset
|
1440 if(end != seconds) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1441 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
|
1442 if(jbir) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1443 jbir->idle_seconds = sec; |
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 } |
25253
f2d533384535
Updated a comment to describe what the actually does
Marcus Lundblad <ml@update.uu.se>
parents:
25252
diff
changeset
|
1446 /* Update the idle time of the buddy resource, if we got it. |
f2d533384535
Updated a comment to describe what the actually does
Marcus Lundblad <ml@update.uu.se>
parents:
25252
diff
changeset
|
1447 This will correct the value when a server doesn't mark |
f2d533384535
Updated a comment to describe what the actually does
Marcus Lundblad <ml@update.uu.se>
parents:
25252
diff
changeset
|
1448 delayed presence and we got the presence when signing on */ |
25251
6185767dc03c
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <ml@update.uu.se>
parents:
25227
diff
changeset
|
1449 jb = jabber_buddy_find(js, from, FALSE); |
6185767dc03c
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <ml@update.uu.se>
parents:
25227
diff
changeset
|
1450 if (jb) { |
6185767dc03c
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <ml@update.uu.se>
parents:
25227
diff
changeset
|
1451 resource = jabber_get_resource(from); |
6185767dc03c
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <ml@update.uu.se>
parents:
25227
diff
changeset
|
1452 buddy_name = jabber_get_bare_jid(from); |
25252
cf29591fe78a
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <ml@update.uu.se>
parents:
25251
diff
changeset
|
1453 /* if the resource already has an idle time set, we |
cf29591fe78a
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <ml@update.uu.se>
parents:
25251
diff
changeset
|
1454 must have gotten it originally from a presence. In |
cf29591fe78a
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <ml@update.uu.se>
parents:
25251
diff
changeset
|
1455 this case we update it. Otherwise don't update it, to |
cf29591fe78a
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <ml@update.uu.se>
parents:
25251
diff
changeset
|
1456 avoid setting an idle and not getting informed about |
cf29591fe78a
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <ml@update.uu.se>
parents:
25251
diff
changeset
|
1457 the resource getting unidle */ |
25251
6185767dc03c
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <ml@update.uu.se>
parents:
25227
diff
changeset
|
1458 if (resource && buddy_name) { |
6185767dc03c
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <ml@update.uu.se>
parents:
25227
diff
changeset
|
1459 jbr = jabber_buddy_find_resource(jb, resource); |
6185767dc03c
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <ml@update.uu.se>
parents:
25227
diff
changeset
|
1460 |
25252
cf29591fe78a
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <ml@update.uu.se>
parents:
25251
diff
changeset
|
1461 if (jbr->idle) { |
cf29591fe78a
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <ml@update.uu.se>
parents:
25251
diff
changeset
|
1462 if (sec) { |
cf29591fe78a
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <ml@update.uu.se>
parents:
25251
diff
changeset
|
1463 jbr->idle = time(NULL) - sec; |
cf29591fe78a
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <ml@update.uu.se>
parents:
25251
diff
changeset
|
1464 } else { |
cf29591fe78a
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <ml@update.uu.se>
parents:
25251
diff
changeset
|
1465 jbr->idle = 0; |
cf29591fe78a
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <ml@update.uu.se>
parents:
25251
diff
changeset
|
1466 } |
cf29591fe78a
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <ml@update.uu.se>
parents:
25251
diff
changeset
|
1467 |
cf29591fe78a
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <ml@update.uu.se>
parents:
25251
diff
changeset
|
1468 if (jbr == |
cf29591fe78a
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <ml@update.uu.se>
parents:
25251
diff
changeset
|
1469 jabber_buddy_find_resource(jb, NULL)) { |
cf29591fe78a
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <ml@update.uu.se>
parents:
25251
diff
changeset
|
1470 purple_prpl_got_user_idle(js->gc->account, |
cf29591fe78a
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <ml@update.uu.se>
parents:
25251
diff
changeset
|
1471 buddy_name, jbr->idle, jbr->idle); |
cf29591fe78a
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <ml@update.uu.se>
parents:
25251
diff
changeset
|
1472 } |
25251
6185767dc03c
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <ml@update.uu.se>
parents:
25227
diff
changeset
|
1473 } |
6185767dc03c
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <ml@update.uu.se>
parents:
25227
diff
changeset
|
1474 } |
6185767dc03c
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <ml@update.uu.se>
parents:
25227
diff
changeset
|
1475 g_free(resource); |
6185767dc03c
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <ml@update.uu.se>
parents:
25227
diff
changeset
|
1476 g_free(buddy_name); |
6185767dc03c
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <ml@update.uu.se>
parents:
25227
diff
changeset
|
1477 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1478 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1479 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1480 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1481 g_free(resource_name); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1482 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1483 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1484 jabber_buddy_info_show_if_ready(jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1485 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1486 |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1487 static void jabber_time_parse(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1488 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1489 xmlnode *packet, gpointer data) |
25653
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1490 { |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1491 JabberBuddyInfo *jbi = data; |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1492 JabberBuddyResource *jbr; |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1493 char *resource_name; |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1494 |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1495 g_return_if_fail(jbi != NULL); |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1496 |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1497 jabber_buddy_info_remove_id(jbi, id); |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1498 |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1499 if (!from) |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1500 return; |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1501 |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1502 resource_name = jabber_get_resource(from); |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1503 jbr = resource_name ? jabber_buddy_find_resource(jbi->jb, resource_name) : NULL; |
25658
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1504 g_free(resource_name); |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1505 if (jbr) { |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
1506 if (type == JABBER_IQ_RESULT) { |
25653
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1507 xmlnode *time = xmlnode_get_child(packet, "time"); |
25654
150282919040
Actually display the buddy's local time.
Paul Aurich <paul@darkrain42.org>
parents:
25653
diff
changeset
|
1508 xmlnode *tzo = time ? xmlnode_get_child(time, "tzo") : NULL; |
25658
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1509 char *tzo_data = tzo ? xmlnode_get_data(tzo) : NULL; |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1510 if (tzo_data) { |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1511 char *c = tzo_data; |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1512 int hours, minutes; |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1513 if (tzo_data[0] == 'Z' && tzo_data[1] == '\0') { |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1514 jbr->tz_off = 0; |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1515 } else { |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1516 gboolean offset_positive = (tzo_data[0] == '+'); |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1517 /* [+-]HH:MM */ |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1518 if (((*c == '+' || *c == '-') && (c = c + 1)) && |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1519 sscanf(c, "%02d:%02d", &hours, &minutes) == 2) { |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1520 jbr->tz_off = 60*60*hours + 60*minutes; |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1521 if (!offset_positive) |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1522 jbr->tz_off *= -1; |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1523 } else { |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1524 purple_debug_info("jabber", "Ignoring malformed timezone %s", |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1525 tzo_data); |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1526 } |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1527 } |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1528 |
b73c79f7490c
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25656
diff
changeset
|
1529 g_free(tzo_data); |
25653
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1530 } |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1531 } |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1532 } |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1533 |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1534 jabber_buddy_info_show_if_ready(jbi); |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1535 } |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1536 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1537 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
|
1538 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1539 if (js->pending_buddy_info_requests) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1540 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1541 JabberBuddyInfo *jbi; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1542 GSList *l = js->pending_buddy_info_requests; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1543 while (l) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1544 jbi = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1545 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1546 g_slist_free(jbi->ids); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1547 jabber_buddy_info_destroy(jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1548 |
15665
6eda87b08cdf
Don't access the list element after it has been freed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15626
diff
changeset
|
1549 l = l->next; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1550 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1551 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1552 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
|
1553 js->pending_buddy_info_requests = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1554 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1555 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1556 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1557 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
|
1558 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1559 JabberBuddyInfo *jbi = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1560 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1561 /* remove the pending callbacks */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1562 while(jbi->ids) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1563 char *id = jbi->ids->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1564 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
|
1565 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
|
1566 g_free(id); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1569 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
|
1570 jbi->timeout_handle = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1571 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1572 jabber_buddy_info_show_if_ready(jbi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1573 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1574 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1575 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1576 |
16979
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1577 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
|
1578 { |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1579 /* 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
|
1580 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
|
1581 return FALSE; |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1582 |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1583 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
|
1584 if(!strcmp(jbr->client.name, "Trillian")) { |
20092
ab3c87375b17
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20058
diff
changeset
|
1585 /* verified by nwalp 2007/05/09 */ |
ab3c87375b17
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20058
diff
changeset
|
1586 if(!strcmp(jbr->client.version, "3.1.0.121") || |
ab3c87375b17
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20058
diff
changeset
|
1587 /* verified by nwalp 2007/09/19 */ |
ab3c87375b17
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20058
diff
changeset
|
1588 !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
|
1589 return TRUE; |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1590 } |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1591 } |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1592 } |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1593 |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1594 return FALSE; |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1595 } |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1596 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1597 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
|
1598 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1599 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1600 xmlnode *vcard; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1601 GList *resources; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1602 JabberBuddy *jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1603 JabberBuddyInfo *jbi; |
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 jb = jabber_buddy_find(js, jid, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1606 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1607 /* invalid JID */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1608 if(!jb) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1609 return; |
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 jbi = g_new0(JabberBuddyInfo, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1612 jbi->jid = g_strdup(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1613 jbi->js = js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1614 jbi->jb = jb; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1615 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
|
1616 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
|
1617 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1618 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
|
1619 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1620 xmlnode_set_attrib(iq->node, "to", jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1621 vcard = xmlnode_new_child(iq->node, "vCard"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1622 xmlnode_set_namespace(vcard, "vcard-temp"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1623 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1624 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
|
1625 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
|
1626 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1627 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1628 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1629 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
|
1630 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1631 JabberBuddyResource *jbr = resources->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1632 JabberBuddyInfoResource *jbir; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1633 char *full_jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1634 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1635 if ((strchr(jid, '/') == NULL) && (jbr->name != NULL)) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1636 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
|
1637 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1638 full_jid = g_strdup(jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1639 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1640 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1641 if (jbr->name != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1642 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1643 jbir = g_new0(JabberBuddyInfoResource, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1644 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
|
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 if(!jbr->client.name) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1648 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
|
1649 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
|
1650 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
|
1651 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
|
1652 jabber_iq_send(iq); |
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 |
16979
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1655 /* 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
|
1656 * to get info on a friend running Trillian, which doesn't |
16995 | 1657 * 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
|
1658 * 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
|
1659 * office. */ |
f8d0c9bbb9ae
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
16951
diff
changeset
|
1660 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
|
1661 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
|
1662 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
|
1663 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
|
1664 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
|
1665 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
|
1666 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1667 |
25653
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1668 if (jbr->tz_off == PURPLE_NO_TZ_OFF && |
25656
d1a0e487d45f
Request time information from a resource if we don't have caps for it
Paul Aurich <paul@darkrain42.org>
parents:
25654
diff
changeset
|
1669 (!jbr->caps || |
d1a0e487d45f
Request time information from a resource if we don't have caps for it
Paul Aurich <paul@darkrain42.org>
parents:
25654
diff
changeset
|
1670 jabber_resource_has_capability(jbr, "urn:xmpp:time"))) { |
25653
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1671 xmlnode *child; |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1672 iq = jabber_iq_new(js, JABBER_IQ_GET); |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1673 xmlnode_set_attrib(iq->node, "to", full_jid); |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1674 child = xmlnode_new_child(iq->node, "time"); |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1675 xmlnode_set_namespace(child, "urn:xmpp:time"); |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1676 jabber_iq_set_callback(iq, jabber_time_parse, jbi); |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1677 jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1678 jabber_iq_send(iq); |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1679 } |
45c33d60c547
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <paul@darkrain42.org>
parents:
25360
diff
changeset
|
1680 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1681 g_free(full_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1682 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1683 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1684 js->pending_buddy_info_requests = g_slist_prepend(js->pending_buddy_info_requests, jbi); |
26530
b87843de7c6a
A patch from Arunan Balasubramaniam to use timeouts in seconds instead of
foss@abala.me
parents:
26469
diff
changeset
|
1685 jbi->timeout_handle = purple_timeout_add_seconds(30, jabber_buddy_get_info_timeout, jbi); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1686 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1687 |
15822 | 1688 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
|
1689 { |
25795
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
24056
diff
changeset
|
1690 JabberStream *js = purple_connection_get_protocol_data(gc); |
24564
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24562
diff
changeset
|
1691 JabberID *jid = jabber_id_new(who); |
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24562
diff
changeset
|
1692 |
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24562
diff
changeset
|
1693 if (!jid) |
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24562
diff
changeset
|
1694 return; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1695 |
25435
d7dcdba13b88
A JID can have no node (the part before the @), but a chat must have one,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25360
diff
changeset
|
1696 if (jid->node && jabber_chat_find(js, jid->node, jid->domain)) { |
24564
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24562
diff
changeset
|
1697 /* For a conversation, include the resource (indicates the user). */ |
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24562
diff
changeset
|
1698 jabber_buddy_get_info_for_jid(js, who); |
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24562
diff
changeset
|
1699 } else { |
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24562
diff
changeset
|
1700 char *bare_jid = jabber_get_bare_jid(who); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1701 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
|
1702 g_free(bare_jid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1703 } |
24564
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24562
diff
changeset
|
1704 |
5f597914cd01
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <paul@darkrain42.org>
parents:
24562
diff
changeset
|
1705 jabber_id_free(jid); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1706 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1707 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1708 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
|
1709 gboolean invisible) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1710 { |
15822 | 1711 PurplePresence *gpresence; |
1712 PurpleAccount *account; | |
1713 PurpleStatus *status; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1714 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
|
1715 xmlnode *presence; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1716 JabberBuddyState state; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1717 char *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1718 int priority; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1719 |
15822 | 1720 account = purple_connection_get_account(js->gc); |
1721 gpresence = purple_account_get_presence(account); | |
1722 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
|
1723 |
15822 | 1724 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
|
1725 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
|
1726 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1727 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1728 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1729 xmlnode_set_attrib(presence, "to", who); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1730 if(invisible) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1731 xmlnode_set_attrib(presence, "type", "invisible"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1732 jb->invisible |= JABBER_INVIS_BUDDY; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1733 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1734 jb->invisible &= ~JABBER_INVIS_BUDDY; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1735 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1736 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1737 jabber_send(js, presence); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1738 xmlnode_free(presence); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1739 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1740 |
15822 | 1741 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
|
1742 { |
15822 | 1743 PurpleBuddy *buddy; |
1744 PurpleConnection *gc; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1745 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1746 |
15822 | 1747 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
|
1748 |
15822 | 1749 buddy = (PurpleBuddy *) node; |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24056
diff
changeset
|
1750 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
25795
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
24056
diff
changeset
|
1751 js = purple_connection_get_protocol_data(gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1752 |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24056
diff
changeset
|
1753 jabber_buddy_set_invisibility(js, purple_buddy_get_name(buddy), TRUE); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1754 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1755 |
15822 | 1756 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
|
1757 { |
15822 | 1758 PurpleBuddy *buddy; |
1759 PurpleConnection *gc; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1760 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1761 |
15822 | 1762 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
|
1763 |
15822 | 1764 buddy = (PurpleBuddy *) node; |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24056
diff
changeset
|
1765 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
25795
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
24056
diff
changeset
|
1766 js = purple_connection_get_protocol_data(gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1767 |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24056
diff
changeset
|
1768 jabber_buddy_set_invisibility(js, purple_buddy_get_name(buddy), FALSE); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1769 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1770 |
15822 | 1771 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
|
1772 gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1773 { |
15822 | 1774 PurpleBuddy *buddy; |
1775 PurpleConnection *gc; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1776 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1777 |
15822 | 1778 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
|
1779 |
15822 | 1780 buddy = (PurpleBuddy *) node; |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24056
diff
changeset
|
1781 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
25795
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
24056
diff
changeset
|
1782 js = purple_connection_get_protocol_data(gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1783 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1784 /* I wonder if we should prompt the user before doing this */ |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24056
diff
changeset
|
1785 jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "unsubscribed"); |
15373
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 |
15822 | 1788 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
|
1789 { |
15822 | 1790 PurpleBuddy *buddy; |
1791 PurpleConnection *gc; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1792 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1793 |
15822 | 1794 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
|
1795 |
15822 | 1796 buddy = (PurpleBuddy *) node; |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24056
diff
changeset
|
1797 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
25795
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
24056
diff
changeset
|
1798 js = purple_connection_get_protocol_data(gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1799 |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24056
diff
changeset
|
1800 jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "subscribe"); |
15373
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 |
15822 | 1804 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
|
1805 { |
15822 | 1806 PurpleBuddy *buddy; |
1807 PurpleConnection *gc; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1808 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1809 |
15822 | 1810 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
|
1811 |
15822 | 1812 buddy = (PurpleBuddy *) node; |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24056
diff
changeset
|
1813 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
25795
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
24056
diff
changeset
|
1814 js = purple_connection_get_protocol_data(gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1815 |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24056
diff
changeset
|
1816 jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "unsubscribe"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1817 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1818 |
17874
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1819 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
|
1820 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
|
1821 /* 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
|
1822 PurpleBuddy *buddy = (PurpleBuddy *) node; |
25795
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
24056
diff
changeset
|
1823 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
24056
diff
changeset
|
1824 JabberStream *js = purple_connection_get_protocol_data(gc); |
17874
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1825 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
|
1826 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
|
1827 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
|
1828 xmlnode *presence; |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1829 JabberBuddyState state; |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1830 char *msg; |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1831 int priority; |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
1832 |
17874
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1833 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
|
1834 presence = jabber_presence_create_js(js, state, msg, priority); |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
1835 |
17874
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1836 g_free(msg); |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
1837 |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24056
diff
changeset
|
1838 xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
1839 |
17874
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1840 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
|
1841 xmlnode_free(presence); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1842 } |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1843 } |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1844 |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1845 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
|
1846 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
|
1847 /* 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
|
1848 PurpleBuddy *buddy = (PurpleBuddy *) node; |
25795
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
24056
diff
changeset
|
1849 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
24056
diff
changeset
|
1850 JabberStream *js = purple_connection_get_protocol_data(gc); |
17874
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1851 xmlnode *presence; |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
1852 |
17874
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1853 presence = jabber_presence_create_js(js, JABBER_BUDDY_STATE_UNAVAILABLE, NULL, 0); |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
1854 |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24056
diff
changeset
|
1855 xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
1856 |
17874
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1857 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
|
1858 xmlnode_free(presence); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1859 } |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1860 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1861 |
15822 | 1862 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
|
1863 { |
25795
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
24056
diff
changeset
|
1864 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
24056
diff
changeset
|
1865 JabberStream *js = purple_connection_get_protocol_data(gc); |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24056
diff
changeset
|
1866 const char *name = purple_buddy_get_name(buddy); |
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24056
diff
changeset
|
1867 JabberBuddy *jb = jabber_buddy_find(js, 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
|
1868 GList *jbrs; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1869 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1870 GList *m = NULL; |
15822 | 1871 PurpleMenuAction *act; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1872 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1873 if(!jb) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1874 return m; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1875 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1876 /* XXX: fix the NOT ME below */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1877 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1878 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
|
1879 if(jb->invisible & JABBER_INVIS_BUDDY) { |
15822 | 1880 act = purple_menu_action_new(_("Un-hide From"), |
1881 PURPLE_CALLBACK(jabber_buddy_make_visible), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1882 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1883 } else { |
15822 | 1884 act = purple_menu_action_new(_("Temporarily Hide From"), |
1885 PURPLE_CALLBACK(jabber_buddy_make_invisible), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1886 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1887 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1888 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1889 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1890 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1891 if(jb->subscription & JABBER_SUB_FROM /* && NOT ME */) { |
15822 | 1892 act = purple_menu_action_new(_("Cancel Presence Notification"), |
1893 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
|
1894 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1895 m = g_list_append(m, act); |
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 if(!(jb->subscription & JABBER_SUB_TO)) { |
15822 | 1899 act = purple_menu_action_new(_("(Re-)Request authorization"), |
1900 PURPLE_CALLBACK(jabber_buddy_rerequest_auth), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1901 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1902 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1903 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1904 } else /* if(NOT ME) */{ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1905 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1906 /* 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
|
1907 removed? */ |
15822 | 1908 act = purple_menu_action_new(_("Unsubscribe"), |
1909 PURPLE_CALLBACK(jabber_buddy_unsubscribe), | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1910 NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1911 m = g_list_append(m, act); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1912 } |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
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 /* |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1915 * 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
|
1916 * |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1917 * 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
|
1918 * 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
|
1919 * 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
|
1920 * 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
|
1921 */ |
25130
16734635febf
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24056
diff
changeset
|
1922 if (g_utf8_strchr(name, -1, '@') == NULL) { |
17874
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1923 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
|
1924 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
|
1925 NULL, NULL); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1926 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
|
1927 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
|
1928 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
|
1929 NULL, NULL); |
906ed2836a04
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17873
diff
changeset
|
1930 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
|
1931 } |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25947
diff
changeset
|
1932 |
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
|
1933 /* 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
|
1934 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
|
1935 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
|
1936 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
|
1937 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
|
1938 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
|
1939 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
|
1940 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
|
1941 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
|
1942 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
|
1943 } |
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
|
1944 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1945 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1946 return m; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1947 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1948 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1949 GList * |
15822 | 1950 jabber_blist_node_menu(PurpleBlistNode *node) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1951 { |
15822 | 1952 if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
1953 return jabber_buddy_menu((PurpleBuddy *) node); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1954 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1955 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1956 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1957 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1958 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1959 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1960 const char * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1961 jabber_buddy_state_get_name(JabberBuddyState state) |
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 switch(state) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1964 case JABBER_BUDDY_STATE_UNKNOWN: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1965 return _("Unknown"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1966 case JABBER_BUDDY_STATE_ERROR: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1967 return _("Error"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1968 case JABBER_BUDDY_STATE_UNAVAILABLE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1969 return _("Offline"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1970 case JABBER_BUDDY_STATE_ONLINE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1971 return _("Available"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1972 case JABBER_BUDDY_STATE_CHAT: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1973 return _("Chatty"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1974 case JABBER_BUDDY_STATE_AWAY: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1975 return _("Away"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1976 case JABBER_BUDDY_STATE_XA: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1977 return _("Extended Away"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1978 case JABBER_BUDDY_STATE_DND: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1979 return _("Do Not Disturb"); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1982 return _("Unknown"); |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1985 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
|
1986 if(!id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1987 return JABBER_BUDDY_STATE_UNKNOWN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1988 if(!strcmp(id, "available")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1989 return JABBER_BUDDY_STATE_ONLINE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1990 if(!strcmp(id, "freeforchat")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1991 return JABBER_BUDDY_STATE_CHAT; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1992 if(!strcmp(id, "away")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1993 return JABBER_BUDDY_STATE_AWAY; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1994 if(!strcmp(id, "extended_away")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1995 return JABBER_BUDDY_STATE_XA; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1996 if(!strcmp(id, "dnd")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1997 return JABBER_BUDDY_STATE_DND; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1998 if(!strcmp(id, "offline")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1999 return JABBER_BUDDY_STATE_UNAVAILABLE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2000 if(!strcmp(id, "error")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2001 return JABBER_BUDDY_STATE_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2002 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2003 return JABBER_BUDDY_STATE_UNKNOWN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2004 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2005 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2006 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
|
2007 if(!id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2008 return JABBER_BUDDY_STATE_UNKNOWN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2009 if(!strcmp(id, "available")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2010 return JABBER_BUDDY_STATE_ONLINE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2011 if(!strcmp(id, "chat")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2012 return JABBER_BUDDY_STATE_CHAT; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2013 if(!strcmp(id, "away")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2014 return JABBER_BUDDY_STATE_AWAY; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2015 if(!strcmp(id, "xa")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2016 return JABBER_BUDDY_STATE_XA; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2017 if(!strcmp(id, "dnd")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2018 return JABBER_BUDDY_STATE_DND; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2019 if(!strcmp(id, "offline")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2020 return JABBER_BUDDY_STATE_UNAVAILABLE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2021 if(!strcmp(id, "error")) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2022 return JABBER_BUDDY_STATE_ERROR; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2023 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2024 return JABBER_BUDDY_STATE_UNKNOWN; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2025 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2026 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2027 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
|
2028 switch(state) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2029 case JABBER_BUDDY_STATE_CHAT: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2030 return "chat"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2031 case JABBER_BUDDY_STATE_AWAY: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2032 return "away"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2033 case JABBER_BUDDY_STATE_XA: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2034 return "xa"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2035 case JABBER_BUDDY_STATE_DND: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2036 return "dnd"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2037 case JABBER_BUDDY_STATE_ONLINE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2038 return "available"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2039 case JABBER_BUDDY_STATE_UNKNOWN: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2040 case JABBER_BUDDY_STATE_ERROR: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2041 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2042 case JABBER_BUDDY_STATE_UNAVAILABLE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2043 return "offline"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2044 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2045 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2046 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2047 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2048 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
|
2049 switch(state) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2050 case JABBER_BUDDY_STATE_CHAT: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2051 return "freeforchat"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2052 case JABBER_BUDDY_STATE_AWAY: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2053 return "away"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2054 case JABBER_BUDDY_STATE_XA: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2055 return "extended_away"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2056 case JABBER_BUDDY_STATE_DND: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2057 return "dnd"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2058 case JABBER_BUDDY_STATE_ONLINE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2059 return "available"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2060 case JABBER_BUDDY_STATE_UNKNOWN: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2061 return "available"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2062 case JABBER_BUDDY_STATE_ERROR: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2063 return "error"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2064 case JABBER_BUDDY_STATE_UNAVAILABLE: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2065 return "offline"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2066 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2067 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2068 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2069 |
15822 | 2070 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
|
2071 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2072 /* XXX find out the jid */ |
15822 | 2073 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
|
2074 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
|
2075 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2076 |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
2077 static void user_search_result_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
2078 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
2079 xmlnode *packet, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2080 { |
15822 | 2081 PurpleNotifySearchResults *results; |
2082 PurpleNotifySearchColumn *column; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2083 xmlnode *x, *query, *item, *field; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2084 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2085 /* XXX error checking? */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2086 if(!(query = xmlnode_get_child(packet, "query"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2087 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2088 |
15822 | 2089 results = purple_notify_searchresults_new(); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2090 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
|
2091 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
|
2092 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
|
2093 |
15822 | 2094 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
|
2095 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2096 if((reported = xmlnode_get_child(x, "reported"))) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2097 xmlnode *field = xmlnode_get_child(reported, "field"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2098 while(field) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2099 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
|
2100 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
|
2101 if(var) { |
15822 | 2102 column = purple_notify_searchresults_column_new(label ? label : var); |
2103 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
|
2104 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
|
2105 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2106 field = xmlnode_get_next_twin(field); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2107 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2108 } |
19755
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2109 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2110 item = xmlnode_get_child(x, "item"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2111 while(item) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2112 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
|
2113 GSList *l; |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2114 xmlnode *valuenode; |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2115 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
|
2116 |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2117 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
|
2118 /* |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2119 * 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
|
2120 * 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
|
2121 */ |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2122 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
|
2123 field != NULL; |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2124 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
|
2125 { |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2126 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
|
2127 !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
|
2128 (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
|
2129 { |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2130 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
|
2131 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
|
2132 break; |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2133 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2134 } |
19755
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2135 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
|
2136 /* 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
|
2137 row = g_list_append(row, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2138 } |
15822 | 2139 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
|
2140 item = xmlnode_get_next_twin(item); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2141 } |
19755
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2142 |
cd067497cbe0
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <mark@kingant.net>
parents:
19730
diff
changeset
|
2143 g_slist_free(column_vars); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2144 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2145 /* old skool */ |
15822 | 2146 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
|
2147 |
15822 | 2148 column = purple_notify_searchresults_column_new(_("JID")); |
2149 purple_notify_searchresults_column_add(results, column); | |
2150 column = purple_notify_searchresults_column_new(_("First Name")); | |
2151 purple_notify_searchresults_column_add(results, column); | |
2152 column = purple_notify_searchresults_column_new(_("Last Name")); | |
2153 purple_notify_searchresults_column_add(results, column); | |
2154 column = purple_notify_searchresults_column_new(_("Nickname")); | |
2155 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
|
2156 column = purple_notify_searchresults_column_new(_("Email")); |
15822 | 2157 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
|
2158 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2159 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
|
2160 const char *jid; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2161 xmlnode *node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2162 GList *row = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2163 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2164 if(!(jid = xmlnode_get_attrib(item, "jid"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2165 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2166 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2167 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
|
2168 node = xmlnode_get_child(item, "first"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2169 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
|
2170 node = xmlnode_get_child(item, "last"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2171 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
|
2172 node = xmlnode_get_child(item, "nick"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2173 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
|
2174 node = xmlnode_get_child(item, "email"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2175 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
|
2176 purple_debug_info("jabber", "row=%p\n", row); |
15822 | 2177 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
|
2178 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2179 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2180 |
15822 | 2181 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
|
2182 user_search_result_add_buddy_cb); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2183 |
15822 | 2184 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
|
2185 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2186 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2187 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
|
2188 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2189 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2190 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2191 char *dir_server = data; |
21120
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2192 const char *type; |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2193 |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2194 /* 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
|
2195 * 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
|
2196 * a cancel, so skip it */ |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2197 type = xmlnode_get_attrib(result, "type"); |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2198 if(type && !strcmp(type, "cancel")) { |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2199 g_free(dir_server); |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2200 return; |
0cc12e6909e2
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21113
diff
changeset
|
2201 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2202 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2203 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
|
2204 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2205 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2206 xmlnode_insert_child(query, result); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2207 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2208 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
|
2209 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
|
2210 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2211 g_free(dir_server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2212 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2213 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2214 struct user_search_info { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2215 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2216 char *directory_server; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2217 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2218 |
15822 | 2219 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
|
2220 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2221 g_free(usi->directory_server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2222 g_free(usi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2223 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2224 |
15822 | 2225 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
|
2226 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2227 JabberStream *js = usi->js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2228 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2229 xmlnode *query; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2230 GList *groups, *flds; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2231 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2232 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
|
2233 query = xmlnode_get_child(iq->node, "query"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2234 |
15822 | 2235 for(groups = purple_request_fields_get_groups(fields); groups; groups = groups->next) { |
2236 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
|
2237 flds; flds = flds->next) { |
15822 | 2238 PurpleRequestField *field = flds->data; |
2239 const char *id = purple_request_field_get_id(field); | |
2240 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
|
2241 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2242 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
|
2243 xmlnode *y = xmlnode_new_child(query, id); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2244 xmlnode_insert_data(y, value, -1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2245 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2246 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2247 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2248 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2249 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
|
2250 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
|
2251 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2252 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2253 g_free(usi->directory_server); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2254 g_free(usi); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2255 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2256 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2257 #if 0 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2258 /* 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
|
2259 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2260 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2261 * 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
|
2262 * comments for Jabber User Directories |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2263 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2264 * See discussion thread "Search comment for Jabber is not translatable" |
15822 | 2265 * 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
|
2266 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2267 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
|
2268 /* 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
|
2269 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
|
2270 "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
|
2271 NULL |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2272 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2273 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2274 |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
2275 static void user_search_fields_result_cb(JabberStream *js, const char *from, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
2276 JabberIqType type, const char *id, |
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
2277 xmlnode *packet, gpointer data) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2278 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2279 xmlnode *query, *x; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2280 |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
2281 if (!from) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2282 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2283 |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
2284 if (type == JABBER_IQ_ERROR) { |
20814
bde477ec6a71
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <will.thompson@collabora.co.uk>
parents:
20092
diff
changeset
|
2285 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
|
2286 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2287 if(!msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2288 msg = g_strdup(_("Unknown error")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2289 |
15822 | 2290 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
|
2291 _("Could not query the directory server."), msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2292 g_free(msg); |
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 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2295 } |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2298 if(!(query = xmlnode_get_child(packet, "query"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2299 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2300 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2301 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
|
2302 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
|
2303 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2304 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2305 struct user_search_info *usi; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2306 xmlnode *instnode; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2307 char *instructions = NULL; |
15822 | 2308 PurpleRequestFields *fields; |
2309 PurpleRequestFieldGroup *group; | |
2310 PurpleRequestField *field; | |
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 /* old skool */ |
15822 | 2313 fields = purple_request_fields_new(); |
2314 group = purple_request_field_group_new(NULL); | |
2315 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
|
2316 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2317 if((instnode = xmlnode_get_child(query, "instructions"))) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2318 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2319 char *tmp = xmlnode_get_data(instnode); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2320 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2321 if(tmp) |
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 /* 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
|
2324 list in jabber_user_dir_comments[]) */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2325 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
|
2326 g_free(tmp); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2327 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2328 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2329 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2330 if(!instructions) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2331 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2332 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
|
2333 "for any matching XMPP users.")); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2334 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2335 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2336 if(xmlnode_get_child(query, "first")) { |
15822 | 2337 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
|
2338 NULL, FALSE); |
15822 | 2339 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
|
2340 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2341 if(xmlnode_get_child(query, "last")) { |
15822 | 2342 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
|
2343 NULL, FALSE); |
15822 | 2344 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
|
2345 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2346 if(xmlnode_get_child(query, "nick")) { |
15822 | 2347 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
|
2348 NULL, FALSE); |
15822 | 2349 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
|
2350 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2351 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
|
2352 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
|
2353 NULL, FALSE); |
15822 | 2354 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
|
2355 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2356 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2357 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
|
2358 usi->js = js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2359 usi->directory_server = g_strdup(from); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2360 |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2361 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
|
2362 _("Search for XMPP users"), instructions, fields, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2363 _("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
|
2364 _("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
|
2365 purple_connection_get_account(js->gc), NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2366 usi); |
15373
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 g_free(instructions); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2369 } |
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 |
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
|
2372 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
|
2373 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2374 JabberIq *iq; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2375 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2376 /* 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
|
2377 if(!directory || !*directory) { |
15822 | 2378 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
|
2379 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2380 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2381 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2382 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
|
2383 xmlnode_set_attrib(iq->node, "to", directory); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2384 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2385 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
|
2386 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2387 jabber_iq_send(iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2388 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2389 |
15822 | 2390 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
|
2391 { |
15822 | 2392 PurpleConnection *gc = (PurpleConnection *) action->context; |
25795
ede22bc33d56
More struct hiding work
Richard Laager <rlaager@wiktel.com>
parents:
24056
diff
changeset
|
2393 JabberStream *js = purple_connection_get_protocol_data(gc); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2394 |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2395 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
|
2396 _("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
|
2397 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
|
2398 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
|
2399 _("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
|
2400 _("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
|
2401 NULL, NULL, NULL, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
2402 js); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2403 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2404 |
23777
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2405 gboolean |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2406 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
|
2407 { |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2408 const GList *iter = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2409 |
23777
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2410 if (!jbr->caps) { |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2411 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
|
2412 "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
|
2413 return FALSE; |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2414 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2415 |
23777
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2416 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
|
2417 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
|
2418 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
|
2419 return TRUE; |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2420 } |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2421 } |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2422 |
24369
f4cb55854e87
Make jabber_resource_have_capability polute the log a little less...
Marcus Lundblad <ml@update.uu.se>
parents:
24056
diff
changeset
|
2423 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
|
2424 return FALSE; |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2425 } |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2426 |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2427 gboolean |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2428 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
|
2429 { |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2430 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
|
2431 |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2432 if (!jbr) { |
25360
c814641afcf2
This happens anytime you IM an offline user, and is totally not an error
Mark Doliner <mark@kingant.net>
parents:
25285
diff
changeset
|
2433 purple_debug_info("jabber", |
23777
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2434 "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
|
2435 return FALSE; |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2436 } |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2437 |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2438 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
|
2439 } |
4ac5db6e39f3
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <ml@update.uu.se>
parents:
23251
diff
changeset
|
2440 |