Mercurial > pidgin.yaz
annotate src/protocols/trepia/trepia.c @ 11127:719779387f96
[gaim-migrate @ 13183]
Change the base16 and base64 functions to use better data types,
and make appropriate changes to other parts of the Gaim code
to get rid of a few warnings and hopefully make things more
correct.
In other news, why is CVS HEAD crashing for me on exit?
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 19 Jul 2005 05:15:45 +0000 |
parents | 50224ac8184d |
children | 096020ae09a9 |
rev | line source |
---|---|
5730 | 1 /** |
2 * @file trepia.c The Trepia protocol plugin | |
3 * | |
4 * gaim | |
5 * | |
6 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> | |
7106
db6bd3e794d8
[gaim-migrate @ 7671]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
7 * |
5730 | 8 * This program is free software; you can redistribute it and/or modify |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5869
diff
changeset
|
22 #include "internal.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5869
diff
changeset
|
23 |
5730 | 24 #include "account.h" |
25 #include "accountopt.h" | |
10744 | 26 #include "cipher.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5869
diff
changeset
|
27 #include "debug.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5869
diff
changeset
|
28 #include "notify.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5869
diff
changeset
|
29 #include "request.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5869
diff
changeset
|
30 #include "server.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5869
diff
changeset
|
31 #include "util.h" |
9954 | 32 #include "version.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5869
diff
changeset
|
33 |
5730 | 34 #include "profile.h" |
35 | |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
36 /* XXX */ |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5869
diff
changeset
|
37 #include "gaim.h" |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
38 |
5730 | 39 #ifndef _WIN32 |
40 # include <sys/socket.h> | |
41 # include <sys/ioctl.h> | |
42 # include <netinet/in.h> | |
43 # include <arpa/inet.h> | |
44 # include <net/if_arp.h> | |
45 #endif | |
46 | |
5950
e8316fec4fd1
[gaim-migrate @ 6394]
Christian Hammond <chipx86@chipx86.com>
parents:
5920
diff
changeset
|
47 #define TREPIA_VERSION "2.52" |
5863
98ec3e394f59
[gaim-migrate @ 6294]
Christian Hammond <chipx86@chipx86.com>
parents:
5855
diff
changeset
|
48 |
5988
4b2bc256d28a
[gaim-migrate @ 6436]
Christian Hammond <chipx86@chipx86.com>
parents:
5952
diff
changeset
|
49 #define TREPIA_CONNECT_STEPS 3 |
4b2bc256d28a
[gaim-migrate @ 6436]
Christian Hammond <chipx86@chipx86.com>
parents:
5952
diff
changeset
|
50 |
5730 | 51 static GaimPlugin *my_protocol = NULL; |
52 | |
53 typedef enum | |
54 { | |
55 TREPIA_LOGIN = 'C', | |
56 TREPIA_PROFILE_REQ = 'D', | |
57 TREPIA_MSG_OUTGOING = 'F', | |
58 TREPIA_REGISTER = 'J', | |
59 TREPIA_USER_LIST = 'L', | |
60 TREPIA_MEMBER_UPDATE = 'M', | |
61 TREPIA_MEMBER_OFFLINE = 'N', | |
62 TREPIA_MEMBER_PROFILE = 'O', | |
63 TREPIA_MSG_INCOMING = 'Q' | |
64 | |
65 } TrepiaMessageType; | |
66 | |
67 typedef struct | |
68 { | |
69 GaimConnection *gc; | |
70 | |
71 int fd; | |
72 | |
73 GString *rxqueue; | |
74 | |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
75 GList *pending_users; |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
76 GHashTable *user_profiles; |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
77 GHashTable *user_ids; |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
78 |
5730 | 79 } TrepiaSession; |
80 | |
81 typedef struct | |
82 { | |
83 TrepiaMessageType *type; | |
84 char *tag; | |
85 | |
86 GHashTable *keys; | |
87 | |
88 GString *buffer; | |
89 | |
90 } TrepiaParserData; | |
91 | |
92 #define TREPIA_SERVER "trepia.com" | |
93 #define TREPIA_PORT 8201 | |
94 #define TREPIA_REG_PORT 8209 | |
95 | |
5849
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
96 static const char alphabet[] = |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
97 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
98 "0123456789+/"; |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
99 |
5730 | 100 static int |
101 trepia_write(int fd, const char *data, size_t len) | |
102 { | |
103 gaim_debug(GAIM_DEBUG_MISC, "trepia", "C: %s%c", data, | |
104 (data[strlen(data) - 1] == '\n' ? '\0' : '\n')); | |
105 | |
106 return write(fd, data, len); | |
107 } | |
108 | |
5869
2f86cf55b0e9
[gaim-migrate @ 6301]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
109 #if 0 |
2f86cf55b0e9
[gaim-migrate @ 6301]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
110 static void |
2f86cf55b0e9
[gaim-migrate @ 6301]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
111 _remove_user_fnc(gpointer key, gpointer value, gpointer user_data) |
2f86cf55b0e9
[gaim-migrate @ 6301]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
112 { |
2f86cf55b0e9
[gaim-migrate @ 6301]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
113 TrepiaSession *session; |
2f86cf55b0e9
[gaim-migrate @ 6301]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
114 TrepiaProfile *profile; |
2f86cf55b0e9
[gaim-migrate @ 6301]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
115 const char *name; |
2f86cf55b0e9
[gaim-migrate @ 6301]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
116 |
2f86cf55b0e9
[gaim-migrate @ 6301]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
117 name = (const char *)key; |
2f86cf55b0e9
[gaim-migrate @ 6301]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
118 profile = (TrepiaProfile *)value; |
2f86cf55b0e9
[gaim-migrate @ 6301]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
119 session = (TrepiaSession *)user_data; |
2f86cf55b0e9
[gaim-migrate @ 6301]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
120 |
2f86cf55b0e9
[gaim-migrate @ 6301]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
121 gaim_blist_remove_buddy(profile->buddy); |
2f86cf55b0e9
[gaim-migrate @ 6301]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
122 } |
2f86cf55b0e9
[gaim-migrate @ 6301]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
123 #endif |
2f86cf55b0e9
[gaim-migrate @ 6301]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
124 |
5730 | 125 static void |
10744 | 126 _clear_user_list(TrepiaSession *session) |
5789
d42d2c9c2122
[gaim-migrate @ 6214]
Christian Hammond <chipx86@chipx86.com>
parents:
5769
diff
changeset
|
127 { |
7382 | 128 GaimBlistNode *gnode, *cnode, *bnode; |
5855 | 129 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
7382 | 130 cnode = gnode->child; |
131 | |
132 while(cnode) { | |
133 if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) { | |
134 bnode = cnode->child; | |
135 cnode = cnode->next; | |
136 while(bnode) { | |
137 GaimBuddy *buddy = (GaimBuddy *)bnode; | |
138 if(GAIM_BLIST_NODE_IS_BUDDY(bnode) && | |
139 buddy->account == session->gc->account) { | |
140 bnode = bnode->next; | |
141 gaim_blist_remove_buddy(buddy); | |
142 } else { | |
143 bnode = bnode->next; | |
144 } | |
145 } | |
5855 | 146 } else { |
7382 | 147 cnode = cnode->next; |
5855 | 148 } |
149 } | |
150 } | |
5730 | 151 } |
152 | |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
153 #if 0 |
5730 | 154 static char * |
10744 | 155 _get_mac_address(const char *ip) |
5730 | 156 { |
157 char *mac = NULL; | |
158 #ifndef _WIN32 | |
159 struct sockaddr_in sin = { 0 }; | |
160 struct arpreq myarp = { { 0 } }; | |
161 int sockfd; | |
162 unsigned char *ptr; | |
163 | |
164 sin.sin_family = AF_INET; | |
165 | |
166 if (inet_aton(ip, &sin.sin_addr) == 0) { | |
167 gaim_debug(GAIM_DEBUG_ERROR, "trepia", "Invalid IP address %s\n", ip); | |
168 return NULL; | |
169 } | |
170 | |
171 memcpy(&myarp.arp_pa, &sin, sizeof(myarp.arp_pa)); | |
172 strcpy(myarp.arp_dev, "eth0"); | |
173 | |
174 if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) { | |
175 gaim_debug(GAIM_DEBUG_ERROR, "trepia", | |
176 "Cannot open socket for retrieving MAC address.\n"); | |
177 return NULL; | |
178 } | |
179 | |
180 if (ioctl(sockfd, SIOCGARP, &myarp) == -1) { | |
181 gaim_debug(GAIM_DEBUG_ERROR, "trepia", | |
182 "No entry in in arp_cache for %s\n", ip); | |
183 return NULL; | |
184 } | |
185 | |
186 ptr = &myarp.arp_ha.sa_data[0]; | |
187 | |
188 mac = g_strdup_printf("%x:%x:%x:%x:%x:%x", | |
189 ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5]); | |
190 #else | |
191 #endif | |
192 | |
193 return mac; | |
194 } | |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
195 #endif |
5730 | 196 |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
197 /************************************************************************** |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
198 * Callbacks |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
199 **************************************************************************/ |
5847
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
200 #define SET_STRING_FIELD(tag, id) \ |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
201 if ((value = gaim_request_fields_get_string(fields, (id))) != NULL) { \ |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
202 buf = g_strdup_printf("%s<%s>%s</%s>", temp, (tag), value, (tag)); \ |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
203 g_free(temp); \ |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
204 temp = buf; \ |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
205 } |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
206 |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
207 #define SET_INT_FIELD(tag, id) \ |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
208 int_val = gaim_request_fields_get_integer(fields, (id)); \ |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
209 buf = g_strdup_printf("%s<%s>%d</%s>", temp, (tag), int_val, (tag)); \ |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
210 g_free(temp); \ |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
211 temp = buf; |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
212 |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
213 static void |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
214 save_profile_cb(GaimConnection *gc, GaimRequestFields *fields) |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
215 { |
5848
8331918af110
[gaim-migrate @ 6279]
Christian Hammond <chipx86@chipx86.com>
parents:
5847
diff
changeset
|
216 TrepiaSession *session = gc->proto_data; |
5847
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
217 const char *value; |
5833
b1fc288ffcb4
[gaim-migrate @ 6264]
Christian Hammond <chipx86@chipx86.com>
parents:
5812
diff
changeset
|
218 char *buf, *temp; |
5847
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
219 int int_val; |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
220 |
5833
b1fc288ffcb4
[gaim-migrate @ 6264]
Christian Hammond <chipx86@chipx86.com>
parents:
5812
diff
changeset
|
221 buf = g_strdup("<K>"); |
b1fc288ffcb4
[gaim-migrate @ 6264]
Christian Hammond <chipx86@chipx86.com>
parents:
5812
diff
changeset
|
222 temp = buf; |
b1fc288ffcb4
[gaim-migrate @ 6264]
Christian Hammond <chipx86@chipx86.com>
parents:
5812
diff
changeset
|
223 |
5847
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
224 SET_STRING_FIELD("b", "email"); |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
225 SET_STRING_FIELD("c", "homepage"); |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
226 SET_STRING_FIELD("d", "firstname"); |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
227 SET_STRING_FIELD("e", "lastname"); |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
228 SET_STRING_FIELD("f", "icq"); |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
229 SET_STRING_FIELD("g", "aim"); |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
230 SET_STRING_FIELD("h", "msn"); |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
231 SET_STRING_FIELD("i", "yahoo"); |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
232 SET_INT_FIELD( "j", "age"); |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
233 |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
234 int_val = gaim_request_fields_get_choice(fields, "gender"); |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
235 |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
236 buf = g_strdup_printf("%s<k>%c</k>", temp, (int_val == 1 ? 'F' : 'M')); |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
237 g_free(temp); |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
238 temp = buf; |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
239 |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
240 SET_STRING_FIELD("l", "profile"); |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
241 SET_STRING_FIELD("n", "country"); |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
242 SET_STRING_FIELD("o", "state"); |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
243 SET_STRING_FIELD("p", "city"); |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
244 |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
245 buf = g_strdup_printf("%s</K>", temp); |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
246 |
5848
8331918af110
[gaim-migrate @ 6279]
Christian Hammond <chipx86@chipx86.com>
parents:
5847
diff
changeset
|
247 if (trepia_write(session->fd, buf, strlen(buf)) < 0) { |
8331918af110
[gaim-migrate @ 6279]
Christian Hammond <chipx86@chipx86.com>
parents:
5847
diff
changeset
|
248 gaim_connection_error(session->gc, _("Write error")); |
8331918af110
[gaim-migrate @ 6279]
Christian Hammond <chipx86@chipx86.com>
parents:
5847
diff
changeset
|
249 return; |
8331918af110
[gaim-migrate @ 6279]
Christian Hammond <chipx86@chipx86.com>
parents:
5847
diff
changeset
|
250 } |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
251 } |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
252 |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
253 static void |
9022 | 254 set_profile(GaimPluginAction *action) |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
255 { |
9022 | 256 GaimConnection *gc = (GaimConnection *)action->context; |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
257 GaimRequestFields *fields; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
258 GaimRequestFieldGroup *group; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
259 GaimRequestField *field; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
260 |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
261 fields = gaim_request_fields_new(); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
262 |
5812
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
263 /* Basic Profile group. */ |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
264 group = gaim_request_field_group_new(_("Basic Profile")); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
265 gaim_request_fields_add_group(fields, group); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
266 |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
267 /* First Name */ |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
268 field = gaim_request_field_string_new("firstname", _("First Name"), NULL, |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
269 FALSE); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
270 gaim_request_field_group_add_field(group, field); |
5847
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
271 gaim_debug(GAIM_DEBUG_MISC, "trepia", "feld type = %d\n", |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
272 field->type); |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
273 |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
274 /* Last Name */ |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
275 field = gaim_request_field_string_new("lastname", _("Last Name"), NULL, |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
276 FALSE); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
277 gaim_request_field_group_add_field(group, field); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
278 |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
279 /* Gender */ |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
280 field = gaim_request_field_choice_new("gender", _("Gender"), 0); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
281 gaim_request_field_choice_add(field, _("Male")); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
282 gaim_request_field_choice_add(field, _("Female")); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
283 gaim_request_field_group_add_field(group, field); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
284 |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
285 /* Age */ |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
286 field = gaim_request_field_int_new("age", _("Age"), 0); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
287 gaim_request_field_group_add_field(group, field); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
288 |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
289 /* Homepage */ |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
290 field = gaim_request_field_string_new("homepage", _("Homepage"), NULL, |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
291 FALSE); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
292 gaim_request_field_group_add_field(group, field); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
293 |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
294 /* E-Mail Address */ |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
295 field = gaim_request_field_string_new("email", _("E-Mail Address"), NULL, |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
296 FALSE); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
297 gaim_request_field_group_add_field(group, field); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
298 |
5812
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
299 /* Profile String */ |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
300 field = gaim_request_field_string_new("profile", |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
301 _("Profile Information"), NULL, |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
302 TRUE); |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
303 gaim_request_field_group_add_field(group, field); |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
304 |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
305 |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
306 /* Instant Messagers */ |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
307 group = gaim_request_field_group_new(_("Instant Messagers")); |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
308 gaim_request_fields_add_group(fields, group); |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
309 |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
310 /* AIM */ |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
311 field = gaim_request_field_string_new("aim", _("AIM"), NULL, FALSE); |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
312 gaim_request_field_group_add_field(group, field); |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
313 |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
314 /* ICQ */ |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
315 field = gaim_request_field_string_new("icq", _("ICQ UIN"), NULL, FALSE); |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
316 gaim_request_field_group_add_field(group, field); |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
317 |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
318 /* MSN */ |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
319 field = gaim_request_field_string_new("msn", _("MSN"), NULL, FALSE); |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
320 gaim_request_field_group_add_field(group, field); |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
321 |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
322 /* Yahoo */ |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
323 field = gaim_request_field_string_new("yahoo", _("Yahoo"), NULL, FALSE); |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
324 gaim_request_field_group_add_field(group, field); |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
325 |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
326 |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
327 /* I'm From */ |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
328 group = gaim_request_field_group_new(_("I'm From")); |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
329 gaim_request_fields_add_group(fields, group); |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
330 |
5847
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
331 /* City */ |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
332 field = gaim_request_field_string_new("city", _("City"), NULL, FALSE); |
5812
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
333 gaim_request_field_group_add_field(group, field); |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
334 |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
335 /* State */ |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
336 field = gaim_request_field_string_new("state", _("State"), NULL, FALSE); |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
337 gaim_request_field_group_add_field(group, field); |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
338 |
5847
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
339 /* Country */ |
54513d0bfb83
[gaim-migrate @ 6278]
Christian Hammond <chipx86@chipx86.com>
parents:
5833
diff
changeset
|
340 field = gaim_request_field_string_new("country", _("Country"), NULL, FALSE); |
5812
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
341 gaim_request_field_group_add_field(group, field); |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
342 |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
343 |
ad28c689dc8e
[gaim-migrate @ 6242]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
344 /* Call the dialog. */ |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
345 gaim_request_fields(gc, NULL, _("Set your Trepia profile data."), |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
346 NULL, fields, |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
347 _("Save"), G_CALLBACK(save_profile_cb), |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
348 _("Cancel"), NULL, gc); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
349 } |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
350 |
5730 | 351 /************************************************************************** |
352 * Protocol Plugin ops | |
353 **************************************************************************/ | |
354 | |
355 static const char * | |
7382 | 356 trepia_list_icon(GaimAccount *a, GaimBuddy *b) |
5730 | 357 { |
358 return "trepia"; | |
359 } | |
360 | |
361 static void | |
9972 | 362 trepia_list_emblems(GaimBuddy *b, const char **se, const char **sw, |
363 const char **nw, const char **ne) | |
5730 | 364 { |
365 TrepiaProfile *profile = (TrepiaProfile *)b->proto_data; | |
366 | |
367 if (trepia_profile_get_sex(profile) == 'M') | |
368 *sw = "male"; | |
369 else if (trepia_profile_get_sex(profile)) | |
370 *sw = "female"; | |
371 } | |
372 | |
373 static char * | |
7382 | 374 trepia_status_text(GaimBuddy *b) |
5730 | 375 { |
5731
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
376 TrepiaProfile *profile = (TrepiaProfile *)b->proto_data; |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
377 const char *value; |
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
378 char *text = NULL; |
5731
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
379 |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
380 if ((value = trepia_profile_get_profile(profile)) != NULL) |
5751
2951d2435196
[gaim-migrate @ 6176]
Christian Hammond <chipx86@chipx86.com>
parents:
5745
diff
changeset
|
381 text = g_markup_escape_text(value, -1); |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
382 |
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
383 return text; |
5730 | 384 } |
385 | |
386 static char * | |
7382 | 387 trepia_tooltip_text(GaimBuddy *b) |
5730 | 388 { |
5731
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
389 TrepiaProfile *profile = (TrepiaProfile *)b->proto_data; |
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
390 const char *value; |
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
391 const char *first_name, *last_name; |
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
392 int int_value; |
8591 | 393 GString *ret = g_string_new(""); |
5731
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
394 |
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
395 first_name = trepia_profile_get_first_name(profile); |
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
396 last_name = trepia_profile_get_last_name(profile); |
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
397 |
8591 | 398 if (first_name != NULL || last_name != NULL) |
399 g_string_append_printf(ret, "\n<b>%s:</b> %s%s%s", _("Name"), | |
5731
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
400 (first_name == NULL ? "" : first_name), |
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
401 (first_name == NULL ? "" : " "), |
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
402 (last_name == NULL ? "" : last_name)); |
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
403 |
8591 | 404 if ((int_value = trepia_profile_get_age(profile)) != 0) |
405 g_string_append_printf(ret, "\n<b>%s:</b> %d", _("Age"), int_value); | |
5731
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
406 |
8591 | 407 g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Gender"), |
6441 | 408 (trepia_profile_get_sex(profile) == 'F' ? _("Female") : _("Male"))); |
5731
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
409 |
8591 | 410 if ((value = trepia_profile_get_city(profile)) != NULL) |
411 g_string_append_printf(ret, "\n<b>%s:</b> %s", _("City"), value); | |
5731
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
412 |
8591 | 413 if ((value = trepia_profile_get_state(profile)) != NULL) |
414 g_string_append_printf(ret, "\n<b>%s:</b> %s", _("State"), value); | |
5731
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
415 |
8591 | 416 if ((value = trepia_profile_get_country(profile)) != NULL) |
417 g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Country"), value); | |
5731
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
418 |
8591 | 419 if ((value = trepia_profile_get_homepage(profile)) != NULL) |
420 g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Homepage"), value); | |
5999
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
421 |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
422 if ((value = trepia_profile_get_profile(profile)) != NULL) { |
5751
2951d2435196
[gaim-migrate @ 6176]
Christian Hammond <chipx86@chipx86.com>
parents:
5745
diff
changeset
|
423 char *escaped_val = g_markup_escape_text(value, -1); |
2951d2435196
[gaim-migrate @ 6176]
Christian Hammond <chipx86@chipx86.com>
parents:
5745
diff
changeset
|
424 |
8591 | 425 g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Profile"), escaped_val); |
5751
2951d2435196
[gaim-migrate @ 6176]
Christian Hammond <chipx86@chipx86.com>
parents:
5745
diff
changeset
|
426 |
2951d2435196
[gaim-migrate @ 6176]
Christian Hammond <chipx86@chipx86.com>
parents:
5745
diff
changeset
|
427 g_free(escaped_val); |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
428 } |
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
429 |
8591 | 430 return g_string_free(ret, FALSE); |
5730 | 431 } |
432 | |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
433 static GList * |
9015 | 434 trepia_actions(GaimPlugin *plugin, gpointer context) |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
435 { |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
436 GList *m = NULL; |
9015 | 437 GaimPluginAction *act; |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
438 |
9015 | 439 act = gaim_plugin_action_new(_("Set Profile"), |
440 set_profile); | |
441 m = g_list_append(m, act); | |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
442 |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
443 return m; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
444 } |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5789
diff
changeset
|
445 |
5730 | 446 static void |
9030 | 447 trepia_visit_homepage(GaimBlistNode *node, gpointer data) |
5999
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
448 { |
9030 | 449 GaimBuddy *buddy; |
450 GaimConnection *gc; | |
5999
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
451 TrepiaProfile *profile; |
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
452 const char *value; |
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
453 |
9030 | 454 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); |
455 | |
456 buddy = (GaimBuddy *) node; | |
457 gc = gaim_account_get_connection(buddy->account); | |
9050 | 458 profile = buddy->proto_data; |
9030 | 459 value = trepia_profile_get_homepage(profile); |
5999
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
460 |
9030 | 461 if (value != NULL) |
10240
95ca0db2d01d
[gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10209
diff
changeset
|
462 gaim_notify_uri(gc, value); |
5999
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
463 } |
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
464 |
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
465 static GList * |
9030 | 466 trepia_blist_node_menu(GaimBlistNode *node) |
5999
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
467 { |
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
468 GList *m = NULL; |
9050 | 469 GaimBlistNodeAction *act; |
5999
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
470 |
9030 | 471 if(GAIM_BLIST_NODE_IS_BUDDY(node)) { |
9050 | 472 GaimBuddy *buddy = (GaimBuddy *) node; |
9030 | 473 TrepiaProfile *profile = buddy->proto_data; |
5999
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
474 |
9030 | 475 if (trepia_profile_get_homepage(profile) != NULL) { |
476 act = gaim_blist_node_action_new(_("Visit Homepage"), | |
10662
54ac161a876e
[gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10589
diff
changeset
|
477 trepia_visit_homepage, |
54ac161a876e
[gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10589
diff
changeset
|
478 NULL, NULL); |
9030 | 479 m = g_list_append(m, act); |
480 } | |
5999
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
481 } |
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
482 |
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
483 return m; |
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
484 } |
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
485 |
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
486 static void |
10744 | 487 _free_parser_data(gpointer user_data) |
5730 | 488 { |
5769
0f9b5737e5fe
[gaim-migrate @ 6194]
Christian Hammond <chipx86@chipx86.com>
parents:
5752
diff
changeset
|
489 #if 0 |
5730 | 490 TrepiaParserData *data = user_data; |
491 | |
492 if (data->buffer != NULL) | |
493 g_string_free(data->buffer, TRUE); | |
494 | |
495 if (data->tag != NULL) | |
496 g_free(data->tag); | |
497 | |
498 g_free(data); | |
5769
0f9b5737e5fe
[gaim-migrate @ 6194]
Christian Hammond <chipx86@chipx86.com>
parents:
5752
diff
changeset
|
499 #endif |
5730 | 500 } |
501 | |
502 static void | |
10744 | 503 _start_element_handler(GMarkupParseContext *context, |
5730 | 504 const gchar *element_name, |
505 const gchar **attribute_names, | |
506 const gchar **attribute_values, | |
507 gpointer user_data, GError **error) | |
508 { | |
509 TrepiaParserData *data = user_data; | |
510 | |
511 if (data->buffer != NULL) { | |
512 g_string_free(data->buffer, TRUE); | |
513 data->buffer = NULL; | |
514 } | |
515 | |
516 if (*data->type == 0) { | |
517 *data->type = *element_name; | |
518 } | |
519 else { | |
6061 | 520 data->tag = g_strdup(element_name); /* XXX - Make sure this is freed */ |
5730 | 521 } |
522 } | |
523 | |
524 static void | |
10744 | 525 _end_element_handler(GMarkupParseContext *context, const gchar *element_name, |
5730 | 526 gpointer user_data, GError **error) |
527 { | |
528 TrepiaParserData *data = user_data; | |
529 gchar *buffer; | |
530 | |
531 if (*element_name == *data->type) | |
532 return; | |
533 | |
534 if (data->buffer == NULL || data->tag == NULL) { | |
535 data->tag = NULL; | |
536 return; | |
537 } | |
538 | |
539 buffer = g_string_free(data->buffer, FALSE); | |
540 data->buffer = NULL; | |
541 | |
5999
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
542 if (buffer != NULL) { |
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
543 if (*buffer != '\0') |
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
544 g_hash_table_insert(data->keys, data->tag, buffer); |
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
545 else |
7606 | 546 g_free(buffer); |
5999
44b7e2530c05
[gaim-migrate @ 6447]
Christian Hammond <chipx86@chipx86.com>
parents:
5990
diff
changeset
|
547 } |
5730 | 548 |
549 data->tag = NULL; | |
550 } | |
551 | |
552 static void | |
10744 | 553 _text_handler(GMarkupParseContext *context, const gchar *text, |
5730 | 554 gsize text_len, gpointer user_data, GError **error) |
555 { | |
556 TrepiaParserData *data = user_data; | |
557 | |
558 if (data->buffer == NULL) | |
559 data->buffer = g_string_new_len(text, text_len); | |
560 else | |
561 g_string_append_len(data->buffer, text, text_len); | |
562 } | |
563 | |
564 static GMarkupParser accounts_parser = | |
565 { | |
10744 | 566 _start_element_handler, |
567 _end_element_handler, | |
568 _text_handler, | |
5730 | 569 NULL, |
570 NULL | |
571 }; | |
572 | |
573 static int | |
10744 | 574 _parse_message(const char *buf, TrepiaMessageType *type, GHashTable **info) |
5730 | 575 { |
576 TrepiaParserData *parser_data = g_new0(TrepiaParserData, 1); | |
577 GMarkupParseContext *context; | |
578 GHashTable *keys; | |
579 | |
580 keys = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | |
581 parser_data->keys = keys; | |
582 parser_data->type = type; | |
583 | |
584 context = g_markup_parse_context_new(&accounts_parser, 0, | |
10744 | 585 parser_data, _free_parser_data); |
5730 | 586 |
587 if (!g_markup_parse_context_parse(context, buf, strlen(buf), NULL)) { | |
588 g_markup_parse_context_free(context); | |
589 g_free(parser_data); | |
590 g_hash_table_destroy(keys); | |
591 | |
592 return 1; | |
593 } | |
594 | |
595 if (!g_markup_parse_context_end_parse(context, NULL)) { | |
596 g_markup_parse_context_free(context); | |
597 g_free(parser_data); | |
598 g_hash_table_destroy(keys); | |
599 | |
600 return 1; | |
601 } | |
602 | |
603 g_markup_parse_context_free(context); | |
6061 | 604 g_free(parser_data); |
5730 | 605 *info = keys; |
606 | |
607 return 0; | |
608 } | |
609 | |
610 static gboolean | |
6087 | 611 _parse_data(TrepiaSession *session, char *buf) |
5730 | 612 { |
613 GHashTable *info; | |
614 GaimAccount *account; | |
615 TrepiaMessageType type = 0; | |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
616 TrepiaProfile *profile = NULL; |
5730 | 617 int ret; |
618 char *buffer; | |
7382 | 619 GaimBuddy *b; |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
620 int id = 0; |
5730 | 621 const char *value; |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
622 char *username; |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
623 int *int_p; |
5990
99fbd0161cb7
[gaim-migrate @ 6438]
Christian Hammond <chipx86@chipx86.com>
parents:
5988
diff
changeset
|
624 GMainContext *ctx; |
5730 | 625 |
626 account = gaim_connection_get_account(session->gc); | |
627 | |
10744 | 628 ret = _parse_message(buf, &type, &info); |
5730 | 629 |
630 if (ret == 1) | |
631 return TRUE; | |
632 | |
633 if (info != NULL) { | |
634 switch (type) { | |
635 case TREPIA_USER_LIST: | |
5988
4b2bc256d28a
[gaim-migrate @ 6436]
Christian Hammond <chipx86@chipx86.com>
parents:
5952
diff
changeset
|
636 gaim_connection_update_progress(session->gc, |
4b2bc256d28a
[gaim-migrate @ 6436]
Christian Hammond <chipx86@chipx86.com>
parents:
5952
diff
changeset
|
637 _("Retrieving buddy list"), 2, TREPIA_CONNECT_STEPS); |
4b2bc256d28a
[gaim-migrate @ 6436]
Christian Hammond <chipx86@chipx86.com>
parents:
5952
diff
changeset
|
638 |
5730 | 639 gaim_connection_set_state(session->gc, GAIM_CONNECTED); |
640 break; | |
641 | |
642 case TREPIA_MSG_INCOMING: /* Incoming Message */ | |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
643 id = atoi(g_hash_table_lookup(info, "a")); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
644 |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
645 profile = g_hash_table_lookup(session->user_profiles, &id); |
5730 | 646 serv_got_im(session->gc, |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
647 trepia_profile_get_login(profile), |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
648 (char *)g_hash_table_lookup(info, "b"), |
6982 | 649 0, time(NULL)); |
5730 | 650 break; |
651 | |
652 case TREPIA_MEMBER_UPDATE: | |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
653 profile = trepia_profile_new(); |
5730 | 654 |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
655 if ((value = g_hash_table_lookup(info, "a")) != NULL) { |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
656 id = atoi(value); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
657 trepia_profile_set_id(profile, id); |
5730 | 658 } |
659 | |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
660 if ((value = g_hash_table_lookup(info, "b")) != NULL) |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
661 trepia_profile_set_login_time(profile, atoi(value)); |
5730 | 662 |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
663 if ((value = g_hash_table_lookup(info, "c")) != NULL) |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
664 trepia_profile_set_type(profile, atoi(value)); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
665 else |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
666 trepia_profile_set_type(profile, 2); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
667 |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
668 session->pending_users = g_list_append(session->pending_users, |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
669 profile); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
670 |
5730 | 671 |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
672 #if 0 |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
673 if (trepia_profile_get_type(profile) == 1) { |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
674 buffer = g_strdup_printf( |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
675 "<D>" |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
676 "<a>%d</a>" |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
677 "<b>1</b>" |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
678 "</D>", |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
679 id); |
5730 | 680 } |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
681 else { |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
682 #endif |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
683 buffer = g_strdup_printf( |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
684 "<D>" |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
685 "<a>%d</a>" |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
686 "<b>1</b>" |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
687 "</D>" |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
688 "<D>" |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
689 "<a>%d</a>" |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
690 "<b>2</b>" |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
691 "</D>", |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
692 id, |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
693 id); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
694 #if 0 |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
695 } |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
696 #endif |
5730 | 697 |
698 if (trepia_write(session->fd, buffer, strlen(buffer)) < 0) { | |
699 gaim_connection_error(session->gc, _("Write error")); | |
700 g_free(buffer); | |
701 return 1; | |
702 } | |
703 | |
704 g_free(buffer); | |
705 break; | |
706 | |
707 case TREPIA_MEMBER_PROFILE: | |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
708 if ((value = g_hash_table_lookup(info, "a")) != NULL) { |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
709 GList *l; |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
710 |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
711 id = atoi(value); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
712 |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
713 for (l = session->pending_users; l != NULL; l = l->next) { |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
714 profile = l->data; |
5730 | 715 |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
716 if (trepia_profile_get_id(profile) == id) |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
717 break; |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
718 |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
719 profile = NULL; |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
720 } |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
721 } |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
722 else |
5730 | 723 break; |
724 | |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
725 if (profile == NULL) { |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
726 profile = g_hash_table_lookup(session->user_profiles, &id); |
5730 | 727 |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
728 if (profile == NULL) |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
729 break; |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
730 } |
5730 | 731 |
732 /* Age */ | |
733 if ((value = g_hash_table_lookup(info, "m")) != NULL) | |
734 trepia_profile_set_age(profile, atoi(value)); | |
735 | |
736 /* ICQ */ | |
737 if ((value = g_hash_table_lookup(info, "i")) != NULL) | |
738 trepia_profile_set_icq(profile, atoi(value)); | |
739 | |
740 /* Sex */ | |
741 if ((value = g_hash_table_lookup(info, "n")) != NULL) | |
742 trepia_profile_set_sex(profile, *value); | |
743 | |
744 /* Location */ | |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
745 if ((value = g_hash_table_lookup(info, "p")) != NULL) |
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
746 trepia_profile_set_location(profile, value); |
5730 | 747 |
748 /* First Name */ | |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
749 if ((value = g_hash_table_lookup(info, "g")) != NULL) |
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
750 trepia_profile_set_first_name(profile, value); |
5730 | 751 |
752 /* Last Name */ | |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
753 if ((value = g_hash_table_lookup(info, "h")) != NULL) |
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
754 trepia_profile_set_last_name(profile, value); |
5730 | 755 |
756 /* Profile */ | |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
757 if ((value = g_hash_table_lookup(info, "o")) != NULL) |
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
758 trepia_profile_set_profile(profile, value); |
5730 | 759 |
760 /* E-mail */ | |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
761 if ((value = g_hash_table_lookup(info, "e")) != NULL) |
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
762 trepia_profile_set_email(profile, value); |
5730 | 763 |
764 /* AIM */ | |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
765 if ((value = g_hash_table_lookup(info, "j")) != NULL) |
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
766 trepia_profile_set_aim(profile, value); |
5730 | 767 |
768 /* MSN */ | |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
769 if ((value = g_hash_table_lookup(info, "k")) != NULL) |
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
770 trepia_profile_set_msn(profile, value); |
5730 | 771 |
772 /* Yahoo */ | |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
773 if ((value = g_hash_table_lookup(info, "l")) != NULL) |
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
774 trepia_profile_set_yahoo(profile, value); |
5730 | 775 |
776 /* Homepage */ | |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
777 if ((value = g_hash_table_lookup(info, "f")) != NULL) |
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
778 trepia_profile_set_homepage(profile, value); |
5730 | 779 |
780 /* Country */ | |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
781 if ((value = g_hash_table_lookup(info, "r")) != NULL) |
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
782 trepia_profile_set_country(profile, value); |
5730 | 783 |
784 /* State */ | |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
785 if ((value = g_hash_table_lookup(info, "s")) != NULL) |
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
786 trepia_profile_set_state(profile, value); |
5730 | 787 |
788 /* City */ | |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
789 if ((value = g_hash_table_lookup(info, "t")) != NULL) |
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
790 trepia_profile_set_city(profile, value); |
5730 | 791 |
792 /* Languages */ | |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
793 if ((value = g_hash_table_lookup(info, "u")) != NULL) |
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
794 trepia_profile_set_languages(profile, value); |
5730 | 795 |
796 /* School */ | |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
797 if ((value = g_hash_table_lookup(info, "v")) != NULL) |
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
798 trepia_profile_set_school(profile, value); |
5730 | 799 |
800 /* Company */ | |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
801 if ((value = g_hash_table_lookup(info, "w")) != NULL) |
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
802 trepia_profile_set_company(profile, value); |
5730 | 803 |
804 /* Login Name */ | |
805 if ((value = g_hash_table_lookup(info, "d")) != NULL) { | |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
806 trepia_profile_set_login(profile, value); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
807 username = g_strdup(value); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
808 } |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
809 else if ((value = trepia_profile_get_login(profile)) != NULL) { |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
810 username = g_strdup(value); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
811 } |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
812 else { |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
813 username = g_strdup_printf("%d", id); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
814 trepia_profile_set_login(profile, username); |
5730 | 815 } |
816 | |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
817 b = gaim_find_buddy(account, username); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
818 |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
819 if (b == NULL) { |
7382 | 820 GaimGroup *g; |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
821 |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
822 g = gaim_find_group(_("Local Users")); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
823 |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
824 if (g == NULL) { |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
825 g = gaim_group_new(_("Local Users")); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
826 gaim_blist_add_group(g, NULL); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
827 } |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
828 |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
829 b = gaim_buddy_new(account, username, NULL); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
830 |
7382 | 831 gaim_blist_add_buddy(b, NULL, g, NULL); |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
832 } |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
833 |
5789
d42d2c9c2122
[gaim-migrate @ 6214]
Christian Hammond <chipx86@chipx86.com>
parents:
5769
diff
changeset
|
834 profile->buddy = b; |
d42d2c9c2122
[gaim-migrate @ 6214]
Christian Hammond <chipx86@chipx86.com>
parents:
5769
diff
changeset
|
835 |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
836 b->proto_data = profile; |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
837 |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
838 session->pending_users = g_list_remove(session->pending_users, |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
839 profile); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
840 |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
841 int_p = g_new0(int, 1); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
842 *int_p = id; |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
843 g_hash_table_insert(session->user_profiles, int_p, profile); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
844 |
10011 | 845 gaim_prpl_got_user_status(account, username, "online", NULL); |
846 gaim_prpl_got_user_login_time(account, username, | |
847 trepia_profile_get_login_time(profile)); | |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
848 |
5730 | 849 /* Buddy Icon */ |
850 if ((value = g_hash_table_lookup(info, "q")) != NULL) { | |
851 char *icon; | |
852 int icon_len; | |
853 | |
11127 | 854 icon = gaim_base64_decode(value, &icon_len); |
5730 | 855 |
10011 | 856 gaim_buddy_icons_set_for_user(account, |
7382 | 857 username, icon, icon_len); |
5730 | 858 |
859 g_free(icon); | |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
860 |
10011 | 861 gaim_prpl_got_user_status(account, username, "online", NULL); |
5730 | 862 } |
5735
a80fcb009d81
[gaim-migrate @ 6159]
Christian Hammond <chipx86@chipx86.com>
parents:
5732
diff
changeset
|
863 |
8273
f24172f53650
[gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents:
8170
diff
changeset
|
864 /* |
f24172f53650
[gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents:
8170
diff
changeset
|
865 * XXX |
f24172f53650
[gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents:
8170
diff
changeset
|
866 * This does nothing when using a non-gtk event loop. |
f24172f53650
[gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents:
8170
diff
changeset
|
867 * What is it supposed to accomplish anyway? |
f24172f53650
[gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents:
8170
diff
changeset
|
868 */ |
5990
99fbd0161cb7
[gaim-migrate @ 6438]
Christian Hammond <chipx86@chipx86.com>
parents:
5988
diff
changeset
|
869 ctx = g_main_context_default(); |
99fbd0161cb7
[gaim-migrate @ 6438]
Christian Hammond <chipx86@chipx86.com>
parents:
5988
diff
changeset
|
870 |
99fbd0161cb7
[gaim-migrate @ 6438]
Christian Hammond <chipx86@chipx86.com>
parents:
5988
diff
changeset
|
871 while (g_main_context_pending(ctx)) |
99fbd0161cb7
[gaim-migrate @ 6438]
Christian Hammond <chipx86@chipx86.com>
parents:
5988
diff
changeset
|
872 g_main_context_iteration(ctx, FALSE); |
99fbd0161cb7
[gaim-migrate @ 6438]
Christian Hammond <chipx86@chipx86.com>
parents:
5988
diff
changeset
|
873 |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
874 g_free(username); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
875 |
5730 | 876 break; |
877 | |
878 case TREPIA_MEMBER_OFFLINE: | |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
879 if ((value = g_hash_table_lookup(info, "a")) != NULL) |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
880 id = atoi(value); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
881 else |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
882 break; |
5730 | 883 |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
884 profile = g_hash_table_lookup(session->user_profiles, &id); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
885 |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
886 if (profile == NULL) |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
887 break; |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
888 |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
889 g_hash_table_remove(session->user_profiles, &id); |
5789
d42d2c9c2122
[gaim-migrate @ 6214]
Christian Hammond <chipx86@chipx86.com>
parents:
5769
diff
changeset
|
890 |
d42d2c9c2122
[gaim-migrate @ 6214]
Christian Hammond <chipx86@chipx86.com>
parents:
5769
diff
changeset
|
891 b = profile->buddy; |
5730 | 892 |
10011 | 893 if (b != NULL) { |
894 gaim_prpl_got_user_status(account, trepia_profile_get_login(profile), | |
895 "offline", NULL); | |
896 gaim_prpl_got_user_login_time(account, trepia_profile_get_login(profile), | |
897 trepia_profile_get_login_time(profile)); | |
898 } | |
5730 | 899 |
900 gaim_blist_remove_buddy(b); | |
901 | |
902 break; | |
903 | |
904 default: | |
905 break; | |
906 } | |
907 | |
908 g_hash_table_destroy(info); | |
909 } | |
910 else { | |
10011 | 911 gaim_debug_warning("trepia", |
912 "Unknown data received. Possibly an image?\n"); | |
5730 | 913 } |
914 | |
915 return TRUE; | |
916 } | |
917 | |
918 static void | |
6087 | 919 _data_cb(gpointer data, gint source, GaimInputCondition cond) |
5730 | 920 { |
921 TrepiaSession *session = data; | |
922 int i = 0; | |
923 char buf[1025]; | |
924 gboolean cont = TRUE; | |
925 | |
926 i = read(session->fd, buf, 1024); | |
927 | |
928 if (i <= 0) { | |
929 gaim_connection_error(session->gc, _("Read error")); | |
930 return; | |
931 } | |
932 | |
933 buf[i] = '\0'; | |
934 | |
935 if (session->rxqueue == NULL) | |
936 session->rxqueue = g_string_new(buf); | |
937 else | |
938 g_string_append(session->rxqueue, buf); | |
939 | |
940 while (cont) { | |
941 char end_tag[5] = "</ >"; | |
942 char *end_s; | |
943 | |
944 end_tag[2] = session->rxqueue->str[1]; | |
945 | |
946 end_s = strstr(session->rxqueue->str, end_tag); | |
947 | |
948 if (end_s != NULL) { | |
949 char *buffer; | |
950 size_t len; | |
951 int ret; | |
952 | |
953 end_s += 4; | |
954 | |
955 len = end_s - session->rxqueue->str; | |
956 buffer = g_new0(char, len + 1); | |
957 strncpy(buffer, session->rxqueue->str, len); | |
958 | |
959 g_string_erase(session->rxqueue, 0, len); | |
960 | |
961 if (*session->rxqueue->str == '\n') | |
962 g_string_erase(session->rxqueue, 0, 1); | |
963 | |
964 gaim_debug(GAIM_DEBUG_MISC, "trepia", "S: %s\n", buffer); | |
965 | |
6087 | 966 ret = _parse_data(session, buffer); |
5730 | 967 |
968 g_free(buffer); | |
969 } | |
970 else | |
971 break; | |
972 } | |
973 } | |
974 | |
975 static void | |
10744 | 976 _login_cb(gpointer data, gint source, GaimInputCondition cond) |
5730 | 977 { |
978 TrepiaSession *session = data; | |
979 GaimAccount *account; | |
980 const char *password; | |
981 char *buffer; | |
5833
b1fc288ffcb4
[gaim-migrate @ 6264]
Christian Hammond <chipx86@chipx86.com>
parents:
5812
diff
changeset
|
982 char *mac = "00:01:02:03:04:05"; |
5730 | 983 char buf[3]; |
984 char md5_password[17]; | |
10744 | 985 GaimCipher *cipher; |
986 GaimCipherContext *context; | |
987 guint8 di[16]; | |
5730 | 988 int i; |
989 | |
990 if (source < 0) { | |
991 gaim_connection_error(session->gc, _("Write error")); | |
992 return; | |
993 } | |
994 | |
5833
b1fc288ffcb4
[gaim-migrate @ 6264]
Christian Hammond <chipx86@chipx86.com>
parents:
5812
diff
changeset
|
995 #if 0 |
10744 | 996 mac = _get_mac_address(); |
5833
b1fc288ffcb4
[gaim-migrate @ 6264]
Christian Hammond <chipx86@chipx86.com>
parents:
5812
diff
changeset
|
997 #endif |
b1fc288ffcb4
[gaim-migrate @ 6264]
Christian Hammond <chipx86@chipx86.com>
parents:
5812
diff
changeset
|
998 |
5730 | 999 session->fd = source; |
1000 | |
1001 account = gaim_connection_get_account(session->gc); | |
1002 | |
10740 | 1003 password = gaim_connection_get_password(session->gc); |
5730 | 1004 |
10744 | 1005 cipher = gaim_ciphers_find_cipher("md5"); |
1006 context = gaim_cipher_context_new(cipher, NULL); | |
1007 gaim_cipher_context_append(context, password, strlen(password)); | |
1008 gaim_cipher_context_digest(context, sizeof(di), di, NULL); | |
5730 | 1009 |
1010 *md5_password = '\0'; | |
1011 | |
1012 for (i = 0; i < 16; i++) { | |
1013 g_snprintf(buf, sizeof(buf), "%02x", di[i]); | |
1014 strcat(md5_password, buf); | |
1015 } | |
1016 | |
1017 buffer = g_strdup_printf( | |
1018 "<C>\n" | |
1019 "<a>%s</a>\n" | |
5833
b1fc288ffcb4
[gaim-migrate @ 6264]
Christian Hammond <chipx86@chipx86.com>
parents:
5812
diff
changeset
|
1020 "<b1></b1>\n" |
5730 | 1021 "<c>%s</c>\n" |
1022 "<d>%s</d>\n" | |
5952 | 1023 "<e>%s</e>\n" |
5730 | 1024 "</C>", |
5833
b1fc288ffcb4
[gaim-migrate @ 6264]
Christian Hammond <chipx86@chipx86.com>
parents:
5812
diff
changeset
|
1025 mac, gaim_account_get_username(account), |
5950
e8316fec4fd1
[gaim-migrate @ 6394]
Christian Hammond <chipx86@chipx86.com>
parents:
5920
diff
changeset
|
1026 md5_password, TREPIA_VERSION); |
5730 | 1027 |
5863
98ec3e394f59
[gaim-migrate @ 6294]
Christian Hammond <chipx86@chipx86.com>
parents:
5855
diff
changeset
|
1028 #if 0 |
5730 | 1029 g_free(mac); |
5863
98ec3e394f59
[gaim-migrate @ 6294]
Christian Hammond <chipx86@chipx86.com>
parents:
5855
diff
changeset
|
1030 #endif |
5730 | 1031 |
5988
4b2bc256d28a
[gaim-migrate @ 6436]
Christian Hammond <chipx86@chipx86.com>
parents:
5952
diff
changeset
|
1032 gaim_connection_update_progress(session->gc, _("Logging in"), 1, |
4b2bc256d28a
[gaim-migrate @ 6436]
Christian Hammond <chipx86@chipx86.com>
parents:
5952
diff
changeset
|
1033 TREPIA_CONNECT_STEPS); |
4b2bc256d28a
[gaim-migrate @ 6436]
Christian Hammond <chipx86@chipx86.com>
parents:
5952
diff
changeset
|
1034 |
5730 | 1035 if (trepia_write(session->fd, buffer, strlen(buffer)) < 0) { |
1036 gaim_connection_error(session->gc, _("Write error")); | |
1037 return; | |
1038 } | |
1039 | |
1040 g_free(buffer); | |
1041 | |
1042 session->gc->inpa = gaim_input_add(session->fd, GAIM_INPUT_READ, | |
6087 | 1043 _data_cb, session); |
5730 | 1044 } |
1045 | |
1046 static void | |
10401 | 1047 trepia_login(GaimAccount *account, GaimStatus *status) |
5730 | 1048 { |
1049 GaimConnection *gc; | |
1050 TrepiaSession *session; | |
1051 const char *server; | |
1052 int port; | |
1053 int i; | |
1054 | |
1055 server = gaim_account_get_string(account, "server", TREPIA_SERVER); | |
1056 port = gaim_account_get_int(account, "port", TREPIA_PORT); | |
1057 | |
1058 gc = gaim_account_get_connection(account); | |
1059 | |
1060 session = g_new0(TrepiaSession, 1); | |
1061 gc->proto_data = session; | |
1062 session->gc = gc; | |
1063 session->fd = -1; | |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
1064 session->user_profiles = g_hash_table_new_full(g_int_hash, g_int_equal, |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
1065 g_free, NULL); |
5730 | 1066 |
10744 | 1067 _clear_user_list(session); |
5730 | 1068 |
5988
4b2bc256d28a
[gaim-migrate @ 6436]
Christian Hammond <chipx86@chipx86.com>
parents:
5952
diff
changeset
|
1069 gaim_connection_update_progress(gc, _("Connecting"), 0, |
4b2bc256d28a
[gaim-migrate @ 6436]
Christian Hammond <chipx86@chipx86.com>
parents:
5952
diff
changeset
|
1070 TREPIA_CONNECT_STEPS); |
4b2bc256d28a
[gaim-migrate @ 6436]
Christian Hammond <chipx86@chipx86.com>
parents:
5952
diff
changeset
|
1071 |
10744 | 1072 i = gaim_proxy_connect(account, server, port, _login_cb, session); |
5730 | 1073 |
1074 if (i != 0) | |
1075 gaim_connection_error(gc, _("Unable to create socket")); | |
1076 } | |
1077 | |
1078 static void | |
1079 trepia_close(GaimConnection *gc) | |
1080 { | |
5745
cae58ab49118
[gaim-migrate @ 6169]
Christian Hammond <chipx86@chipx86.com>
parents:
5739
diff
changeset
|
1081 TrepiaSession *session = gc->proto_data; |
cae58ab49118
[gaim-migrate @ 6169]
Christian Hammond <chipx86@chipx86.com>
parents:
5739
diff
changeset
|
1082 |
cae58ab49118
[gaim-migrate @ 6169]
Christian Hammond <chipx86@chipx86.com>
parents:
5739
diff
changeset
|
1083 if (session->rxqueue != NULL) |
cae58ab49118
[gaim-migrate @ 6169]
Christian Hammond <chipx86@chipx86.com>
parents:
5739
diff
changeset
|
1084 g_string_free(session->rxqueue, TRUE); |
cae58ab49118
[gaim-migrate @ 6169]
Christian Hammond <chipx86@chipx86.com>
parents:
5739
diff
changeset
|
1085 |
5789
d42d2c9c2122
[gaim-migrate @ 6214]
Christian Hammond <chipx86@chipx86.com>
parents:
5769
diff
changeset
|
1086 if (session->gc->inpa) |
d42d2c9c2122
[gaim-migrate @ 6214]
Christian Hammond <chipx86@chipx86.com>
parents:
5769
diff
changeset
|
1087 gaim_input_remove(session->gc->inpa); |
5745
cae58ab49118
[gaim-migrate @ 6169]
Christian Hammond <chipx86@chipx86.com>
parents:
5739
diff
changeset
|
1088 |
5789
d42d2c9c2122
[gaim-migrate @ 6214]
Christian Hammond <chipx86@chipx86.com>
parents:
5769
diff
changeset
|
1089 gaim_debug(GAIM_DEBUG_INFO, "trepia", "Destroying user_profiles\n"); |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
1090 g_hash_table_destroy(session->user_profiles); |
5789
d42d2c9c2122
[gaim-migrate @ 6214]
Christian Hammond <chipx86@chipx86.com>
parents:
5769
diff
changeset
|
1091 gaim_debug(GAIM_DEBUG_INFO, "trepia", "Destroying pending_users\n"); |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
1092 g_list_free(session->pending_users); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
1093 |
5789
d42d2c9c2122
[gaim-migrate @ 6214]
Christian Hammond <chipx86@chipx86.com>
parents:
5769
diff
changeset
|
1094 gaim_debug(GAIM_DEBUG_INFO, "trepia", "Closing socket\n"); |
5745
cae58ab49118
[gaim-migrate @ 6169]
Christian Hammond <chipx86@chipx86.com>
parents:
5739
diff
changeset
|
1095 close(session->fd); |
cae58ab49118
[gaim-migrate @ 6169]
Christian Hammond <chipx86@chipx86.com>
parents:
5739
diff
changeset
|
1096 |
cae58ab49118
[gaim-migrate @ 6169]
Christian Hammond <chipx86@chipx86.com>
parents:
5739
diff
changeset
|
1097 g_free(session); |
5739
edf4d443e671
[gaim-migrate @ 6163]
Christian Hammond <chipx86@chipx86.com>
parents:
5737
diff
changeset
|
1098 |
5730 | 1099 gc->proto_data = NULL; |
5789
d42d2c9c2122
[gaim-migrate @ 6214]
Christian Hammond <chipx86@chipx86.com>
parents:
5769
diff
changeset
|
1100 gaim_debug(GAIM_DEBUG_INFO, "trepia", "Leaving trepia_close\n"); |
5730 | 1101 } |
1102 | |
1103 static int | |
1104 trepia_send_im(GaimConnection *gc, const char *who, const char *message, | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7106
diff
changeset
|
1105 GaimConvImFlags flags) |
5730 | 1106 { |
1107 TrepiaSession *session = gc->proto_data; | |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
1108 TrepiaProfile *profile; |
7382 | 1109 GaimBuddy *b; |
5737
72ced7411599
[gaim-migrate @ 6161]
Christian Hammond <chipx86@chipx86.com>
parents:
5736
diff
changeset
|
1110 char *escaped_msg; |
5730 | 1111 char *buffer; |
1112 | |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
1113 b = gaim_find_buddy(gaim_connection_get_account(gc), who); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
1114 |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
1115 if (b == NULL) { |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
1116 gaim_debug(GAIM_DEBUG_ERROR, "trepia", |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
1117 "Unable to send to buddy not on your list!\n"); |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
1118 return 0; |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
1119 } |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
1120 |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
1121 profile = b->proto_data; |
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
1122 |
5737
72ced7411599
[gaim-migrate @ 6161]
Christian Hammond <chipx86@chipx86.com>
parents:
5736
diff
changeset
|
1123 escaped_msg = g_markup_escape_text(message, -1); |
72ced7411599
[gaim-migrate @ 6161]
Christian Hammond <chipx86@chipx86.com>
parents:
5736
diff
changeset
|
1124 |
5730 | 1125 buffer = g_strdup_printf( |
1126 "<F>\n" | |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
1127 "<a>%d</a>\n" |
5730 | 1128 "<b>%s</b>\n" |
1129 "</F>", | |
5752
90eea4997759
[gaim-migrate @ 6177]
Christian Hammond <chipx86@chipx86.com>
parents:
5751
diff
changeset
|
1130 trepia_profile_get_id(profile), escaped_msg); |
5737
72ced7411599
[gaim-migrate @ 6161]
Christian Hammond <chipx86@chipx86.com>
parents:
5736
diff
changeset
|
1131 |
72ced7411599
[gaim-migrate @ 6161]
Christian Hammond <chipx86@chipx86.com>
parents:
5736
diff
changeset
|
1132 g_free(escaped_msg); |
5730 | 1133 |
1134 if (trepia_write(session->fd, buffer, strlen(buffer)) < 0) { | |
1135 gaim_connection_error(gc, _("Write error")); | |
1136 g_free(buffer); | |
1137 return 1; | |
1138 } | |
1139 | |
1140 return 1; | |
1141 } | |
1142 | |
1143 static void | |
7382 | 1144 trepia_buddy_free(GaimBuddy *b) |
5730 | 1145 { |
1146 if (b->proto_data != NULL) { | |
1147 trepia_profile_destroy(b->proto_data); | |
1148 | |
1149 b->proto_data = NULL; | |
1150 } | |
1151 } | |
1152 | |
1153 static void | |
5849
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1154 trepia_set_buddy_icon(GaimConnection *gc, const char *filename) |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1155 { |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1156 TrepiaSession *session = gc->proto_data; |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1157 struct stat sb; |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1158 |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10401
diff
changeset
|
1159 if (!g_stat(filename, &sb)) { |
5849
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1160 FILE *fp; |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1161 |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10401
diff
changeset
|
1162 if ((fp = g_fopen(filename, "rb")) != NULL) { |
5849
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1163 char *buf = g_malloc(sb.st_size + 1); |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1164 char *temp; |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1165 char *out_buf; |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1166 |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1167 fread(buf, 1, sb.st_size, fp); |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1168 |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1169 buf[sb.st_size] = '\0'; |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1170 |
7106
db6bd3e794d8
[gaim-migrate @ 7671]
Christian Hammond <chipx86@chipx86.com>
parents:
6982
diff
changeset
|
1171 temp = gaim_base64_encode(buf, sb.st_size); |
5849
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1172 |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1173 out_buf = g_strdup_printf("<K><m>%s</m></K>", temp); |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1174 |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1175 g_free(temp); |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1176 g_free(buf); |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1177 |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1178 fclose(fp); |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1179 |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1180 if (trepia_write(session->fd, out_buf, strlen(out_buf)) < 0) { |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1181 gaim_connection_error(session->gc, _("Write error")); |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1182 return; |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1183 } |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1184 } |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1185 } |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1186 } |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1187 |
97d1ad7a50cc
[gaim-migrate @ 6280]
Christian Hammond <chipx86@chipx86.com>
parents:
5848
diff
changeset
|
1188 static void |
5730 | 1189 trepia_register_user(GaimAccount *account) |
1190 { | |
1191 char *buffer; | |
5863
98ec3e394f59
[gaim-migrate @ 6294]
Christian Hammond <chipx86@chipx86.com>
parents:
5855
diff
changeset
|
1192 char *mac = "00:01:02:03:04:05"; |
5730 | 1193 |
1194 buffer = g_strdup_printf( | |
5863
98ec3e394f59
[gaim-migrate @ 6294]
Christian Hammond <chipx86@chipx86.com>
parents:
5855
diff
changeset
|
1195 "<J><a>%s</a><b1>%s</b1><c>%s</c><d>%s</d><e>%s</e>" |
98ec3e394f59
[gaim-migrate @ 6294]
Christian Hammond <chipx86@chipx86.com>
parents:
5855
diff
changeset
|
1196 "<f></f><g></g><h></h><i></i><j></j><k></k><l></l>" |
98ec3e394f59
[gaim-migrate @ 6294]
Christian Hammond <chipx86@chipx86.com>
parents:
5855
diff
changeset
|
1197 "<m></m></J>", |
98ec3e394f59
[gaim-migrate @ 6294]
Christian Hammond <chipx86@chipx86.com>
parents:
5855
diff
changeset
|
1198 mac, "", TREPIA_VERSION, gaim_account_get_username(account), |
10744 | 1199 gaim_connection_get_password(account->gc)); |
5730 | 1200 } |
1201 | |
1202 static GaimPluginProtocolInfo prpl_info = | |
1203 { | |
9308 | 1204 0, |
9050 | 1205 NULL, /* user_splits */ |
1206 NULL, /* protocol_options */ | |
9308 | 1207 {"Christian, fix me!", 0, 0}, |
5730 | 1208 trepia_list_icon, |
1209 trepia_list_emblems, | |
5731
7cb2bbf03db5
[gaim-migrate @ 6155]
Christian Hammond <chipx86@chipx86.com>
parents:
5730
diff
changeset
|
1210 trepia_status_text, |
5730 | 1211 trepia_tooltip_text, |
9050 | 1212 NULL, /* away_states */ |
9030 | 1213 trepia_blist_node_menu, |
9050 | 1214 NULL, /* chat_info */ |
9754 | 1215 NULL, /* chat_info_defaults */ |
5730 | 1216 trepia_login, |
1217 trepia_close, | |
1218 trepia_send_im, | |
9050 | 1219 NULL, /* set_info */ |
1220 NULL, /* send_typing */ | |
1221 NULL, /* get_info */ | |
1222 NULL, /* set_away */ | |
1223 NULL, /* set_idle */ | |
1224 NULL, /* change_passwd */ | |
9285 | 1225 NULL, /* add_buddy */ |
9050 | 1226 NULL, /* add_buddies */ |
9285 | 1227 NULL, /* rem_buddy */ |
9050 | 1228 NULL, /* remove_buddies */ |
1229 NULL, /* add_permit */ | |
1230 NULL, /* add_deny */ | |
1231 NULL, /* rem_permit */ | |
1232 NULL, /* rem_deny */ | |
1233 NULL, /* set_permit_deny */ | |
1234 NULL, /* warn */ | |
1235 NULL, /* join_chat */ | |
1236 NULL, /* reject_chat */ | |
9917 | 1237 NULL, /* get_chat_name */ |
9050 | 1238 NULL, /* chat_invite */ |
1239 NULL, /* chat_leave */ | |
1240 NULL, /* chat_whisper */ | |
1241 NULL, /* chat_send */ | |
1242 NULL, /* keepalive */ | |
5730 | 1243 trepia_register_user, |
9050 | 1244 NULL, /* get_cb_info */ |
1245 NULL, /* get_cb_away */ | |
1246 NULL, /* alias_buddy */ | |
1247 NULL, /* group_buddy */ | |
1248 NULL, /* rename_group */ | |
5730 | 1249 trepia_buddy_free, |
9050 | 1250 NULL, /* convo_closed */ |
1251 NULL, /* normalize */ | |
8586 | 1252 trepia_set_buddy_icon, |
9050 | 1253 NULL, /* remove_group */ |
1254 NULL, /* get_cb_real_name */ | |
1255 NULL, /* set_chat_topic */ | |
1256 NULL, /* find_blist_chat */ | |
1257 NULL, /* roomlist_get_list */ | |
1258 NULL, /* roomlist_cancel */ | |
9473 | 1259 NULL, /* roomlist_expand_category */ |
1260 NULL, /* can_receive_file */ | |
1261 NULL /* send_file */ | |
5730 | 1262 }; |
1263 | |
1264 static GaimPluginInfo info = | |
1265 { | |
9954 | 1266 GAIM_PLUGIN_MAGIC, |
1267 GAIM_MAJOR_VERSION, | |
1268 GAIM_MINOR_VERSION, | |
5730 | 1269 GAIM_PLUGIN_PROTOCOL, /**< type */ |
1270 NULL, /**< ui_requirement */ | |
1271 0, /**< flags */ | |
1272 NULL, /**< dependencies */ | |
1273 GAIM_PRIORITY_DEFAULT, /**< priority */ | |
1274 | |
1275 "prpl-trepia", /**< id */ | |
1276 "Trepia", /**< name */ | |
1277 VERSION, /**< version */ | |
1278 /** summary */ | |
1279 N_("Trepia Protocol Plugin"), | |
1280 /** description */ | |
1281 N_("Trepia Protocol Plugin"), | |
1282 "Christian Hammond <chipx86@gnupdate.org>", /**< author */ | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6087
diff
changeset
|
1283 GAIM_WEBSITE, /**< homepage */ |
5730 | 1284 |
1285 NULL, /**< load */ | |
1286 NULL, /**< unload */ | |
1287 NULL, /**< destroy */ | |
1288 | |
1289 NULL, /**< ui_info */ | |
8993 | 1290 &prpl_info, /**< extra_info */ |
1291 NULL, | |
9015 | 1292 trepia_actions |
5730 | 1293 }; |
1294 | |
1295 static void | |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1296 init_plugin(GaimPlugin *plugin) |
5730 | 1297 { |
1298 GaimAccountOption *option; | |
1299 | |
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10751
diff
changeset
|
1300 gaim_debug_register_category("trepia"); |
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
10751
diff
changeset
|
1301 |
5730 | 1302 option = gaim_account_option_string_new(_("Login server"), "server", |
1303 TREPIA_SERVER); | |
1304 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, | |
1305 option); | |
1306 | |
1307 option = gaim_account_option_int_new(_("Port"), "port", TREPIA_PORT); | |
1308 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, | |
1309 option); | |
1310 | |
1311 my_protocol = plugin; | |
1312 } | |
1313 | |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
1314 GAIM_INIT_PLUGIN(trepia, init_plugin, info); |