Sun, 29 Mar 2009 20:54:30 +0000
Fix compilation errors and add padding to UI ops. My bad...
| 7014 | 1 | /* |
| 15884 | 2 | * purple - Jabber Protocol Plugin |
| 7014 | 3 | * |
| 4 | * Copyright (C) 2003, Nathan Walp <faceprint@faceprint.com> | |
| 5 | * | |
| 6 | * This program is free software; you can redistribute it and/or modify | |
| 7 | * it under the terms of the GNU General Public License as published by | |
| 8 | * the Free Software Foundation; either version 2 of the License, or | |
| 9 | * (at your option) any later version. | |
| 10 | * | |
| 11 | * This program is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 | * GNU General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU General Public License | |
| 17 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18315
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 7014 | 19 | * |
| 20 | */ | |
| 21 | #include "internal.h" | |
| 22 | #include "debug.h" | |
| 7076 | 23 | #include "imgstore.h" |
|
9713
bb37562302a1
[gaim-migrate @ 10574]
Mark Doliner <markdoliner@pidgin.im>
parents:
9466
diff
changeset
|
24 | #include "prpl.h" |
| 7014 | 25 | #include "notify.h" |
| 26 | #include "request.h" | |
| 27 | #include "util.h" | |
| 7395 | 28 | #include "xmlnode.h" |
| 7014 | 29 | |
| 30 | #include "buddy.h" | |
| 31 | #include "chat.h" | |
| 32 | #include "jabber.h" | |
| 33 | #include "iq.h" | |
| 34 | #include "presence.h" | |
| 11675 | 35 | #include "xdata.h" |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
36 | #include "pep.h" |
|
17816
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
37 | #include "adhoccommands.h" |
| 7014 | 38 | |
|
24012
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23501
diff
changeset
|
39 | #define MAX_HTTP_BUDDYICON_BYTES (200 * 1024) |
|
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23501
diff
changeset
|
40 | |
| 13794 | 41 | typedef struct { |
| 42 | long idle_seconds; | |
| 43 | } JabberBuddyInfoResource; | |
| 44 | ||
| 45 | typedef struct { | |
| 46 | JabberStream *js; | |
| 47 | JabberBuddy *jb; | |
| 48 | char *jid; | |
| 49 | GSList *ids; | |
| 50 | GHashTable *resources; | |
| 51 | int timeout_handle; | |
| 52 | GSList *vcard_imgids; | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
53 | PurpleNotifyUserInfo *user_info; |
| 13794 | 54 | } JabberBuddyInfo; |
| 55 | ||
| 7116 | 56 | void jabber_buddy_free(JabberBuddy *jb) |
| 57 | { | |
| 58 | g_return_if_fail(jb != NULL); | |
| 59 | ||
|
22942
2bf494f8e2a4
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents:
22928
diff
changeset
|
60 | g_free(jb->error_msg); |
| 7116 | 61 | while(jb->resources) |
| 62 | jabber_buddy_resource_free(jb->resources->data); | |
| 63 | ||
| 64 | g_free(jb); | |
| 65 | } | |
| 66 | ||
| 7014 | 67 | JabberBuddy *jabber_buddy_find(JabberStream *js, const char *name, |
| 68 | gboolean create) | |
| 69 | { | |
| 70 | JabberBuddy *jb; | |
| 7445 | 71 | const char *realname; |
| 7014 | 72 | |
|
15143
37451143f5c4
[gaim-migrate @ 17867]
Mark Doliner <markdoliner@pidgin.im>
parents:
15092
diff
changeset
|
73 | if (js->buddies == NULL) |
|
37451143f5c4
[gaim-migrate @ 17867]
Mark Doliner <markdoliner@pidgin.im>
parents:
15092
diff
changeset
|
74 | return NULL; |
|
37451143f5c4
[gaim-migrate @ 17867]
Mark Doliner <markdoliner@pidgin.im>
parents:
15092
diff
changeset
|
75 | |
| 7445 | 76 | if(!(realname = jabber_normalize(js->gc->account, name))) |
| 7014 | 77 | return NULL; |
| 78 | ||
| 79 | jb = g_hash_table_lookup(js->buddies, realname); | |
| 80 | ||
| 81 | if(!jb && create) { | |
| 82 | jb = g_new0(JabberBuddy, 1); | |
| 83 | g_hash_table_insert(js->buddies, g_strdup(realname), jb); | |
| 84 | } | |
| 85 | ||
| 86 | return jb; | |
| 87 | } | |
| 88 | ||
| 89 | ||
| 90 | JabberBuddyResource *jabber_buddy_find_resource(JabberBuddy *jb, | |
| 91 | const char *resource) | |
| 92 | { | |
| 93 | JabberBuddyResource *jbr = NULL; | |
| 94 | GList *l; | |
| 95 | ||
| 96 | if(!jb) | |
| 97 | return NULL; | |
| 98 | ||
| 99 | for(l = jb->resources; l; l = l->next) | |
| 100 | { | |
| 101 | if(!jbr && !resource) { | |
| 102 | jbr = l->data; | |
| 103 | } else if(!resource) { | |
|
22550
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
104 | if(((JabberBuddyResource *)l->data)->priority > jbr->priority) |
| 7014 | 105 | jbr = l->data; |
|
22550
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
106 | else if(((JabberBuddyResource *)l->data)->priority == jbr->priority) { |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
107 | /* Determine if this resource is more available than the one we've currently chosen */ |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
108 | switch(((JabberBuddyResource *)l->data)->state) { |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
109 | case JABBER_BUDDY_STATE_ONLINE: |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
110 | case JABBER_BUDDY_STATE_CHAT: |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
111 | /* This resource is online/chatty. Prefer to one which isn't either. */ |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
112 | if ((jbr->state != JABBER_BUDDY_STATE_ONLINE) && (jbr->state != JABBER_BUDDY_STATE_CHAT)) |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
113 | jbr = l->data; |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
114 | break; |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
115 | case JABBER_BUDDY_STATE_AWAY: |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
116 | case JABBER_BUDDY_STATE_DND: |
|
24827
5e3f3d989002
This technically doesn't matter due to behavior elsewhere in the prpl, but
Paul Aurich <darkrain42@pidgin.im>
parents:
24816
diff
changeset
|
117 | /* This resource is away/dnd. Prefer to one which is extended away, unavailable, or unknown. */ |
|
5e3f3d989002
This technically doesn't matter due to behavior elsewhere in the prpl, but
Paul Aurich <darkrain42@pidgin.im>
parents:
24816
diff
changeset
|
118 | if ((jbr->state == JABBER_BUDDY_STATE_XA) || (jbr->state == JABBER_BUDDY_STATE_UNAVAILABLE) || |
|
22550
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
119 | (jbr->state == JABBER_BUDDY_STATE_UNKNOWN) || (jbr->state == JABBER_BUDDY_STATE_ERROR)) |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
120 | jbr = l->data; |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
121 | break; |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
122 | case JABBER_BUDDY_STATE_XA: |
|
24827
5e3f3d989002
This technically doesn't matter due to behavior elsewhere in the prpl, but
Paul Aurich <darkrain42@pidgin.im>
parents:
24816
diff
changeset
|
123 | /* This resource is extended away. That's better than unavailable or unknown. */ |
|
5e3f3d989002
This technically doesn't matter due to behavior elsewhere in the prpl, but
Paul Aurich <darkrain42@pidgin.im>
parents:
24816
diff
changeset
|
124 | if ((jbr->state == JABBER_BUDDY_STATE_UNAVAILABLE) || (jbr->state == JABBER_BUDDY_STATE_UNKNOWN) || (jbr->state == JABBER_BUDDY_STATE_ERROR)) |
|
5e3f3d989002
This technically doesn't matter due to behavior elsewhere in the prpl, but
Paul Aurich <darkrain42@pidgin.im>
parents:
24816
diff
changeset
|
125 | jbr = l->data; |
|
5e3f3d989002
This technically doesn't matter due to behavior elsewhere in the prpl, but
Paul Aurich <darkrain42@pidgin.im>
parents:
24816
diff
changeset
|
126 | break; |
|
5e3f3d989002
This technically doesn't matter due to behavior elsewhere in the prpl, but
Paul Aurich <darkrain42@pidgin.im>
parents:
24816
diff
changeset
|
127 | case JABBER_BUDDY_STATE_UNAVAILABLE: |
|
5e3f3d989002
This technically doesn't matter due to behavior elsewhere in the prpl, but
Paul Aurich <darkrain42@pidgin.im>
parents:
24816
diff
changeset
|
128 | /* This resource is unavailable. That's better than unknown. */ |
|
22550
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
129 | if ((jbr->state == JABBER_BUDDY_STATE_UNKNOWN) || (jbr->state == JABBER_BUDDY_STATE_ERROR)) |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
130 | jbr = l->data; |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
131 | break; |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
132 | case JABBER_BUDDY_STATE_UNKNOWN: |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
133 | case JABBER_BUDDY_STATE_ERROR: |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
134 | /* These are never preferable. */ |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
135 | break; |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
136 | } |
|
bbfe56f7ad40
Prefer more available resources to less available ones when priorities are the same. Fixes #5079.
Evan Schoenberg <evands@pidgin.im>
parents:
22425
diff
changeset
|
137 | } |
| 7014 | 138 | } else if(((JabberBuddyResource *)l->data)->name) { |
| 139 | if(!strcmp(((JabberBuddyResource *)l->data)->name, resource)) { | |
| 140 | jbr = l->data; | |
| 141 | break; | |
| 142 | } | |
| 143 | } | |
| 144 | } | |
| 145 | ||
| 146 | return jbr; | |
| 147 | } | |
| 148 | ||
| 9954 | 149 | JabberBuddyResource *jabber_buddy_track_resource(JabberBuddy *jb, const char *resource, |
| 150 | int priority, JabberBuddyState state, const char *status) | |
| 7014 | 151 | { |
| 152 | JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, resource); | |
| 153 | if(!jbr) { | |
| 154 | jbr = g_new0(JabberBuddyResource, 1); | |
| 7116 | 155 | jbr->jb = jb; |
| 7014 | 156 | jbr->name = g_strdup(resource); |
| 157 | jbr->capabilities = JABBER_CAP_XHTML; | |
| 158 | jb->resources = g_list_append(jb->resources, jbr); | |
| 159 | } | |
| 160 | jbr->priority = priority; | |
| 161 | jbr->state = state; | |
| 22928 | 162 | g_free(jbr->status); |
| 163 | jbr->status = status != NULL ? g_markup_escape_text(status, -1) : NULL; | |
| 9954 | 164 | |
| 165 | return jbr; | |
| 7014 | 166 | } |
| 167 | ||
| 7116 | 168 | void jabber_buddy_resource_free(JabberBuddyResource *jbr) |
| 169 | { | |
| 170 | g_return_if_fail(jbr != NULL); | |
| 171 | ||
| 172 | jbr->jb->resources = g_list_remove(jbr->jb->resources, jbr); | |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
173 | |
|
17816
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
174 | while(jbr->commands) { |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
175 | JabberAdHocCommands *cmd = jbr->commands->data; |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
176 | g_free(cmd->jid); |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
177 | g_free(cmd->node); |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
178 | g_free(cmd->name); |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
179 | g_free(cmd); |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
180 | jbr->commands = g_list_delete_link(jbr->commands, jbr->commands); |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
181 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
182 | |
|
17816
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
183 | jabber_caps_free_clientinfo(jbr->caps); |
| 7116 | 184 | |
| 185 | g_free(jbr->name); | |
| 13794 | 186 | g_free(jbr->status); |
| 187 | g_free(jbr->thread_id); | |
| 188 | g_free(jbr->client.name); | |
| 189 | g_free(jbr->client.version); | |
| 190 | g_free(jbr->client.os); | |
| 7116 | 191 | g_free(jbr); |
| 192 | } | |
| 193 | ||
| 7014 | 194 | void jabber_buddy_remove_resource(JabberBuddy *jb, const char *resource) |
| 195 | { | |
| 196 | JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, resource); | |
| 197 | ||
| 198 | if(!jbr) | |
| 199 | return; | |
| 200 | ||
| 7116 | 201 | jabber_buddy_resource_free(jbr); |
| 7014 | 202 | } |
| 203 | ||
| 204 | const char *jabber_buddy_get_status_msg(JabberBuddy *jb) | |
| 205 | { | |
| 206 | JabberBuddyResource *jbr; | |
| 207 | ||
| 208 | if(!jb) | |
| 209 | return NULL; | |
| 210 | ||
| 211 | jbr = jabber_buddy_find_resource(jb, NULL); | |
| 212 | ||
| 213 | if(!jbr) | |
| 214 | return NULL; | |
| 215 | ||
| 216 | return jbr->status; | |
| 217 | } | |
| 218 | ||
| 219 | /******* | |
| 220 | * This is the old vCard stuff taken from the old prpl. vCards, by definition | |
| 221 | * are a temporary thing until jabber can get its act together and come up | |
| 222 | * with a format for user information, hence the namespace of 'vcard-temp' | |
| 223 | * | |
| 224 | * Since I don't feel like putting that much work into something that's | |
| 225 | * _supposed_ to go away, i'm going to just copy the kludgy old code here, | |
| 226 | * and make it purdy when jabber comes up with a standards-track JEP to | |
| 227 | * replace vcard-temp | |
| 228 | * --Nathan | |
| 229 | *******/ | |
| 230 | ||
| 231 | /*---------------------------------------*/ | |
| 232 | /* Jabber "set info" (vCard) support */ | |
| 233 | /*---------------------------------------*/ | |
| 234 | ||
| 235 | /* | |
| 236 | * V-Card format: | |
| 237 | * | |
| 238 | * <vCard prodid='' version='' xmlns=''> | |
| 239 | * <FN></FN> | |
| 240 | * <N> | |
| 241 | * <FAMILY/> | |
| 242 | * <GIVEN/> | |
| 243 | * </N> | |
| 244 | * <NICKNAME/> | |
| 245 | * <URL/> | |
| 246 | * <ADR> | |
| 247 | * <STREET/> | |
| 248 | * <EXTADD/> | |
| 249 | * <LOCALITY/> | |
| 250 | * <REGION/> | |
| 251 | * <PCODE/> | |
| 252 | * <COUNTRY/> | |
| 253 | * </ADR> | |
| 254 | * <TEL/> | |
| 255 | * <EMAIL/> | |
| 256 | * <ORG> | |
| 257 | * <ORGNAME/> | |
| 258 | * <ORGUNIT/> | |
| 259 | * </ORG> | |
| 260 | * <TITLE/> | |
| 261 | * <ROLE/> | |
| 262 | * <DESC/> | |
| 263 | * <BDAY/> | |
| 264 | * </vCard> | |
| 265 | * | |
| 266 | * See also: | |
| 267 | * | |
| 268 | * http://docs.jabber.org/proto/html/vcard-temp.html | |
| 269 | * http://www.vcard-xml.org/dtd/vCard-XML-v2-20010520.dtd | |
| 270 | */ | |
| 271 | ||
| 272 | /* | |
| 273 | * Cross-reference user-friendly V-Card entry labels to vCard XML tags | |
| 274 | * and attributes. | |
| 275 | * | |
| 276 | * Order is (or should be) unimportant. For example: we have no way of | |
| 277 | * knowing in what order real data will arrive. | |
| 278 | * | |
| 279 | * Format: Label, Pre-set text, "visible" flag, "editable" flag, XML tag | |
| 280 | * name, XML tag's parent tag "path" (relative to vCard node). | |
| 281 | * | |
| 282 | * List is terminated by a NULL label pointer. | |
| 283 | * | |
| 284 | * Entries with no label text, but with XML tag and parent tag | |
| 285 | * entries, are used by V-Card XML construction routines to | |
| 286 | * "automagically" construct the appropriate XML node tree. | |
| 287 | * | |
| 288 | * Thoughts on future direction/expansion | |
| 289 | * | |
| 290 | * This is a "simple" vCard. | |
| 291 | * | |
| 292 | * It is possible for nodes other than the "vCard" node to have | |
| 293 | * attributes. Should that prove necessary/desirable, add an | |
| 294 | * "attributes" pointer to the vcard_template struct, create the | |
| 295 | * necessary tag_attr structs, and add 'em to the vcard_dflt_data | |
| 296 | * array. | |
| 297 | * | |
| 298 | * The above changes will (obviously) require changes to the vCard | |
| 299 | * construction routines. | |
| 300 | */ | |
| 301 | ||
| 302 | struct vcard_template { | |
| 303 | char *label; /* label text pointer */ | |
| 304 | char *tag; /* tag text */ | |
| 305 | char *ptag; /* parent tag "path" text */ | |
|
21091
07fe1a99c47b
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@pidgin.im>
parents:
20169
diff
changeset
|
306 | } const vcard_template_data[] = { |
|
26563
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
307 | {N_("Full Name"), "FN", NULL}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
308 | {N_("Family Name"), "FAMILY", "N"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
309 | {N_("Given Name"), "GIVEN", "N"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
310 | {N_("Nickname"), "NICKNAME", NULL}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
311 | {N_("URL"), "URL", NULL}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
312 | {N_("Street Address"), "STREET", "ADR"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
313 | {N_("Extended Address"), "EXTADD", "ADR"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
314 | {N_("Locality"), "LOCALITY", "ADR"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
315 | {N_("Region"), "REGION", "ADR"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
316 | {N_("Postal Code"), "PCODE", "ADR"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
317 | {N_("Country"), "CTRY", "ADR"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
318 | {N_("Telephone"), "NUMBER", "TEL"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
319 | {N_("Email"), "USERID", "EMAIL"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
320 | {N_("Organization Name"), "ORGNAME", "ORG"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
321 | {N_("Organization Unit"), "ORGUNIT", "ORG"}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
322 | {N_("Title"), "TITLE", NULL}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
323 | {N_("Role"), "ROLE", NULL}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
324 | {N_("Birthday"), "BDAY", NULL}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
325 | {N_("Description"), "DESC", NULL}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
326 | {"", "N", NULL}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
327 | {"", "ADR", NULL}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
328 | {"", "ORG", NULL}, |
|
29674a9754ab
Remove some unused fields. Thanks to Mayank Jain Nawal's email to the
Mark Doliner <markdoliner@pidgin.im>
parents:
26042
diff
changeset
|
329 | {NULL, NULL, NULL} |
| 7014 | 330 | }; |
| 331 | ||
| 332 | /* | |
|
8735
01248ea222d3
[gaim-migrate @ 9490]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
8401
diff
changeset
|
333 | * The "vCard" tag's attribute list... |
| 7014 | 334 | */ |
| 335 | struct tag_attr { | |
| 336 | char *attr; | |
| 337 | char *value; | |
|
21091
07fe1a99c47b
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@pidgin.im>
parents:
20169
diff
changeset
|
338 | } const vcard_tag_attr_list[] = { |
| 7014 | 339 | {"prodid", "-//HandGen//NONSGML vGen v1.0//EN"}, |
| 340 | {"version", "2.0", }, | |
| 341 | {"xmlns", "vcard-temp", }, | |
| 342 | {NULL, NULL}, | |
| 343 | }; | |
| 344 | ||
| 345 | ||
| 346 | /* | |
| 347 | * Insert a tag node into an xmlnode tree, recursively inserting parent tag | |
| 348 | * nodes as necessary | |
| 349 | * | |
| 350 | * Returns pointer to inserted node | |
| 351 | * | |
| 352 | * Note to hackers: this code is designed to be re-entrant (it's recursive--it | |
| 353 | * calls itself), so don't put any "static"s in here! | |
| 354 | */ | |
| 355 | static xmlnode *insert_tag_to_parent_tag(xmlnode *start, const char *parent_tag, const char *new_tag) | |
| 356 | { | |
| 357 | xmlnode *x = NULL; | |
| 358 | ||
| 359 | /* | |
| 360 | * If the parent tag wasn't specified, see if we can get it | |
| 361 | * from the vCard template struct. | |
| 362 | */ | |
| 363 | if(parent_tag == NULL) { | |
|
21091
07fe1a99c47b
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@pidgin.im>
parents:
20169
diff
changeset
|
364 | const struct vcard_template *vc_tp = vcard_template_data; |
| 7014 | 365 | |
| 366 | while(vc_tp->label != NULL) { | |
| 367 | if(strcmp(vc_tp->tag, new_tag) == 0) { | |
| 368 | parent_tag = vc_tp->ptag; | |
| 369 | break; | |
| 370 | } | |
| 371 | ++vc_tp; | |
| 372 | } | |
| 373 | } | |
| 374 | ||
| 375 | /* | |
| 376 | * If we have a parent tag... | |
| 377 | */ | |
| 378 | if(parent_tag != NULL ) { | |
| 379 | /* | |
| 380 | * Try to get the parent node for a tag | |
| 381 | */ | |
| 382 | if((x = xmlnode_get_child(start, parent_tag)) == NULL) { | |
| 383 | /* | |
| 384 | * Descend? | |
| 385 | */ | |
| 386 | char *grand_parent = g_strdup(parent_tag); | |
| 387 | char *parent; | |
| 388 | ||
| 389 | if((parent = strrchr(grand_parent, '/')) != NULL) { | |
| 390 | *(parent++) = '\0'; | |
| 391 | x = insert_tag_to_parent_tag(start, grand_parent, parent); | |
| 392 | } else { | |
| 393 | x = xmlnode_new_child(start, grand_parent); | |
| 394 | } | |
| 395 | g_free(grand_parent); | |
| 396 | } else { | |
| 397 | /* | |
| 398 | * We found *something* to be the parent node. | |
| 399 | * Note: may be the "root" node! | |
| 400 | */ | |
| 401 | xmlnode *y; | |
| 402 | if((y = xmlnode_get_child(x, new_tag)) != NULL) { | |
| 403 | return(y); | |
| 404 | } | |
| 405 | } | |
| 406 | } | |
| 407 | ||
| 408 | /* | |
| 409 | * insert the new tag into its parent node | |
| 410 | */ | |
| 411 | return(xmlnode_new_child((x == NULL? start : x), new_tag)); | |
| 412 | } | |
| 413 | ||
| 414 | /* | |
| 415 | * Send vCard info to Jabber server | |
| 416 | */ | |
| 15884 | 417 | void jabber_set_info(PurpleConnection *gc, const char *info) |
| 7014 | 418 | { |
|
22425
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
419 | PurpleStoredImage *img; |
| 7014 | 420 | JabberIq *iq; |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
421 | JabberStream *js = purple_connection_get_protocol_data(gc); |
| 7014 | 422 | xmlnode *vc_node; |
|
21091
07fe1a99c47b
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@pidgin.im>
parents:
20169
diff
changeset
|
423 | const struct tag_attr *tag_attr; |
| 7014 | 424 | |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
425 | /* if we have't grabbed the remote vcard yet, we can't |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
426 | * assume that what we have here is correct */ |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
427 | if(!js->vcard_fetched) |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
428 | return; |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
429 | |
|
15273
a7838f939207
[gaim-migrate @ 18001]
Mark Doliner <markdoliner@pidgin.im>
parents:
15205
diff
changeset
|
430 | g_free(js->avatar_hash); |
| 10189 | 431 | js->avatar_hash = NULL; |
| 7014 | 432 | |
| 433 | /* | |
| 434 | * Send only if there's actually any *information* to send | |
| 435 | */ | |
| 11388 | 436 | vc_node = info ? xmlnode_from_str(info, -1) : NULL; |
| 10189 | 437 | |
|
22425
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
438 | if (vc_node && (!vc_node->name || |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
439 | g_ascii_strncasecmp(vc_node->name, "vCard", 5))) { |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
440 | xmlnode_free(vc_node); |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
441 | vc_node = NULL; |
| 10189 | 442 | } |
| 7014 | 443 | |
|
22425
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
444 | if ((img = purple_buddy_icons_find_account_icon(gc->account))) { |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
445 | gconstpointer avatar_data; |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
446 | gsize avatar_len; |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
447 | xmlnode *photo, *binval, *type; |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
448 | gchar *enc; |
| 10189 | 449 | |
|
22425
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
450 | if(!vc_node) { |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
451 | vc_node = xmlnode_new("vCard"); |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
452 | for(tag_attr = vcard_tag_attr_list; tag_attr->attr != NULL; ++tag_attr) |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
453 | xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value); |
|
15273
a7838f939207
[gaim-migrate @ 18001]
Mark Doliner <markdoliner@pidgin.im>
parents:
15205
diff
changeset
|
454 | } |
| 10189 | 455 | |
|
22425
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
456 | avatar_data = purple_imgstore_get_data(img); |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
457 | avatar_len = purple_imgstore_get_size(img); |
|
25386
7ca88088e0de
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <darkrain42@pidgin.im>
parents:
25385
diff
changeset
|
458 | /* Get rid of an old PHOTO if one exists. |
|
7ca88088e0de
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <darkrain42@pidgin.im>
parents:
25385
diff
changeset
|
459 | * TODO: This may want to be modified to remove all old PHOTO |
|
7ca88088e0de
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <darkrain42@pidgin.im>
parents:
25385
diff
changeset
|
460 | * children, at the moment some people have managed to get |
|
7ca88088e0de
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <darkrain42@pidgin.im>
parents:
25385
diff
changeset
|
461 | * multiple PHOTO entries in their vCard. */ |
|
22425
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
462 | if((photo = xmlnode_get_child(vc_node, "PHOTO"))) { |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
463 | xmlnode_free(photo); |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
464 | } |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
465 | photo = xmlnode_new_child(vc_node, "PHOTO"); |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
466 | type = xmlnode_new_child(photo, "TYPE"); |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
467 | xmlnode_insert_data(type, "image/png", -1); |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
468 | binval = xmlnode_new_child(photo, "BINVAL"); |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
469 | enc = purple_base64_encode(avatar_data, avatar_len); |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
470 | |
|
25110
40b3fffdb00b
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <darkrain42@pidgin.im>
parents:
25109
diff
changeset
|
471 | js->avatar_hash = jabber_calculate_data_sha1sum(avatar_data, avatar_len); |
|
22425
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
472 | |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
473 | xmlnode_insert_data(binval, enc, -1); |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
474 | g_free(enc); |
|
25386
7ca88088e0de
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <darkrain42@pidgin.im>
parents:
25385
diff
changeset
|
475 | } else if (vc_node) { |
|
7ca88088e0de
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <darkrain42@pidgin.im>
parents:
25385
diff
changeset
|
476 | xmlnode *photo; |
|
7ca88088e0de
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <darkrain42@pidgin.im>
parents:
25385
diff
changeset
|
477 | /* TODO: Remove all PHOTO children? (see above note) */ |
|
7ca88088e0de
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <darkrain42@pidgin.im>
parents:
25385
diff
changeset
|
478 | if ((photo = xmlnode_get_child(vc_node, "PHOTO"))) { |
|
7ca88088e0de
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <darkrain42@pidgin.im>
parents:
25385
diff
changeset
|
479 | xmlnode_free(photo); |
|
7ca88088e0de
Allow us to remove vCard avatars when the PurpleAccount doesn't have one
Paul Aurich <darkrain42@pidgin.im>
parents:
25385
diff
changeset
|
480 | } |
|
22425
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
481 | } |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
482 | |
|
42142a0938a2
Fix setting vCard buddy icons when we don't have any other user info set.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21957
diff
changeset
|
483 | if (vc_node != NULL) { |
|
15273
a7838f939207
[gaim-migrate @ 18001]
Mark Doliner <markdoliner@pidgin.im>
parents:
15205
diff
changeset
|
484 | iq = jabber_iq_new(js, JABBER_IQ_SET); |
|
a7838f939207
[gaim-migrate @ 18001]
Mark Doliner <markdoliner@pidgin.im>
parents:
15205
diff
changeset
|
485 | xmlnode_insert_child(iq->node, vc_node); |
|
a7838f939207
[gaim-migrate @ 18001]
Mark Doliner <markdoliner@pidgin.im>
parents:
15205
diff
changeset
|
486 | jabber_iq_send(iq); |
| 7014 | 487 | } |
| 488 | } | |
| 489 | ||
|
16538
c7e61e2917c9
Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents:
16534
diff
changeset
|
490 | void jabber_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) |
| 10189 | 491 | { |
| 15884 | 492 | PurplePresence *gpresence; |
| 493 | PurpleStatus *status; | |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
494 | |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
495 | if(((JabberStream*)purple_connection_get_protocol_data(gc))->pep) { |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
496 | /* XEP-0084: User Avatars */ |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
497 | if(img) { |
|
22942
2bf494f8e2a4
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents:
22928
diff
changeset
|
498 | /* |
|
2bf494f8e2a4
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents:
22928
diff
changeset
|
499 | * TODO: This is pretty gross. The Jabber PRPL really shouldn't |
|
2bf494f8e2a4
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents:
22928
diff
changeset
|
500 | * do voodoo to try to determine the image type, height |
|
2bf494f8e2a4
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents:
22928
diff
changeset
|
501 | * and width. |
|
2bf494f8e2a4
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents:
22928
diff
changeset
|
502 | */ |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
503 | /* A PNG header, including the IHDR, but nothing else */ |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
504 | const struct { |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
505 | guchar signature[8]; /* must be hex 89 50 4E 47 0D 0A 1A 0A */ |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
506 | struct { |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
507 | guint32 length; /* must be 0x0d */ |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
508 | guchar type[4]; /* must be 'I' 'H' 'D' 'R' */ |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
509 | guint32 width; |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
510 | guint32 height; |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
511 | guchar bitdepth; |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
512 | guchar colortype; |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
513 | guchar compression; |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
514 | guchar filter; |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
515 | guchar interlace; |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
516 | } ihdr; |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
517 | } *png = purple_imgstore_get_data(img); /* ATTN: this is in network byte order! */ |
| 10189 | 518 | |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
519 | /* check if the data is a valid png file (well, at least to some extend) */ |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
520 | if(png->signature[0] == 0x89 && |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
521 | png->signature[1] == 0x50 && |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
522 | png->signature[2] == 0x4e && |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
523 | png->signature[3] == 0x47 && |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
524 | png->signature[4] == 0x0d && |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
525 | png->signature[5] == 0x0a && |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
526 | png->signature[6] == 0x1a && |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
527 | png->signature[7] == 0x0a && |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
528 | ntohl(png->ihdr.length) == 0x0d && |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
529 | png->ihdr.type[0] == 'I' && |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
530 | png->ihdr.type[1] == 'H' && |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
531 | png->ihdr.type[2] == 'D' && |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
532 | png->ihdr.type[3] == 'R') { |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
533 | /* parse PNG header to get the size of the image (yes, this is required) */ |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
534 | guint32 width = ntohl(png->ihdr.width); |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
535 | guint32 height = ntohl(png->ihdr.height); |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
536 | xmlnode *publish, *item, *data, *metadata, *info; |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
537 | char *lengthstring, *widthstring, *heightstring; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
538 | |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
539 | /* compute the sha1 hash */ |
|
25110
40b3fffdb00b
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <darkrain42@pidgin.im>
parents:
25109
diff
changeset
|
540 | char *hash = jabber_calculate_data_sha1sum(purple_imgstore_get_data(img), purple_imgstore_get_size(img)); |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
541 | char *base64avatar; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
542 | |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
543 | publish = xmlnode_new("publish"); |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
544 | xmlnode_set_attrib(publish,"node",AVATARNAMESPACEDATA); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
545 | |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
546 | item = xmlnode_new_child(publish, "item"); |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
547 | xmlnode_set_attrib(item, "id", hash); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
548 | |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
549 | data = xmlnode_new_child(item, "data"); |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
550 | xmlnode_set_namespace(data,AVATARNAMESPACEDATA); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
551 | |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
552 | base64avatar = purple_base64_encode(purple_imgstore_get_data(img), purple_imgstore_get_size(img)); |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
553 | xmlnode_insert_data(data,base64avatar,-1); |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
554 | g_free(base64avatar); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
555 | |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
556 | /* publish the avatar itself */ |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
557 | jabber_pep_publish((JabberStream*)purple_connection_get_protocol_data(gc), publish); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
558 | |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
559 | /* next step: publish the metadata */ |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
560 | publish = xmlnode_new("publish"); |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
561 | xmlnode_set_attrib(publish,"node",AVATARNAMESPACEMETA); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
562 | |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
563 | item = xmlnode_new_child(publish, "item"); |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
564 | xmlnode_set_attrib(item, "id", hash); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
565 | |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
566 | metadata = xmlnode_new_child(item, "metadata"); |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
567 | xmlnode_set_namespace(metadata,AVATARNAMESPACEMETA); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
568 | |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
569 | info = xmlnode_new_child(metadata, "info"); |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
570 | xmlnode_set_attrib(info, "id", hash); |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
571 | xmlnode_set_attrib(info, "type", "image/png"); |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
572 | lengthstring = g_strdup_printf("%u", (unsigned)purple_imgstore_get_size(img)); |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
573 | xmlnode_set_attrib(info, "bytes", lengthstring); |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
574 | g_free(lengthstring); |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
575 | widthstring = g_strdup_printf("%u", width); |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
576 | xmlnode_set_attrib(info, "width", widthstring); |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
577 | g_free(widthstring); |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
578 | heightstring = g_strdup_printf("%u", height); |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
579 | xmlnode_set_attrib(info, "height", heightstring); |
|
21681
80530c8be0a1
Fix a double-free and a leak at the same time.
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21630
diff
changeset
|
580 | g_free(heightstring); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
581 | |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
582 | /* publish the metadata */ |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
583 | jabber_pep_publish((JabberStream*)purple_connection_get_protocol_data(gc), publish); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
584 | |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
585 | g_free(hash); |
|
25385
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
586 | } else { |
|
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
587 | purple_debug_error("jabber", "jabber_set_buddy_icon received non-png data"); |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
588 | } |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
589 | } else { |
|
25385
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
590 | /* remove the metadata */ |
|
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
591 | xmlnode *metadata, *item; |
|
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
592 | xmlnode *publish = xmlnode_new("publish"); |
|
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
593 | xmlnode_set_attrib(publish,"node",AVATARNAMESPACEMETA); |
|
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
594 | |
|
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
595 | item = xmlnode_new_child(publish, "item"); |
|
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
596 | |
|
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
597 | metadata = xmlnode_new_child(item, "metadata"); |
|
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
598 | xmlnode_set_namespace(metadata,AVATARNAMESPACEMETA); |
|
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
599 | |
|
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
600 | xmlnode_new_child(metadata, "stop"); |
|
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
601 | |
|
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
602 | /* publish the metadata */ |
|
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
603 | jabber_pep_publish((JabberStream*)gc->proto_data, publish); |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
604 | } |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
605 | } |
|
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
606 | |
|
25385
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
607 | /* vCard avatars do not have an image type requirement so update our |
|
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
608 | * vCard avatar regardless of image type for those poor older clients |
|
158a12123bc8
Paul noticed that the conditional blocks here were backwards. I'm surprised no
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
609 | */ |
| 15884 | 610 | jabber_set_info(gc, purple_account_get_user_info(gc->account)); |
| 10189 | 611 | |
| 15884 | 612 | gpresence = purple_account_get_presence(gc->account); |
| 613 | status = purple_presence_get_active_status(gpresence); | |
| 10216 | 614 | jabber_presence_send(gc->account, status); |
| 10189 | 615 | } |
| 616 | ||
| 7014 | 617 | /* |
| 618 | * This is the callback from the "ok clicked" for "set vCard" | |
| 619 | * | |
|
25391
363cb62aa353
Correct a comment, I don't imagine anyone will actually need this but better
Etan Reisner <deryni@pidgin.im>
parents:
25386
diff
changeset
|
620 | * Sets the vCard with data from PurpleRequestFields. |
| 7014 | 621 | */ |
| 622 | static void | |
| 15884 | 623 | jabber_format_info(PurpleConnection *gc, PurpleRequestFields *fields) |
| 7014 | 624 | { |
| 625 | xmlnode *vc_node; | |
| 15884 | 626 | PurpleRequestField *field; |
| 7014 | 627 | const char *text; |
| 628 | char *p; | |
| 629 | const struct vcard_template *vc_tp; | |
|
21091
07fe1a99c47b
Patch from Andrew Gaul to constify a bunch of static variables to reduce
Ka-Hing Cheung <khc@pidgin.im>
parents:
20169
diff
changeset
|
630 | const struct tag_attr *tag_attr; |
| 7014 | 631 | |
| 632 | vc_node = xmlnode_new("vCard"); | |
| 633 | ||
| 634 | for(tag_attr = vcard_tag_attr_list; tag_attr->attr != NULL; ++tag_attr) | |
| 635 | xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value); | |
| 636 | ||
| 637 | for (vc_tp = vcard_template_data; vc_tp->label != NULL; vc_tp++) { | |
| 638 | if (*vc_tp->label == '\0') | |
| 639 | continue; | |
| 640 | ||
| 15884 | 641 | field = purple_request_fields_get_field(fields, vc_tp->tag); |
| 642 | text = purple_request_field_string_get_value(field); | |
| 7014 | 643 | |
| 644 | ||
| 645 | if (text != NULL && *text != '\0') { | |
| 646 | xmlnode *xp; | |
| 647 | ||
| 15884 | 648 | purple_debug(PURPLE_DEBUG_INFO, "jabber", |
| 9339 | 649 | "Setting %s to '%s'\n", vc_tp->tag, text); |
| 650 | ||
| 7014 | 651 | if ((xp = insert_tag_to_parent_tag(vc_node, |
| 652 | NULL, vc_tp->tag)) != NULL) { | |
| 653 | ||
| 654 | xmlnode_insert_data(xp, text, -1); | |
| 655 | } | |
| 656 | } | |
| 657 | } | |
| 658 | ||
| 7642 | 659 | p = xmlnode_to_str(vc_node, NULL); |
| 7014 | 660 | xmlnode_free(vc_node); |
| 661 | ||
| 15884 | 662 | purple_account_set_user_info(purple_connection_get_account(gc), p); |
|
14669
df3f48ab4aff
[gaim-migrate @ 17335]
Mark Doliner <markdoliner@pidgin.im>
parents:
14525
diff
changeset
|
663 | serv_set_info(gc, p); |
| 7014 | 664 | |
| 665 | g_free(p); | |
| 666 | } | |
| 667 | ||
| 668 | /* | |
| 669 | * This gets executed by the proto action | |
| 670 | * | |
| 15884 | 671 | * Creates a new PurpleRequestFields struct, gets the XML-formatted user_info |
| 7014 | 672 | * string (if any) into GSLists for the (multi-entry) edit dialog and |
| 673 | * calls the set_vcard dialog. | |
| 674 | */ | |
| 15884 | 675 | void jabber_setup_set_info(PurplePluginAction *action) |
| 7014 | 676 | { |
| 15884 | 677 | PurpleConnection *gc = (PurpleConnection *) action->context; |
| 678 | PurpleRequestFields *fields; | |
| 679 | PurpleRequestFieldGroup *group; | |
| 680 | PurpleRequestField *field; | |
| 7014 | 681 | const struct vcard_template *vc_tp; |
|
14129
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
682 | const char *user_info; |
|
14130
02a5f8dad9cf
[gaim-migrate @ 16689]
Daniel Atallah <datallah@pidgin.im>
parents:
14129
diff
changeset
|
683 | char *cdata = NULL; |
| 7014 | 684 | xmlnode *x_vc_data = NULL; |
| 685 | ||
| 15884 | 686 | fields = purple_request_fields_new(); |
| 687 | group = purple_request_field_group_new(NULL); | |
| 688 | purple_request_fields_add_group(fields, group); | |
| 7014 | 689 | |
| 690 | /* | |
| 691 | * Get existing, XML-formatted, user info | |
| 692 | */ | |
| 15884 | 693 | if((user_info = purple_account_get_user_info(gc->account)) != NULL) |
| 7014 | 694 | x_vc_data = xmlnode_from_str(user_info, -1); |
| 695 | ||
| 696 | /* | |
| 697 | * Set up GSLists for edit with labels from "template," data from user info | |
| 698 | */ | |
| 699 | for(vc_tp = vcard_template_data; vc_tp->label != NULL; ++vc_tp) { | |
| 700 | xmlnode *data_node; | |
| 701 | if((vc_tp->label)[0] == '\0') | |
| 702 | continue; | |
|
14129
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
703 | |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
704 | if (x_vc_data != NULL) { |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
705 | if(vc_tp->ptag == NULL) { |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
706 | data_node = xmlnode_get_child(x_vc_data, vc_tp->tag); |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
707 | } else { |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
708 | gchar *tag = g_strdup_printf("%s/%s", vc_tp->ptag, vc_tp->tag); |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
709 | data_node = xmlnode_get_child(x_vc_data, tag); |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
710 | g_free(tag); |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
711 | } |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
712 | if(data_node) |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
713 | cdata = xmlnode_get_data(data_node); |
|
14130
02a5f8dad9cf
[gaim-migrate @ 16689]
Daniel Atallah <datallah@pidgin.im>
parents:
14129
diff
changeset
|
714 | } |
| 7014 | 715 | |
| 716 | if(strcmp(vc_tp->tag, "DESC") == 0) { | |
| 15884 | 717 | field = purple_request_field_string_new(vc_tp->tag, |
| 7014 | 718 | _(vc_tp->label), cdata, |
| 719 | TRUE); | |
| 720 | } else { | |
| 15884 | 721 | field = purple_request_field_string_new(vc_tp->tag, |
| 7014 | 722 | _(vc_tp->label), cdata, |
| 723 | FALSE); | |
| 724 | } | |
| 725 | ||
|
14130
02a5f8dad9cf
[gaim-migrate @ 16689]
Daniel Atallah <datallah@pidgin.im>
parents:
14129
diff
changeset
|
726 | g_free(cdata); |
|
02a5f8dad9cf
[gaim-migrate @ 16689]
Daniel Atallah <datallah@pidgin.im>
parents:
14129
diff
changeset
|
727 | cdata = NULL; |
|
02a5f8dad9cf
[gaim-migrate @ 16689]
Daniel Atallah <datallah@pidgin.im>
parents:
14129
diff
changeset
|
728 | |
| 15884 | 729 | purple_request_field_group_add_field(group, field); |
| 7014 | 730 | } |
| 731 | ||
| 732 | if(x_vc_data != NULL) | |
| 733 | xmlnode_free(x_vc_data); | |
| 734 | ||
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
735 | purple_request_fields(gc, _("Edit XMPP vCard"), |
|
16961
b6955f946f8f
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@pidgin.im>
parents:
16799
diff
changeset
|
736 | _("Edit XMPP vCard"), |
| 7014 | 737 | _("All items below are optional. Enter only the " |
| 738 | "information with which you feel comfortable."), | |
| 739 | fields, | |
| 740 | _("Save"), G_CALLBACK(jabber_format_info), | |
| 741 | _("Cancel"), NULL, | |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
15884
diff
changeset
|
742 | purple_connection_get_account(gc), NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
743 | gc); |
| 7014 | 744 | } |
| 745 | ||
| 746 | /*---------------------------------------*/ | |
| 747 | /* End Jabber "set info" (vCard) support */ | |
| 748 | /*---------------------------------------*/ | |
| 749 | ||
| 750 | /****** | |
| 751 | * end of that ancient crap that needs to die | |
| 752 | ******/ | |
| 753 | ||
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
754 | static void jabber_buddy_info_destroy(JabberBuddyInfo *jbi) |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
755 | { |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
756 | /* Remove the timeout, which would otherwise trigger jabber_buddy_get_info_timeout() */ |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
757 | if (jbi->timeout_handle > 0) |
| 15884 | 758 | purple_timeout_remove(jbi->timeout_handle); |
|
15727
0754583ceeae
Don't access the list element after it has been freed.
Daniel Atallah <datallah@pidgin.im>
parents:
15688
diff
changeset
|
759 | |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
760 | g_free(jbi->jid); |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
761 | g_hash_table_destroy(jbi->resources); |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
762 | purple_notify_user_info_destroy(jbi->user_info); |
|
15727
0754583ceeae
Don't access the list element after it has been freed.
Daniel Atallah <datallah@pidgin.im>
parents:
15688
diff
changeset
|
763 | g_free(jbi); |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
764 | } |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
765 | |
| 13794 | 766 | static void jabber_buddy_info_show_if_ready(JabberBuddyInfo *jbi) |
| 7014 | 767 | { |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15143
diff
changeset
|
768 | char *resource_name, *tmp; |
| 13794 | 769 | JabberBuddyResource *jbr; |
|
15092
e7c5edee202e
[gaim-migrate @ 17813]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
14669
diff
changeset
|
770 | JabberBuddyInfoResource *jbir = NULL; |
| 13794 | 771 | GList *resources; |
| 15884 | 772 | PurpleNotifyUserInfo *user_info; |
| 7014 | 773 | |
| 13794 | 774 | /* not yet */ |
| 775 | if(jbi->ids) | |
| 11361 | 776 | return; |
| 777 | ||
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
778 | user_info = jbi->user_info; |
| 13794 | 779 | resource_name = jabber_get_resource(jbi->jid); |
| 7014 | 780 | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
781 | /* If we have one or more pairs from the vcard, put a section break above it */ |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
782 | if (purple_notify_user_info_get_entries(user_info)) |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
783 | purple_notify_user_info_prepend_section_break(user_info); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
784 | |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
785 | /* Prepend the primary buddy info to user_info so that it goes before the vcard. */ |
| 7014 | 786 | if(resource_name) { |
| 13794 | 787 | jbr = jabber_buddy_find_resource(jbi->jb, resource_name); |
| 788 | jbir = g_hash_table_lookup(jbi->resources, resource_name); | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
789 | if(jbr && jbr->client.name) { |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
790 | tmp = g_strdup_printf("%s%s%s", jbr->client.name, |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
791 | (jbr->client.version ? " " : ""), |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
792 | (jbr->client.version ? jbr->client.version : "")); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
793 | purple_notify_user_info_add_pair(user_info, _("Client"), tmp); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
794 | g_free(tmp); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
795 | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
796 | if(jbr->client.os) { |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
797 | purple_notify_user_info_prepend_pair(user_info, _("Operating System"), jbr->client.os); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
798 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
799 | } |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
800 | if(jbir) { |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
801 | if(jbir->idle_seconds > 0) { |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
802 | char *idle = purple_str_seconds_to_string(jbir->idle_seconds); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
803 | purple_notify_user_info_prepend_pair(user_info, _("Idle"), idle); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
804 | g_free(idle); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
805 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
806 | } |
| 7014 | 807 | if(jbr) { |
| 7145 | 808 | char *purdy = NULL; |
|
23404
836828ff554c
Remove compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23393
diff
changeset
|
809 | const char *status_name = jabber_buddy_state_get_name(jbr->state); |
| 7145 | 810 | if(jbr->status) |
| 15884 | 811 | purdy = purple_strdup_withhtml(jbr->status); |
|
23393
7b640ff909dc
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evands@pidgin.im>
parents:
23367
diff
changeset
|
812 | if(status_name && purdy && !strcmp(status_name, purdy)) |
|
7b640ff909dc
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evands@pidgin.im>
parents:
23367
diff
changeset
|
813 | status_name = NULL; |
|
7b640ff909dc
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evands@pidgin.im>
parents:
23367
diff
changeset
|
814 | |
|
7b640ff909dc
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evands@pidgin.im>
parents:
23367
diff
changeset
|
815 | tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""), |
|
7b640ff909dc
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evands@pidgin.im>
parents:
23367
diff
changeset
|
816 | ((status_name && purdy) ? ": " : ""), |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15143
diff
changeset
|
817 | (purdy ? purdy : "")); |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
818 | purple_notify_user_info_prepend_pair(user_info, _("Status"), tmp); |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15143
diff
changeset
|
819 | g_free(tmp); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15143
diff
changeset
|
820 | g_free(purdy); |
| 7014 | 821 | } else { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
822 | purple_notify_user_info_prepend_pair(user_info, _("Status"), _("Unknown")); |
| 13794 | 823 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
824 | #if 0 |
|
19921
d920ce72002e
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
825 | /* #if 0 this for now; I think this would be far more useful if we limited this to a particular set of features |
|
d920ce72002e
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
826 | * of particular interest (-vv jumps out as one). As it is now, I don't picture people getting all excited: "Oh sweet crap! |
|
d920ce72002e
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
827 | * So-and-so supports 'jabber:x:data' AND 'Collaborative Data Objects'!" |
|
d920ce72002e
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
828 | */ |
|
d920ce72002e
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
829 | |
|
18798
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
830 | if(jbr && jbr->caps) { |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
831 | GString *tmp = g_string_new(""); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
832 | GList *iter; |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
833 | for(iter = jbr->caps->features; iter; iter = g_list_next(iter)) { |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
834 | const char *feature = iter->data; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
835 | |
|
18798
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
836 | if(!strcmp(feature, "jabber:iq:last")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
837 | feature = _("Last Activity"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
838 | else if(!strcmp(feature, "http://jabber.org/protocol/disco#info")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
839 | feature = _("Service Discovery Info"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
840 | else if(!strcmp(feature, "http://jabber.org/protocol/disco#items")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
841 | feature = _("Service Discovery Items"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
842 | else if(!strcmp(feature, "http://jabber.org/protocol/address")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
843 | feature = _("Extended Stanza Addressing"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
844 | else if(!strcmp(feature, "http://jabber.org/protocol/muc")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
845 | feature = _("Multi-User Chat"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
846 | else if(!strcmp(feature, "http://jabber.org/protocol/muc#user")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
847 | feature = _("Multi-User Chat Extended Presence Information"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
848 | else if(!strcmp(feature, "http://jabber.org/protocol/ibb")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
849 | feature = _("In-Band Bytestreams"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
850 | else if(!strcmp(feature, "http://jabber.org/protocol/commands")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
851 | feature = _("Ad-Hoc Commands"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
852 | else if(!strcmp(feature, "http://jabber.org/protocol/pubsub")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
853 | feature = _("PubSub Service"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
854 | else if(!strcmp(feature, "http://jabber.org/protocol/bytestreams")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
855 | feature = _("SOCKS5 Bytestreams"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
856 | else if(!strcmp(feature, "jabber:x:oob")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
857 | feature = _("Out of Band Data"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
858 | else if(!strcmp(feature, "http://jabber.org/protocol/xhtml-im")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
859 | feature = _("XHTML-IM"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
860 | else if(!strcmp(feature, "jabber:iq:register")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
861 | feature = _("In-Band Registration"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
862 | else if(!strcmp(feature, "http://jabber.org/protocol/geoloc")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
863 | feature = _("User Location"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
864 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0084.html")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
865 | feature = _("User Avatar"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
866 | else if(!strcmp(feature, "http://jabber.org/protocol/chatstates")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
867 | feature = _("Chat State Notifications"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
868 | else if(!strcmp(feature, "jabber:iq:version")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
869 | feature = _("Software Version"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
870 | else if(!strcmp(feature, "http://jabber.org/protocol/si")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
871 | feature = _("Stream Initiation"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
872 | else if(!strcmp(feature, "http://jabber.org/protocol/si/profile/file-transfer")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
873 | feature = _("File Transfer"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
874 | else if(!strcmp(feature, "http://jabber.org/protocol/mood")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
875 | feature = _("User Mood"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
876 | else if(!strcmp(feature, "http://jabber.org/protocol/activity")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
877 | feature = _("User Activity"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
878 | else if(!strcmp(feature, "http://jabber.org/protocol/caps")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
879 | feature = _("Entity Capabilities"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
880 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0116.html")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
881 | feature = _("Encrypted Session Negotiations"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
882 | else if(!strcmp(feature, "http://jabber.org/protocol/tune")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
883 | feature = _("User Tune"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
884 | else if(!strcmp(feature, "http://jabber.org/protocol/rosterx")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
885 | feature = _("Roster Item Exchange"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
886 | else if(!strcmp(feature, "http://jabber.org/protocol/reach")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
887 | feature = _("Reachability Address"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
888 | else if(!strcmp(feature, "http://jabber.org/protocol/profile")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
889 | feature = _("User Profile"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
890 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0166.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
891 | feature = _("Jingle"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
892 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0167.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
893 | feature = _("Jingle Audio"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
894 | else if(!strcmp(feature, "http://jabber.org/protocol/nick")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
895 | feature = _("User Nickname"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
896 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0176.html#ns-udp")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
897 | feature = _("Jingle ICE UDP"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
898 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0176.html#ns-tcp")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
899 | feature = _("Jingle ICE TCP"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
900 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0177.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
901 | feature = _("Jingle Raw UDP"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
902 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0180.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
903 | feature = _("Jingle Video"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
904 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0181.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
905 | feature = _("Jingle DTMF"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
906 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0184.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
907 | feature = _("Message Receipts"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
908 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0189.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
909 | feature = _("Public Key Publishing"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
910 | else if(!strcmp(feature, "http://jabber.org/protocol/chatting")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
911 | feature = _("User Chatting"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
912 | else if(!strcmp(feature, "http://jabber.org/protocol/browsing")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
913 | feature = _("User Browsing"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
914 | else if(!strcmp(feature, "http://jabber.org/protocol/gaming")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
915 | feature = _("User Gaming"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
916 | else if(!strcmp(feature, "http://jabber.org/protocol/viewing")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
917 | feature = _("User Viewing"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
918 | else if(!strcmp(feature, "urn:xmpp:ping") || !strcmp(feature, "http://www.xmpp.org/extensions/xep-0199.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
919 | feature = _("Ping"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
920 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0200.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
921 | feature = _("Stanza Encryption"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
922 | else if(!strcmp(feature, "urn:xmpp:time")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
923 | feature = _("Entity Time"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
924 | else if(!strcmp(feature, "urn:xmpp:delay")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
925 | feature = _("Delayed Delivery"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
926 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0204.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
927 | feature = _("Collaborative Data Objects"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
928 | else if(!strcmp(feature, "http://jabber.org/protocol/fileshare")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
929 | feature = _("File Repository and Sharing"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
930 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0215.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
931 | feature = _("STUN Service Discovery for Jingle"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
932 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0116.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
933 | feature = _("Simplified Encrypted Session Negotiation"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
934 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0219.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
935 | feature = _("Hop Check"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
936 | else if(g_str_has_suffix(feature, "+notify")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
937 | feature = NULL; |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
938 | if(feature) |
|
19921
d920ce72002e
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
939 | g_string_append_printf(tmp, "%s<br/>", feature); |
|
18798
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
940 | } |
|
19921
d920ce72002e
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
941 | |
|
18798
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
942 | if(strlen(tmp->str) > 0) |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
943 | purple_notify_user_info_prepend_pair(user_info, _("Capabilities"), tmp->str); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
944 | |
|
18798
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
945 | g_string_free(tmp, TRUE); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
946 | } |
|
19921
d920ce72002e
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
947 | #endif |
| 7014 | 948 | } else { |
|
24816
bd870d9ff0ab
The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents:
24589
diff
changeset
|
949 | gboolean multiple_resources = jbi->jb->resources && jbi->jb->resources->next; |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
950 | |
| 13794 | 951 | for(resources = jbi->jb->resources; resources; resources = resources->next) { |
|
23404
836828ff554c
Remove compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23393
diff
changeset
|
952 | char *purdy = NULL; |
|
836828ff554c
Remove compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23393
diff
changeset
|
953 | const char *status_name = NULL; |
|
836828ff554c
Remove compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23393
diff
changeset
|
954 | |
| 7014 | 955 | jbr = resources->data; |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
956 | |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
957 | if(jbr->client.name) { |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
958 | tmp = g_strdup_printf("%s%s%s", jbr->client.name, |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
959 | (jbr->client.version ? " " : ""), |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
960 | (jbr->client.version ? jbr->client.version : "")); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
961 | purple_notify_user_info_prepend_pair(user_info, |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
962 | _("Client"), tmp); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
963 | g_free(tmp); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
964 | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
965 | if(jbr->client.os) { |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
966 | purple_notify_user_info_prepend_pair(user_info, _("Operating System"), jbr->client.os); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
967 | } |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
968 | } |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
969 | |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
970 | if(jbr->name && (jbir = g_hash_table_lookup(jbi->resources, jbr->name))) { |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
971 | if(jbir->idle_seconds > 0) { |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
972 | char *idle = purple_str_seconds_to_string(jbir->idle_seconds); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
973 | purple_notify_user_info_prepend_pair(user_info, _("Idle"), idle); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
974 | g_free(idle); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
975 | } |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
976 | } |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
977 | |
|
23393
7b640ff909dc
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evands@pidgin.im>
parents:
23367
diff
changeset
|
978 | status_name = jabber_buddy_state_get_name(jbr->state); |
| 7145 | 979 | if(jbr->status) |
| 15884 | 980 | purdy = purple_strdup_withhtml(jbr->status); |
|
23393
7b640ff909dc
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evands@pidgin.im>
parents:
23367
diff
changeset
|
981 | if(status_name && purdy && !strcmp(status_name, purdy)) |
|
7b640ff909dc
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evands@pidgin.im>
parents:
23367
diff
changeset
|
982 | status_name = NULL; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
983 | |
|
23393
7b640ff909dc
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evands@pidgin.im>
parents:
23367
diff
changeset
|
984 | tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""), |
|
7b640ff909dc
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evands@pidgin.im>
parents:
23367
diff
changeset
|
985 | ((status_name && purdy) ? ": " : ""), |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15143
diff
changeset
|
986 | (purdy ? purdy : "")); |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
987 | purple_notify_user_info_prepend_pair(user_info, _("Status"), tmp); |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15143
diff
changeset
|
988 | g_free(tmp); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15143
diff
changeset
|
989 | g_free(purdy); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
990 | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
991 | if(multiple_resources) { |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
992 | tmp = g_strdup_printf("%d", jbr->priority); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
993 | purple_notify_user_info_prepend_pair(user_info, _("Priority"), tmp); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
994 | g_free(tmp); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
995 | } |
| 13794 | 996 | |
|
15092
e7c5edee202e
[gaim-migrate @ 17813]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
14669
diff
changeset
|
997 | if(jbr->name) |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
998 | purple_notify_user_info_prepend_pair(user_info, _("Resource"), jbr->name); |
|
19921
d920ce72002e
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
999 | #if 0 |
|
18798
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1000 | if(jbr && jbr->caps) { |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1001 | GString *tmp = g_string_new(""); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1002 | GList *iter; |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1003 | for(iter = jbr->caps->features; iter; iter = g_list_next(iter)) { |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1004 | const char *feature = iter->data; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1005 | |
|
18798
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1006 | if(!strcmp(feature, "jabber:iq:last")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1007 | feature = _("Last Activity"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1008 | else if(!strcmp(feature, "http://jabber.org/protocol/disco#info")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1009 | feature = _("Service Discovery Info"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1010 | else if(!strcmp(feature, "http://jabber.org/protocol/disco#items")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1011 | feature = _("Service Discovery Items"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1012 | else if(!strcmp(feature, "http://jabber.org/protocol/address")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1013 | feature = _("Extended Stanza Addressing"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1014 | else if(!strcmp(feature, "http://jabber.org/protocol/muc")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1015 | feature = _("Multi-User Chat"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1016 | else if(!strcmp(feature, "http://jabber.org/protocol/muc#user")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1017 | feature = _("Multi-User Chat Extended Presence Information"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1018 | else if(!strcmp(feature, "http://jabber.org/protocol/ibb")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1019 | feature = _("In-Band Bytestreams"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1020 | else if(!strcmp(feature, "http://jabber.org/protocol/commands")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1021 | feature = _("Ad-Hoc Commands"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1022 | else if(!strcmp(feature, "http://jabber.org/protocol/pubsub")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1023 | feature = _("PubSub Service"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1024 | else if(!strcmp(feature, "http://jabber.org/protocol/bytestreams")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1025 | feature = _("SOCKS5 Bytestreams"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1026 | else if(!strcmp(feature, "jabber:x:oob")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1027 | feature = _("Out of Band Data"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1028 | else if(!strcmp(feature, "http://jabber.org/protocol/xhtml-im")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1029 | feature = _("XHTML-IM"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1030 | else if(!strcmp(feature, "jabber:iq:register")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1031 | feature = _("In-Band Registration"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1032 | else if(!strcmp(feature, "http://jabber.org/protocol/geoloc")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1033 | feature = _("User Location"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1034 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0084.html")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1035 | feature = _("User Avatar"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1036 | else if(!strcmp(feature, "http://jabber.org/protocol/chatstates")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1037 | feature = _("Chat State Notifications"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1038 | else if(!strcmp(feature, "jabber:iq:version")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1039 | feature = _("Software Version"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1040 | else if(!strcmp(feature, "http://jabber.org/protocol/si")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1041 | feature = _("Stream Initiation"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1042 | else if(!strcmp(feature, "http://jabber.org/protocol/si/profile/file-transfer")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1043 | feature = _("File Transfer"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1044 | else if(!strcmp(feature, "http://jabber.org/protocol/mood")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1045 | feature = _("User Mood"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1046 | else if(!strcmp(feature, "http://jabber.org/protocol/activity")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1047 | feature = _("User Activity"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1048 | else if(!strcmp(feature, "http://jabber.org/protocol/caps")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1049 | feature = _("Entity Capabilities"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1050 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0116.html")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1051 | feature = _("Encrypted Session Negotiations"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1052 | else if(!strcmp(feature, "http://jabber.org/protocol/tune")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1053 | feature = _("User Tune"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1054 | else if(!strcmp(feature, "http://jabber.org/protocol/rosterx")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1055 | feature = _("Roster Item Exchange"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1056 | else if(!strcmp(feature, "http://jabber.org/protocol/reach")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1057 | feature = _("Reachability Address"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1058 | else if(!strcmp(feature, "http://jabber.org/protocol/profile")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1059 | feature = _("User Profile"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1060 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0166.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1061 | feature = _("Jingle"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1062 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0167.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1063 | feature = _("Jingle Audio"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1064 | else if(!strcmp(feature, "http://jabber.org/protocol/nick")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1065 | feature = _("User Nickname"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1066 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0176.html#ns-udp")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1067 | feature = _("Jingle ICE UDP"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1068 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0176.html#ns-tcp")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1069 | feature = _("Jingle ICE TCP"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1070 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0177.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1071 | feature = _("Jingle Raw UDP"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1072 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0180.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1073 | feature = _("Jingle Video"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1074 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0181.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1075 | feature = _("Jingle DTMF"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1076 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0184.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1077 | feature = _("Message Receipts"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1078 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0189.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1079 | feature = _("Public Key Publishing"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1080 | else if(!strcmp(feature, "http://jabber.org/protocol/chatting")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1081 | feature = _("User Chatting"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1082 | else if(!strcmp(feature, "http://jabber.org/protocol/browsing")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1083 | feature = _("User Browsing"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1084 | else if(!strcmp(feature, "http://jabber.org/protocol/gaming")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1085 | feature = _("User Gaming"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1086 | else if(!strcmp(feature, "http://jabber.org/protocol/viewing")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1087 | feature = _("User Viewing"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1088 | else if(!strcmp(feature, "urn:xmpp:ping") || !strcmp(feature, "http://www.xmpp.org/extensions/xep-0199.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1089 | feature = _("Ping"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1090 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0200.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1091 | feature = _("Stanza Encryption"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1092 | else if(!strcmp(feature, "urn:xmpp:time")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1093 | feature = _("Entity Time"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1094 | else if(!strcmp(feature, "urn:xmpp:delay")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1095 | feature = _("Delayed Delivery"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1096 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0204.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1097 | feature = _("Collaborative Data Objects"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1098 | else if(!strcmp(feature, "http://jabber.org/protocol/fileshare")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1099 | feature = _("File Repository and Sharing"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1100 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0215.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1101 | feature = _("STUN Service Discovery for Jingle"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1102 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0116.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1103 | feature = _("Simplified Encrypted Session Negotiation"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1104 | else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0219.html#ns")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1105 | feature = _("Hop Check"); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1106 | else if(g_str_has_suffix(feature, "+notify")) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1107 | feature = NULL; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1108 | |
|
18798
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1109 | if(feature) |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1110 | g_string_append_printf(tmp, "%s\n", feature); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1111 | } |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1112 | if(strlen(tmp->str) > 0) |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1113 | purple_notify_user_info_prepend_pair(user_info, _("Capabilities"), tmp->str); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1114 | |
|
18798
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1115 | g_string_free(tmp, TRUE); |
|
148a6c45b6f7
Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
Andreas Monitzer <am@adiumx.com>
parents:
18718
diff
changeset
|
1116 | } |
|
19921
d920ce72002e
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
1117 | #endif |
| 7014 | 1118 | } |
| 1119 | } | |
| 1120 | ||
| 7306 | 1121 | g_free(resource_name); |
| 1122 | ||
| 15884 | 1123 | purple_notify_userinfo(jbi->js->gc, jbi->jid, user_info, NULL, NULL); |
| 13794 | 1124 | |
| 1125 | while(jbi->vcard_imgids) { | |
|
16437
7ff7c3405ea2
Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
1126 | purple_imgstore_unref_by_id(GPOINTER_TO_INT(jbi->vcard_imgids->data)); |
| 13794 | 1127 | jbi->vcard_imgids = g_slist_delete_link(jbi->vcard_imgids, jbi->vcard_imgids); |
| 1128 | } | |
| 1129 | ||
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1130 | jbi->js->pending_buddy_info_requests = g_slist_remove(jbi->js->pending_buddy_info_requests, jbi); |
|
14155
c754f6e5be1f
[gaim-migrate @ 16719]
Mark Doliner <markdoliner@pidgin.im>
parents:
14130
diff
changeset
|
1131 | |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1132 | jabber_buddy_info_destroy(jbi); |
| 13794 | 1133 | } |
| 1134 | ||
| 1135 | static void jabber_buddy_info_remove_id(JabberBuddyInfo *jbi, const char *id) | |
| 1136 | { | |
| 1137 | GSList *l = jbi->ids; | |
|
15727
0754583ceeae
Don't access the list element after it has been freed.
Daniel Atallah <datallah@pidgin.im>
parents:
15688
diff
changeset
|
1138 | char *comp_id; |
| 13794 | 1139 | |
| 1140 | if(!id) | |
| 1141 | return; | |
| 1142 | ||
| 1143 | while(l) { | |
|
15727
0754583ceeae
Don't access the list element after it has been freed.
Daniel Atallah <datallah@pidgin.im>
parents:
15688
diff
changeset
|
1144 | comp_id = l->data; |
|
0754583ceeae
Don't access the list element after it has been freed.
Daniel Atallah <datallah@pidgin.im>
parents:
15688
diff
changeset
|
1145 | if(!strcmp(id, comp_id)) { |
|
0754583ceeae
Don't access the list element after it has been freed.
Daniel Atallah <datallah@pidgin.im>
parents:
15688
diff
changeset
|
1146 | jbi->ids = g_slist_remove(jbi->ids, comp_id); |
|
0754583ceeae
Don't access the list element after it has been freed.
Daniel Atallah <datallah@pidgin.im>
parents:
15688
diff
changeset
|
1147 | g_free(comp_id); |
| 13794 | 1148 | return; |
| 1149 | } | |
| 1150 | l = l->next; | |
| 1151 | } | |
| 1152 | } | |
| 1153 | ||
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1154 | static void jabber_vcard_save_mine(JabberStream *js, xmlnode *packet, gpointer data) |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1155 | { |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1156 | xmlnode *vcard; |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1157 | char *txt; |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1158 | PurpleStoredImage *img; |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1159 | |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1160 | if((vcard = xmlnode_get_child(packet, "vCard")) || |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1161 | (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1162 | { |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1163 | txt = xmlnode_to_str(vcard, NULL); |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1164 | purple_account_set_user_info(purple_connection_get_account(js->gc), txt); |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1165 | |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1166 | g_free(txt); |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1167 | } else { |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1168 | /* if we have no vCard, then lets not overwrite what we might have locally */ |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1169 | } |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1170 | |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1171 | js->vcard_fetched = TRUE; |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1172 | |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1173 | if(NULL != (img = purple_buddy_icons_find_account_icon(js->gc->account))) { |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1174 | jabber_set_buddy_icon(js->gc, img); |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1175 | purple_imgstore_unref(img); |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1176 | } |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1177 | } |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1178 | |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1179 | void jabber_vcard_fetch_mine(JabberStream *js) |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1180 | { |
|
21957
0ce77f86c7f3
Fix XMPP buddy icons. Somehow a 'VCard' element got changed to a query
Sean Egan <seanegan@pidgin.im>
parents:
21681
diff
changeset
|
1181 | JabberIq *iq = jabber_iq_new(js, JABBER_IQ_GET); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1182 | |
|
21957
0ce77f86c7f3
Fix XMPP buddy icons. Somehow a 'VCard' element got changed to a query
Sean Egan <seanegan@pidgin.im>
parents:
21681
diff
changeset
|
1183 | xmlnode *vcard = xmlnode_new_child(iq->node, "vCard"); |
|
0ce77f86c7f3
Fix XMPP buddy icons. Somehow a 'VCard' element got changed to a query
Sean Egan <seanegan@pidgin.im>
parents:
21681
diff
changeset
|
1184 | xmlnode_set_namespace(vcard, "vcard-temp"); |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1185 | jabber_iq_set_callback(iq, jabber_vcard_save_mine, NULL); |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1186 | |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1187 | jabber_iq_send(iq); |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1188 | } |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1189 | |
| 13794 | 1190 | static void jabber_vcard_parse(JabberStream *js, xmlnode *packet, gpointer data) |
| 1191 | { | |
|
14129
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
1192 | const char *id, *from; |
| 13794 | 1193 | char *bare_jid; |
| 1194 | char *text; | |
|
22586
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1195 | char *serverside_alias = NULL; |
| 13794 | 1196 | xmlnode *vcard; |
| 15884 | 1197 | PurpleBuddy *b; |
| 13794 | 1198 | JabberBuddyInfo *jbi = data; |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1199 | PurpleNotifyUserInfo *user_info; |
| 13794 | 1200 | |
| 1201 | from = xmlnode_get_attrib(packet, "from"); | |
| 1202 | id = xmlnode_get_attrib(packet, "id"); | |
| 1203 | ||
| 1204 | if(!jbi) | |
| 1205 | return; | |
| 1206 | ||
|
14129
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
1207 | jabber_buddy_info_remove_id(jbi, id); |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
1208 | |
| 13794 | 1209 | if(!from) |
| 1210 | return; | |
| 1211 | ||
|
14129
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
1212 | if(!jabber_buddy_find(js, from, FALSE)) |
| 13794 | 1213 | return; |
| 1214 | ||
| 1215 | /* XXX: handle the error case */ | |
| 1216 | ||
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1217 | user_info = jbi->user_info; |
| 13794 | 1218 | bare_jid = jabber_get_bare_jid(from); |
| 1219 | ||
| 15884 | 1220 | b = purple_find_buddy(js->gc->account, bare_jid); |
| 13794 | 1221 | |
| 10189 | 1222 | if((vcard = xmlnode_get_child(packet, "vCard")) || |
| 1223 | (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) { | |
| 7014 | 1224 | xmlnode *child; |
| 1225 | for(child = vcard->child; child; child = child->next) | |
| 1226 | { | |
| 1227 | xmlnode *child2; | |
| 1228 | ||
| 8135 | 1229 | if(child->type != XMLNODE_TYPE_TAG) |
| 7014 | 1230 | continue; |
| 1231 | ||
| 1232 | text = xmlnode_get_data(child); | |
| 1233 | if(text && !strcmp(child->name, "FN")) { | |
|
22586
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1234 | if (!serverside_alias) |
|
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1235 | serverside_alias = g_strdup(text); |
|
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1236 | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1237 | purple_notify_user_info_add_pair(user_info, _("Full Name"), text); |
| 7014 | 1238 | } else if(!strcmp(child->name, "N")) { |
| 1239 | for(child2 = child->child; child2; child2 = child2->next) | |
| 1240 | { | |
| 1241 | char *text2; | |
| 1242 | ||
| 8135 | 1243 | if(child2->type != XMLNODE_TYPE_TAG) |
| 7014 | 1244 | continue; |
| 1245 | ||
| 1246 | text2 = xmlnode_get_data(child2); | |
| 1247 | if(text2 && !strcmp(child2->name, "FAMILY")) { | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1248 | purple_notify_user_info_add_pair(user_info, _("Family Name"), text2); |
| 7014 | 1249 | } else if(text2 && !strcmp(child2->name, "GIVEN")) { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1250 | purple_notify_user_info_add_pair(user_info, _("Given Name"), text2); |
| 7014 | 1251 | } else if(text2 && !strcmp(child2->name, "MIDDLE")) { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1252 | purple_notify_user_info_add_pair(user_info, _("Middle Name"), text2); |
| 7014 | 1253 | } |
| 1254 | g_free(text2); | |
| 1255 | } | |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1256 | } else if(text && !strcmp(child->name, "NICKNAME")) { |
|
24200
6c6870d15155
Ignore nicknames which are just the user portion of the JID, as these aren't useful. Instead, prefer the fullname in that situation for serverside alias purposes.
Evan Schoenberg <evands@pidgin.im>
parents:
24012
diff
changeset
|
1257 | /* Prefer the Nickcname to the Full Name as the serverside alias if it's not just part of the jid. |
|
6c6870d15155
Ignore nicknames which are just the user portion of the JID, as these aren't useful. Instead, prefer the fullname in that situation for serverside alias purposes.
Evan Schoenberg <evands@pidgin.im>
parents:
24012
diff
changeset
|
1258 | * Ignore it if it's part of the jid. */ |
|
6c6870d15155
Ignore nicknames which are just the user portion of the JID, as these aren't useful. Instead, prefer the fullname in that situation for serverside alias purposes.
Evan Schoenberg <evands@pidgin.im>
parents:
24012
diff
changeset
|
1259 | if (strstr(bare_jid, text) == NULL) { |
|
6c6870d15155
Ignore nicknames which are just the user portion of the JID, as these aren't useful. Instead, prefer the fullname in that situation for serverside alias purposes.
Evan Schoenberg <evands@pidgin.im>
parents:
24012
diff
changeset
|
1260 | g_free(serverside_alias); |
|
6c6870d15155
Ignore nicknames which are just the user portion of the JID, as these aren't useful. Instead, prefer the fullname in that situation for serverside alias purposes.
Evan Schoenberg <evands@pidgin.im>
parents:
24012
diff
changeset
|
1261 | serverside_alias = g_strdup(text); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1262 | |
|
24200
6c6870d15155
Ignore nicknames which are just the user portion of the JID, as these aren't useful. Instead, prefer the fullname in that situation for serverside alias purposes.
Evan Schoenberg <evands@pidgin.im>
parents:
24012
diff
changeset
|
1263 | purple_notify_user_info_add_pair(user_info, _("Nickname"), text); |
|
6c6870d15155
Ignore nicknames which are just the user portion of the JID, as these aren't useful. Instead, prefer the fullname in that situation for serverside alias purposes.
Evan Schoenberg <evands@pidgin.im>
parents:
24012
diff
changeset
|
1264 | } |
| 7014 | 1265 | } else if(text && !strcmp(child->name, "BDAY")) { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1266 | purple_notify_user_info_add_pair(user_info, _("Birthday"), text); |
| 7014 | 1267 | } else if(!strcmp(child->name, "ADR")) { |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1268 | gboolean address_line_added = FALSE; |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1269 | |
| 7014 | 1270 | for(child2 = child->child; child2; child2 = child2->next) |
| 1271 | { | |
| 1272 | char *text2; | |
| 1273 | ||
| 8135 | 1274 | if(child2->type != XMLNODE_TYPE_TAG) |
| 7014 | 1275 | continue; |
| 1276 | ||
| 1277 | text2 = xmlnode_get_data(child2); | |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1278 | if (text2 == NULL) |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1279 | continue; |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1280 | |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1281 | /* We do this here so that it's not added if all the child |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1282 | * elements are empty. */ |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1283 | if (!address_line_added) |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1284 | { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1285 | purple_notify_user_info_add_section_header(user_info, _("Address")); |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1286 | address_line_added = TRUE; |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1287 | } |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1288 | |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1289 | if(!strcmp(child2->name, "POBOX")) { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1290 | purple_notify_user_info_add_pair(user_info, _("P.O. Box"), text2); |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1291 | } else if(!strcmp(child2->name, "EXTADR")) { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1292 | purple_notify_user_info_add_pair(user_info, _("Extended Address"), text2); |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1293 | } else if(!strcmp(child2->name, "STREET")) { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1294 | purple_notify_user_info_add_pair(user_info, _("Street Address"), text2); |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1295 | } else if(!strcmp(child2->name, "LOCALITY")) { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1296 | purple_notify_user_info_add_pair(user_info, _("Locality"), text2); |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1297 | } else if(!strcmp(child2->name, "REGION")) { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1298 | purple_notify_user_info_add_pair(user_info, _("Region"), text2); |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1299 | } else if(!strcmp(child2->name, "PCODE")) { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1300 | purple_notify_user_info_add_pair(user_info, _("Postal Code"), text2); |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1301 | } else if(!strcmp(child2->name, "CTRY") |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1302 | || !strcmp(child2->name, "COUNTRY")) { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1303 | purple_notify_user_info_add_pair(user_info, _("Country"), text2); |
| 7014 | 1304 | } |
| 1305 | g_free(text2); | |
| 1306 | } | |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1307 | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1308 | if (address_line_added) |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1309 | purple_notify_user_info_add_section_break(user_info); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1310 | |
| 7014 | 1311 | } else if(!strcmp(child->name, "TEL")) { |
| 1312 | char *number; | |
| 1313 | if((child2 = xmlnode_get_child(child, "NUMBER"))) { | |
| 1314 | /* show what kind of number it is */ | |
| 1315 | number = xmlnode_get_data(child2); | |
| 1316 | if(number) { | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1317 | purple_notify_user_info_add_pair(user_info, _("Telephone"), number); |
| 7014 | 1318 | g_free(number); |
| 1319 | } | |
| 1320 | } else if((number = xmlnode_get_data(child))) { | |
| 15884 | 1321 | /* lots of clients (including purple) do this, but it's |
| 7014 | 1322 | * out of spec */ |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1323 | purple_notify_user_info_add_pair(user_info, _("Telephone"), number); |
| 7014 | 1324 | g_free(number); |
| 1325 | } | |
| 1326 | } else if(!strcmp(child->name, "EMAIL")) { | |
|
19931
229fb62285b0
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <markdoliner@pidgin.im>
parents:
19921
diff
changeset
|
1327 | char *userid, *escaped; |
| 7014 | 1328 | if((child2 = xmlnode_get_child(child, "USERID"))) { |
| 1329 | /* show what kind of email it is */ | |
| 1330 | userid = xmlnode_get_data(child2); | |
| 1331 | if(userid) { | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1332 | char *mailto; |
|
19931
229fb62285b0
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <markdoliner@pidgin.im>
parents:
19921
diff
changeset
|
1333 | escaped = g_markup_escape_text(userid, -1); |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1334 | mailto = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", escaped, escaped); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1335 | purple_notify_user_info_add_pair(user_info, _("Email"), mailto); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1336 | |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1337 | g_free(mailto); |
|
19931
229fb62285b0
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <markdoliner@pidgin.im>
parents:
19921
diff
changeset
|
1338 | g_free(escaped); |
| 7014 | 1339 | g_free(userid); |
| 1340 | } | |
| 1341 | } else if((userid = xmlnode_get_data(child))) { | |
| 15884 | 1342 | /* lots of clients (including purple) do this, but it's |
| 7014 | 1343 | * out of spec */ |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1344 | char *mailto; |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1345 | |
|
19931
229fb62285b0
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <markdoliner@pidgin.im>
parents:
19921
diff
changeset
|
1346 | escaped = g_markup_escape_text(userid, -1); |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1347 | mailto = g_strdup_printf("<a href=\"mailto:%s\">%s</a>", escaped, escaped); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1348 | purple_notify_user_info_add_pair(user_info, _("Email"), mailto); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1349 | |
|
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1350 | g_free(mailto); |
|
19931
229fb62285b0
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <markdoliner@pidgin.im>
parents:
19921
diff
changeset
|
1351 | g_free(escaped); |
| 7014 | 1352 | g_free(userid); |
| 1353 | } | |
| 1354 | } else if(!strcmp(child->name, "ORG")) { | |
| 1355 | for(child2 = child->child; child2; child2 = child2->next) | |
| 1356 | { | |
| 1357 | char *text2; | |
| 1358 | ||
| 8135 | 1359 | if(child2->type != XMLNODE_TYPE_TAG) |
| 7014 | 1360 | continue; |
| 1361 | ||
| 1362 | text2 = xmlnode_get_data(child2); | |
| 1363 | if(text2 && !strcmp(child2->name, "ORGNAME")) { | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1364 | purple_notify_user_info_add_pair(user_info, _("Organization Name"), text2); |
| 7014 | 1365 | } else if(text2 && !strcmp(child2->name, "ORGUNIT")) { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1366 | purple_notify_user_info_add_pair(user_info, _("Organization Unit"), text2); |
| 7014 | 1367 | } |
| 1368 | g_free(text2); | |
| 1369 | } | |
| 1370 | } else if(text && !strcmp(child->name, "TITLE")) { | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1371 | purple_notify_user_info_add_pair(user_info, _("Title"), text); |
| 7014 | 1372 | } else if(text && !strcmp(child->name, "ROLE")) { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1373 | purple_notify_user_info_add_pair(user_info, _("Role"), text); |
| 7014 | 1374 | } else if(text && !strcmp(child->name, "DESC")) { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1375 | purple_notify_user_info_add_pair(user_info, _("Description"), text); |
| 7076 | 1376 | } else if(!strcmp(child->name, "PHOTO") || |
| 1377 | !strcmp(child->name, "LOGO")) { | |
| 10941 | 1378 | char *bintext = NULL; |
| 1379 | xmlnode *binval; | |
| 11361 | 1380 | |
| 1381 | if( ((binval = xmlnode_get_child(child, "BINVAL")) && | |
| 1382 | (bintext = xmlnode_get_data(binval))) || | |
| 1383 | (bintext = xmlnode_get_data(child))) { | |
|
11127
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10941
diff
changeset
|
1384 | gsize size; |
|
11137
cf40226ddff7
[gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents:
11127
diff
changeset
|
1385 | guchar *data; |
| 10941 | 1386 | gboolean photo = (strcmp(child->name, "PHOTO") == 0); |
| 10189 | 1387 | |
| 15884 | 1388 | data = purple_base64_decode(bintext, &size); |
|
16587
50de12a4b81b
disapproval of revision 'f95b376c0d2f066996620c5bb595dc71b5ee22d9'
Richard Laager <rlaager@pidgin.im>
parents:
16585
diff
changeset
|
1389 | if (data) { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1390 | char *img_text; |
|
25110
40b3fffdb00b
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <darkrain42@pidgin.im>
parents:
25109
diff
changeset
|
1391 | char *hash; |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1392 | |
|
16587
50de12a4b81b
disapproval of revision 'f95b376c0d2f066996620c5bb595dc71b5ee22d9'
Richard Laager <rlaager@pidgin.im>
parents:
16585
diff
changeset
|
1393 | jbi->vcard_imgids = g_slist_prepend(jbi->vcard_imgids, GINT_TO_POINTER(purple_imgstore_add_with_id(g_memdup(data, size), size, "logo.png"))); |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1394 | img_text = g_strdup_printf("<img id='%d'>", GPOINTER_TO_INT(jbi->vcard_imgids->data)); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1395 | |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1396 | purple_notify_user_info_add_pair(user_info, (photo ? _("Photo") : _("Logo")), img_text); |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1397 | |
|
25110
40b3fffdb00b
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <darkrain42@pidgin.im>
parents:
25109
diff
changeset
|
1398 | hash = jabber_calculate_data_sha1sum(data, size); |
|
16587
50de12a4b81b
disapproval of revision 'f95b376c0d2f066996620c5bb595dc71b5ee22d9'
Richard Laager <rlaager@pidgin.im>
parents:
16585
diff
changeset
|
1399 | purple_buddy_icons_set_for_user(js->gc->account, bare_jid, |
|
50de12a4b81b
disapproval of revision 'f95b376c0d2f066996620c5bb595dc71b5ee22d9'
Richard Laager <rlaager@pidgin.im>
parents:
16585
diff
changeset
|
1400 | data, size, hash); |
|
25110
40b3fffdb00b
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <darkrain42@pidgin.im>
parents:
25109
diff
changeset
|
1401 | g_free(hash); |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1402 | g_free(img_text); |
|
16587
50de12a4b81b
disapproval of revision 'f95b376c0d2f066996620c5bb595dc71b5ee22d9'
Richard Laager <rlaager@pidgin.im>
parents:
16585
diff
changeset
|
1403 | } |
|
25110
40b3fffdb00b
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <darkrain42@pidgin.im>
parents:
25109
diff
changeset
|
1404 | g_free(bintext); |
| 10941 | 1405 | } |
| 7014 | 1406 | } |
| 1407 | g_free(text); | |
| 1408 | } | |
| 1409 | } | |
| 1410 | ||
|
22586
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1411 | if (serverside_alias) { |
|
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1412 | /* If we found a serverside alias, set it and tell the core */ |
|
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1413 | serv_got_alias(js->gc, from, serverside_alias); |
|
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1414 | if (b) { |
|
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1415 | purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", serverside_alias); |
|
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1416 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1417 | |
|
22586
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1418 | g_free(serverside_alias); |
|
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1419 | } |
|
ae2d0016b91e
If we receive a Full Name and no nickname, use the Full Name as the serverside alias for an XMPP contact. If we receive just a nickname or both a full name and a nickname, prefer the nickname.
Evan Schoenberg <evands@pidgin.im>
parents:
22550
diff
changeset
|
1420 | |
| 13794 | 1421 | g_free(bare_jid); |
| 1422 | ||
| 1423 | jabber_buddy_info_show_if_ready(jbi); | |
| 1424 | } | |
| 1425 | ||
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1426 | typedef struct _JabberBuddyAvatarUpdateURLInfo { |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1427 | JabberStream *js; |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1428 | char *from; |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1429 | char *id; |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1430 | } JabberBuddyAvatarUpdateURLInfo; |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1431 | |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1432 | static void do_buddy_avatar_update_fromurl(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message) { |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1433 | JabberBuddyAvatarUpdateURLInfo *info = user_data; |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1434 | if(!url_text) { |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1435 | purple_debug(PURPLE_DEBUG_ERROR, "jabber", |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1436 | "do_buddy_avatar_update_fromurl got error \"%s\"", error_message); |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1437 | return; |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1438 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1439 | |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1440 | purple_buddy_icons_set_for_user(purple_connection_get_account(info->js->gc), info->from, (void*)url_text, len, info->id); |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1441 | g_free(info->from); |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1442 | g_free(info->id); |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1443 | g_free(info); |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1444 | } |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1445 | |
|
17789
f75d542850e3
Turns out the example in XEP-0084 is wrong. Fixed my implementation to not try to work around an issue that isn't one.
Andreas Monitzer <am@adiumx.com>
parents:
17788
diff
changeset
|
1446 | static void do_buddy_avatar_update_data(JabberStream *js, const char *from, xmlnode *items) { |
|
f75d542850e3
Turns out the example in XEP-0084 is wrong. Fixed my implementation to not try to work around an issue that isn't one.
Andreas Monitzer <am@adiumx.com>
parents:
17788
diff
changeset
|
1447 | xmlnode *item, *data; |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1448 | const char *checksum; |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1449 | char *b64data; |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1450 | void *img; |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1451 | size_t size; |
|
17789
f75d542850e3
Turns out the example in XEP-0084 is wrong. Fixed my implementation to not try to work around an issue that isn't one.
Andreas Monitzer <am@adiumx.com>
parents:
17788
diff
changeset
|
1452 | if(!items) |
|
f75d542850e3
Turns out the example in XEP-0084 is wrong. Fixed my implementation to not try to work around an issue that isn't one.
Andreas Monitzer <am@adiumx.com>
parents:
17788
diff
changeset
|
1453 | return; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1454 | |
|
17789
f75d542850e3
Turns out the example in XEP-0084 is wrong. Fixed my implementation to not try to work around an issue that isn't one.
Andreas Monitzer <am@adiumx.com>
parents:
17788
diff
changeset
|
1455 | item = xmlnode_get_child(items, "item"); |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1456 | if(!item) |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1457 | return; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1458 | |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1459 | data = xmlnode_get_child_with_namespace(item,"data",AVATARNAMESPACEDATA); |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1460 | if(!data) |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1461 | return; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1462 | |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1463 | checksum = xmlnode_get_attrib(item,"id"); |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1464 | if(!checksum) |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1465 | return; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1466 | |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1467 | b64data = xmlnode_get_data(data); |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1468 | if(!b64data) |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1469 | return; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1470 | |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1471 | img = purple_base64_decode(b64data, &size); |
|
20320
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19963
diff
changeset
|
1472 | if(!img) { |
|
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19963
diff
changeset
|
1473 | g_free(b64data); |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1474 | return; |
|
20320
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19963
diff
changeset
|
1475 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1476 | |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1477 | purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, img, size, checksum); |
|
20320
6337e101f6ab
Plug some memory leaks.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19963
diff
changeset
|
1478 | g_free(b64data); |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1479 | } |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1480 | |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
1481 | void jabber_buddy_avatar_update_metadata(JabberStream *js, const char *from, xmlnode *items) { |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1482 | PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(js->gc), from); |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1483 | const char *checksum; |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1484 | xmlnode *item, *metadata; |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1485 | if(!buddy) |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1486 | return; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1487 | |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1488 | checksum = purple_buddy_icons_get_checksum_for_user(buddy); |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1489 | item = xmlnode_get_child(items,"item"); |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1490 | metadata = xmlnode_get_child_with_namespace(item, "metadata", AVATARNAMESPACEMETA); |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1491 | if(!metadata) |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1492 | return; |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1493 | /* check if we have received a stop */ |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1494 | if(xmlnode_get_child(metadata, "stop")) { |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1495 | purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, NULL, 0, NULL); |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1496 | } else { |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1497 | xmlnode *info, *goodinfo = NULL; |
|
25109
50e793b5d621
Support an empty <metadata/> element to indicate that a user has no XEP-0084
Paul Aurich <darkrain42@pidgin.im>
parents:
24829
diff
changeset
|
1498 | gboolean has_children = FALSE; |
|
50e793b5d621
Support an empty <metadata/> element to indicate that a user has no XEP-0084
Paul Aurich <darkrain42@pidgin.im>
parents:
24829
diff
changeset
|
1499 | |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1500 | /* iterate over all info nodes to get one we can use */ |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1501 | for(info = metadata->child; info; info = info->next) { |
|
25109
50e793b5d621
Support an empty <metadata/> element to indicate that a user has no XEP-0084
Paul Aurich <darkrain42@pidgin.im>
parents:
24829
diff
changeset
|
1502 | if(info->type == XMLNODE_TYPE_TAG) |
|
50e793b5d621
Support an empty <metadata/> element to indicate that a user has no XEP-0084
Paul Aurich <darkrain42@pidgin.im>
parents:
24829
diff
changeset
|
1503 | has_children = TRUE; |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1504 | if(info->type == XMLNODE_TYPE_TAG && !strcmp(info->name,"info")) { |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1505 | const char *type = xmlnode_get_attrib(info,"type"); |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1506 | const char *id = xmlnode_get_attrib(info,"id"); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1507 | |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1508 | if(checksum && id && !strcmp(id, checksum)) { |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1509 | /* we already have that avatar, so we don't have to do anything */ |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1510 | goodinfo = NULL; |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1511 | break; |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1512 | } |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1513 | /* We'll only pick the png one for now. It's a very nice image format anyways. */ |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1514 | if(type && id && !goodinfo && !strcmp(type, "image/png")) |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1515 | goodinfo = info; |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1516 | } |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1517 | } |
|
25109
50e793b5d621
Support an empty <metadata/> element to indicate that a user has no XEP-0084
Paul Aurich <darkrain42@pidgin.im>
parents:
24829
diff
changeset
|
1518 | if(has_children == FALSE) { |
|
50e793b5d621
Support an empty <metadata/> element to indicate that a user has no XEP-0084
Paul Aurich <darkrain42@pidgin.im>
parents:
24829
diff
changeset
|
1519 | purple_buddy_icons_set_for_user(purple_connection_get_account(js->gc), from, NULL, 0, NULL); |
|
50e793b5d621
Support an empty <metadata/> element to indicate that a user has no XEP-0084
Paul Aurich <darkrain42@pidgin.im>
parents:
24829
diff
changeset
|
1520 | } else if(goodinfo) { |
|
24012
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23501
diff
changeset
|
1521 | const char *url = xmlnode_get_attrib(goodinfo, "url"); |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1522 | const char *id = xmlnode_get_attrib(goodinfo,"id"); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1523 | |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1524 | /* the avatar might either be stored in a pep node, or on a HTTP/HTTPS URL */ |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1525 | if(!url) |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1526 | jabber_pep_request_item(js, from, AVATARNAMESPACEDATA, id, do_buddy_avatar_update_data); |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1527 | else { |
|
24012
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23501
diff
changeset
|
1528 | PurpleUtilFetchUrlData *url_data; |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1529 | JabberBuddyAvatarUpdateURLInfo *info = g_new0(JabberBuddyAvatarUpdateURLInfo, 1); |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1530 | info->js = js; |
|
24012
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23501
diff
changeset
|
1531 | |
|
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23501
diff
changeset
|
1532 | url_data = purple_util_fetch_url_len(url, TRUE, NULL, TRUE, |
|
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23501
diff
changeset
|
1533 | MAX_HTTP_BUDDYICON_BYTES, |
|
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23501
diff
changeset
|
1534 | do_buddy_avatar_update_fromurl, info); |
|
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23501
diff
changeset
|
1535 | if (url_data) { |
|
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23501
diff
changeset
|
1536 | info->from = g_strdup(from); |
|
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23501
diff
changeset
|
1537 | info->id = g_strdup(id); |
|
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23501
diff
changeset
|
1538 | js->url_datas = g_slist_prepend(js->url_datas, url_data); |
|
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23501
diff
changeset
|
1539 | } else |
|
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23501
diff
changeset
|
1540 | g_free(info); |
|
913d6f18cb95
Restrict buddy icon downloads from arbitrary urls to 200kB.
Daniel Atallah <datallah@pidgin.im>
parents:
23501
diff
changeset
|
1541 | |
|
17788
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1542 | } |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1543 | } |
|
e6e381b0c7d6
Implemented receiving other people's avatars via XEP-0084. Note that this code now includes a workaround for a non-spec incompatibility for the current ejabberd PEP implementation, and doesn't use the correct namespace due to Psi using the wrong one (outdated?). Works fine though, and the vcard-based approach is retained.
Andreas Monitzer <am@adiumx.com>
parents:
17787
diff
changeset
|
1544 | } |
|
17787
439329d20337
Added support for setting the avatar via XEP-0084. Receiving other people's avatar is up next.
Andreas Monitzer <am@adiumx.com>
parents:
17770
diff
changeset
|
1545 | } |
| 8213 | 1546 | |
| 13794 | 1547 | static void jabber_buddy_info_resource_free(gpointer data) |
| 1548 | { | |
| 1549 | JabberBuddyInfoResource *jbri = data; | |
| 1550 | g_free(jbri); | |
| 1551 | } | |
| 1552 | ||
| 1553 | static void jabber_version_parse(JabberStream *js, xmlnode *packet, gpointer data) | |
| 1554 | { | |
| 1555 | JabberBuddyInfo *jbi = data; | |
| 1556 | const char *type, *id, *from; | |
| 1557 | xmlnode *query; | |
| 1558 | char *resource_name; | |
| 1559 | ||
| 1560 | g_return_if_fail(jbi != NULL); | |
| 1561 | ||
| 1562 | type = xmlnode_get_attrib(packet, "type"); | |
| 1563 | id = xmlnode_get_attrib(packet, "id"); | |
| 1564 | from = xmlnode_get_attrib(packet, "from"); | |
| 7014 | 1565 | |
| 13794 | 1566 | jabber_buddy_info_remove_id(jbi, id); |
| 1567 | ||
| 1568 | if(!from) | |
| 1569 | return; | |
| 1570 | ||
| 1571 | resource_name = jabber_get_resource(from); | |
| 1572 | ||
| 1573 | if(resource_name) { | |
| 1574 | if(type && !strcmp(type, "result")) { | |
| 1575 | if((query = xmlnode_get_child(packet, "query"))) { | |
| 1576 | JabberBuddyResource *jbr = jabber_buddy_find_resource(jbi->jb, resource_name); | |
| 1577 | if(jbr) { | |
| 1578 | xmlnode *node; | |
| 1579 | if((node = xmlnode_get_child(query, "name"))) { | |
| 1580 | jbr->client.name = xmlnode_get_data(node); | |
| 1581 | } | |
| 1582 | if((node = xmlnode_get_child(query, "version"))) { | |
| 1583 | jbr->client.version = xmlnode_get_data(node); | |
| 1584 | } | |
| 1585 | if((node = xmlnode_get_child(query, "os"))) { | |
| 1586 | jbr->client.os = xmlnode_get_data(node); | |
| 1587 | } | |
| 1588 | } | |
| 1589 | } | |
| 1590 | } | |
| 1591 | g_free(resource_name); | |
| 10189 | 1592 | } |
| 13794 | 1593 | |
| 1594 | jabber_buddy_info_show_if_ready(jbi); | |
| 7014 | 1595 | } |
| 1596 | ||
| 13794 | 1597 | static void jabber_last_parse(JabberStream *js, xmlnode *packet, gpointer data) |
| 1598 | { | |
| 1599 | JabberBuddyInfo *jbi = data; | |
| 1600 | xmlnode *query; | |
| 1601 | char *resource_name; | |
| 1602 | const char *type, *id, *from, *seconds; | |
| 1603 | ||
| 1604 | g_return_if_fail(jbi != NULL); | |
| 1605 | ||
| 1606 | type = xmlnode_get_attrib(packet, "type"); | |
| 1607 | id = xmlnode_get_attrib(packet, "id"); | |
| 1608 | from = xmlnode_get_attrib(packet, "from"); | |
| 1609 | ||
| 1610 | jabber_buddy_info_remove_id(jbi, id); | |
| 1611 | ||
| 1612 | if(!from) | |
| 1613 | return; | |
| 1614 | ||
| 1615 | resource_name = jabber_get_resource(from); | |
| 1616 | ||
| 1617 | if(resource_name) { | |
| 1618 | if(type && !strcmp(type, "result")) { | |
| 1619 | if((query = xmlnode_get_child(packet, "query"))) { | |
| 1620 | seconds = xmlnode_get_attrib(query, "seconds"); | |
| 1621 | if(seconds) { | |
| 1622 | char *end = NULL; | |
| 1623 | long sec = strtol(seconds, &end, 10); | |
| 1624 | if(end != seconds) { | |
| 1625 | JabberBuddyInfoResource *jbir = g_hash_table_lookup(jbi->resources, resource_name); | |
| 1626 | if(jbir) { | |
| 1627 | jbir->idle_seconds = sec; | |
| 1628 | } | |
| 1629 | } | |
| 1630 | } | |
| 1631 | } | |
| 1632 | } | |
| 1633 | g_free(resource_name); | |
| 1634 | } | |
| 1635 | ||
| 1636 | jabber_buddy_info_show_if_ready(jbi); | |
| 1637 | } | |
| 1638 | ||
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1639 | void jabber_buddy_remove_all_pending_buddy_info_requests(JabberStream *js) |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1640 | { |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1641 | if (js->pending_buddy_info_requests) |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1642 | { |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1643 | JabberBuddyInfo *jbi; |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1644 | GSList *l = js->pending_buddy_info_requests; |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1645 | while (l) { |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1646 | jbi = l->data; |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1647 | |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1648 | g_slist_free(jbi->ids); |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1649 | jabber_buddy_info_destroy(jbi); |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1650 | |
|
15727
0754583ceeae
Don't access the list element after it has been freed.
Daniel Atallah <datallah@pidgin.im>
parents:
15688
diff
changeset
|
1651 | l = l->next; |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1652 | } |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1653 | |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1654 | g_slist_free(js->pending_buddy_info_requests); |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1655 | js->pending_buddy_info_requests = NULL; |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1656 | } |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1657 | } |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1658 | |
| 13794 | 1659 | static gboolean jabber_buddy_get_info_timeout(gpointer data) |
| 1660 | { | |
| 1661 | JabberBuddyInfo *jbi = data; | |
| 1662 | ||
| 1663 | /* remove the pending callbacks */ | |
| 1664 | while(jbi->ids) { | |
| 1665 | char *id = jbi->ids->data; | |
| 1666 | jabber_iq_remove_callback_by_id(jbi->js, id); | |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1667 | jbi->ids = g_slist_remove(jbi->ids, id); |
| 13794 | 1668 | g_free(id); |
| 1669 | } | |
| 1670 | ||
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1671 | jbi->js->pending_buddy_info_requests = g_slist_remove(jbi->js->pending_buddy_info_requests, jbi); |
| 13794 | 1672 | jbi->timeout_handle = 0; |
| 1673 | ||
| 1674 | jabber_buddy_info_show_if_ready(jbi); | |
| 1675 | ||
| 1676 | return FALSE; | |
| 1677 | } | |
| 1678 | ||
|
17029
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1679 | static gboolean _client_is_blacklisted(JabberBuddyResource *jbr, const char *ns) |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1680 | { |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1681 | /* can't be blacklisted if we don't know what you're running yet */ |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1682 | if(!jbr->client.name) |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1683 | return FALSE; |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1684 | |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1685 | if(!strcmp(ns, "jabber:iq:last")) { |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1686 | if(!strcmp(jbr->client.name, "Trillian")) { |
|
20350
ae3f3561e698
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20320
diff
changeset
|
1687 | /* verified by nwalp 2007/05/09 */ |
|
ae3f3561e698
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20320
diff
changeset
|
1688 | if(!strcmp(jbr->client.version, "3.1.0.121") || |
|
ae3f3561e698
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20320
diff
changeset
|
1689 | /* verified by nwalp 2007/09/19 */ |
|
ae3f3561e698
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20320
diff
changeset
|
1690 | !strcmp(jbr->client.version, "3.1.7.0")) { |
|
17029
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1691 | return TRUE; |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1692 | } |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1693 | } |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1694 | } |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1695 | |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1696 | return FALSE; |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1697 | } |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1698 | |
| 13794 | 1699 | static void jabber_buddy_get_info_for_jid(JabberStream *js, const char *jid) |
| 7014 | 1700 | { |
| 1701 | JabberIq *iq; | |
| 1702 | xmlnode *vcard; | |
| 13794 | 1703 | GList *resources; |
| 1704 | JabberBuddy *jb; | |
| 1705 | JabberBuddyInfo *jbi; | |
| 1706 | ||
| 1707 | jb = jabber_buddy_find(js, jid, TRUE); | |
| 1708 | ||
| 1709 | /* invalid JID */ | |
| 1710 | if(!jb) | |
| 1711 | return; | |
| 1712 | ||
| 1713 | jbi = g_new0(JabberBuddyInfo, 1); | |
| 1714 | jbi->jid = g_strdup(jid); | |
| 1715 | jbi->js = js; | |
| 1716 | jbi->jb = jb; | |
| 1717 | jbi->resources = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, jabber_buddy_info_resource_free); | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1718 | jbi->user_info = purple_notify_user_info_new(); |
| 7014 | 1719 | |
| 1720 | iq = jabber_iq_new(js, JABBER_IQ_GET); | |
| 1721 | ||
| 13794 | 1722 | xmlnode_set_attrib(iq->node, "to", jid); |
| 7014 | 1723 | vcard = xmlnode_new_child(iq->node, "vCard"); |
| 13808 | 1724 | xmlnode_set_namespace(vcard, "vcard-temp"); |
| 7014 | 1725 | |
| 13794 | 1726 | jabber_iq_set_callback(iq, jabber_vcard_parse, jbi); |
| 1727 | jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); | |
| 7014 | 1728 | |
| 1729 | jabber_iq_send(iq); | |
| 13794 | 1730 | |
| 1731 | for(resources = jb->resources; resources; resources = resources->next) | |
| 1732 | { | |
| 1733 | JabberBuddyResource *jbr = resources->data; | |
|
14164
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1734 | JabberBuddyInfoResource *jbir; |
| 13794 | 1735 | char *full_jid; |
|
14164
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1736 | |
|
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1737 | if ((strchr(jid, '/') == NULL) && (jbr->name != NULL)) { |
|
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1738 | full_jid = g_strdup_printf("%s/%s", jid, jbr->name); |
|
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1739 | } else { |
| 13794 | 1740 | full_jid = g_strdup(jid); |
| 1741 | } | |
| 1742 | ||
|
14164
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1743 | if (jbr->name != NULL) |
|
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1744 | { |
|
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1745 | jbir = g_new0(JabberBuddyInfoResource, 1); |
|
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1746 | g_hash_table_insert(jbi->resources, g_strdup(jbr->name), jbir); |
|
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1747 | } |
| 13794 | 1748 | |
| 1749 | if(!jbr->client.name) { | |
| 1750 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:version"); | |
| 1751 | xmlnode_set_attrib(iq->node, "to", full_jid); | |
| 1752 | jabber_iq_set_callback(iq, jabber_version_parse, jbi); | |
| 1753 | jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); | |
| 1754 | jabber_iq_send(iq); | |
| 1755 | } | |
| 1756 | ||
|
17029
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1757 | /* this is to fix the feeling of irritation I get when trying |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1758 | * to get info on a friend running Trillian, which doesn't |
| 17051 | 1759 | * respond (with an error or otherwise) to jabber:iq:last |
|
17029
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1760 | * requests. There are a number of Trillian users in my |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1761 | * office. */ |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1762 | if(!_client_is_blacklisted(jbr, "jabber:iq:last")) { |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1763 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:last"); |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1764 | xmlnode_set_attrib(iq->node, "to", full_jid); |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1765 | jabber_iq_set_callback(iq, jabber_last_parse, jbi); |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1766 | jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1767 | jabber_iq_send(iq); |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1768 | } |
| 13794 | 1769 | |
| 1770 | g_free(full_jid); | |
| 1771 | } | |
| 1772 | ||
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1773 | js->pending_buddy_info_requests = g_slist_prepend(js->pending_buddy_info_requests, jbi); |
| 15884 | 1774 | jbi->timeout_handle = purple_timeout_add(30000, jabber_buddy_get_info_timeout, jbi); |
| 7014 | 1775 | } |
| 1776 | ||
| 15884 | 1777 | void jabber_buddy_get_info(PurpleConnection *gc, const char *who) |
| 10189 | 1778 | { |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1779 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
24829
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1780 | JabberID *jid = jabber_id_new(who); |
|
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1781 | |
|
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1782 | if (!jid) |
|
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1783 | return; |
| 10189 | 1784 | |
|
25575
9fbf7bf38146
A JID can have no node (the part before the @), but a chat must have one,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25454
diff
changeset
|
1785 | if (jid->node && jabber_chat_find(js, jid->node, jid->domain)) { |
|
24829
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1786 | /* For a conversation, include the resource (indicates the user). */ |
|
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1787 | jabber_buddy_get_info_for_jid(js, who); |
|
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1788 | } else { |
|
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1789 | char *bare_jid = jabber_get_bare_jid(who); |
| 10189 | 1790 | jabber_buddy_get_info_for_jid(js, bare_jid); |
| 1791 | g_free(bare_jid); | |
| 1792 | } | |
|
24829
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1793 | |
|
7f33c1a6ab97
Don't try to get info for MUC's. Allow getting info for regular JID's and
Paul Aurich <darkrain42@pidgin.im>
parents:
24827
diff
changeset
|
1794 | jabber_id_free(jid); |
| 10189 | 1795 | } |
| 1796 | ||
| 7014 | 1797 | static void jabber_buddy_set_invisibility(JabberStream *js, const char *who, |
| 1798 | gboolean invisible) | |
| 1799 | { | |
| 15884 | 1800 | PurplePresence *gpresence; |
| 1801 | PurpleAccount *account; | |
| 1802 | PurpleStatus *status; | |
| 7014 | 1803 | JabberBuddy *jb = jabber_buddy_find(js, who, TRUE); |
| 1804 | xmlnode *presence; | |
| 9954 | 1805 | JabberBuddyState state; |
| 14525 | 1806 | char *msg; |
| 9954 | 1807 | int priority; |
| 7014 | 1808 | |
| 15884 | 1809 | account = purple_connection_get_account(js->gc); |
| 1810 | gpresence = purple_account_get_presence(account); | |
| 1811 | status = purple_presence_get_active_status(gpresence); | |
|
9944
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9797
diff
changeset
|
1812 | |
| 15884 | 1813 | purple_status_to_jabber(status, &state, &msg, &priority); |
|
17770
e67998927a3c
Added the ability to define extensions to caps
Andreas Monitzer <am@adiumx.com>
parents:
17051
diff
changeset
|
1814 | presence = jabber_presence_create_js(js, state, msg, priority); |
| 9954 | 1815 | |
| 14525 | 1816 | g_free(msg); |
| 1817 | ||
| 7014 | 1818 | xmlnode_set_attrib(presence, "to", who); |
| 1819 | if(invisible) { | |
| 1820 | xmlnode_set_attrib(presence, "type", "invisible"); | |
| 1821 | jb->invisible |= JABBER_INVIS_BUDDY; | |
| 1822 | } else { | |
| 1823 | jb->invisible &= ~JABBER_INVIS_BUDDY; | |
| 1824 | } | |
| 1825 | ||
| 1826 | jabber_send(js, presence); | |
| 1827 | xmlnode_free(presence); | |
| 1828 | } | |
| 1829 | ||
| 15884 | 1830 | static void jabber_buddy_make_invisible(PurpleBlistNode *node, gpointer data) |
| 7014 | 1831 | { |
| 15884 | 1832 | PurpleBuddy *buddy; |
| 1833 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1834 | JabberStream *js; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1835 | |
| 15884 | 1836 | g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1837 | |
| 15884 | 1838 | buddy = (PurpleBuddy *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1839 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1840 | js = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1841 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1842 | jabber_buddy_set_invisibility(js, purple_buddy_get_name(buddy), TRUE); |
| 7014 | 1843 | } |
| 1844 | ||
| 15884 | 1845 | static void jabber_buddy_make_visible(PurpleBlistNode *node, gpointer data) |
| 7014 | 1846 | { |
| 15884 | 1847 | PurpleBuddy *buddy; |
| 1848 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1849 | JabberStream *js; |
| 7014 | 1850 | |
| 15884 | 1851 | g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
| 7014 | 1852 | |
| 15884 | 1853 | buddy = (PurpleBuddy *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1854 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1855 | js = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1856 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1857 | jabber_buddy_set_invisibility(js, purple_buddy_get_name(buddy), FALSE); |
| 7014 | 1858 | } |
| 1859 | ||
| 15884 | 1860 | static void jabber_buddy_cancel_presence_notification(PurpleBlistNode *node, |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1861 | gpointer data) |
| 7014 | 1862 | { |
| 15884 | 1863 | PurpleBuddy *buddy; |
| 1864 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1865 | JabberStream *js; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1866 | |
| 15884 | 1867 | g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
| 7014 | 1868 | |
| 15884 | 1869 | buddy = (PurpleBuddy *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1870 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1871 | js = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1872 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1873 | /* I wonder if we should prompt the user before doing this */ |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1874 | jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "unsubscribed"); |
| 7014 | 1875 | } |
| 1876 | ||
| 15884 | 1877 | static void jabber_buddy_rerequest_auth(PurpleBlistNode *node, gpointer data) |
| 7250 | 1878 | { |
| 15884 | 1879 | PurpleBuddy *buddy; |
| 1880 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1881 | JabberStream *js; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1882 | |
| 15884 | 1883 | g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
| 7250 | 1884 | |
| 15884 | 1885 | buddy = (PurpleBuddy *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1886 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1887 | js = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1888 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1889 | jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "subscribe"); |
| 7250 | 1890 | } |
| 1891 | ||
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1892 | |
| 15884 | 1893 | static void jabber_buddy_unsubscribe(PurpleBlistNode *node, gpointer data) |
| 7014 | 1894 | { |
| 15884 | 1895 | PurpleBuddy *buddy; |
| 1896 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1897 | JabberStream *js; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1898 | |
| 15884 | 1899 | g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1900 | |
| 15884 | 1901 | buddy = (PurpleBuddy *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1902 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1903 | js = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1904 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1905 | jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "unsubscribe"); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1906 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1907 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1908 | static void jabber_buddy_login(PurpleBlistNode *node, gpointer data) { |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1909 | if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1910 | /* simply create a directed presence of the current status */ |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1911 | PurpleBuddy *buddy = (PurpleBuddy *) node; |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1912 | PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1913 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1914 | PurpleAccount *account = purple_connection_get_account(gc); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1915 | PurplePresence *gpresence = purple_account_get_presence(account); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1916 | PurpleStatus *status = purple_presence_get_active_status(gpresence); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1917 | xmlnode *presence; |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1918 | JabberBuddyState state; |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1919 | char *msg; |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1920 | int priority; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1921 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1922 | purple_status_to_jabber(status, &state, &msg, &priority); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1923 | presence = jabber_presence_create_js(js, state, msg, priority); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1924 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1925 | g_free(msg); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1926 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1927 | xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1928 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1929 | jabber_send(js, presence); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1930 | xmlnode_free(presence); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1931 | } |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1932 | } |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1933 | |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1934 | static void jabber_buddy_logout(PurpleBlistNode *node, gpointer data) { |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1935 | if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1936 | /* simply create a directed unavailable presence */ |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1937 | PurpleBuddy *buddy = (PurpleBuddy *) node; |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1938 | PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1939 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1940 | xmlnode *presence; |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1941 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1942 | presence = jabber_presence_create_js(js, JABBER_BUDDY_STATE_UNAVAILABLE, NULL, 0); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1943 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1944 | xmlnode_set_attrib(presence, "to", purple_buddy_get_name(buddy)); |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1945 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1946 | jabber_send(js, presence); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1947 | xmlnode_free(presence); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1948 | } |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1949 | } |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1950 | |
| 15884 | 1951 | static GList *jabber_buddy_menu(PurpleBuddy *buddy) |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1952 | { |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1953 | PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1954 | JabberStream *js = purple_connection_get_protocol_data(gc); |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1955 | const char *name = purple_buddy_get_name(buddy); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1956 | JabberBuddy *jb = jabber_buddy_find(js, name, TRUE); |
|
17816
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
1957 | GList *jbrs; |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1958 | |
| 7014 | 1959 | GList *m = NULL; |
| 15884 | 1960 | PurpleMenuAction *act; |
| 7395 | 1961 | |
| 1962 | if(!jb) | |
| 1963 | return m; | |
| 1964 | ||
| 8185 | 1965 | /* XXX: fix the NOT ME below */ |
| 1966 | ||
| 1967 | if(js->protocol_version == JABBER_PROTO_0_9 /* && NOT ME */) { | |
| 8166 | 1968 | if(jb->invisible & JABBER_INVIS_BUDDY) { |
| 15884 | 1969 | act = purple_menu_action_new(_("Un-hide From"), |
| 1970 | PURPLE_CALLBACK(jabber_buddy_make_visible), | |
| 12919 | 1971 | NULL, NULL); |
| 8166 | 1972 | } else { |
| 15884 | 1973 | act = purple_menu_action_new(_("Temporarily Hide From"), |
| 1974 | PURPLE_CALLBACK(jabber_buddy_make_invisible), | |
| 13019 | 1975 | NULL, NULL); |
| 8166 | 1976 | } |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1977 | m = g_list_append(m, act); |
| 7014 | 1978 | } |
| 1979 | ||
| 8185 | 1980 | if(jb->subscription & JABBER_SUB_FROM /* && NOT ME */) { |
| 15884 | 1981 | act = purple_menu_action_new(_("Cancel Presence Notification"), |
| 1982 | PURPLE_CALLBACK(jabber_buddy_cancel_presence_notification), | |
| 12919 | 1983 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1984 | m = g_list_append(m, act); |
| 7014 | 1985 | } |
| 1986 | ||
| 1987 | if(!(jb->subscription & JABBER_SUB_TO)) { | |
| 15884 | 1988 | act = purple_menu_action_new(_("(Re-)Request authorization"), |
| 1989 | PURPLE_CALLBACK(jabber_buddy_rerequest_auth), | |
| 12919 | 1990 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1991 | m = g_list_append(m, act); |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1992 | |
| 8185 | 1993 | } else /* if(NOT ME) */{ |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1994 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1995 | /* shouldn't this just happen automatically when the buddy is |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1996 | removed? */ |
| 15884 | 1997 | act = purple_menu_action_new(_("Unsubscribe"), |
| 1998 | PURPLE_CALLBACK(jabber_buddy_unsubscribe), | |
| 12919 | 1999 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
2000 | m = g_list_append(m, act); |
| 7014 | 2001 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
2002 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
2003 | /* |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
2004 | * This if-condition implements parts of XEP-0100: Gateway Interaction |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
2005 | * |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
2006 | * According to stpeter, there is no way to know if a jid on the roster is a gateway without sending a disco#info. |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
2007 | * However, since the gateway might appear offline to us, we cannot get that information. Therefore, I just assume |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
2008 | * that gateways on the roster can be identified by having no '@' in their jid. This is a faily safe assumption, since |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
2009 | * people don't tend to have a server or other service there. |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
2010 | */ |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
2011 | if (g_utf8_strchr(name, -1, '@') == NULL) { |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
2012 | act = purple_menu_action_new(_("Log In"), |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
2013 | PURPLE_CALLBACK(jabber_buddy_login), |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
2014 | NULL, NULL); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
2015 | m = g_list_append(m, act); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
2016 | act = purple_menu_action_new(_("Log Out"), |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
2017 | PURPLE_CALLBACK(jabber_buddy_logout), |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
2018 | NULL, NULL); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
2019 | m = g_list_append(m, act); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
2020 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
2021 | |
|
17816
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
2022 | /* add all ad hoc commands to the action menu */ |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
2023 | for(jbrs = jb->resources; jbrs; jbrs = g_list_next(jbrs)) { |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
2024 | JabberBuddyResource *jbr = jbrs->data; |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
2025 | GList *commands; |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
2026 | if (!jbr->commands) |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
2027 | continue; |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
2028 | for(commands = jbr->commands; commands; commands = g_list_next(commands)) { |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
2029 | JabberAdHocCommands *cmd = commands->data; |
|
17818
ebd51078c0e6
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 <am@adiumx.com>
parents:
17816
diff
changeset
|
2030 | act = purple_menu_action_new(cmd->name, PURPLE_CALLBACK(jabber_adhoc_execute_action), cmd, NULL); |
|
17816
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
2031 | m = g_list_append(m, act); |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
2032 | } |
|
1b7362b4a7a2
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
17808
diff
changeset
|
2033 | } |
| 7014 | 2034 | |
| 2035 | return m; | |
| 2036 | } | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
2037 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
2038 | GList * |
| 15884 | 2039 | jabber_blist_node_menu(PurpleBlistNode *node) |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
2040 | { |
| 15884 | 2041 | if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
| 2042 | return jabber_buddy_menu((PurpleBuddy *) node); | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
2043 | } else { |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
2044 | return NULL; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
2045 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
2046 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
2047 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
2048 | |
| 9954 | 2049 | const char * |
| 2050 | jabber_buddy_state_get_name(JabberBuddyState state) | |
| 2051 | { | |
| 2052 | switch(state) { | |
| 2053 | case JABBER_BUDDY_STATE_UNKNOWN: | |
| 2054 | return _("Unknown"); | |
| 2055 | case JABBER_BUDDY_STATE_ERROR: | |
| 2056 | return _("Error"); | |
| 2057 | case JABBER_BUDDY_STATE_UNAVAILABLE: | |
| 2058 | return _("Offline"); | |
| 2059 | case JABBER_BUDDY_STATE_ONLINE: | |
|
12467
94948d1eb8cf
[gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
2060 | return _("Available"); |
| 9954 | 2061 | case JABBER_BUDDY_STATE_CHAT: |
| 2062 | return _("Chatty"); | |
| 2063 | case JABBER_BUDDY_STATE_AWAY: | |
| 2064 | return _("Away"); | |
| 2065 | case JABBER_BUDDY_STATE_XA: | |
| 2066 | return _("Extended Away"); | |
| 2067 | case JABBER_BUDDY_STATE_DND: | |
| 2068 | return _("Do Not Disturb"); | |
| 2069 | } | |
| 2070 | ||
| 2071 | return _("Unknown"); | |
| 2072 | } | |
| 2073 | ||
| 2074 | JabberBuddyState jabber_buddy_status_id_get_state(const char *id) { | |
| 2075 | if(!id) | |
| 2076 | return JABBER_BUDDY_STATE_UNKNOWN; | |
|
11540
ad0321374664
[gaim-migrate @ 13795]
Mark Doliner <markdoliner@pidgin.im>
parents:
11533
diff
changeset
|
2077 | if(!strcmp(id, "available")) |
| 9954 | 2078 | return JABBER_BUDDY_STATE_ONLINE; |
| 12683 | 2079 | if(!strcmp(id, "freeforchat")) |
| 2080 | return JABBER_BUDDY_STATE_CHAT; | |
| 2081 | if(!strcmp(id, "away")) | |
| 2082 | return JABBER_BUDDY_STATE_AWAY; | |
| 2083 | if(!strcmp(id, "extended_away")) | |
| 2084 | return JABBER_BUDDY_STATE_XA; | |
| 2085 | if(!strcmp(id, "dnd")) | |
| 2086 | return JABBER_BUDDY_STATE_DND; | |
| 2087 | if(!strcmp(id, "offline")) | |
| 2088 | return JABBER_BUDDY_STATE_UNAVAILABLE; | |
| 2089 | if(!strcmp(id, "error")) | |
| 2090 | return JABBER_BUDDY_STATE_ERROR; | |
| 2091 | ||
| 2092 | return JABBER_BUDDY_STATE_UNKNOWN; | |
| 2093 | } | |
| 2094 | ||
| 2095 | JabberBuddyState jabber_buddy_show_get_state(const char *id) { | |
| 2096 | if(!id) | |
| 2097 | return JABBER_BUDDY_STATE_UNKNOWN; | |
| 2098 | if(!strcmp(id, "available")) | |
| 2099 | return JABBER_BUDDY_STATE_ONLINE; | |
| 9954 | 2100 | if(!strcmp(id, "chat")) |
| 2101 | return JABBER_BUDDY_STATE_CHAT; | |
| 2102 | if(!strcmp(id, "away")) | |
| 2103 | return JABBER_BUDDY_STATE_AWAY; | |
| 2104 | if(!strcmp(id, "xa")) | |
| 2105 | return JABBER_BUDDY_STATE_XA; | |
| 2106 | if(!strcmp(id, "dnd")) | |
| 2107 | return JABBER_BUDDY_STATE_DND; | |
| 2108 | if(!strcmp(id, "offline")) | |
| 2109 | return JABBER_BUDDY_STATE_UNAVAILABLE; | |
| 2110 | if(!strcmp(id, "error")) | |
| 2111 | return JABBER_BUDDY_STATE_ERROR; | |
| 2112 | ||
| 2113 | return JABBER_BUDDY_STATE_UNKNOWN; | |
| 2114 | } | |
| 2115 | ||
| 12683 | 2116 | const char *jabber_buddy_state_get_show(JabberBuddyState state) { |
| 9954 | 2117 | switch(state) { |
| 2118 | case JABBER_BUDDY_STATE_CHAT: | |
| 2119 | return "chat"; | |
| 2120 | case JABBER_BUDDY_STATE_AWAY: | |
| 2121 | return "away"; | |
| 2122 | case JABBER_BUDDY_STATE_XA: | |
| 2123 | return "xa"; | |
| 2124 | case JABBER_BUDDY_STATE_DND: | |
| 2125 | return "dnd"; | |
| 2126 | case JABBER_BUDDY_STATE_ONLINE: | |
|
11540
ad0321374664
[gaim-migrate @ 13795]
Mark Doliner <markdoliner@pidgin.im>
parents:
11533
diff
changeset
|
2127 | return "available"; |
| 9954 | 2128 | case JABBER_BUDDY_STATE_UNKNOWN: |
| 2129 | case JABBER_BUDDY_STATE_ERROR: | |
| 2130 | return NULL; | |
| 2131 | case JABBER_BUDDY_STATE_UNAVAILABLE: | |
| 2132 | return "offline"; | |
| 2133 | } | |
| 2134 | return NULL; | |
| 2135 | } | |
| 11675 | 2136 | |
| 12683 | 2137 | const char *jabber_buddy_state_get_status_id(JabberBuddyState state) { |
| 2138 | switch(state) { | |
| 2139 | case JABBER_BUDDY_STATE_CHAT: | |
| 2140 | return "freeforchat"; | |
| 2141 | case JABBER_BUDDY_STATE_AWAY: | |
| 2142 | return "away"; | |
| 2143 | case JABBER_BUDDY_STATE_XA: | |
| 2144 | return "extended_away"; | |
| 2145 | case JABBER_BUDDY_STATE_DND: | |
| 2146 | return "dnd"; | |
| 2147 | case JABBER_BUDDY_STATE_ONLINE: | |
| 2148 | return "available"; | |
| 2149 | case JABBER_BUDDY_STATE_UNKNOWN: | |
| 13758 | 2150 | return "available"; |
| 12683 | 2151 | case JABBER_BUDDY_STATE_ERROR: |
| 13758 | 2152 | return "error"; |
| 12683 | 2153 | case JABBER_BUDDY_STATE_UNAVAILABLE: |
| 2154 | return "offline"; | |
| 2155 | } | |
| 2156 | return NULL; | |
| 2157 | } | |
| 2158 | ||
| 15884 | 2159 | static void user_search_result_add_buddy_cb(PurpleConnection *gc, GList *row, void *user_data) |
| 11675 | 2160 | { |
| 2161 | /* XXX find out the jid */ | |
| 15884 | 2162 | purple_blist_request_add_buddy(purple_connection_get_account(gc), |
| 11675 | 2163 | g_list_nth_data(row, 0), NULL, NULL); |
| 2164 | } | |
| 2165 | ||
| 2166 | static void user_search_result_cb(JabberStream *js, xmlnode *packet, gpointer data) | |
| 2167 | { | |
| 15884 | 2168 | PurpleNotifySearchResults *results; |
| 2169 | PurpleNotifySearchColumn *column; | |
| 11675 | 2170 | xmlnode *x, *query, *item, *field; |
| 2171 | ||
| 2172 | /* XXX error checking? */ | |
| 2173 | if(!(query = xmlnode_get_child(packet, "query"))) | |
| 2174 | return; | |
| 2175 | ||
| 15884 | 2176 | results = purple_notify_searchresults_new(); |
| 11675 | 2177 | if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { |
| 2178 | xmlnode *reported; | |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2179 | GSList *column_vars = NULL; |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2180 | |
| 15884 | 2181 | purple_debug_info("jabber", "new-skool\n"); |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2182 | |
| 11675 | 2183 | if((reported = xmlnode_get_child(x, "reported"))) { |
| 2184 | xmlnode *field = xmlnode_get_child(reported, "field"); | |
| 2185 | while(field) { | |
| 2186 | const char *var = xmlnode_get_attrib(field, "var"); | |
| 2187 | const char *label = xmlnode_get_attrib(field, "label"); | |
| 2188 | if(var) { | |
| 15884 | 2189 | column = purple_notify_searchresults_column_new(label ? label : var); |
| 2190 | purple_notify_searchresults_column_add(results, column); | |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2191 | column_vars = g_slist_append(column_vars, (char *)var); |
| 11675 | 2192 | } |
| 2193 | field = xmlnode_get_next_twin(field); | |
| 2194 | } | |
| 2195 | } | |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2196 | |
| 11675 | 2197 | item = xmlnode_get_child(x, "item"); |
| 2198 | while(item) { | |
| 2199 | GList *row = NULL; | |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2200 | GSList *l; |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2201 | xmlnode *valuenode; |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2202 | const char *var; |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2203 | |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2204 | for (l = column_vars; l != NULL; l = l->next) { |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2205 | /* |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2206 | * Build a row containing the strings that correspond |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2207 | * to each column of the search results. |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2208 | */ |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2209 | for (field = xmlnode_get_child(item, "field"); |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2210 | field != NULL; |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2211 | field = xmlnode_get_next_twin(field)) |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2212 | { |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2213 | if ((var = xmlnode_get_attrib(field, "var")) && |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2214 | !strcmp(var, l->data) && |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2215 | (valuenode = xmlnode_get_child(field, "value"))) |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2216 | { |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2217 | char *value = xmlnode_get_data(valuenode); |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2218 | row = g_list_append(row, value); |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2219 | break; |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2220 | } |
| 11675 | 2221 | } |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2222 | if (field == NULL) |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2223 | /* No data for this column */ |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2224 | row = g_list_append(row, NULL); |
| 11675 | 2225 | } |
| 15884 | 2226 | purple_notify_searchresults_row_add(results, row); |
| 11675 | 2227 | item = xmlnode_get_next_twin(item); |
| 2228 | } | |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2229 | |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2230 | g_slist_free(column_vars); |
| 11675 | 2231 | } else { |
| 2232 | /* old skool */ | |
| 15884 | 2233 | purple_debug_info("jabber", "old-skool\n"); |
| 11675 | 2234 | |
| 15884 | 2235 | column = purple_notify_searchresults_column_new(_("JID")); |
| 2236 | purple_notify_searchresults_column_add(results, column); | |
| 2237 | column = purple_notify_searchresults_column_new(_("First Name")); | |
| 2238 | purple_notify_searchresults_column_add(results, column); | |
| 2239 | column = purple_notify_searchresults_column_new(_("Last Name")); | |
| 2240 | purple_notify_searchresults_column_add(results, column); | |
| 2241 | column = purple_notify_searchresults_column_new(_("Nickname")); | |
| 2242 | purple_notify_searchresults_column_add(results, column); | |
|
23325
a374a26fe217
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@pidgin.im>
parents:
23026
diff
changeset
|
2243 | column = purple_notify_searchresults_column_new(_("Email")); |
| 15884 | 2244 | purple_notify_searchresults_column_add(results, column); |
| 11675 | 2245 | |
| 2246 | for(item = xmlnode_get_child(query, "item"); item; item = xmlnode_get_next_twin(item)) { | |
| 2247 | const char *jid; | |
| 2248 | xmlnode *node; | |
| 2249 | GList *row = NULL; | |
| 2250 | ||
| 2251 | if(!(jid = xmlnode_get_attrib(item, "jid"))) | |
| 2252 | continue; | |
| 2253 | ||
| 2254 | row = g_list_append(row, g_strdup(jid)); | |
| 2255 | node = xmlnode_get_child(item, "first"); | |
| 2256 | row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); | |
| 2257 | node = xmlnode_get_child(item, "last"); | |
| 2258 | row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); | |
| 2259 | node = xmlnode_get_child(item, "nick"); | |
| 2260 | row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); | |
| 2261 | node = xmlnode_get_child(item, "email"); | |
| 2262 | row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); | |
|
22622
1ecb840b5101
Fix a bunch of compiler warnings caused by my addition of G_GNUC_PRINTF()
Mark Doliner <markdoliner@pidgin.im>
parents:
22586
diff
changeset
|
2263 | purple_debug_info("jabber", "row=%p\n", row); |
| 15884 | 2264 | purple_notify_searchresults_row_add(results, row); |
| 11675 | 2265 | } |
| 2266 | } | |
| 2267 | ||
| 15884 | 2268 | purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD, |
| 11675 | 2269 | user_search_result_add_buddy_cb); |
| 2270 | ||
| 15884 | 2271 | purple_notify_searchresults(js->gc, NULL, NULL, _("The following are the results of your search"), results, NULL, NULL); |
| 11675 | 2272 | } |
| 2273 | ||
| 2274 | static void user_search_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) | |
| 2275 | { | |
| 2276 | xmlnode *query; | |
| 2277 | JabberIq *iq; | |
| 13345 | 2278 | char *dir_server = data; |
|
21388
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2279 | const char *type; |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2280 | |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2281 | /* if they've cancelled the search, we're |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2282 | * just going to get an error if we send |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2283 | * a cancel, so skip it */ |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2284 | type = xmlnode_get_attrib(result, "type"); |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2285 | if(type && !strcmp(type, "cancel")) { |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2286 | g_free(dir_server); |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2287 | return; |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2288 | } |
| 11675 | 2289 | |
| 2290 | iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:search"); | |
| 2291 | query = xmlnode_get_child(iq->node, "query"); | |
| 2292 | ||
| 2293 | xmlnode_insert_child(query, result); | |
| 2294 | ||
| 2295 | jabber_iq_set_callback(iq, user_search_result_cb, NULL); | |
| 13345 | 2296 | xmlnode_set_attrib(iq->node, "to", dir_server); |
| 11675 | 2297 | jabber_iq_send(iq); |
| 13345 | 2298 | g_free(dir_server); |
| 11675 | 2299 | } |
| 2300 | ||
| 2301 | struct user_search_info { | |
| 2302 | JabberStream *js; | |
| 2303 | char *directory_server; | |
| 2304 | }; | |
| 2305 | ||
| 15884 | 2306 | static void user_search_cancel_cb(struct user_search_info *usi, PurpleRequestFields *fields) |
| 11675 | 2307 | { |
| 2308 | g_free(usi->directory_server); | |
| 2309 | g_free(usi); | |
| 2310 | } | |
| 2311 | ||
| 15884 | 2312 | static void user_search_cb(struct user_search_info *usi, PurpleRequestFields *fields) |
| 11675 | 2313 | { |
| 2314 | JabberStream *js = usi->js; | |
| 2315 | JabberIq *iq; | |
| 2316 | xmlnode *query; | |
| 2317 | GList *groups, *flds; | |
| 2318 | ||
| 2319 | iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:search"); | |
| 2320 | query = xmlnode_get_child(iq->node, "query"); | |
| 2321 | ||
| 15884 | 2322 | for(groups = purple_request_fields_get_groups(fields); groups; groups = groups->next) { |
| 2323 | for(flds = purple_request_field_group_get_fields(groups->data); | |
| 11675 | 2324 | flds; flds = flds->next) { |
| 15884 | 2325 | PurpleRequestField *field = flds->data; |
| 2326 | const char *id = purple_request_field_get_id(field); | |
| 2327 | const char *value = purple_request_field_string_get_value(field); | |
| 11675 | 2328 | |
| 2329 | if(value && (!strcmp(id, "first") || !strcmp(id, "last") || !strcmp(id, "nick") || !strcmp(id, "email"))) { | |
| 2330 | xmlnode *y = xmlnode_new_child(query, id); | |
| 2331 | xmlnode_insert_data(y, value, -1); | |
| 2332 | } | |
| 2333 | } | |
| 2334 | } | |
| 2335 | ||
| 2336 | jabber_iq_set_callback(iq, user_search_result_cb, NULL); | |
| 2337 | xmlnode_set_attrib(iq->node, "to", usi->directory_server); | |
| 2338 | jabber_iq_send(iq); | |
| 2339 | ||
| 2340 | g_free(usi->directory_server); | |
| 2341 | g_free(usi); | |
| 2342 | } | |
| 2343 | ||
|
13617
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2344 | #if 0 |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2345 | /* This is for gettext only -- it will see this even though there's an #if 0. */ |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2346 | |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2347 | /* |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2348 | * An incomplete list of server generated original language search |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2349 | * comments for Jabber User Directories |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2350 | * |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2351 | * See discussion thread "Search comment for Jabber is not translatable" |
| 15884 | 2352 | * in purple-i18n@lists.sourceforge.net (March 2006) |
|
13617
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2353 | */ |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2354 | static const char * jabber_user_dir_comments [] = { |
|
19894
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18798
diff
changeset
|
2355 | /* current comment from Jabber User Directory users.jabber.org */ |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18798
diff
changeset
|
2356 | N_("Find a contact by entering the search criteria in the given fields. " |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18798
diff
changeset
|
2357 | "Note: Each field supports wild card searches (%)"), |
|
b273d0db2bdd
Fixed code indenting, some spaces were still left and now replaced by tabs.
Andreas Monitzer <am@adiumx.com>
parents:
18798
diff
changeset
|
2358 | NULL |
|
13617
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2359 | }; |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2360 | #endif |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2361 | |
| 11675 | 2362 | static void user_search_fields_result_cb(JabberStream *js, xmlnode *packet, gpointer data) |
| 2363 | { | |
| 2364 | xmlnode *query, *x; | |
| 13345 | 2365 | const char *from, *type; |
| 11675 | 2366 | |
| 12284 | 2367 | if(!(from = xmlnode_get_attrib(packet, "from"))) |
| 11675 | 2368 | return; |
| 2369 | ||
| 13345 | 2370 | if(!(type = xmlnode_get_attrib(packet, "type")) || !strcmp(type, "error")) { |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20350
diff
changeset
|
2371 | char *msg = jabber_parse_error(js, packet, NULL); |
| 13794 | 2372 | |
|
13634
e9f9cef982d7
[gaim-migrate @ 16031]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13619
diff
changeset
|
2373 | if(!msg) |
|
e9f9cef982d7
[gaim-migrate @ 16031]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13619
diff
changeset
|
2374 | msg = g_strdup(_("Unknown error")); |
|
e9f9cef982d7
[gaim-migrate @ 16031]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13619
diff
changeset
|
2375 | |
| 15884 | 2376 | purple_notify_error(js->gc, _("Directory Query Failed"), |
|
13634
e9f9cef982d7
[gaim-migrate @ 16031]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13619
diff
changeset
|
2377 | _("Could not query the directory server."), msg); |
|
e9f9cef982d7
[gaim-migrate @ 16031]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13619
diff
changeset
|
2378 | g_free(msg); |
|
e9f9cef982d7
[gaim-migrate @ 16031]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13619
diff
changeset
|
2379 | |
| 13345 | 2380 | return; |
| 2381 | } | |
| 2382 | ||
| 11675 | 2383 | |
| 2384 | if(!(query = xmlnode_get_child(packet, "query"))) | |
| 2385 | return; | |
| 2386 | ||
| 13330 | 2387 | if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { |
| 13345 | 2388 | jabber_x_data_request(js, x, user_search_x_data_cb, g_strdup(from)); |
| 11675 | 2389 | return; |
| 2390 | } else { | |
| 2391 | struct user_search_info *usi; | |
| 2392 | xmlnode *instnode; | |
|
13617
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2393 | char *instructions = NULL; |
| 15884 | 2394 | PurpleRequestFields *fields; |
| 2395 | PurpleRequestFieldGroup *group; | |
| 2396 | PurpleRequestField *field; | |
| 11675 | 2397 | |
| 2398 | /* old skool */ | |
| 15884 | 2399 | fields = purple_request_fields_new(); |
| 2400 | group = purple_request_field_group_new(NULL); | |
| 2401 | purple_request_fields_add_group(fields, group); | |
| 11675 | 2402 | |
| 2403 | if((instnode = xmlnode_get_child(query, "instructions"))) | |
|
13574
433001d94e3e
[gaim-migrate @ 15952]
Richard Laager <rlaager@pidgin.im>
parents:
13572
diff
changeset
|
2404 | { |
|
433001d94e3e
[gaim-migrate @ 15952]
Richard Laager <rlaager@pidgin.im>
parents:
13572
diff
changeset
|
2405 | char *tmp = xmlnode_get_data(instnode); |
| 13794 | 2406 | |
|
13617
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2407 | if(tmp) |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2408 | { |
| 13794 | 2409 | /* Try to translate the message (see static message |
|
13617
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2410 | list in jabber_user_dir_comments[]) */ |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2411 | instructions = g_strdup_printf(_("Server Instructions: %s"), _(tmp)); |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2412 | g_free(tmp); |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2413 | } |
|
13574
433001d94e3e
[gaim-migrate @ 15952]
Richard Laager <rlaager@pidgin.im>
parents:
13572
diff
changeset
|
2414 | } |
| 13794 | 2415 | |
|
13617
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2416 | if(!instructions) |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2417 | { |
| 11675 | 2418 | instructions = g_strdup(_("Fill in one or more fields to search " |
|
16961
b6955f946f8f
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@pidgin.im>
parents:
16799
diff
changeset
|
2419 | "for any matching XMPP users.")); |
|
13617
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2420 | } |
| 11675 | 2421 | |
| 2422 | if(xmlnode_get_child(query, "first")) { | |
| 15884 | 2423 | field = purple_request_field_string_new("first", _("First Name"), |
| 11675 | 2424 | NULL, FALSE); |
| 15884 | 2425 | purple_request_field_group_add_field(group, field); |
| 11675 | 2426 | } |
| 2427 | if(xmlnode_get_child(query, "last")) { | |
| 15884 | 2428 | field = purple_request_field_string_new("last", _("Last Name"), |
| 11675 | 2429 | NULL, FALSE); |
| 15884 | 2430 | purple_request_field_group_add_field(group, field); |
| 11675 | 2431 | } |
| 2432 | if(xmlnode_get_child(query, "nick")) { | |
| 15884 | 2433 | field = purple_request_field_string_new("nick", _("Nickname"), |
| 11675 | 2434 | NULL, FALSE); |
| 15884 | 2435 | purple_request_field_group_add_field(group, field); |
| 11675 | 2436 | } |
| 2437 | if(xmlnode_get_child(query, "email")) { | |
|
23325
a374a26fe217
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@pidgin.im>
parents:
23026
diff
changeset
|
2438 | field = purple_request_field_string_new("email", _("Email Address"), |
| 11675 | 2439 | NULL, FALSE); |
| 15884 | 2440 | purple_request_field_group_add_field(group, field); |
| 11675 | 2441 | } |
| 2442 | ||
| 2443 | usi = g_new0(struct user_search_info, 1); | |
| 2444 | usi->js = js; | |
| 2445 | usi->directory_server = g_strdup(from); | |
| 2446 | ||
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
2447 | purple_request_fields(js->gc, _("Search for XMPP users"), |
|
16961
b6955f946f8f
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@pidgin.im>
parents:
16799
diff
changeset
|
2448 | _("Search for XMPP users"), instructions, fields, |
| 11675 | 2449 | _("Search"), G_CALLBACK(user_search_cb), |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
15884
diff
changeset
|
2450 | _("Cancel"), G_CALLBACK(user_search_cancel_cb), |
|
17798
45d377fdb3c3
Fixed weird bug that caused not supplying the account when searching for users.
Andreas Monitzer <am@adiumx.com>
parents:
17789
diff
changeset
|
2451 | purple_connection_get_account(js->gc), NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
2452 | usi); |
| 11675 | 2453 | |
| 2454 | g_free(instructions); | |
| 2455 | } | |
| 2456 | } | |
| 2457 | ||
|
17807
d98844d33c37
Exposed the user search function, so that directory searches can be performed directly when the jid is known.
Andreas Monitzer <am@adiumx.com>
parents:
17798
diff
changeset
|
2458 | void jabber_user_search(JabberStream *js, const char *directory) |
| 11675 | 2459 | { |
| 2460 | JabberIq *iq; | |
| 2461 | ||
| 2462 | /* XXX: should probably better validate the directory we're given */ | |
| 2463 | if(!directory || !*directory) { | |
| 15884 | 2464 | purple_notify_error(js->gc, _("Invalid Directory"), _("Invalid Directory"), NULL); |
| 11675 | 2465 | return; |
| 2466 | } | |
| 2467 | ||
| 2468 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:search"); | |
| 2469 | xmlnode_set_attrib(iq->node, "to", directory); | |
| 2470 | ||
| 2471 | jabber_iq_set_callback(iq, user_search_fields_result_cb, NULL); | |
| 2472 | ||
| 2473 | jabber_iq_send(iq); | |
| 2474 | } | |
| 2475 | ||
| 15884 | 2476 | void jabber_user_search_begin(PurplePluginAction *action) |
| 11675 | 2477 | { |
| 15884 | 2478 | PurpleConnection *gc = (PurpleConnection *) action->context; |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
2479 | JabberStream *js = purple_connection_get_protocol_data(gc); |
| 11675 | 2480 | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
2481 | purple_request_input(gc, _("Enter a User Directory"), _("Enter a User Directory"), |
| 11675 | 2482 | _("Select a user directory to search"), |
|
17007
66c0fa6e5e2a
Removes 'jabber.org' defaults from XMPP. I think we had agreed this was a good idea.
Sean Egan <seanegan@pidgin.im>
parents:
16961
diff
changeset
|
2483 | js->user_directories ? js->user_directories->data : NULL, |
| 11675 | 2484 | FALSE, FALSE, NULL, |
|
17807
d98844d33c37
Exposed the user search function, so that directory searches can be performed directly when the jid is known.
Andreas Monitzer <am@adiumx.com>
parents:
17798
diff
changeset
|
2485 | _("Search Directory"), PURPLE_CALLBACK(jabber_user_search), |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
15884
diff
changeset
|
2486 | _("Cancel"), NULL, |
|
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
15884
diff
changeset
|
2487 | NULL, NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
2488 | js); |
| 11675 | 2489 | } |
| 13794 | 2490 | |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2491 | gboolean |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2492 | jabber_resource_has_capability(const JabberBuddyResource *jbr, const gchar *cap) |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2493 | { |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2494 | const GList *iter = NULL; |
| 13794 | 2495 | |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2496 | if (!jbr->caps) { |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2497 | purple_debug_error("jabber", |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2498 | "Unable to find caps: nothing known about buddy\n"); |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2499 | return FALSE; |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2500 | } |
| 13794 | 2501 | |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2502 | for (iter = jbr->caps->features ; iter ; iter = g_list_next(iter)) { |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2503 | if (strcmp(iter->data, cap) == 0) { |
|
24589
4027dd2acdbf
Make jabber_resource_have_capability polute the log a little less...
Marcus Lundblad <malu@pidgin.im>
parents:
24251
diff
changeset
|
2504 | purple_debug_info("jabber", "Found cap: %s\n", (char *)iter->data); |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2505 | return TRUE; |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2506 | } |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2507 | } |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2508 | |
|
24589
4027dd2acdbf
Make jabber_resource_have_capability polute the log a little less...
Marcus Lundblad <malu@pidgin.im>
parents:
24251
diff
changeset
|
2509 | purple_debug_info("jabber", "Cap %s not found\n", cap); |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2510 | return FALSE; |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2511 | } |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2512 | |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2513 | gboolean |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2514 | jabber_buddy_has_capability(const JabberBuddy *jb, const gchar *cap) |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2515 | { |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2516 | JabberBuddyResource *jbr = jabber_buddy_find_resource((JabberBuddy*)jb, NULL); |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2517 | |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2518 | if (!jbr) { |
|
25454
9a1500ef24bd
This happens anytime you IM an offline user, and is totally not an error
Mark Doliner <markdoliner@pidgin.im>
parents:
25391
diff
changeset
|
2519 | purple_debug_info("jabber", |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2520 | "Unable to find caps: buddy might be offline\n"); |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2521 | return FALSE; |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2522 | } |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2523 | |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2524 | return jabber_resource_has_capability(jbr, cap); |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2525 | } |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2526 |