annotate libpurple/protocols/jabber/buddy.c @ 18698:b5546f8f8c71

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