Wed, 06 May 2009 19:01:31 +0000
Add a section break between resources in "Get info"
| 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" | |
|
25475
ad7612a5d678
Migrate the XMPP User Avatar (XEP-0084) code to its own file
Paul Aurich <darkrain42@pidgin.im>
parents:
25391
diff
changeset
|
35 | #include "useravatar.h" |
| 11675 | 36 | #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
|
37 | #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
|
38 | #include "adhoccommands.h" |
| 7014 | 39 | |
| 13794 | 40 | typedef struct { |
| 41 | long idle_seconds; | |
| 42 | } JabberBuddyInfoResource; | |
| 43 | ||
| 44 | typedef struct { | |
| 45 | JabberStream *js; | |
| 46 | JabberBuddy *jb; | |
| 47 | char *jid; | |
| 48 | GSList *ids; | |
| 49 | GHashTable *resources; | |
| 50 | int timeout_handle; | |
| 51 | 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
|
52 | PurpleNotifyUserInfo *user_info; |
| 13794 | 53 | } JabberBuddyInfo; |
| 54 | ||
| 7116 | 55 | void jabber_buddy_free(JabberBuddy *jb) |
| 56 | { | |
| 57 | g_return_if_fail(jb != NULL); | |
| 58 | ||
|
22942
2bf494f8e2a4
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents:
22928
diff
changeset
|
59 | g_free(jb->error_msg); |
| 7116 | 60 | while(jb->resources) |
| 61 | jabber_buddy_resource_free(jb->resources->data); | |
| 62 | ||
| 63 | g_free(jb); | |
| 64 | } | |
| 65 | ||
| 7014 | 66 | JabberBuddy *jabber_buddy_find(JabberStream *js, const char *name, |
| 67 | gboolean create) | |
| 68 | { | |
| 69 | JabberBuddy *jb; | |
| 7445 | 70 | const char *realname; |
| 7014 | 71 | |
|
15143
37451143f5c4
[gaim-migrate @ 17867]
Mark Doliner <markdoliner@pidgin.im>
parents:
15092
diff
changeset
|
72 | if (js->buddies == NULL) |
|
37451143f5c4
[gaim-migrate @ 17867]
Mark Doliner <markdoliner@pidgin.im>
parents:
15092
diff
changeset
|
73 | return NULL; |
|
37451143f5c4
[gaim-migrate @ 17867]
Mark Doliner <markdoliner@pidgin.im>
parents:
15092
diff
changeset
|
74 | |
| 7445 | 75 | if(!(realname = jabber_normalize(js->gc->account, name))) |
| 7014 | 76 | return NULL; |
| 77 | ||
| 78 | jb = g_hash_table_lookup(js->buddies, realname); | |
| 79 | ||
| 80 | if(!jb && create) { | |
| 81 | jb = g_new0(JabberBuddy, 1); | |
| 82 | g_hash_table_insert(js->buddies, g_strdup(realname), jb); | |
| 83 | } | |
| 84 | ||
| 85 | return jb; | |
| 86 | } | |
| 87 | ||
| 88 | ||
| 89 | JabberBuddyResource *jabber_buddy_find_resource(JabberBuddy *jb, | |
| 90 | const char *resource) | |
| 91 | { | |
| 92 | JabberBuddyResource *jbr = NULL; | |
| 93 | GList *l; | |
| 94 | ||
| 95 | if(!jb) | |
| 96 | return NULL; | |
| 97 | ||
| 98 | for(l = jb->resources; l; l = l->next) | |
| 99 | { | |
| 24890 | 100 | JabberBuddyResource *tmp = (JabberBuddyResource *) l->data; |
| 101 | if (!jbr && !resource) { | |
| 102 | jbr = tmp; | |
| 103 | } else if (!resource) { | |
| 104 | if (tmp->priority > jbr->priority) | |
| 105 | jbr = tmp; | |
| 106 | else if (tmp->priority == jbr->priority) { | |
|
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
|
107 | /* Determine if this resource is more available than the one we've currently chosen */ |
| 24890 | 108 | switch(tmp->state) { |
|
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
|
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. */ |
| 24890 | 112 | if (((jbr->state != JABBER_BUDDY_STATE_ONLINE) && (jbr->state != JABBER_BUDDY_STATE_CHAT)) |
| 113 | || (jbr->idle && !tmp->idle) | |
| 114 | || (jbr->idle && tmp->idle && tmp->idle > jbr->idle)) | |
| 115 | jbr = tmp; | |
|
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
|
116 | 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
|
117 | 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
|
118 | 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
|
119 | /* This resource is away/dnd. Prefer to one which is extended away, unavailable, or unknown. */ |
| 24890 | 120 | 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
|
121 | (jbr->state == JABBER_BUDDY_STATE_UNKNOWN) || (jbr->state == JABBER_BUDDY_STATE_ERROR)) |
| 24890 | 122 | || (jbr->idle && !tmp->idle) |
| 123 | || (jbr->idle && tmp->idle && tmp->idle > jbr->idle)) | |
| 124 | jbr = tmp; | |
|
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
|
125 | 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
|
126 | 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
|
127 | /* 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
|
128 | if ((jbr->state == JABBER_BUDDY_STATE_UNAVAILABLE) || (jbr->state == JABBER_BUDDY_STATE_UNKNOWN) || (jbr->state == JABBER_BUDDY_STATE_ERROR)) |
| 24890 | 129 | jbr = tmp; |
|
24827
5e3f3d989002
This technically doesn't matter due to behavior elsewhere in the prpl, but
Paul Aurich <darkrain42@pidgin.im>
parents:
24816
diff
changeset
|
130 | break; |
|
5e3f3d989002
This technically doesn't matter due to behavior elsewhere in the prpl, but
Paul Aurich <darkrain42@pidgin.im>
parents:
24816
diff
changeset
|
131 | 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
|
132 | /* 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
|
133 | if ((jbr->state == JABBER_BUDDY_STATE_UNKNOWN) || (jbr->state == JABBER_BUDDY_STATE_ERROR)) |
| 24890 | 134 | jbr = tmp; |
|
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
|
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 | 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
|
137 | 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
|
138 | /* 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
|
139 | 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
|
140 | } |
|
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
|
141 | } |
| 24890 | 142 | } else if(tmp->name) { |
| 143 | if(!strcmp(tmp->name, resource)) { | |
| 144 | jbr = tmp; | |
| 7014 | 145 | break; |
| 146 | } | |
| 147 | } | |
| 148 | } | |
| 149 | ||
| 150 | return jbr; | |
| 151 | } | |
| 152 | ||
| 9954 | 153 | JabberBuddyResource *jabber_buddy_track_resource(JabberBuddy *jb, const char *resource, |
| 154 | int priority, JabberBuddyState state, const char *status) | |
| 7014 | 155 | { |
| 156 | JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, resource); | |
| 157 | if(!jbr) { | |
| 158 | jbr = g_new0(JabberBuddyResource, 1); | |
| 7116 | 159 | jbr->jb = jb; |
| 7014 | 160 | jbr->name = g_strdup(resource); |
| 161 | jbr->capabilities = JABBER_CAP_XHTML; | |
|
25822
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
162 | jbr->tz_off = PURPLE_NO_TZ_OFF; |
| 7014 | 163 | jb->resources = g_list_append(jb->resources, jbr); |
| 164 | } | |
| 165 | jbr->priority = priority; | |
| 166 | jbr->state = state; | |
| 22928 | 167 | g_free(jbr->status); |
| 168 | jbr->status = status != NULL ? g_markup_escape_text(status, -1) : NULL; | |
| 9954 | 169 | |
| 170 | return jbr; | |
| 7014 | 171 | } |
| 172 | ||
| 7116 | 173 | void jabber_buddy_resource_free(JabberBuddyResource *jbr) |
| 174 | { | |
| 175 | g_return_if_fail(jbr != NULL); | |
| 176 | ||
| 177 | 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
|
178 | |
|
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
|
179 | 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
|
180 | 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
|
181 | 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
|
182 | 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
|
183 | 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
|
184 | 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
|
185 | 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
|
186 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
187 | |
|
24880
ae4e8598d0bf
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents:
24878
diff
changeset
|
188 | if (jbr->caps.exts) { |
|
ae4e8598d0bf
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents:
24878
diff
changeset
|
189 | g_list_foreach(jbr->caps.exts, (GFunc)g_free, NULL); |
|
ae4e8598d0bf
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents:
24878
diff
changeset
|
190 | g_list_free(jbr->caps.exts); |
|
ae4e8598d0bf
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents:
24878
diff
changeset
|
191 | } |
| 7116 | 192 | g_free(jbr->name); |
| 13794 | 193 | g_free(jbr->status); |
| 194 | g_free(jbr->thread_id); | |
| 195 | g_free(jbr->client.name); | |
| 196 | g_free(jbr->client.version); | |
| 197 | g_free(jbr->client.os); | |
| 7116 | 198 | g_free(jbr); |
| 199 | } | |
| 200 | ||
| 7014 | 201 | void jabber_buddy_remove_resource(JabberBuddy *jb, const char *resource) |
| 202 | { | |
| 203 | JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, resource); | |
| 204 | ||
| 205 | if(!jbr) | |
| 206 | return; | |
| 207 | ||
| 7116 | 208 | jabber_buddy_resource_free(jbr); |
| 7014 | 209 | } |
| 210 | ||
| 211 | /******* | |
| 212 | * This is the old vCard stuff taken from the old prpl. vCards, by definition | |
| 213 | * are a temporary thing until jabber can get its act together and come up | |
| 214 | * with a format for user information, hence the namespace of 'vcard-temp' | |
| 215 | * | |
| 216 | * Since I don't feel like putting that much work into something that's | |
| 217 | * _supposed_ to go away, i'm going to just copy the kludgy old code here, | |
| 218 | * and make it purdy when jabber comes up with a standards-track JEP to | |
| 219 | * replace vcard-temp | |
| 220 | * --Nathan | |
| 221 | *******/ | |
| 222 | ||
| 223 | /*---------------------------------------*/ | |
| 224 | /* Jabber "set info" (vCard) support */ | |
| 225 | /*---------------------------------------*/ | |
| 226 | ||
| 227 | /* | |
| 228 | * V-Card format: | |
| 229 | * | |
| 230 | * <vCard prodid='' version='' xmlns=''> | |
| 231 | * <FN></FN> | |
| 232 | * <N> | |
| 233 | * <FAMILY/> | |
| 234 | * <GIVEN/> | |
| 235 | * </N> | |
| 236 | * <NICKNAME/> | |
| 237 | * <URL/> | |
| 238 | * <ADR> | |
| 239 | * <STREET/> | |
| 240 | * <EXTADD/> | |
| 241 | * <LOCALITY/> | |
| 242 | * <REGION/> | |
| 243 | * <PCODE/> | |
| 244 | * <COUNTRY/> | |
| 245 | * </ADR> | |
| 246 | * <TEL/> | |
| 247 | * <EMAIL/> | |
| 248 | * <ORG> | |
| 249 | * <ORGNAME/> | |
| 250 | * <ORGUNIT/> | |
| 251 | * </ORG> | |
| 252 | * <TITLE/> | |
| 253 | * <ROLE/> | |
| 254 | * <DESC/> | |
| 255 | * <BDAY/> | |
| 256 | * </vCard> | |
| 257 | * | |
| 258 | * See also: | |
| 259 | * | |
| 260 | * http://docs.jabber.org/proto/html/vcard-temp.html | |
| 261 | * http://www.vcard-xml.org/dtd/vCard-XML-v2-20010520.dtd | |
| 262 | */ | |
| 263 | ||
| 264 | /* | |
| 265 | * Cross-reference user-friendly V-Card entry labels to vCard XML tags | |
| 266 | * and attributes. | |
| 267 | * | |
| 268 | * Order is (or should be) unimportant. For example: we have no way of | |
| 269 | * knowing in what order real data will arrive. | |
| 270 | * | |
| 271 | * Format: Label, Pre-set text, "visible" flag, "editable" flag, XML tag | |
| 272 | * name, XML tag's parent tag "path" (relative to vCard node). | |
| 273 | * | |
| 274 | * List is terminated by a NULL label pointer. | |
| 275 | * | |
| 276 | * Entries with no label text, but with XML tag and parent tag | |
| 277 | * entries, are used by V-Card XML construction routines to | |
| 278 | * "automagically" construct the appropriate XML node tree. | |
| 279 | * | |
| 280 | * Thoughts on future direction/expansion | |
| 281 | * | |
| 282 | * This is a "simple" vCard. | |
| 283 | * | |
| 284 | * It is possible for nodes other than the "vCard" node to have | |
| 285 | * attributes. Should that prove necessary/desirable, add an | |
| 286 | * "attributes" pointer to the vcard_template struct, create the | |
| 287 | * necessary tag_attr structs, and add 'em to the vcard_dflt_data | |
| 288 | * array. | |
| 289 | * | |
| 290 | * The above changes will (obviously) require changes to the vCard | |
| 291 | * construction routines. | |
| 292 | */ | |
| 293 | ||
| 294 | struct vcard_template { | |
| 295 | char *label; /* label text pointer */ | |
| 296 | char *tag; /* tag text */ | |
| 297 | 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
|
298 | } 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
|
299 | {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
|
300 | {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
|
301 | {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
|
302 | {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
|
303 | {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
|
304 | {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
|
305 | {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
|
306 | {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
|
307 | {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
|
308 | {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
|
309 | {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
|
310 | {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
|
311 | {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
|
312 | {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
|
313 | {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
|
314 | {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
|
315 | {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
|
316 | {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
|
317 | {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
|
318 | {"", "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
|
319 | {"", "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
|
320 | {"", "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
|
321 | {NULL, NULL, NULL} |
| 7014 | 322 | }; |
| 323 | ||
| 324 | /* | |
|
8735
01248ea222d3
[gaim-migrate @ 9490]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
8401
diff
changeset
|
325 | * The "vCard" tag's attribute list... |
| 7014 | 326 | */ |
| 327 | struct tag_attr { | |
| 328 | char *attr; | |
| 329 | 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
|
330 | } const vcard_tag_attr_list[] = { |
| 7014 | 331 | {"prodid", "-//HandGen//NONSGML vGen v1.0//EN"}, |
| 332 | {"version", "2.0", }, | |
| 333 | {"xmlns", "vcard-temp", }, | |
| 334 | {NULL, NULL}, | |
| 335 | }; | |
| 336 | ||
| 337 | ||
| 338 | /* | |
| 339 | * Insert a tag node into an xmlnode tree, recursively inserting parent tag | |
| 340 | * nodes as necessary | |
| 341 | * | |
| 342 | * Returns pointer to inserted node | |
| 343 | * | |
| 344 | * Note to hackers: this code is designed to be re-entrant (it's recursive--it | |
| 345 | * calls itself), so don't put any "static"s in here! | |
| 346 | */ | |
| 347 | static xmlnode *insert_tag_to_parent_tag(xmlnode *start, const char *parent_tag, const char *new_tag) | |
| 348 | { | |
| 349 | xmlnode *x = NULL; | |
| 350 | ||
| 351 | /* | |
| 352 | * If the parent tag wasn't specified, see if we can get it | |
| 353 | * from the vCard template struct. | |
| 354 | */ | |
| 355 | 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
|
356 | const struct vcard_template *vc_tp = vcard_template_data; |
| 7014 | 357 | |
| 358 | while(vc_tp->label != NULL) { | |
| 359 | if(strcmp(vc_tp->tag, new_tag) == 0) { | |
| 360 | parent_tag = vc_tp->ptag; | |
| 361 | break; | |
| 362 | } | |
| 363 | ++vc_tp; | |
| 364 | } | |
| 365 | } | |
| 366 | ||
| 367 | /* | |
| 368 | * If we have a parent tag... | |
| 369 | */ | |
| 370 | if(parent_tag != NULL ) { | |
| 371 | /* | |
| 372 | * Try to get the parent node for a tag | |
| 373 | */ | |
| 374 | if((x = xmlnode_get_child(start, parent_tag)) == NULL) { | |
| 375 | /* | |
| 376 | * Descend? | |
| 377 | */ | |
| 378 | char *grand_parent = g_strdup(parent_tag); | |
| 379 | char *parent; | |
| 380 | ||
| 381 | if((parent = strrchr(grand_parent, '/')) != NULL) { | |
| 382 | *(parent++) = '\0'; | |
| 383 | x = insert_tag_to_parent_tag(start, grand_parent, parent); | |
| 384 | } else { | |
| 385 | x = xmlnode_new_child(start, grand_parent); | |
| 386 | } | |
| 387 | g_free(grand_parent); | |
| 388 | } else { | |
| 389 | /* | |
| 390 | * We found *something* to be the parent node. | |
| 391 | * Note: may be the "root" node! | |
| 392 | */ | |
| 393 | xmlnode *y; | |
| 394 | if((y = xmlnode_get_child(x, new_tag)) != NULL) { | |
| 395 | return(y); | |
| 396 | } | |
| 397 | } | |
| 398 | } | |
| 399 | ||
| 400 | /* | |
| 401 | * insert the new tag into its parent node | |
| 402 | */ | |
| 403 | return(xmlnode_new_child((x == NULL? start : x), new_tag)); | |
| 404 | } | |
| 405 | ||
| 406 | /* | |
| 407 | * Send vCard info to Jabber server | |
| 408 | */ | |
| 15884 | 409 | void jabber_set_info(PurpleConnection *gc, const char *info) |
| 7014 | 410 | { |
|
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
|
411 | PurpleStoredImage *img; |
| 7014 | 412 | JabberIq *iq; |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
413 | JabberStream *js = purple_connection_get_protocol_data(gc); |
| 7014 | 414 | 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
|
415 | const struct tag_attr *tag_attr; |
| 7014 | 416 | |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
417 | /* 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
|
418 | * 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
|
419 | 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
|
420 | return; |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
421 | |
|
15273
a7838f939207
[gaim-migrate @ 18001]
Mark Doliner <markdoliner@pidgin.im>
parents:
15205
diff
changeset
|
422 | g_free(js->avatar_hash); |
| 10189 | 423 | js->avatar_hash = NULL; |
| 7014 | 424 | |
| 425 | /* | |
| 426 | * Send only if there's actually any *information* to send | |
| 427 | */ | |
| 11388 | 428 | vc_node = info ? xmlnode_from_str(info, -1) : NULL; |
| 10189 | 429 | |
|
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
|
430 | 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
|
431 | 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
|
432 | 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
|
433 | vc_node = NULL; |
| 10189 | 434 | } |
| 7014 | 435 | |
|
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
|
436 | 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
|
437 | 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
|
438 | 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
|
439 | 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
|
440 | gchar *enc; |
| 10189 | 441 | |
|
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
|
442 | 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
|
443 | 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
|
444 | 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
|
445 | 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
|
446 | } |
| 10189 | 447 | |
|
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
|
448 | 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
|
449 | 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
|
450 | /* 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
|
451 | * 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
|
452 | * 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
|
453 | * 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
|
454 | 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
|
455 | 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
|
456 | } |
|
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 | 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
|
458 | 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
|
459 | 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
|
460 | 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
|
461 | 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
|
462 | |
|
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
|
463 | 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
|
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 | 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
|
466 | 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
|
467 | } 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
|
468 | 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
|
469 | /* 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
|
470 | 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
|
471 | 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
|
472 | } |
|
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
|
473 | } |
|
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 | |
|
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
|
475 | if (vc_node != NULL) { |
|
15273
a7838f939207
[gaim-migrate @ 18001]
Mark Doliner <markdoliner@pidgin.im>
parents:
15205
diff
changeset
|
476 | iq = jabber_iq_new(js, JABBER_IQ_SET); |
|
a7838f939207
[gaim-migrate @ 18001]
Mark Doliner <markdoliner@pidgin.im>
parents:
15205
diff
changeset
|
477 | xmlnode_insert_child(iq->node, vc_node); |
|
a7838f939207
[gaim-migrate @ 18001]
Mark Doliner <markdoliner@pidgin.im>
parents:
15205
diff
changeset
|
478 | jabber_iq_send(iq); |
|
25478
0a7f22678a35
Send presence updates from jabber_set_info, not jabber_set_buddy_icon.
Paul Aurich <darkrain42@pidgin.im>
parents:
25477
diff
changeset
|
479 | |
|
0a7f22678a35
Send presence updates from jabber_set_info, not jabber_set_buddy_icon.
Paul Aurich <darkrain42@pidgin.im>
parents:
25477
diff
changeset
|
480 | /* Send presence to update vcard-temp:x:update */ |
|
26958
a955bd42f529
propagate from branch 'im.pidgin.pidgin' (head 36f75a1d52a6af5574bf847d60054a1392dcbc67)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
481 | jabber_presence_send(js, FALSE); |
| 7014 | 482 | } |
| 483 | } | |
| 484 | ||
|
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
|
485 | void jabber_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img) |
| 10189 | 486 | { |
|
25811
57012229a242
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <darkrain42@pidgin.im>
parents:
25542
diff
changeset
|
487 | PurpleAccount *account = purple_connection_get_account(gc); |
|
26950
842628304397
Publish only 'new' xmlns of avatars and delete old.
Paul Aurich <darkrain42@pidgin.im>
parents:
26947
diff
changeset
|
488 | |
|
842628304397
Publish only 'new' xmlns of avatars and delete old.
Paul Aurich <darkrain42@pidgin.im>
parents:
26947
diff
changeset
|
489 | /* Publish the avatar as specified in XEP-0084 */ |
|
842628304397
Publish only 'new' xmlns of avatars and delete old.
Paul Aurich <darkrain42@pidgin.im>
parents:
26947
diff
changeset
|
490 | jabber_avatar_set(gc->proto_data, img); |
|
842628304397
Publish only 'new' xmlns of avatars and delete old.
Paul Aurich <darkrain42@pidgin.im>
parents:
26947
diff
changeset
|
491 | /* Set the image in our vCard */ |
|
25811
57012229a242
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <darkrain42@pidgin.im>
parents:
25542
diff
changeset
|
492 | jabber_set_info(gc, purple_account_get_user_info(account)); |
| 10189 | 493 | |
|
25811
57012229a242
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <darkrain42@pidgin.im>
parents:
25542
diff
changeset
|
494 | /* TODO: Fake image to ourselves, since a number of servers do not echo |
|
57012229a242
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <darkrain42@pidgin.im>
parents:
25542
diff
changeset
|
495 | * back our presence to us. To do this without uselessly copying the data |
|
57012229a242
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <darkrain42@pidgin.im>
parents:
25542
diff
changeset
|
496 | * of the image, we need purple_buddy_icons_set_for_user_image (i.e. takes |
|
57012229a242
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <darkrain42@pidgin.im>
parents:
25542
diff
changeset
|
497 | * an existing icon/stored image). */ |
| 10189 | 498 | } |
| 499 | ||
| 7014 | 500 | /* |
| 501 | * This is the callback from the "ok clicked" for "set vCard" | |
| 502 | * | |
|
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
|
503 | * Sets the vCard with data from PurpleRequestFields. |
| 7014 | 504 | */ |
| 505 | static void | |
| 15884 | 506 | jabber_format_info(PurpleConnection *gc, PurpleRequestFields *fields) |
| 7014 | 507 | { |
| 508 | xmlnode *vc_node; | |
| 15884 | 509 | PurpleRequestField *field; |
| 7014 | 510 | const char *text; |
| 511 | char *p; | |
| 512 | 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
|
513 | const struct tag_attr *tag_attr; |
| 7014 | 514 | |
| 515 | vc_node = xmlnode_new("vCard"); | |
| 516 | ||
| 517 | for(tag_attr = vcard_tag_attr_list; tag_attr->attr != NULL; ++tag_attr) | |
| 518 | xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value); | |
| 519 | ||
| 520 | for (vc_tp = vcard_template_data; vc_tp->label != NULL; vc_tp++) { | |
| 521 | if (*vc_tp->label == '\0') | |
| 522 | continue; | |
| 523 | ||
| 15884 | 524 | field = purple_request_fields_get_field(fields, vc_tp->tag); |
| 525 | text = purple_request_field_string_get_value(field); | |
| 7014 | 526 | |
| 527 | ||
| 528 | if (text != NULL && *text != '\0') { | |
| 529 | xmlnode *xp; | |
| 530 | ||
| 15884 | 531 | purple_debug(PURPLE_DEBUG_INFO, "jabber", |
| 9339 | 532 | "Setting %s to '%s'\n", vc_tp->tag, text); |
| 533 | ||
| 7014 | 534 | if ((xp = insert_tag_to_parent_tag(vc_node, |
| 535 | NULL, vc_tp->tag)) != NULL) { | |
| 536 | ||
| 537 | xmlnode_insert_data(xp, text, -1); | |
| 538 | } | |
| 539 | } | |
| 540 | } | |
| 541 | ||
| 7642 | 542 | p = xmlnode_to_str(vc_node, NULL); |
| 7014 | 543 | xmlnode_free(vc_node); |
| 544 | ||
| 15884 | 545 | 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
|
546 | serv_set_info(gc, p); |
| 7014 | 547 | |
| 548 | g_free(p); | |
| 549 | } | |
| 550 | ||
| 551 | /* | |
| 552 | * This gets executed by the proto action | |
| 553 | * | |
| 15884 | 554 | * Creates a new PurpleRequestFields struct, gets the XML-formatted user_info |
| 7014 | 555 | * string (if any) into GSLists for the (multi-entry) edit dialog and |
| 556 | * calls the set_vcard dialog. | |
| 557 | */ | |
| 15884 | 558 | void jabber_setup_set_info(PurplePluginAction *action) |
| 7014 | 559 | { |
| 15884 | 560 | PurpleConnection *gc = (PurpleConnection *) action->context; |
| 561 | PurpleRequestFields *fields; | |
| 562 | PurpleRequestFieldGroup *group; | |
| 563 | PurpleRequestField *field; | |
| 7014 | 564 | const struct vcard_template *vc_tp; |
|
14129
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
565 | const char *user_info; |
|
14130
02a5f8dad9cf
[gaim-migrate @ 16689]
Daniel Atallah <datallah@pidgin.im>
parents:
14129
diff
changeset
|
566 | char *cdata = NULL; |
| 7014 | 567 | xmlnode *x_vc_data = NULL; |
| 568 | ||
| 15884 | 569 | fields = purple_request_fields_new(); |
| 570 | group = purple_request_field_group_new(NULL); | |
| 571 | purple_request_fields_add_group(fields, group); | |
| 7014 | 572 | |
| 573 | /* | |
| 574 | * Get existing, XML-formatted, user info | |
| 575 | */ | |
| 15884 | 576 | if((user_info = purple_account_get_user_info(gc->account)) != NULL) |
| 7014 | 577 | x_vc_data = xmlnode_from_str(user_info, -1); |
| 578 | ||
| 579 | /* | |
| 580 | * Set up GSLists for edit with labels from "template," data from user info | |
| 581 | */ | |
| 582 | for(vc_tp = vcard_template_data; vc_tp->label != NULL; ++vc_tp) { | |
| 583 | xmlnode *data_node; | |
| 584 | if((vc_tp->label)[0] == '\0') | |
| 585 | continue; | |
|
14129
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
586 | |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
587 | if (x_vc_data != NULL) { |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
588 | if(vc_tp->ptag == NULL) { |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
589 | data_node = xmlnode_get_child(x_vc_data, vc_tp->tag); |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
590 | } else { |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
591 | 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
|
592 | data_node = xmlnode_get_child(x_vc_data, tag); |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
593 | g_free(tag); |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
594 | } |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
595 | if(data_node) |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
596 | cdata = xmlnode_get_data(data_node); |
|
14130
02a5f8dad9cf
[gaim-migrate @ 16689]
Daniel Atallah <datallah@pidgin.im>
parents:
14129
diff
changeset
|
597 | } |
| 7014 | 598 | |
| 599 | if(strcmp(vc_tp->tag, "DESC") == 0) { | |
| 15884 | 600 | field = purple_request_field_string_new(vc_tp->tag, |
| 7014 | 601 | _(vc_tp->label), cdata, |
| 602 | TRUE); | |
| 603 | } else { | |
| 15884 | 604 | field = purple_request_field_string_new(vc_tp->tag, |
| 7014 | 605 | _(vc_tp->label), cdata, |
| 606 | FALSE); | |
| 607 | } | |
| 608 | ||
|
14130
02a5f8dad9cf
[gaim-migrate @ 16689]
Daniel Atallah <datallah@pidgin.im>
parents:
14129
diff
changeset
|
609 | g_free(cdata); |
|
02a5f8dad9cf
[gaim-migrate @ 16689]
Daniel Atallah <datallah@pidgin.im>
parents:
14129
diff
changeset
|
610 | cdata = NULL; |
|
02a5f8dad9cf
[gaim-migrate @ 16689]
Daniel Atallah <datallah@pidgin.im>
parents:
14129
diff
changeset
|
611 | |
| 15884 | 612 | purple_request_field_group_add_field(group, field); |
| 7014 | 613 | } |
| 614 | ||
| 615 | if(x_vc_data != NULL) | |
| 616 | xmlnode_free(x_vc_data); | |
| 617 | ||
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
618 | 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
|
619 | _("Edit XMPP vCard"), |
| 7014 | 620 | _("All items below are optional. Enter only the " |
| 621 | "information with which you feel comfortable."), | |
| 622 | fields, | |
| 623 | _("Save"), G_CALLBACK(jabber_format_info), | |
| 624 | _("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
|
625 | purple_connection_get_account(gc), NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
626 | gc); |
| 7014 | 627 | } |
| 628 | ||
| 629 | /*---------------------------------------*/ | |
| 630 | /* End Jabber "set info" (vCard) support */ | |
| 631 | /*---------------------------------------*/ | |
| 632 | ||
| 633 | /****** | |
| 634 | * end of that ancient crap that needs to die | |
| 635 | ******/ | |
| 636 | ||
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
637 | static void jabber_buddy_info_destroy(JabberBuddyInfo *jbi) |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
638 | { |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
639 | /* 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
|
640 | if (jbi->timeout_handle > 0) |
| 15884 | 641 | 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
|
642 | |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
643 | g_free(jbi->jid); |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
644 | 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
|
645 | 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
|
646 | g_free(jbi); |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
647 | } |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
648 | |
| 13794 | 649 | static void jabber_buddy_info_show_if_ready(JabberBuddyInfo *jbi) |
| 7014 | 650 | { |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15143
diff
changeset
|
651 | char *resource_name, *tmp; |
| 13794 | 652 | JabberBuddyResource *jbr; |
|
15092
e7c5edee202e
[gaim-migrate @ 17813]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
14669
diff
changeset
|
653 | JabberBuddyInfoResource *jbir = NULL; |
| 13794 | 654 | GList *resources; |
| 15884 | 655 | PurpleNotifyUserInfo *user_info; |
| 7014 | 656 | |
| 13794 | 657 | /* not yet */ |
| 658 | if(jbi->ids) | |
| 11361 | 659 | return; |
| 660 | ||
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
661 | user_info = jbi->user_info; |
| 13794 | 662 | resource_name = jabber_get_resource(jbi->jid); |
| 7014 | 663 | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
664 | /* 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
|
665 | 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
|
666 | 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
|
667 | |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
668 | /* Prepend the primary buddy info to user_info so that it goes before the vcard. */ |
| 7014 | 669 | if(resource_name) { |
| 13794 | 670 | jbr = jabber_buddy_find_resource(jbi->jb, resource_name); |
| 671 | 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
|
672 | 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
|
673 | 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
|
674 | (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
|
675 | (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
|
676 | 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
|
677 | 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
|
678 | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
679 | 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
|
680 | 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
|
681 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
682 | } |
|
25822
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
683 | if (jbr && jbr->tz_off != PURPLE_NO_TZ_OFF) { |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
684 | time_t now_t; |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
685 | struct tm *now; |
|
25827
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
686 | char *timestamp; |
|
25822
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
687 | time(&now_t); |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
688 | now_t += jbr->tz_off; |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
689 | now = gmtime(&now_t); |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
690 | |
|
25828
6ddbedccda5a
Format the time as "localtimeformat [+-]HHMM". Iterative development is fun.
Paul Aurich <darkrain42@pidgin.im>
parents:
25827
diff
changeset
|
691 | timestamp = g_strdup_printf("%s %c%02d%02d", purple_time_format(now), |
|
6ddbedccda5a
Format the time as "localtimeformat [+-]HHMM". Iterative development is fun.
Paul Aurich <darkrain42@pidgin.im>
parents:
25827
diff
changeset
|
692 | jbr->tz_off < 0 ? '-' : '+', |
|
6ddbedccda5a
Format the time as "localtimeformat [+-]HHMM". Iterative development is fun.
Paul Aurich <darkrain42@pidgin.im>
parents:
25827
diff
changeset
|
693 | abs(jbr->tz_off / (60*60)), |
|
6ddbedccda5a
Format the time as "localtimeformat [+-]HHMM". Iterative development is fun.
Paul Aurich <darkrain42@pidgin.im>
parents:
25827
diff
changeset
|
694 | abs((jbr->tz_off % (60*60)) / 60)); |
|
25827
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
695 | purple_notify_user_info_prepend_pair(user_info, _("Local Time"), timestamp); |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
696 | g_free(timestamp); |
|
25822
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
697 | } |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
698 | 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
|
699 | 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
|
700 | 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
|
701 | 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
|
702 | 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
|
703 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
704 | } |
| 7014 | 705 | if(jbr) { |
| 7145 | 706 | char *purdy = NULL; |
|
23404
836828ff554c
Remove compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23393
diff
changeset
|
707 | const char *status_name = jabber_buddy_state_get_name(jbr->state); |
| 7145 | 708 | if(jbr->status) |
| 15884 | 709 | 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
|
710 | 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
|
711 | 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
|
712 | |
|
7b640ff909dc
If the status name and status message are the same for a jabber buddy,
Evan Schoenberg <evands@pidgin.im>
parents:
23367
diff
changeset
|
713 | 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
|
714 | ((status_name && purdy) ? ": " : ""), |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15143
diff
changeset
|
715 | (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
|
716 | purple_notify_user_info_prepend_pair(user_info, _("Status"), tmp); |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15143
diff
changeset
|
717 | g_free(tmp); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15143
diff
changeset
|
718 | g_free(purdy); |
| 7014 | 719 | } 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
|
720 | purple_notify_user_info_prepend_pair(user_info, _("Status"), _("Unknown")); |
| 13794 | 721 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
722 | #if 0 |
|
19921
d920ce72002e
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
723 | /* #if 0 this for now; I think this would be far more useful if we limited this to a particular set of features |
|
d920ce72002e
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
724 | * of particular interest (-vv jumps out as one). As it is now, I don't picture people getting all excited: "Oh sweet crap! |
|
d920ce72002e
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
725 | * 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
|
726 | */ |
|
d920ce72002e
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
727 | |
|
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
|
728 | 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
|
729 | 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
|
730 | 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
|
731 | 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
|
732 | 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
|
733 | |
|
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
|
734 | 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
|
735 | 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
|
736 | 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
|
737 | 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
|
738 | 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
|
739 | 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
|
740 | 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
|
741 | 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
|
742 | 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
|
743 | 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
|
744 | 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
|
745 | 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
|
746 | 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
|
747 | 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
|
748 | 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
|
749 | 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
|
750 | 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
|
751 | 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
|
752 | 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
|
753 | 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
|
754 | 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
|
755 | 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
|
756 | 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
|
757 | 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
|
758 | 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
|
759 | 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
|
760 | 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
|
761 | 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
|
762 | 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
|
763 | 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
|
764 | 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
|
765 | 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
|
766 | 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
|
767 | 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
|
768 | 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
|
769 | 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
|
770 | 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
|
771 | 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
|
772 | 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
|
773 | 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
|
774 | 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
|
775 | 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
|
776 | 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
|
777 | 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
|
778 | 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
|
779 | 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
|
780 | 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
|
781 | 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
|
782 | 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
|
783 | 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
|
784 | 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
|
785 | 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
|
786 | 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
|
787 | 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
|
788 | 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
|
789 | 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
|
790 | 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
|
791 | 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
|
792 | 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
|
793 | 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
|
794 | 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
|
795 | 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
|
796 | 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
|
797 | 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
|
798 | 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
|
799 | 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
|
800 | 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
|
801 | 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
|
802 | 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
|
803 | 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
|
804 | 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
|
805 | 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
|
806 | 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
|
807 | 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
|
808 | 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
|
809 | 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
|
810 | 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
|
811 | 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
|
812 | 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
|
813 | 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
|
814 | 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
|
815 | feature = _("User Viewing"); |
|
26688
e036a4d105c1
Do not advertise support for old XEP-0199 (Ping) namespace
Paul Aurich <darkrain42@pidgin.im>
parents:
26687
diff
changeset
|
816 | else if(!strcmp(feature, "urn:xmpp:ping")) |
|
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
|
817 | 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
|
818 | 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
|
819 | 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
|
820 | 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
|
821 | 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
|
822 | 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
|
823 | 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
|
824 | 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
|
825 | 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
|
826 | 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
|
827 | 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
|
828 | 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
|
829 | 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
|
830 | 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
|
831 | 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
|
832 | 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
|
833 | 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
|
834 | 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
|
835 | 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
|
836 | if(feature) |
|
19921
d920ce72002e
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
837 | 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
|
838 | } |
|
19921
d920ce72002e
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
839 | |
|
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
|
840 | 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
|
841 | 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
|
842 | |
|
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
|
843 | 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
|
844 | } |
|
19921
d920ce72002e
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
845 | #endif |
| 7014 | 846 | } 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
|
847 | 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
|
848 | |
| 13794 | 849 | for(resources = jbi->jb->resources; resources; resources = resources->next) { |
|
23404
836828ff554c
Remove compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23393
diff
changeset
|
850 | char *purdy = NULL; |
|
836828ff554c
Remove compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23393
diff
changeset
|
851 | const char *status_name = NULL; |
|
836828ff554c
Remove compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23393
diff
changeset
|
852 | |
| 7014 | 853 | 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
|
854 | |
|
27053
fb088f01758d
Add a section break between resources in "Get info"
Marcus Lundblad <malu@pidgin.im>
parents:
26958
diff
changeset
|
855 | /* put a section break between resources, this is not needed if |
|
fb088f01758d
Add a section break between resources in "Get info"
Marcus Lundblad <malu@pidgin.im>
parents:
26958
diff
changeset
|
856 | we are at the first, because one was already added for the vcard |
|
fb088f01758d
Add a section break between resources in "Get info"
Marcus Lundblad <malu@pidgin.im>
parents:
26958
diff
changeset
|
857 | section */ |
|
fb088f01758d
Add a section break between resources in "Get info"
Marcus Lundblad <malu@pidgin.im>
parents:
26958
diff
changeset
|
858 | if (resources != jbi->jb->resources) { |
|
fb088f01758d
Add a section break between resources in "Get info"
Marcus Lundblad <malu@pidgin.im>
parents:
26958
diff
changeset
|
859 | purple_notify_user_info_prepend_section_break(user_info); |
|
fb088f01758d
Add a section break between resources in "Get info"
Marcus Lundblad <malu@pidgin.im>
parents:
26958
diff
changeset
|
860 | } |
|
fb088f01758d
Add a section break between resources in "Get info"
Marcus Lundblad <malu@pidgin.im>
parents:
26958
diff
changeset
|
861 | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
862 | 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
|
863 | 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
|
864 | (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
|
865 | (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
|
866 | 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
|
867 | _("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
|
868 | 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
|
869 | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
870 | 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
|
871 | 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
|
872 | } |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
873 | } |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
874 | |
|
25822
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
875 | if (jbr->tz_off != PURPLE_NO_TZ_OFF) { |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
876 | time_t now_t; |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
877 | struct tm *now; |
|
25827
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
878 | char *timestamp; |
|
25822
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
879 | time(&now_t); |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
880 | now_t += jbr->tz_off; |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
881 | now = gmtime(&now_t); |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
882 | |
|
25828
6ddbedccda5a
Format the time as "localtimeformat [+-]HHMM". Iterative development is fun.
Paul Aurich <darkrain42@pidgin.im>
parents:
25827
diff
changeset
|
883 | timestamp = g_strdup_printf("%s %c%02d%02d", purple_time_format(now), |
|
6ddbedccda5a
Format the time as "localtimeformat [+-]HHMM". Iterative development is fun.
Paul Aurich <darkrain42@pidgin.im>
parents:
25827
diff
changeset
|
884 | jbr->tz_off < 0 ? '-' : '+', |
|
6ddbedccda5a
Format the time as "localtimeformat [+-]HHMM". Iterative development is fun.
Paul Aurich <darkrain42@pidgin.im>
parents:
25827
diff
changeset
|
885 | abs(jbr->tz_off / (60*60)), |
|
6ddbedccda5a
Format the time as "localtimeformat [+-]HHMM". Iterative development is fun.
Paul Aurich <darkrain42@pidgin.im>
parents:
25827
diff
changeset
|
886 | abs((jbr->tz_off % (60*60)) / 60)); |
|
25827
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
887 | purple_notify_user_info_prepend_pair(user_info, _("Local Time"), timestamp); |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
888 | g_free(timestamp); |
|
25822
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
889 | } |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
890 | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
891 | 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
|
892 | 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
|
893 | 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
|
894 | 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
|
895 | 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
|
896 | } |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
897 | } |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
898 | |
|
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
|
899 | status_name = jabber_buddy_state_get_name(jbr->state); |
| 7145 | 900 | if(jbr->status) |
| 15884 | 901 | 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
|
902 | 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
|
903 | 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
|
904 | |
|
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
|
905 | 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
|
906 | ((status_name && purdy) ? ": " : ""), |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15143
diff
changeset
|
907 | (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
|
908 | purple_notify_user_info_prepend_pair(user_info, _("Status"), tmp); |
|
15205
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15143
diff
changeset
|
909 | g_free(tmp); |
|
f642029b2f97
[gaim-migrate @ 17929]
Evan Schoenberg <evands@pidgin.im>
parents:
15143
diff
changeset
|
910 | 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
|
911 | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
912 | 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
|
913 | 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
|
914 | 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
|
915 | 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
|
916 | } |
| 13794 | 917 | |
|
15092
e7c5edee202e
[gaim-migrate @ 17813]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
14669
diff
changeset
|
918 | 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
|
919 | 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
|
920 | #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
|
921 | 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
|
922 | 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
|
923 | 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
|
924 | 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
|
925 | 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
|
926 | |
|
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
|
927 | 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
|
928 | 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
|
929 | 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
|
930 | 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
|
931 | 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
|
932 | 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
|
933 | 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
|
934 | 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
|
935 | 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
|
936 | 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
|
937 | 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
|
938 | 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
|
939 | 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
|
940 | 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
|
941 | 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
|
942 | 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
|
943 | 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
|
944 | 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
|
945 | 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
|
946 | 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
|
947 | 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
|
948 | 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
|
949 | 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
|
950 | 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
|
951 | 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
|
952 | 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
|
953 | 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
|
954 | 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
|
955 | 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
|
956 | 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
|
957 | 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
|
958 | 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
|
959 | 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
|
960 | 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
|
961 | 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
|
962 | 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
|
963 | 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
|
964 | 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
|
965 | 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
|
966 | 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
|
967 | 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
|
968 | 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
|
969 | 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
|
970 | 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
|
971 | 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
|
972 | 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
|
973 | 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
|
974 | 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
|
975 | 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
|
976 | 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
|
977 | 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
|
978 | 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
|
979 | 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
|
980 | 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
|
981 | 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
|
982 | 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
|
983 | 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
|
984 | 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
|
985 | 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
|
986 | 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
|
987 | 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
|
988 | 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
|
989 | 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
|
990 | 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
|
991 | 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
|
992 | 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
|
993 | 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
|
994 | 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
|
995 | 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
|
996 | 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
|
997 | 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
|
998 | 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
|
999 | 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
|
1000 | 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
|
1001 | 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
|
1002 | 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
|
1003 | 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
|
1004 | 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
|
1005 | 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
|
1006 | 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
|
1007 | 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
|
1008 | feature = _("User Viewing"); |
|
26688
e036a4d105c1
Do not advertise support for old XEP-0199 (Ping) namespace
Paul Aurich <darkrain42@pidgin.im>
parents:
26687
diff
changeset
|
1009 | else if(!strcmp(feature, "urn:xmpp:ping")) |
|
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
|
1010 | 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
|
1011 | 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
|
1012 | 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
|
1013 | 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
|
1014 | 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
|
1015 | 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
|
1016 | 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
|
1017 | 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
|
1018 | 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
|
1019 | 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
|
1020 | 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
|
1021 | 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
|
1022 | 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
|
1023 | 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
|
1024 | 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
|
1025 | 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
|
1026 | 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
|
1027 | 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
|
1028 | 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
|
1029 | |
|
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
|
1030 | 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
|
1031 | 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
|
1032 | } |
|
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 | 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
|
1034 | 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
|
1035 | |
|
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
|
1036 | 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
|
1037 | } |
|
19921
d920ce72002e
Dont spam the buddy info window with esoteric capabilities
Sean Egan <seanegan@pidgin.im>
parents:
19897
diff
changeset
|
1038 | #endif |
| 7014 | 1039 | } |
| 1040 | } | |
| 1041 | ||
| 7306 | 1042 | g_free(resource_name); |
| 1043 | ||
| 15884 | 1044 | purple_notify_userinfo(jbi->js->gc, jbi->jid, user_info, NULL, NULL); |
| 13794 | 1045 | |
| 1046 | 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
|
1047 | purple_imgstore_unref_by_id(GPOINTER_TO_INT(jbi->vcard_imgids->data)); |
| 13794 | 1048 | jbi->vcard_imgids = g_slist_delete_link(jbi->vcard_imgids, jbi->vcard_imgids); |
| 1049 | } | |
| 1050 | ||
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1051 | 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
|
1052 | |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1053 | jabber_buddy_info_destroy(jbi); |
| 13794 | 1054 | } |
| 1055 | ||
| 1056 | static void jabber_buddy_info_remove_id(JabberBuddyInfo *jbi, const char *id) | |
| 1057 | { | |
| 1058 | 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
|
1059 | char *comp_id; |
| 13794 | 1060 | |
| 1061 | if(!id) | |
| 1062 | return; | |
| 1063 | ||
| 1064 | while(l) { | |
|
15727
0754583ceeae
Don't access the list element after it has been freed.
Daniel Atallah <datallah@pidgin.im>
parents:
15688
diff
changeset
|
1065 | 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
|
1066 | 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
|
1067 | 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
|
1068 | g_free(comp_id); |
| 13794 | 1069 | return; |
| 1070 | } | |
| 1071 | l = l->next; | |
| 1072 | } | |
| 1073 | } | |
| 1074 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1075 | static void jabber_vcard_save_mine(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1076 | JabberIqType type, const char *id, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1077 | xmlnode *packet, gpointer data) |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1078 | { |
|
25477
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1079 | xmlnode *vcard, *photo, *binval; |
|
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1080 | char *txt, *vcard_hash = NULL; |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1081 | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1082 | if (type == JABBER_IQ_ERROR) { |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1083 | purple_debug_warning("jabber", "Server returned error while retrieving vCard"); |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1084 | return; |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1085 | } |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1086 | |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1087 | 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
|
1088 | (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
|
1089 | { |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1090 | 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
|
1091 | 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
|
1092 | |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1093 | g_free(txt); |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1094 | } else { |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1095 | /* 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
|
1096 | } |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1097 | |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1098 | 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
|
1099 | |
|
25477
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1100 | if (vcard && (photo = xmlnode_get_child(vcard, "PHOTO")) && |
|
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1101 | (binval = xmlnode_get_child(photo, "BINVAL"))) { |
|
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1102 | gsize size; |
|
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1103 | char *bintext = xmlnode_get_data(binval); |
|
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1104 | guchar *data = purple_base64_decode(bintext, &size); |
|
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1105 | g_free(bintext); |
|
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1106 | |
|
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1107 | if (data) { |
|
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1108 | vcard_hash = jabber_calculate_data_sha1sum(data, size); |
|
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1109 | g_free(data); |
|
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1110 | } |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1111 | } |
|
25477
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1112 | |
|
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1113 | /* Republish our vcard if the photo is different than the server's */ |
|
26947
176ef2bfef9f
Use purple_strequal and g_str_equal
Paul Aurich <darkrain42@pidgin.im>
parents:
26946
diff
changeset
|
1114 | if (!purple_strequal(vcard_hash, js->initial_avatar_hash)) { |
|
25477
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1115 | PurpleAccount *account = purple_connection_get_account(js->gc); |
|
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1116 | jabber_set_info(js->gc, purple_account_get_user_info(account)); |
|
25811
57012229a242
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <darkrain42@pidgin.im>
parents:
25542
diff
changeset
|
1117 | } else if (js->initial_avatar_hash) { |
|
25477
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1118 | /* Our photo is in the vcard, so advertise vcard-temp updates */ |
|
25811
57012229a242
Use a JabberStream variable instead of a setting for the initial hash
Paul Aurich <darkrain42@pidgin.im>
parents:
25542
diff
changeset
|
1119 | js->avatar_hash = g_strdup(js->initial_avatar_hash); |
|
25477
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1120 | } |
|
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1121 | |
|
ada9e5c4a10a
Only (re)publish XMPP avatars at login if the server's avatar differs
Paul Aurich <darkrain42@pidgin.im>
parents:
25475
diff
changeset
|
1122 | g_free(vcard_hash); |
|
18235
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1123 | } |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1124 | |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1125 | 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
|
1126 | { |
|
21957
0ce77f86c7f3
Fix XMPP buddy icons. Somehow a 'VCard' element got changed to a query
Sean Egan <seanegan@pidgin.im>
parents:
21681
diff
changeset
|
1127 | 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
|
1128 | |
|
21957
0ce77f86c7f3
Fix XMPP buddy icons. Somehow a 'VCard' element got changed to a query
Sean Egan <seanegan@pidgin.im>
parents:
21681
diff
changeset
|
1129 | 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
|
1130 | 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
|
1131 | 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
|
1132 | |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1133 | 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
|
1134 | } |
|
60a9bd99f035
server-side jabber vcards now take precedence over local vcards, so
Nathan Walp <nwalp@pidgin.im>
parents:
18196
diff
changeset
|
1135 | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1136 | static void jabber_vcard_parse(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1137 | JabberIqType type, const char *id, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1138 | xmlnode *packet, gpointer data) |
| 13794 | 1139 | { |
| 1140 | char *bare_jid; | |
| 1141 | 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
|
1142 | char *serverside_alias = NULL; |
| 13794 | 1143 | xmlnode *vcard; |
| 15884 | 1144 | PurpleBuddy *b; |
| 13794 | 1145 | 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
|
1146 | PurpleNotifyUserInfo *user_info; |
| 13794 | 1147 | |
| 1148 | if(!jbi) | |
| 1149 | return; | |
| 1150 | ||
|
14129
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
1151 | jabber_buddy_info_remove_id(jbi, id); |
|
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
1152 | |
| 13794 | 1153 | if(!from) |
| 1154 | return; | |
| 1155 | ||
|
14129
70db31dfeeb1
[gaim-migrate @ 16688]
Daniel Atallah <datallah@pidgin.im>
parents:
13808
diff
changeset
|
1156 | if(!jabber_buddy_find(js, from, FALSE)) |
| 13794 | 1157 | return; |
| 1158 | ||
| 1159 | /* XXX: handle the error case */ | |
| 1160 | ||
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1161 | user_info = jbi->user_info; |
| 13794 | 1162 | bare_jid = jabber_get_bare_jid(from); |
| 1163 | ||
| 15884 | 1164 | b = purple_find_buddy(js->gc->account, bare_jid); |
| 13794 | 1165 | |
| 10189 | 1166 | if((vcard = xmlnode_get_child(packet, "vCard")) || |
| 1167 | (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) { | |
| 7014 | 1168 | xmlnode *child; |
| 1169 | for(child = vcard->child; child; child = child->next) | |
| 1170 | { | |
| 1171 | xmlnode *child2; | |
| 1172 | ||
| 8135 | 1173 | if(child->type != XMLNODE_TYPE_TAG) |
| 7014 | 1174 | continue; |
| 1175 | ||
| 1176 | text = xmlnode_get_data(child); | |
| 1177 | 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
|
1178 | 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
|
1179 | 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
|
1180 | |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1181 | purple_notify_user_info_add_pair(user_info, _("Full Name"), text); |
| 7014 | 1182 | } else if(!strcmp(child->name, "N")) { |
| 1183 | for(child2 = child->child; child2; child2 = child2->next) | |
| 1184 | { | |
| 1185 | char *text2; | |
| 1186 | ||
| 8135 | 1187 | if(child2->type != XMLNODE_TYPE_TAG) |
| 7014 | 1188 | continue; |
| 1189 | ||
| 1190 | text2 = xmlnode_get_data(child2); | |
| 1191 | 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
|
1192 | purple_notify_user_info_add_pair(user_info, _("Family Name"), text2); |
| 7014 | 1193 | } 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
|
1194 | purple_notify_user_info_add_pair(user_info, _("Given Name"), text2); |
| 7014 | 1195 | } 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
|
1196 | purple_notify_user_info_add_pair(user_info, _("Middle Name"), text2); |
| 7014 | 1197 | } |
| 1198 | g_free(text2); | |
| 1199 | } | |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1200 | } 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
|
1201 | /* 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
|
1202 | * 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
|
1203 | 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
|
1204 | 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
|
1205 | 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
|
1206 | |
|
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
|
1207 | 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
|
1208 | } |
| 7014 | 1209 | } 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
|
1210 | purple_notify_user_info_add_pair(user_info, _("Birthday"), text); |
| 7014 | 1211 | } else if(!strcmp(child->name, "ADR")) { |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1212 | gboolean address_line_added = FALSE; |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1213 | |
| 7014 | 1214 | for(child2 = child->child; child2; child2 = child2->next) |
| 1215 | { | |
| 1216 | char *text2; | |
| 1217 | ||
| 8135 | 1218 | if(child2->type != XMLNODE_TYPE_TAG) |
| 7014 | 1219 | continue; |
| 1220 | ||
| 1221 | text2 = xmlnode_get_data(child2); | |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1222 | if (text2 == NULL) |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1223 | continue; |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1224 | |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1225 | /* 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
|
1226 | * elements are empty. */ |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1227 | if (!address_line_added) |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1228 | { |
|
23347
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1229 | purple_notify_user_info_add_section_header(user_info, _("Address")); |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1230 | address_line_added = TRUE; |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1231 | } |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1232 | |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1233 | 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
|
1234 | 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
|
1235 | } 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
|
1236 | 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
|
1237 | } 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
|
1238 | 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
|
1239 | } 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
|
1240 | purple_notify_user_info_add_pair(user_info, _("Locality"), text2); |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1241 | } 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
|
1242 | purple_notify_user_info_add_pair(user_info, _("Region"), text2); |
|
12933
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1243 | } 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
|
1244 | 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
|
1245 | } else if(!strcmp(child2->name, "CTRY") |
|
885970470a9b
[gaim-migrate @ 15286]
Richard Laager <rlaager@pidgin.im>
parents:
12919
diff
changeset
|
1246 | || !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
|
1247 | purple_notify_user_info_add_pair(user_info, _("Country"), text2); |
| 7014 | 1248 | } |
| 1249 | g_free(text2); | |
| 1250 | } | |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1251 | |
|
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 | 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
|
1253 | 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
|
1254 | |
| 7014 | 1255 | } else if(!strcmp(child->name, "TEL")) { |
| 1256 | char *number; | |
| 1257 | if((child2 = xmlnode_get_child(child, "NUMBER"))) { | |
| 1258 | /* show what kind of number it is */ | |
| 1259 | number = xmlnode_get_data(child2); | |
| 1260 | 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
|
1261 | purple_notify_user_info_add_pair(user_info, _("Telephone"), number); |
| 7014 | 1262 | g_free(number); |
| 1263 | } | |
| 1264 | } else if((number = xmlnode_get_data(child))) { | |
| 15884 | 1265 | /* lots of clients (including purple) do this, but it's |
| 7014 | 1266 | * 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
|
1267 | purple_notify_user_info_add_pair(user_info, _("Telephone"), number); |
| 7014 | 1268 | g_free(number); |
| 1269 | } | |
| 1270 | } 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
|
1271 | char *userid, *escaped; |
| 7014 | 1272 | if((child2 = xmlnode_get_child(child, "USERID"))) { |
| 1273 | /* show what kind of email it is */ | |
| 1274 | userid = xmlnode_get_data(child2); | |
| 1275 | 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
|
1276 | 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
|
1277 | 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
|
1278 | 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
|
1279 | 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
|
1280 | |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1281 | 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
|
1282 | g_free(escaped); |
| 7014 | 1283 | g_free(userid); |
| 1284 | } | |
| 1285 | } else if((userid = xmlnode_get_data(child))) { | |
| 15884 | 1286 | /* lots of clients (including purple) do this, but it's |
| 7014 | 1287 | * 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
|
1288 | 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
|
1289 | |
|
19931
229fb62285b0
Data in vCards is supposed to be plain text, not HTML. So escape
Mark Doliner <markdoliner@pidgin.im>
parents:
19921
diff
changeset
|
1290 | 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
|
1291 | 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
|
1292 | 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
|
1293 | |
|
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1294 | 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
|
1295 | g_free(escaped); |
| 7014 | 1296 | g_free(userid); |
| 1297 | } | |
| 1298 | } else if(!strcmp(child->name, "ORG")) { | |
| 1299 | for(child2 = child->child; child2; child2 = child2->next) | |
| 1300 | { | |
| 1301 | char *text2; | |
| 1302 | ||
| 8135 | 1303 | if(child2->type != XMLNODE_TYPE_TAG) |
| 7014 | 1304 | continue; |
| 1305 | ||
| 1306 | text2 = xmlnode_get_data(child2); | |
| 1307 | 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
|
1308 | purple_notify_user_info_add_pair(user_info, _("Organization Name"), text2); |
| 7014 | 1309 | } 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
|
1310 | purple_notify_user_info_add_pair(user_info, _("Organization Unit"), text2); |
| 7014 | 1311 | } |
| 1312 | g_free(text2); | |
| 1313 | } | |
| 1314 | } 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
|
1315 | purple_notify_user_info_add_pair(user_info, _("Title"), text); |
| 7014 | 1316 | } 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
|
1317 | purple_notify_user_info_add_pair(user_info, _("Role"), text); |
| 7014 | 1318 | } 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
|
1319 | purple_notify_user_info_add_pair(user_info, _("Description"), text); |
| 7076 | 1320 | } else if(!strcmp(child->name, "PHOTO") || |
| 1321 | !strcmp(child->name, "LOGO")) { | |
| 10941 | 1322 | char *bintext = NULL; |
| 1323 | xmlnode *binval; | |
| 11361 | 1324 | |
| 1325 | if( ((binval = xmlnode_get_child(child, "BINVAL")) && | |
| 1326 | (bintext = xmlnode_get_data(binval))) || | |
| 1327 | (bintext = xmlnode_get_data(child))) { | |
|
11127
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
10941
diff
changeset
|
1328 | gsize size; |
|
11137
cf40226ddff7
[gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents:
11127
diff
changeset
|
1329 | guchar *data; |
| 10941 | 1330 | gboolean photo = (strcmp(child->name, "PHOTO") == 0); |
| 10189 | 1331 | |
| 15884 | 1332 | data = purple_base64_decode(bintext, &size); |
|
16587
50de12a4b81b
disapproval of revision 'f95b376c0d2f066996620c5bb595dc71b5ee22d9'
Richard Laager <rlaager@pidgin.im>
parents:
16585
diff
changeset
|
1333 | 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
|
1334 | 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
|
1335 | 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
|
1336 | |
|
16587
50de12a4b81b
disapproval of revision 'f95b376c0d2f066996620c5bb595dc71b5ee22d9'
Richard Laager <rlaager@pidgin.im>
parents:
16585
diff
changeset
|
1337 | 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
|
1338 | 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
|
1339 | |
|
4b62b4732afd
Use the notify_user_info API for the vcard information instead of creating
Evan Schoenberg <evands@pidgin.im>
parents:
23325
diff
changeset
|
1340 | 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
|
1341 | |
|
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
|
1342 | hash = jabber_calculate_data_sha1sum(data, size); |
|
16587
50de12a4b81b
disapproval of revision 'f95b376c0d2f066996620c5bb595dc71b5ee22d9'
Richard Laager <rlaager@pidgin.im>
parents:
16585
diff
changeset
|
1343 | 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
|
1344 | 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
|
1345 | 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
|
1346 | g_free(img_text); |
|
16587
50de12a4b81b
disapproval of revision 'f95b376c0d2f066996620c5bb595dc71b5ee22d9'
Richard Laager <rlaager@pidgin.im>
parents:
16585
diff
changeset
|
1347 | } |
|
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
|
1348 | g_free(bintext); |
| 10941 | 1349 | } |
| 7014 | 1350 | } |
| 1351 | g_free(text); | |
| 1352 | } | |
| 1353 | } | |
| 1354 | ||
|
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
|
1355 | 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
|
1356 | /* 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
|
1357 | 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
|
1358 | 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
|
1359 | 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
|
1360 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1361 | |
|
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
|
1362 | 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
|
1363 | } |
|
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
|
1364 | |
| 13794 | 1365 | g_free(bare_jid); |
| 1366 | ||
| 1367 | jabber_buddy_info_show_if_ready(jbi); | |
| 1368 | } | |
| 1369 | ||
| 1370 | static void jabber_buddy_info_resource_free(gpointer data) | |
| 1371 | { | |
| 1372 | JabberBuddyInfoResource *jbri = data; | |
| 1373 | g_free(jbri); | |
| 1374 | } | |
| 1375 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1376 | static void jabber_version_parse(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1377 | JabberIqType type, const char *id, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1378 | xmlnode *packet, gpointer data) |
| 13794 | 1379 | { |
| 1380 | JabberBuddyInfo *jbi = data; | |
| 1381 | xmlnode *query; | |
| 1382 | char *resource_name; | |
| 1383 | ||
| 1384 | g_return_if_fail(jbi != NULL); | |
| 1385 | ||
| 1386 | jabber_buddy_info_remove_id(jbi, id); | |
| 1387 | ||
| 1388 | if(!from) | |
| 1389 | return; | |
| 1390 | ||
| 1391 | resource_name = jabber_get_resource(from); | |
| 1392 | ||
| 1393 | if(resource_name) { | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1394 | if (type == JABBER_IQ_RESULT) { |
| 13794 | 1395 | if((query = xmlnode_get_child(packet, "query"))) { |
| 1396 | JabberBuddyResource *jbr = jabber_buddy_find_resource(jbi->jb, resource_name); | |
| 1397 | if(jbr) { | |
| 1398 | xmlnode *node; | |
| 1399 | if((node = xmlnode_get_child(query, "name"))) { | |
| 1400 | jbr->client.name = xmlnode_get_data(node); | |
| 1401 | } | |
| 1402 | if((node = xmlnode_get_child(query, "version"))) { | |
| 1403 | jbr->client.version = xmlnode_get_data(node); | |
| 1404 | } | |
| 1405 | if((node = xmlnode_get_child(query, "os"))) { | |
| 1406 | jbr->client.os = xmlnode_get_data(node); | |
| 1407 | } | |
| 1408 | } | |
| 1409 | } | |
| 1410 | } | |
| 1411 | g_free(resource_name); | |
| 10189 | 1412 | } |
| 13794 | 1413 | |
| 1414 | jabber_buddy_info_show_if_ready(jbi); | |
| 7014 | 1415 | } |
| 1416 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1417 | static void jabber_last_parse(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1418 | JabberIqType type, const char *id, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1419 | xmlnode *packet, gpointer data) |
| 13794 | 1420 | { |
| 1421 | JabberBuddyInfo *jbi = data; | |
| 1422 | xmlnode *query; | |
| 1423 | char *resource_name; | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1424 | const char *seconds; |
| 13794 | 1425 | |
| 1426 | g_return_if_fail(jbi != NULL); | |
| 1427 | ||
| 1428 | jabber_buddy_info_remove_id(jbi, id); | |
| 1429 | ||
| 1430 | if(!from) | |
| 1431 | return; | |
| 1432 | ||
| 1433 | resource_name = jabber_get_resource(from); | |
| 1434 | ||
| 1435 | if(resource_name) { | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1436 | if (type == JABBER_IQ_RESULT) { |
| 13794 | 1437 | if((query = xmlnode_get_child(packet, "query"))) { |
| 1438 | seconds = xmlnode_get_attrib(query, "seconds"); | |
| 1439 | if(seconds) { | |
| 1440 | char *end = NULL; | |
| 1441 | long sec = strtol(seconds, &end, 10); | |
|
25493
8bf093c656a5
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <malu@pidgin.im>
parents:
25228
diff
changeset
|
1442 | JabberBuddy *jb = NULL; |
|
8bf093c656a5
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <malu@pidgin.im>
parents:
25228
diff
changeset
|
1443 | char *resource = NULL; |
|
8bf093c656a5
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <malu@pidgin.im>
parents:
25228
diff
changeset
|
1444 | char *buddy_name = NULL; |
|
8bf093c656a5
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <malu@pidgin.im>
parents:
25228
diff
changeset
|
1445 | JabberBuddyResource *jbr = NULL; |
|
26958
a955bd42f529
propagate from branch 'im.pidgin.pidgin' (head 36f75a1d52a6af5574bf847d60054a1392dcbc67)
Paul Aurich <darkrain42@pidgin.im>
diff
changeset
|
1446 | |
|
25493
8bf093c656a5
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <malu@pidgin.im>
parents:
25228
diff
changeset
|
1447 | if(end != seconds) { |
| 13794 | 1448 | JabberBuddyInfoResource *jbir = g_hash_table_lookup(jbi->resources, resource_name); |
| 1449 | if(jbir) { | |
| 1450 | jbir->idle_seconds = sec; | |
| 1451 | } | |
| 1452 | } | |
|
25495
914281ac1de9
Updated a comment to describe what the actually does
Marcus Lundblad <malu@pidgin.im>
parents:
25494
diff
changeset
|
1453 | /* Update the idle time of the buddy resource, if we got it. |
|
914281ac1de9
Updated a comment to describe what the actually does
Marcus Lundblad <malu@pidgin.im>
parents:
25494
diff
changeset
|
1454 | This will correct the value when a server doesn't mark |
|
914281ac1de9
Updated a comment to describe what the actually does
Marcus Lundblad <malu@pidgin.im>
parents:
25494
diff
changeset
|
1455 | delayed presence and we got the presence when signing on */ |
|
25493
8bf093c656a5
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <malu@pidgin.im>
parents:
25228
diff
changeset
|
1456 | jb = jabber_buddy_find(js, from, FALSE); |
|
8bf093c656a5
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <malu@pidgin.im>
parents:
25228
diff
changeset
|
1457 | if (jb) { |
|
8bf093c656a5
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <malu@pidgin.im>
parents:
25228
diff
changeset
|
1458 | resource = jabber_get_resource(from); |
|
8bf093c656a5
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <malu@pidgin.im>
parents:
25228
diff
changeset
|
1459 | buddy_name = jabber_get_bare_jid(from); |
|
25494
84e0c2cb0c83
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <malu@pidgin.im>
parents:
25493
diff
changeset
|
1460 | /* if the resource already has an idle time set, we |
|
84e0c2cb0c83
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <malu@pidgin.im>
parents:
25493
diff
changeset
|
1461 | must have gotten it originally from a presence. In |
|
84e0c2cb0c83
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <malu@pidgin.im>
parents:
25493
diff
changeset
|
1462 | this case we update it. Otherwise don't update it, to |
|
84e0c2cb0c83
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <malu@pidgin.im>
parents:
25493
diff
changeset
|
1463 | avoid setting an idle and not getting informed about |
|
84e0c2cb0c83
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <malu@pidgin.im>
parents:
25493
diff
changeset
|
1464 | the resource getting unidle */ |
|
25493
8bf093c656a5
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <malu@pidgin.im>
parents:
25228
diff
changeset
|
1465 | if (resource && buddy_name) { |
|
8bf093c656a5
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <malu@pidgin.im>
parents:
25228
diff
changeset
|
1466 | jbr = jabber_buddy_find_resource(jb, resource); |
|
8bf093c656a5
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <malu@pidgin.im>
parents:
25228
diff
changeset
|
1467 | |
|
25494
84e0c2cb0c83
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <malu@pidgin.im>
parents:
25493
diff
changeset
|
1468 | if (jbr->idle) { |
|
84e0c2cb0c83
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <malu@pidgin.im>
parents:
25493
diff
changeset
|
1469 | if (sec) { |
|
84e0c2cb0c83
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <malu@pidgin.im>
parents:
25493
diff
changeset
|
1470 | jbr->idle = time(NULL) - sec; |
|
84e0c2cb0c83
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <malu@pidgin.im>
parents:
25493
diff
changeset
|
1471 | } else { |
|
84e0c2cb0c83
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <malu@pidgin.im>
parents:
25493
diff
changeset
|
1472 | jbr->idle = 0; |
|
84e0c2cb0c83
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <malu@pidgin.im>
parents:
25493
diff
changeset
|
1473 | } |
|
84e0c2cb0c83
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <malu@pidgin.im>
parents:
25493
diff
changeset
|
1474 | |
|
84e0c2cb0c83
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <malu@pidgin.im>
parents:
25493
diff
changeset
|
1475 | if (jbr == |
|
84e0c2cb0c83
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <malu@pidgin.im>
parents:
25493
diff
changeset
|
1476 | jabber_buddy_find_resource(jb, NULL)) { |
|
84e0c2cb0c83
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <malu@pidgin.im>
parents:
25493
diff
changeset
|
1477 | purple_prpl_got_user_idle(js->gc->account, |
|
84e0c2cb0c83
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <malu@pidgin.im>
parents:
25493
diff
changeset
|
1478 | buddy_name, jbr->idle, jbr->idle); |
|
84e0c2cb0c83
Only update the idle time on a buddy when getting info if the buddy already has
Marcus Lundblad <malu@pidgin.im>
parents:
25493
diff
changeset
|
1479 | } |
|
25493
8bf093c656a5
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <malu@pidgin.im>
parents:
25228
diff
changeset
|
1480 | } |
|
8bf093c656a5
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <malu@pidgin.im>
parents:
25228
diff
changeset
|
1481 | } |
|
8bf093c656a5
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <malu@pidgin.im>
parents:
25228
diff
changeset
|
1482 | g_free(resource); |
|
8bf093c656a5
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <malu@pidgin.im>
parents:
25228
diff
changeset
|
1483 | g_free(buddy_name); |
|
8bf093c656a5
When getting info from a buddy, update the idle status to the libpurple core
Marcus Lundblad <malu@pidgin.im>
parents:
25228
diff
changeset
|
1484 | } |
| 13794 | 1485 | } |
| 1486 | } | |
| 1487 | } | |
| 1488 | g_free(resource_name); | |
| 1489 | } | |
| 1490 | ||
| 1491 | jabber_buddy_info_show_if_ready(jbi); | |
| 1492 | } | |
| 1493 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1494 | static void jabber_time_parse(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1495 | JabberIqType type, const char *id, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1496 | xmlnode *packet, gpointer data) |
|
25822
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1497 | { |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1498 | JabberBuddyInfo *jbi = data; |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1499 | JabberBuddyResource *jbr; |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1500 | char *resource_name; |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1501 | |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1502 | g_return_if_fail(jbi != NULL); |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1503 | |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1504 | jabber_buddy_info_remove_id(jbi, id); |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1505 | |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1506 | if (!from) |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1507 | return; |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1508 | |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1509 | resource_name = jabber_get_resource(from); |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1510 | jbr = resource_name ? jabber_buddy_find_resource(jbi->jb, resource_name) : NULL; |
|
25827
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1511 | g_free(resource_name); |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1512 | if (jbr) { |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
1513 | if (type == JABBER_IQ_RESULT) { |
|
25822
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1514 | xmlnode *time = xmlnode_get_child(packet, "time"); |
|
25823
f17d4d5e59b4
Actually display the buddy's local time.
Paul Aurich <darkrain42@pidgin.im>
parents:
25822
diff
changeset
|
1515 | xmlnode *tzo = time ? xmlnode_get_child(time, "tzo") : NULL; |
|
25827
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1516 | char *tzo_data = tzo ? xmlnode_get_data(tzo) : NULL; |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1517 | if (tzo_data) { |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1518 | char *c = tzo_data; |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1519 | int hours, minutes; |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1520 | if (tzo_data[0] == 'Z' && tzo_data[1] == '\0') { |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1521 | jbr->tz_off = 0; |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1522 | } else { |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1523 | gboolean offset_positive = (tzo_data[0] == '+'); |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1524 | /* [+-]HH:MM */ |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1525 | if (((*c == '+' || *c == '-') && (c = c + 1)) && |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1526 | sscanf(c, "%02d:%02d", &hours, &minutes) == 2) { |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1527 | jbr->tz_off = 60*60*hours + 60*minutes; |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1528 | if (!offset_positive) |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1529 | jbr->tz_off *= -1; |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1530 | } else { |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1531 | purple_debug_info("jabber", "Ignoring malformed timezone %s", |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1532 | tzo_data); |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1533 | } |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1534 | } |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1535 | |
|
6adc5c7df7ae
Fix the timezone parsing (again) and display the timezone in the info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25825
diff
changeset
|
1536 | g_free(tzo_data); |
|
25822
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1537 | } |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1538 | } |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1539 | } |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1540 | |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1541 | jabber_buddy_info_show_if_ready(jbi); |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1542 | } |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1543 | |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1544 | void jabber_buddy_remove_all_pending_buddy_info_requests(JabberStream *js) |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1545 | { |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1546 | if (js->pending_buddy_info_requests) |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1547 | { |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1548 | JabberBuddyInfo *jbi; |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1549 | GSList *l = js->pending_buddy_info_requests; |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1550 | while (l) { |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1551 | jbi = l->data; |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1552 | |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1553 | g_slist_free(jbi->ids); |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1554 | jabber_buddy_info_destroy(jbi); |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1555 | |
|
15727
0754583ceeae
Don't access the list element after it has been freed.
Daniel Atallah <datallah@pidgin.im>
parents:
15688
diff
changeset
|
1556 | l = l->next; |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1557 | } |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1558 | |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1559 | g_slist_free(js->pending_buddy_info_requests); |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1560 | js->pending_buddy_info_requests = NULL; |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1561 | } |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1562 | } |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1563 | |
| 13794 | 1564 | static gboolean jabber_buddy_get_info_timeout(gpointer data) |
| 1565 | { | |
| 1566 | JabberBuddyInfo *jbi = data; | |
| 1567 | ||
| 1568 | /* remove the pending callbacks */ | |
| 1569 | while(jbi->ids) { | |
| 1570 | char *id = jbi->ids->data; | |
| 1571 | jabber_iq_remove_callback_by_id(jbi->js, id); | |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1572 | jbi->ids = g_slist_remove(jbi->ids, id); |
| 13794 | 1573 | g_free(id); |
| 1574 | } | |
| 1575 | ||
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1576 | jbi->js->pending_buddy_info_requests = g_slist_remove(jbi->js->pending_buddy_info_requests, jbi); |
| 13794 | 1577 | jbi->timeout_handle = 0; |
| 1578 | ||
| 1579 | jabber_buddy_info_show_if_ready(jbi); | |
| 1580 | ||
| 1581 | return FALSE; | |
| 1582 | } | |
| 1583 | ||
|
17029
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1584 | 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
|
1585 | { |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1586 | /* 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
|
1587 | 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
|
1588 | return FALSE; |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1589 | |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1590 | 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
|
1591 | if(!strcmp(jbr->client.name, "Trillian")) { |
|
20350
ae3f3561e698
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20320
diff
changeset
|
1592 | /* verified by nwalp 2007/05/09 */ |
|
ae3f3561e698
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20320
diff
changeset
|
1593 | if(!strcmp(jbr->client.version, "3.1.0.121") || |
|
ae3f3561e698
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20320
diff
changeset
|
1594 | /* verified by nwalp 2007/09/19 */ |
|
ae3f3561e698
another day, another irritating workaround
Nathan Walp <nwalp@pidgin.im>
parents:
20320
diff
changeset
|
1595 | !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
|
1596 | return TRUE; |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1597 | } |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1598 | } |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1599 | } |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1600 | |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1601 | return FALSE; |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1602 | } |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1603 | |
| 13794 | 1604 | static void jabber_buddy_get_info_for_jid(JabberStream *js, const char *jid) |
| 7014 | 1605 | { |
| 1606 | JabberIq *iq; | |
| 1607 | xmlnode *vcard; | |
| 13794 | 1608 | GList *resources; |
| 1609 | JabberBuddy *jb; | |
| 1610 | JabberBuddyInfo *jbi; | |
| 1611 | ||
| 1612 | jb = jabber_buddy_find(js, jid, TRUE); | |
| 1613 | ||
| 1614 | /* invalid JID */ | |
| 1615 | if(!jb) | |
| 1616 | return; | |
| 1617 | ||
| 1618 | jbi = g_new0(JabberBuddyInfo, 1); | |
| 1619 | jbi->jid = g_strdup(jid); | |
| 1620 | jbi->js = js; | |
| 1621 | jbi->jb = jb; | |
| 1622 | 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
|
1623 | jbi->user_info = purple_notify_user_info_new(); |
| 7014 | 1624 | |
| 1625 | iq = jabber_iq_new(js, JABBER_IQ_GET); | |
| 1626 | ||
| 13794 | 1627 | xmlnode_set_attrib(iq->node, "to", jid); |
| 7014 | 1628 | vcard = xmlnode_new_child(iq->node, "vCard"); |
| 13808 | 1629 | xmlnode_set_namespace(vcard, "vcard-temp"); |
| 7014 | 1630 | |
| 13794 | 1631 | jabber_iq_set_callback(iq, jabber_vcard_parse, jbi); |
| 1632 | jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); | |
| 7014 | 1633 | |
| 1634 | jabber_iq_send(iq); | |
| 13794 | 1635 | |
| 1636 | for(resources = jb->resources; resources; resources = resources->next) | |
| 1637 | { | |
| 1638 | JabberBuddyResource *jbr = resources->data; | |
|
14164
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1639 | JabberBuddyInfoResource *jbir; |
| 13794 | 1640 | char *full_jid; |
|
14164
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1641 | |
|
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1642 | if ((strchr(jid, '/') == NULL) && (jbr->name != NULL)) { |
|
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1643 | full_jid = g_strdup_printf("%s/%s", jid, jbr->name); |
|
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1644 | } else { |
| 13794 | 1645 | full_jid = g_strdup(jid); |
| 1646 | } | |
| 1647 | ||
|
14164
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1648 | if (jbr->name != NULL) |
|
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1649 | { |
|
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1650 | jbir = g_new0(JabberBuddyInfoResource, 1); |
|
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1651 | g_hash_table_insert(jbi->resources, g_strdup(jbr->name), jbir); |
|
d85f44e1fec1
[gaim-migrate @ 16732]
Mark Doliner <markdoliner@pidgin.im>
parents:
14155
diff
changeset
|
1652 | } |
| 13794 | 1653 | |
| 1654 | if(!jbr->client.name) { | |
| 1655 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:version"); | |
| 1656 | xmlnode_set_attrib(iq->node, "to", full_jid); | |
| 1657 | jabber_iq_set_callback(iq, jabber_version_parse, jbi); | |
| 1658 | jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); | |
| 1659 | jabber_iq_send(iq); | |
| 1660 | } | |
| 1661 | ||
|
17029
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1662 | /* 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
|
1663 | * to get info on a friend running Trillian, which doesn't |
| 17051 | 1664 | * 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
|
1665 | * 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
|
1666 | * office. */ |
|
dea59a003028
gross hack that will save me time in 30 second chunks
Nathan Walp <nwalp@pidgin.im>
parents:
17007
diff
changeset
|
1667 | 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
|
1668 | 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
|
1669 | 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
|
1670 | 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
|
1671 | 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
|
1672 | 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
|
1673 | } |
| 13794 | 1674 | |
|
25822
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1675 | if (jbr->tz_off == PURPLE_NO_TZ_OFF && |
| 26708 | 1676 | (!jbr->caps.info || |
|
25825
f77482c011dc
Request time information from a resource if we don't have caps for it
Paul Aurich <darkrain42@pidgin.im>
parents:
25823
diff
changeset
|
1677 | jabber_resource_has_capability(jbr, "urn:xmpp:time"))) { |
|
25822
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1678 | xmlnode *child; |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1679 | iq = jabber_iq_new(js, JABBER_IQ_GET); |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1680 | xmlnode_set_attrib(iq->node, "to", full_jid); |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1681 | child = xmlnode_new_child(iq->node, "time"); |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1682 | xmlnode_set_namespace(child, "urn:xmpp:time"); |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1683 | jabber_iq_set_callback(iq, jabber_time_parse, jbi); |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1684 | jbi->ids = g_slist_prepend(jbi->ids, g_strdup(iq->id)); |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1685 | jabber_iq_send(iq); |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1686 | } |
|
23f62dd4aed5
Retrieve and display buddy's local time in Get Info dialog
Paul Aurich <darkrain42@pidgin.im>
parents:
25454
diff
changeset
|
1687 | |
| 13794 | 1688 | g_free(full_jid); |
| 1689 | } | |
| 1690 | ||
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15273
diff
changeset
|
1691 | js->pending_buddy_info_requests = g_slist_prepend(js->pending_buddy_info_requests, jbi); |
|
26752
27fe5aa7cbd0
A patch from Arunan Balasubramaniam to use timeouts in seconds instead of
Arunan Balasubramaniam <foss@abala.me>
parents:
26691
diff
changeset
|
1692 | jbi->timeout_handle = purple_timeout_add_seconds(30, jabber_buddy_get_info_timeout, jbi); |
| 7014 | 1693 | } |
| 1694 | ||
| 15884 | 1695 | void jabber_buddy_get_info(PurpleConnection *gc, const char *who) |
| 10189 | 1696 | { |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1697 | 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
|
1698 | 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
|
1699 | |
|
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
|
1700 | 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
|
1701 | return; |
| 10189 | 1702 | |
|
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
|
1703 | 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
|
1704 | /* 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
|
1705 | 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
|
1706 | } 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
|
1707 | char *bare_jid = jabber_get_bare_jid(who); |
| 10189 | 1708 | jabber_buddy_get_info_for_jid(js, bare_jid); |
| 1709 | g_free(bare_jid); | |
| 1710 | } | |
|
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
|
1711 | |
|
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
|
1712 | jabber_id_free(jid); |
| 10189 | 1713 | } |
| 1714 | ||
| 7014 | 1715 | static void jabber_buddy_set_invisibility(JabberStream *js, const char *who, |
| 1716 | gboolean invisible) | |
| 1717 | { | |
| 15884 | 1718 | PurplePresence *gpresence; |
| 1719 | PurpleAccount *account; | |
| 1720 | PurpleStatus *status; | |
| 7014 | 1721 | JabberBuddy *jb = jabber_buddy_find(js, who, TRUE); |
| 1722 | xmlnode *presence; | |
| 9954 | 1723 | JabberBuddyState state; |
| 14525 | 1724 | char *msg; |
| 9954 | 1725 | int priority; |
| 7014 | 1726 | |
| 15884 | 1727 | account = purple_connection_get_account(js->gc); |
| 1728 | gpresence = purple_account_get_presence(account); | |
| 1729 | status = purple_presence_get_active_status(gpresence); | |
|
9944
71ef020ec4b0
[gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents:
9797
diff
changeset
|
1730 | |
| 15884 | 1731 | 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
|
1732 | presence = jabber_presence_create_js(js, state, msg, priority); |
| 9954 | 1733 | |
| 14525 | 1734 | g_free(msg); |
| 1735 | ||
| 7014 | 1736 | xmlnode_set_attrib(presence, "to", who); |
| 1737 | if(invisible) { | |
| 1738 | xmlnode_set_attrib(presence, "type", "invisible"); | |
| 1739 | jb->invisible |= JABBER_INVIS_BUDDY; | |
| 1740 | } else { | |
| 1741 | jb->invisible &= ~JABBER_INVIS_BUDDY; | |
| 1742 | } | |
| 1743 | ||
| 1744 | jabber_send(js, presence); | |
| 1745 | xmlnode_free(presence); | |
| 1746 | } | |
| 1747 | ||
| 15884 | 1748 | static void jabber_buddy_make_invisible(PurpleBlistNode *node, gpointer data) |
| 7014 | 1749 | { |
| 15884 | 1750 | PurpleBuddy *buddy; |
| 1751 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1752 | JabberStream *js; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1753 | |
| 15884 | 1754 | g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1755 | |
| 15884 | 1756 | buddy = (PurpleBuddy *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1757 | 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
|
1758 | js = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1759 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1760 | jabber_buddy_set_invisibility(js, purple_buddy_get_name(buddy), TRUE); |
| 7014 | 1761 | } |
| 1762 | ||
| 15884 | 1763 | static void jabber_buddy_make_visible(PurpleBlistNode *node, gpointer data) |
| 7014 | 1764 | { |
| 15884 | 1765 | PurpleBuddy *buddy; |
| 1766 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1767 | JabberStream *js; |
| 7014 | 1768 | |
| 15884 | 1769 | g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
| 7014 | 1770 | |
| 15884 | 1771 | buddy = (PurpleBuddy *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1772 | 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
|
1773 | js = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1774 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1775 | jabber_buddy_set_invisibility(js, purple_buddy_get_name(buddy), FALSE); |
| 7014 | 1776 | } |
| 1777 | ||
| 15884 | 1778 | static void jabber_buddy_cancel_presence_notification(PurpleBlistNode *node, |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1779 | gpointer data) |
| 7014 | 1780 | { |
| 15884 | 1781 | PurpleBuddy *buddy; |
| 1782 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1783 | JabberStream *js; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1784 | |
| 15884 | 1785 | g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
| 7014 | 1786 | |
| 15884 | 1787 | buddy = (PurpleBuddy *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1788 | 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
|
1789 | js = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1790 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1791 | /* 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
|
1792 | jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "unsubscribed"); |
| 7014 | 1793 | } |
| 1794 | ||
| 15884 | 1795 | static void jabber_buddy_rerequest_auth(PurpleBlistNode *node, gpointer data) |
| 7250 | 1796 | { |
| 15884 | 1797 | PurpleBuddy *buddy; |
| 1798 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1799 | JabberStream *js; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1800 | |
| 15884 | 1801 | g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
| 7250 | 1802 | |
| 15884 | 1803 | buddy = (PurpleBuddy *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1804 | 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
|
1805 | js = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1806 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1807 | jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "subscribe"); |
| 7250 | 1808 | } |
| 1809 | ||
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1810 | |
| 15884 | 1811 | static void jabber_buddy_unsubscribe(PurpleBlistNode *node, gpointer data) |
| 7014 | 1812 | { |
| 15884 | 1813 | PurpleBuddy *buddy; |
| 1814 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1815 | JabberStream *js; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1816 | |
| 15884 | 1817 | g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1818 | |
| 15884 | 1819 | buddy = (PurpleBuddy *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1820 | 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
|
1821 | js = purple_connection_get_protocol_data(gc); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1822 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1823 | 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
|
1824 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1825 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1826 | 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
|
1827 | 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
|
1828 | /* 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
|
1829 | PurpleBuddy *buddy = (PurpleBuddy *) node; |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1830 | 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
|
1831 | 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
|
1832 | 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
|
1833 | 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
|
1834 | 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
|
1835 | xmlnode *presence; |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1836 | JabberBuddyState state; |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1837 | char *msg; |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1838 | 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
|
1839 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1840 | 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
|
1841 | 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
|
1842 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1843 | 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
|
1844 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1845 | 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
|
1846 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1847 | 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
|
1848 | xmlnode_free(presence); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1849 | } |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1850 | } |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1851 | |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1852 | 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
|
1853 | 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
|
1854 | /* 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
|
1855 | PurpleBuddy *buddy = (PurpleBuddy *) node; |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1856 | 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
|
1857 | 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
|
1858 | 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
|
1859 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1860 | 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
|
1861 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1862 | 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
|
1863 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1864 | 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
|
1865 | xmlnode_free(presence); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1866 | } |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1867 | } |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1868 | |
| 15884 | 1869 | static GList *jabber_buddy_menu(PurpleBuddy *buddy) |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1870 | { |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
1871 | 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
|
1872 | 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
|
1873 | 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
|
1874 | 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
|
1875 | GList *jbrs; |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1876 | |
| 7014 | 1877 | GList *m = NULL; |
| 15884 | 1878 | PurpleMenuAction *act; |
| 7395 | 1879 | |
| 1880 | if(!jb) | |
| 1881 | return m; | |
| 1882 | ||
| 8185 | 1883 | /* XXX: fix the NOT ME below */ |
| 1884 | ||
| 1885 | if(js->protocol_version == JABBER_PROTO_0_9 /* && NOT ME */) { | |
| 8166 | 1886 | if(jb->invisible & JABBER_INVIS_BUDDY) { |
| 15884 | 1887 | act = purple_menu_action_new(_("Un-hide From"), |
| 1888 | PURPLE_CALLBACK(jabber_buddy_make_visible), | |
| 12919 | 1889 | NULL, NULL); |
| 8166 | 1890 | } else { |
| 15884 | 1891 | act = purple_menu_action_new(_("Temporarily Hide From"), |
| 1892 | PURPLE_CALLBACK(jabber_buddy_make_invisible), | |
| 13019 | 1893 | NULL, NULL); |
| 8166 | 1894 | } |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1895 | m = g_list_append(m, act); |
| 7014 | 1896 | } |
| 1897 | ||
| 8185 | 1898 | if(jb->subscription & JABBER_SUB_FROM /* && NOT ME */) { |
| 15884 | 1899 | act = purple_menu_action_new(_("Cancel Presence Notification"), |
| 1900 | PURPLE_CALLBACK(jabber_buddy_cancel_presence_notification), | |
| 12919 | 1901 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1902 | m = g_list_append(m, act); |
| 7014 | 1903 | } |
| 1904 | ||
| 1905 | if(!(jb->subscription & JABBER_SUB_TO)) { | |
| 15884 | 1906 | act = purple_menu_action_new(_("(Re-)Request authorization"), |
| 1907 | PURPLE_CALLBACK(jabber_buddy_rerequest_auth), | |
| 12919 | 1908 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1909 | m = g_list_append(m, act); |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1910 | |
| 8185 | 1911 | } else /* if(NOT ME) */{ |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1912 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1913 | /* shouldn't this just happen automatically when the buddy is |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1914 | removed? */ |
| 15884 | 1915 | act = purple_menu_action_new(_("Unsubscribe"), |
| 1916 | PURPLE_CALLBACK(jabber_buddy_unsubscribe), | |
| 12919 | 1917 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1918 | m = g_list_append(m, act); |
| 7014 | 1919 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1920 | |
|
17808
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1921 | /* |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1922 | * 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
|
1923 | * |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1924 | * 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
|
1925 | * 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
|
1926 | * 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
|
1927 | * 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
|
1928 | */ |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24251
diff
changeset
|
1929 | 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
|
1930 | 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
|
1931 | 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
|
1932 | NULL, NULL); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1933 | 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
|
1934 | 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
|
1935 | 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
|
1936 | NULL, NULL); |
|
9b9a78bf9a03
Implemented logging in/out of gateways, as explained in XEP-0100.
Andreas Monitzer <am@adiumx.com>
parents:
17807
diff
changeset
|
1937 | 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
|
1938 | } |
|
26042
4dabdb5fe213
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25911
diff
changeset
|
1939 | |
|
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
|
1940 | /* 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
|
1941 | 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
|
1942 | 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
|
1943 | 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
|
1944 | 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
|
1945 | 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
|
1946 | 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
|
1947 | 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
|
1948 | 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
|
1949 | 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
|
1950 | } |
|
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
|
1951 | } |
| 7014 | 1952 | |
| 1953 | return m; | |
| 1954 | } | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1955 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1956 | GList * |
| 15884 | 1957 | jabber_blist_node_menu(PurpleBlistNode *node) |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1958 | { |
| 15884 | 1959 | if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
| 1960 | return jabber_buddy_menu((PurpleBuddy *) node); | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1961 | } else { |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1962 | return NULL; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1963 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1964 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1965 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
1966 | |
| 9954 | 1967 | const char * |
| 1968 | jabber_buddy_state_get_name(JabberBuddyState state) | |
| 1969 | { | |
| 1970 | switch(state) { | |
| 1971 | case JABBER_BUDDY_STATE_UNKNOWN: | |
| 1972 | return _("Unknown"); | |
| 1973 | case JABBER_BUDDY_STATE_ERROR: | |
| 1974 | return _("Error"); | |
| 1975 | case JABBER_BUDDY_STATE_UNAVAILABLE: | |
| 1976 | return _("Offline"); | |
| 1977 | case JABBER_BUDDY_STATE_ONLINE: | |
|
12467
94948d1eb8cf
[gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents:
12323
diff
changeset
|
1978 | return _("Available"); |
| 9954 | 1979 | case JABBER_BUDDY_STATE_CHAT: |
| 1980 | return _("Chatty"); | |
| 1981 | case JABBER_BUDDY_STATE_AWAY: | |
| 1982 | return _("Away"); | |
| 1983 | case JABBER_BUDDY_STATE_XA: | |
| 1984 | return _("Extended Away"); | |
| 1985 | case JABBER_BUDDY_STATE_DND: | |
| 1986 | return _("Do Not Disturb"); | |
| 1987 | } | |
| 1988 | ||
| 1989 | return _("Unknown"); | |
| 1990 | } | |
| 1991 | ||
| 1992 | JabberBuddyState jabber_buddy_status_id_get_state(const char *id) { | |
| 1993 | if(!id) | |
| 1994 | return JABBER_BUDDY_STATE_UNKNOWN; | |
|
11540
ad0321374664
[gaim-migrate @ 13795]
Mark Doliner <markdoliner@pidgin.im>
parents:
11533
diff
changeset
|
1995 | if(!strcmp(id, "available")) |
| 9954 | 1996 | return JABBER_BUDDY_STATE_ONLINE; |
| 12683 | 1997 | if(!strcmp(id, "freeforchat")) |
| 1998 | return JABBER_BUDDY_STATE_CHAT; | |
| 1999 | if(!strcmp(id, "away")) | |
| 2000 | return JABBER_BUDDY_STATE_AWAY; | |
| 2001 | if(!strcmp(id, "extended_away")) | |
| 2002 | return JABBER_BUDDY_STATE_XA; | |
| 2003 | if(!strcmp(id, "dnd")) | |
| 2004 | return JABBER_BUDDY_STATE_DND; | |
| 2005 | if(!strcmp(id, "offline")) | |
| 2006 | return JABBER_BUDDY_STATE_UNAVAILABLE; | |
| 2007 | if(!strcmp(id, "error")) | |
| 2008 | return JABBER_BUDDY_STATE_ERROR; | |
| 2009 | ||
| 2010 | return JABBER_BUDDY_STATE_UNKNOWN; | |
| 2011 | } | |
| 2012 | ||
| 2013 | JabberBuddyState jabber_buddy_show_get_state(const char *id) { | |
| 2014 | if(!id) | |
| 2015 | return JABBER_BUDDY_STATE_UNKNOWN; | |
| 2016 | if(!strcmp(id, "available")) | |
| 2017 | return JABBER_BUDDY_STATE_ONLINE; | |
| 9954 | 2018 | if(!strcmp(id, "chat")) |
| 2019 | return JABBER_BUDDY_STATE_CHAT; | |
| 2020 | if(!strcmp(id, "away")) | |
| 2021 | return JABBER_BUDDY_STATE_AWAY; | |
| 2022 | if(!strcmp(id, "xa")) | |
| 2023 | return JABBER_BUDDY_STATE_XA; | |
| 2024 | if(!strcmp(id, "dnd")) | |
| 2025 | return JABBER_BUDDY_STATE_DND; | |
| 2026 | if(!strcmp(id, "offline")) | |
| 2027 | return JABBER_BUDDY_STATE_UNAVAILABLE; | |
| 2028 | if(!strcmp(id, "error")) | |
| 2029 | return JABBER_BUDDY_STATE_ERROR; | |
| 2030 | ||
| 2031 | return JABBER_BUDDY_STATE_UNKNOWN; | |
| 2032 | } | |
| 2033 | ||
| 12683 | 2034 | const char *jabber_buddy_state_get_show(JabberBuddyState state) { |
| 9954 | 2035 | switch(state) { |
| 2036 | case JABBER_BUDDY_STATE_CHAT: | |
| 2037 | return "chat"; | |
| 2038 | case JABBER_BUDDY_STATE_AWAY: | |
| 2039 | return "away"; | |
| 2040 | case JABBER_BUDDY_STATE_XA: | |
| 2041 | return "xa"; | |
| 2042 | case JABBER_BUDDY_STATE_DND: | |
| 2043 | return "dnd"; | |
| 2044 | case JABBER_BUDDY_STATE_ONLINE: | |
|
11540
ad0321374664
[gaim-migrate @ 13795]
Mark Doliner <markdoliner@pidgin.im>
parents:
11533
diff
changeset
|
2045 | return "available"; |
| 9954 | 2046 | case JABBER_BUDDY_STATE_UNKNOWN: |
| 2047 | case JABBER_BUDDY_STATE_ERROR: | |
| 2048 | return NULL; | |
| 2049 | case JABBER_BUDDY_STATE_UNAVAILABLE: | |
| 2050 | return "offline"; | |
| 2051 | } | |
| 2052 | return NULL; | |
| 2053 | } | |
| 11675 | 2054 | |
| 12683 | 2055 | const char *jabber_buddy_state_get_status_id(JabberBuddyState state) { |
| 2056 | switch(state) { | |
| 2057 | case JABBER_BUDDY_STATE_CHAT: | |
| 2058 | return "freeforchat"; | |
| 2059 | case JABBER_BUDDY_STATE_AWAY: | |
| 2060 | return "away"; | |
| 2061 | case JABBER_BUDDY_STATE_XA: | |
| 2062 | return "extended_away"; | |
| 2063 | case JABBER_BUDDY_STATE_DND: | |
| 2064 | return "dnd"; | |
| 2065 | case JABBER_BUDDY_STATE_ONLINE: | |
| 2066 | return "available"; | |
| 2067 | case JABBER_BUDDY_STATE_UNKNOWN: | |
| 13758 | 2068 | return "available"; |
| 12683 | 2069 | case JABBER_BUDDY_STATE_ERROR: |
| 13758 | 2070 | return "error"; |
| 12683 | 2071 | case JABBER_BUDDY_STATE_UNAVAILABLE: |
| 2072 | return "offline"; | |
| 2073 | } | |
| 2074 | return NULL; | |
| 2075 | } | |
| 2076 | ||
| 15884 | 2077 | static void user_search_result_add_buddy_cb(PurpleConnection *gc, GList *row, void *user_data) |
| 11675 | 2078 | { |
| 2079 | /* XXX find out the jid */ | |
| 15884 | 2080 | purple_blist_request_add_buddy(purple_connection_get_account(gc), |
| 11675 | 2081 | g_list_nth_data(row, 0), NULL, NULL); |
| 2082 | } | |
| 2083 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
2084 | static void user_search_result_cb(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
2085 | JabberIqType type, const char *id, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
2086 | xmlnode *packet, gpointer data) |
| 11675 | 2087 | { |
| 15884 | 2088 | PurpleNotifySearchResults *results; |
| 2089 | PurpleNotifySearchColumn *column; | |
| 11675 | 2090 | xmlnode *x, *query, *item, *field; |
| 2091 | ||
| 2092 | /* XXX error checking? */ | |
| 2093 | if(!(query = xmlnode_get_child(packet, "query"))) | |
| 2094 | return; | |
| 2095 | ||
| 15884 | 2096 | results = purple_notify_searchresults_new(); |
| 11675 | 2097 | if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { |
| 2098 | 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
|
2099 | 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
|
2100 | |
| 15884 | 2101 | 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
|
2102 | |
| 11675 | 2103 | if((reported = xmlnode_get_child(x, "reported"))) { |
| 2104 | xmlnode *field = xmlnode_get_child(reported, "field"); | |
| 2105 | while(field) { | |
| 2106 | const char *var = xmlnode_get_attrib(field, "var"); | |
| 2107 | const char *label = xmlnode_get_attrib(field, "label"); | |
| 2108 | if(var) { | |
| 15884 | 2109 | column = purple_notify_searchresults_column_new(label ? label : var); |
| 2110 | 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
|
2111 | column_vars = g_slist_append(column_vars, (char *)var); |
| 11675 | 2112 | } |
| 2113 | field = xmlnode_get_next_twin(field); | |
| 2114 | } | |
| 2115 | } | |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2116 | |
| 11675 | 2117 | item = xmlnode_get_child(x, "item"); |
| 2118 | while(item) { | |
| 2119 | 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
|
2120 | GSList *l; |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2121 | xmlnode *valuenode; |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2122 | 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
|
2123 | |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2124 | 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
|
2125 | /* |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2126 | * 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
|
2127 | * 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
|
2128 | */ |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2129 | 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
|
2130 | field != NULL; |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2131 | 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
|
2132 | { |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2133 | 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
|
2134 | !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
|
2135 | (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
|
2136 | { |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2137 | 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
|
2138 | 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
|
2139 | break; |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2140 | } |
| 11675 | 2141 | } |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2142 | 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
|
2143 | /* 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
|
2144 | row = g_list_append(row, NULL); |
| 11675 | 2145 | } |
| 15884 | 2146 | purple_notify_searchresults_row_add(results, row); |
| 11675 | 2147 | item = xmlnode_get_next_twin(item); |
| 2148 | } | |
|
19963
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2149 | |
|
46f23859d166
Fix the bug reported to the devel mailing list by Georgi Kirilov.
Mark Doliner <markdoliner@pidgin.im>
parents:
19931
diff
changeset
|
2150 | g_slist_free(column_vars); |
| 11675 | 2151 | } else { |
| 2152 | /* old skool */ | |
| 15884 | 2153 | purple_debug_info("jabber", "old-skool\n"); |
| 11675 | 2154 | |
| 15884 | 2155 | column = purple_notify_searchresults_column_new(_("JID")); |
| 2156 | purple_notify_searchresults_column_add(results, column); | |
| 2157 | column = purple_notify_searchresults_column_new(_("First Name")); | |
| 2158 | purple_notify_searchresults_column_add(results, column); | |
| 2159 | column = purple_notify_searchresults_column_new(_("Last Name")); | |
| 2160 | purple_notify_searchresults_column_add(results, column); | |
| 2161 | column = purple_notify_searchresults_column_new(_("Nickname")); | |
| 2162 | 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
|
2163 | column = purple_notify_searchresults_column_new(_("Email")); |
| 15884 | 2164 | purple_notify_searchresults_column_add(results, column); |
| 11675 | 2165 | |
| 2166 | for(item = xmlnode_get_child(query, "item"); item; item = xmlnode_get_next_twin(item)) { | |
| 2167 | const char *jid; | |
| 2168 | xmlnode *node; | |
| 2169 | GList *row = NULL; | |
| 2170 | ||
| 2171 | if(!(jid = xmlnode_get_attrib(item, "jid"))) | |
| 2172 | continue; | |
| 2173 | ||
| 2174 | row = g_list_append(row, g_strdup(jid)); | |
| 2175 | node = xmlnode_get_child(item, "first"); | |
| 2176 | row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); | |
| 2177 | node = xmlnode_get_child(item, "last"); | |
| 2178 | row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); | |
| 2179 | node = xmlnode_get_child(item, "nick"); | |
| 2180 | row = g_list_append(row, node ? xmlnode_get_data(node) : NULL); | |
| 2181 | node = xmlnode_get_child(item, "email"); | |
| 2182 | 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
|
2183 | purple_debug_info("jabber", "row=%p\n", row); |
| 15884 | 2184 | purple_notify_searchresults_row_add(results, row); |
| 11675 | 2185 | } |
| 2186 | } | |
| 2187 | ||
| 15884 | 2188 | purple_notify_searchresults_button_add(results, PURPLE_NOTIFY_BUTTON_ADD, |
| 11675 | 2189 | user_search_result_add_buddy_cb); |
| 2190 | ||
| 15884 | 2191 | purple_notify_searchresults(js->gc, NULL, NULL, _("The following are the results of your search"), results, NULL, NULL); |
| 11675 | 2192 | } |
| 2193 | ||
| 2194 | static void user_search_x_data_cb(JabberStream *js, xmlnode *result, gpointer data) | |
| 2195 | { | |
| 2196 | xmlnode *query; | |
| 2197 | JabberIq *iq; | |
| 13345 | 2198 | char *dir_server = data; |
|
21388
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2199 | const char *type; |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2200 | |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2201 | /* 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
|
2202 | * 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
|
2203 | * a cancel, so skip it */ |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2204 | type = xmlnode_get_attrib(result, "type"); |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2205 | if(type && !strcmp(type, "cancel")) { |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2206 | g_free(dir_server); |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2207 | return; |
|
108195e86aa3
don't send a canceled user query
Nathan Walp <nwalp@pidgin.im>
parents:
21381
diff
changeset
|
2208 | } |
| 11675 | 2209 | |
| 2210 | iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:search"); | |
| 2211 | query = xmlnode_get_child(iq->node, "query"); | |
| 2212 | ||
| 2213 | xmlnode_insert_child(query, result); | |
| 2214 | ||
| 2215 | jabber_iq_set_callback(iq, user_search_result_cb, NULL); | |
| 13345 | 2216 | xmlnode_set_attrib(iq->node, "to", dir_server); |
| 11675 | 2217 | jabber_iq_send(iq); |
| 13345 | 2218 | g_free(dir_server); |
| 11675 | 2219 | } |
| 2220 | ||
| 2221 | struct user_search_info { | |
| 2222 | JabberStream *js; | |
| 2223 | char *directory_server; | |
| 2224 | }; | |
| 2225 | ||
| 15884 | 2226 | static void user_search_cancel_cb(struct user_search_info *usi, PurpleRequestFields *fields) |
| 11675 | 2227 | { |
| 2228 | g_free(usi->directory_server); | |
| 2229 | g_free(usi); | |
| 2230 | } | |
| 2231 | ||
| 15884 | 2232 | static void user_search_cb(struct user_search_info *usi, PurpleRequestFields *fields) |
| 11675 | 2233 | { |
| 2234 | JabberStream *js = usi->js; | |
| 2235 | JabberIq *iq; | |
| 2236 | xmlnode *query; | |
| 2237 | GList *groups, *flds; | |
| 2238 | ||
| 2239 | iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:search"); | |
| 2240 | query = xmlnode_get_child(iq->node, "query"); | |
| 2241 | ||
| 15884 | 2242 | for(groups = purple_request_fields_get_groups(fields); groups; groups = groups->next) { |
| 2243 | for(flds = purple_request_field_group_get_fields(groups->data); | |
| 11675 | 2244 | flds; flds = flds->next) { |
| 15884 | 2245 | PurpleRequestField *field = flds->data; |
| 2246 | const char *id = purple_request_field_get_id(field); | |
| 2247 | const char *value = purple_request_field_string_get_value(field); | |
| 11675 | 2248 | |
| 2249 | if(value && (!strcmp(id, "first") || !strcmp(id, "last") || !strcmp(id, "nick") || !strcmp(id, "email"))) { | |
| 2250 | xmlnode *y = xmlnode_new_child(query, id); | |
| 2251 | xmlnode_insert_data(y, value, -1); | |
| 2252 | } | |
| 2253 | } | |
| 2254 | } | |
| 2255 | ||
| 2256 | jabber_iq_set_callback(iq, user_search_result_cb, NULL); | |
| 2257 | xmlnode_set_attrib(iq->node, "to", usi->directory_server); | |
| 2258 | jabber_iq_send(iq); | |
| 2259 | ||
| 2260 | g_free(usi->directory_server); | |
| 2261 | g_free(usi); | |
| 2262 | } | |
| 2263 | ||
|
13617
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2264 | #if 0 |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2265 | /* 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
|
2266 | |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2267 | /* |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2268 | * 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
|
2269 | * comments for Jabber User Directories |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2270 | * |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2271 | * See discussion thread "Search comment for Jabber is not translatable" |
| 15884 | 2272 | * 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
|
2273 | */ |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2274 | 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
|
2275 | /* 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
|
2276 | 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
|
2277 | "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
|
2278 | NULL |
|
13617
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2279 | }; |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2280 | #endif |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2281 | |
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
2282 | static void user_search_fields_result_cb(JabberStream *js, const char *from, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
2283 | JabberIqType type, const char *id, |
|
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
2284 | xmlnode *packet, gpointer data) |
| 11675 | 2285 | { |
| 2286 | xmlnode *query, *x; | |
| 2287 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
2288 | if (!from) |
| 11675 | 2289 | return; |
| 2290 | ||
|
26687
1e799151fabe
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents:
26088
diff
changeset
|
2291 | if (type == JABBER_IQ_ERROR) { |
|
21150
bedd1215fb5e
Stop jabber setting wants_to_die itself. This involved plumbing disconnection
Will Thompson <resiak@pidgin.im>
parents:
20350
diff
changeset
|
2292 | char *msg = jabber_parse_error(js, packet, NULL); |
| 13794 | 2293 | |
|
13634
e9f9cef982d7
[gaim-migrate @ 16031]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13619
diff
changeset
|
2294 | if(!msg) |
|
e9f9cef982d7
[gaim-migrate @ 16031]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13619
diff
changeset
|
2295 | msg = g_strdup(_("Unknown error")); |
|
e9f9cef982d7
[gaim-migrate @ 16031]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13619
diff
changeset
|
2296 | |
| 15884 | 2297 | 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
|
2298 | _("Could not query the directory server."), msg); |
|
e9f9cef982d7
[gaim-migrate @ 16031]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13619
diff
changeset
|
2299 | g_free(msg); |
|
e9f9cef982d7
[gaim-migrate @ 16031]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13619
diff
changeset
|
2300 | |
| 13345 | 2301 | return; |
| 2302 | } | |
| 2303 | ||
| 11675 | 2304 | |
| 2305 | if(!(query = xmlnode_get_child(packet, "query"))) | |
| 2306 | return; | |
| 2307 | ||
| 13330 | 2308 | if((x = xmlnode_get_child_with_namespace(query, "x", "jabber:x:data"))) { |
| 13345 | 2309 | jabber_x_data_request(js, x, user_search_x_data_cb, g_strdup(from)); |
| 11675 | 2310 | return; |
| 2311 | } else { | |
| 2312 | struct user_search_info *usi; | |
| 2313 | xmlnode *instnode; | |
|
13617
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2314 | char *instructions = NULL; |
| 15884 | 2315 | PurpleRequestFields *fields; |
| 2316 | PurpleRequestFieldGroup *group; | |
| 2317 | PurpleRequestField *field; | |
| 11675 | 2318 | |
| 2319 | /* old skool */ | |
| 15884 | 2320 | fields = purple_request_fields_new(); |
| 2321 | group = purple_request_field_group_new(NULL); | |
| 2322 | purple_request_fields_add_group(fields, group); | |
| 11675 | 2323 | |
| 2324 | if((instnode = xmlnode_get_child(query, "instructions"))) | |
|
13574
433001d94e3e
[gaim-migrate @ 15952]
Richard Laager <rlaager@pidgin.im>
parents:
13572
diff
changeset
|
2325 | { |
|
433001d94e3e
[gaim-migrate @ 15952]
Richard Laager <rlaager@pidgin.im>
parents:
13572
diff
changeset
|
2326 | char *tmp = xmlnode_get_data(instnode); |
| 13794 | 2327 | |
|
13617
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2328 | if(tmp) |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2329 | { |
| 13794 | 2330 | /* 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
|
2331 | list in jabber_user_dir_comments[]) */ |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2332 | instructions = g_strdup_printf(_("Server Instructions: %s"), _(tmp)); |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2333 | g_free(tmp); |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2334 | } |
|
13574
433001d94e3e
[gaim-migrate @ 15952]
Richard Laager <rlaager@pidgin.im>
parents:
13572
diff
changeset
|
2335 | } |
| 13794 | 2336 | |
|
13617
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2337 | if(!instructions) |
|
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2338 | { |
| 11675 | 2339 | 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
|
2340 | "for any matching XMPP users.")); |
|
13617
983b0c58fcae
[gaim-migrate @ 16002]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13574
diff
changeset
|
2341 | } |
| 11675 | 2342 | |
| 2343 | if(xmlnode_get_child(query, "first")) { | |
| 15884 | 2344 | field = purple_request_field_string_new("first", _("First Name"), |
| 11675 | 2345 | NULL, FALSE); |
| 15884 | 2346 | purple_request_field_group_add_field(group, field); |
| 11675 | 2347 | } |
| 2348 | if(xmlnode_get_child(query, "last")) { | |
| 15884 | 2349 | field = purple_request_field_string_new("last", _("Last Name"), |
| 11675 | 2350 | NULL, FALSE); |
| 15884 | 2351 | purple_request_field_group_add_field(group, field); |
| 11675 | 2352 | } |
| 2353 | if(xmlnode_get_child(query, "nick")) { | |
| 15884 | 2354 | field = purple_request_field_string_new("nick", _("Nickname"), |
| 11675 | 2355 | NULL, FALSE); |
| 15884 | 2356 | purple_request_field_group_add_field(group, field); |
| 11675 | 2357 | } |
| 2358 | 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
|
2359 | field = purple_request_field_string_new("email", _("Email Address"), |
| 11675 | 2360 | NULL, FALSE); |
| 15884 | 2361 | purple_request_field_group_add_field(group, field); |
| 11675 | 2362 | } |
| 2363 | ||
| 2364 | usi = g_new0(struct user_search_info, 1); | |
| 2365 | usi->js = js; | |
| 2366 | usi->directory_server = g_strdup(from); | |
| 2367 | ||
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
2368 | 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
|
2369 | _("Search for XMPP users"), instructions, fields, |
| 11675 | 2370 | _("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
|
2371 | _("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
|
2372 | purple_connection_get_account(js->gc), NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
2373 | usi); |
| 11675 | 2374 | |
| 2375 | g_free(instructions); | |
| 2376 | } | |
| 2377 | } | |
| 2378 | ||
|
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
|
2379 | void jabber_user_search(JabberStream *js, const char *directory) |
| 11675 | 2380 | { |
| 2381 | JabberIq *iq; | |
| 2382 | ||
| 2383 | /* XXX: should probably better validate the directory we're given */ | |
| 2384 | if(!directory || !*directory) { | |
| 15884 | 2385 | purple_notify_error(js->gc, _("Invalid Directory"), _("Invalid Directory"), NULL); |
| 11675 | 2386 | return; |
| 2387 | } | |
| 2388 | ||
| 2389 | iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:search"); | |
| 2390 | xmlnode_set_attrib(iq->node, "to", directory); | |
| 2391 | ||
| 2392 | jabber_iq_set_callback(iq, user_search_fields_result_cb, NULL); | |
| 2393 | ||
| 2394 | jabber_iq_send(iq); | |
| 2395 | } | |
| 2396 | ||
| 15884 | 2397 | void jabber_user_search_begin(PurplePluginAction *action) |
| 11675 | 2398 | { |
| 15884 | 2399 | PurpleConnection *gc = (PurpleConnection *) action->context; |
|
24942
ec72b773a9da
More struct hiding work
Richard Laager <rlaager@pidgin.im>
parents:
24251
diff
changeset
|
2400 | JabberStream *js = purple_connection_get_protocol_data(gc); |
| 11675 | 2401 | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
2402 | purple_request_input(gc, _("Enter a User Directory"), _("Enter a User Directory"), |
| 11675 | 2403 | _("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
|
2404 | js->user_directories ? js->user_directories->data : NULL, |
| 11675 | 2405 | 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
|
2406 | _("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
|
2407 | _("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
|
2408 | NULL, NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
2409 | js); |
| 11675 | 2410 | } |
| 13794 | 2411 | |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2412 | gboolean |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2413 | 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
|
2414 | { |
|
24802
eb481e98ac6a
Sprinkle jabber_resource_has_capability in places
Paul Aurich <darkrain42@pidgin.im>
parents:
24732
diff
changeset
|
2415 | const GList *node = NULL; |
|
24880
ae4e8598d0bf
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents:
24878
diff
changeset
|
2416 | const JabberCapsNodeExts *exts; |
| 13794 | 2417 | |
|
24880
ae4e8598d0bf
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents:
24878
diff
changeset
|
2418 | if (!jbr->caps.info) { |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2419 | purple_debug_error("jabber", |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2420 | "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
|
2421 | return FALSE; |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2422 | } |
| 13794 | 2423 | |
|
24880
ae4e8598d0bf
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents:
24878
diff
changeset
|
2424 | node = g_list_find_custom(jbr->caps.info->features, cap, (GCompareFunc)strcmp); |
|
ae4e8598d0bf
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents:
24878
diff
changeset
|
2425 | if (!node && jbr->caps.exts && jbr->caps.info->exts) { |
|
ae4e8598d0bf
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents:
24878
diff
changeset
|
2426 | const GList *ext; |
|
ae4e8598d0bf
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents:
24878
diff
changeset
|
2427 | exts = jbr->caps.info->exts; |
|
ae4e8598d0bf
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents:
24878
diff
changeset
|
2428 | /* Walk through all the enabled caps, checking each list for the cap. |
|
ae4e8598d0bf
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents:
24878
diff
changeset
|
2429 | * Don't check it twice, though. */ |
|
ae4e8598d0bf
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents:
24878
diff
changeset
|
2430 | for (ext = jbr->caps.exts; ext && !node; ext = ext->next) { |
|
ae4e8598d0bf
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents:
24878
diff
changeset
|
2431 | GList *features = g_hash_table_lookup(exts->exts, ext->data); |
|
ae4e8598d0bf
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents:
24878
diff
changeset
|
2432 | if (features) |
|
ae4e8598d0bf
Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents:
24878
diff
changeset
|
2433 | node = g_list_find_custom(features, cap, (GCompareFunc)strcmp); |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2434 | } |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2435 | } |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2436 | |
|
24802
eb481e98ac6a
Sprinkle jabber_resource_has_capability in places
Paul Aurich <darkrain42@pidgin.im>
parents:
24732
diff
changeset
|
2437 | /* TODO: Are these messages actually useful? */ |
|
eb481e98ac6a
Sprinkle jabber_resource_has_capability in places
Paul Aurich <darkrain42@pidgin.im>
parents:
24732
diff
changeset
|
2438 | if (node) |
|
eb481e98ac6a
Sprinkle jabber_resource_has_capability in places
Paul Aurich <darkrain42@pidgin.im>
parents:
24732
diff
changeset
|
2439 | purple_debug_info("jabber", "Found cap: %s\n", cap); |
|
eb481e98ac6a
Sprinkle jabber_resource_has_capability in places
Paul Aurich <darkrain42@pidgin.im>
parents:
24732
diff
changeset
|
2440 | else |
|
eb481e98ac6a
Sprinkle jabber_resource_has_capability in places
Paul Aurich <darkrain42@pidgin.im>
parents:
24732
diff
changeset
|
2441 | 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
|
2442 | |
|
24802
eb481e98ac6a
Sprinkle jabber_resource_has_capability in places
Paul Aurich <darkrain42@pidgin.im>
parents:
24732
diff
changeset
|
2443 | return (node != NULL); |
|
23626
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2444 | } |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2445 | |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2446 | gboolean |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2447 | 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
|
2448 | { |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2449 | 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
|
2450 | |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2451 | 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
|
2452 | 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
|
2453 | "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
|
2454 | return FALSE; |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2455 | } |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2456 | |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2457 | 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
|
2458 | } |
|
e21afec2f485
Custom smileys for XMPP according to XEP 0231. Refs #5627.
Marcus Lundblad <malu@pidgin.im>
parents:
23393
diff
changeset
|
2459 |