Mercurial > pidgin.yaz
annotate src/protocols/oscar/oscar.c @ 4200:c8fb43808a4b
[gaim-migrate @ 4431]
I try to look at it like this:
At least now I know a little more about va_args.
So when you pass stuff through "...", gcc promotes the argument to an
integer. So passing fu16_t because 4 bytes instead of 2. Then when
using va_args, you have to use a type that is 4 bytes instead of 2.
I guess va_args is different in gcc 2, in that, if you give it a 2 byte
type, it will get 4 bytes anyway. Either that, or gcc2 doesn't promote
stuff to 4 bytes when passed through ....
Anyway, sorry to all gcc3.x users. This patch just fixes a little bit
of whitespace stuff, again, for no real reason.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 04 Jan 2003 19:41:07 +0000 |
parents | 97de60e7b7ba |
children | 511c2b63caa4 |
rev | line source |
---|---|
2086 | 1 /* |
2 * gaim | |
3 * | |
4 * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * libfaim code copyright 1998, 1999 Adam Fritzler <afritz@auk.cx> | |
6 * | |
7 * This program is free software; you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 * | |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
24 #include <config.h> |
2086 | 25 #endif |
26 | |
3664 | 27 #include <sys/types.h> |
28 /*this must happen before sys/socket.h or freebsd won't compile*/ | |
29 | |
3630 | 30 #ifndef _WIN32 |
2086 | 31 #include <netdb.h> |
32 #include <netinet/in.h> | |
33 #include <arpa/inet.h> | |
3630 | 34 #include <sys/socket.h> |
35 #include <unistd.h> | |
36 #endif | |
37 | |
38 #include <errno.h> | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
39 #include <ctype.h> |
2086 | 40 #include <string.h> |
41 #include <stdlib.h> | |
42 #include <stdio.h> | |
43 #include <time.h> | |
44 #include <sys/stat.h> | |
3630 | 45 #include <signal.h> |
46 | |
2086 | 47 #include "multi.h" |
48 #include "prpl.h" | |
49 #include "gaim.h" | |
50 #include "aim.h" | |
51 #include "proxy.h" | |
52 | |
3630 | 53 #ifdef _WIN32 |
54 #include "win32dep.h" | |
55 #endif | |
56 | |
3490 | 57 #include "pixmaps/protocols/oscar/ab.xpm" |
58 #include "pixmaps/protocols/oscar/admin_icon.xpm" | |
59 #include "pixmaps/protocols/oscar/aol_icon.xpm" | |
60 #include "pixmaps/protocols/oscar/away_icon.xpm" | |
61 #include "pixmaps/protocols/oscar/dt_icon.xpm" | |
62 #include "pixmaps/protocols/oscar/free_icon.xpm" | |
63 #include "pixmaps/protocols/oscar/wireless_icon.xpm" | |
2086 | 64 |
3579 | 65 #include "pixmaps/protocols/icq/gnomeicu-online.xpm" |
66 #include "pixmaps/protocols/icq/gnomeicu-offline.xpm" | |
67 #include "pixmaps/protocols/icq/gnomeicu-away.xpm" | |
68 #include "pixmaps/protocols/icq/gnomeicu-dnd.xpm" | |
69 #include "pixmaps/protocols/icq/gnomeicu-na.xpm" | |
70 #include "pixmaps/protocols/icq/gnomeicu-occ.xpm" | |
71 #include "pixmaps/protocols/icq/gnomeicu-ffc.xpm" | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
72 |
2086 | 73 /* constants to identify proto_opts */ |
74 #define USEROPT_AUTH 0 | |
75 #define USEROPT_AUTHPORT 1 | |
76 | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
77 #define UC_AOL 0x02 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
78 #define UC_ADMIN 0x04 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
79 #define UC_UNCONFIRMED 0x08 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
80 #define UC_NORMAL 0x10 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
81 #define UC_AB 0x20 |
3079 | 82 #define UC_WIRELESS 0x40 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
83 |
2086 | 84 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" |
85 | |
3630 | 86 /* For win32 compatability */ |
87 G_MODULE_IMPORT GSList *connections; | |
88 G_MODULE_IMPORT int report_idle; | |
89 | |
90 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | | |
91 AIM_CAPS_IMIMAGE | AIM_CAPS_SENDFILE; | |
3458 | 92 |
93 /* Set AIM caps, because Gaim can still do them over ICQ and | |
94 * Winicq doesn't mind. */ | |
4154 | 95 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_IMIMAGE | AIM_CAPS_SENDFILE; |
3595 | 96 /* static int caps_icq = AIM_CAPS_ICQ; */ |
97 /* What does AIM_CAPS_ICQ actually mean? -SE */ | |
3458 | 98 |
2308
a90be9567452
[gaim-migrate @ 2318]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2305
diff
changeset
|
99 static fu8_t gaim_features[] = {0x01, 0x01, 0x01, 0x02}; |
2086 | 100 |
101 struct oscar_data { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
102 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
103 aim_conn_t *conn; |
2086 | 104 |
105 guint cnpa; | |
106 guint paspa; | |
3694 | 107 guint emlpa; |
2086 | 108 |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
109 GSList *create_rooms; |
2086 | 110 |
111 gboolean conf; | |
112 gboolean reqemail; | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
113 gboolean setemail; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
114 char *email; |
2979 | 115 gboolean setnick; |
116 char *newsn; | |
2086 | 117 gboolean chpass; |
118 char *oldp; | |
119 char *newp; | |
120 | |
121 GSList *oscar_chats; | |
122 GSList *direct_ims; | |
3630 | 123 GSList *file_transfers; |
2086 | 124 GSList *hasicons; |
3600 | 125 GHashTable *supports_tn; |
2086 | 126 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
127 gboolean killme; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
128 gboolean icq; |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
129 GSList *evilhack; |
2993 | 130 |
131 struct { | |
132 guint maxbuddies; /* max users you can watch */ | |
133 guint maxwatchers; /* max users who can watch you */ | |
134 guint maxpermits; /* max users on permit list */ | |
135 guint maxdenies; /* max users on deny list */ | |
136 guint maxsiglen; /* max size (bytes) of profile */ | |
137 guint maxawaymsglen; /* max size (bytes) of posted away message */ | |
138 } rights; | |
2086 | 139 }; |
140 | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
141 struct create_room { |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
142 char *name; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
143 int exchange; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
144 }; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
145 |
2086 | 146 struct chat_connection { |
147 char *name; | |
148 char *show; /* AOL did something funny to us */ | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
149 fu16_t exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
150 fu16_t instance; |
2086 | 151 int fd; /* this is redundant since we have the conn below */ |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
152 aim_conn_t *conn; |
2086 | 153 int inpa; |
154 int id; | |
155 struct gaim_connection *gc; /* i hate this. */ | |
156 struct conversation *cnv; /* bah. */ | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
157 int maxlen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
158 int maxvis; |
2086 | 159 }; |
160 | |
161 struct direct_im { | |
162 struct gaim_connection *gc; | |
163 char name[80]; | |
164 int watcher; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
165 aim_conn_t *conn; |
3008 | 166 gboolean connected; |
2086 | 167 }; |
168 | |
169 struct ask_direct { | |
170 struct gaim_connection *gc; | |
171 char *sn; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
172 char ip[64]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
173 fu8_t cookie[8]; |
2086 | 174 }; |
175 | |
3630 | 176 struct oscar_file_transfer { |
177 enum { OFT_SENDFILE_IN, OFT_SENDFILE_OUT } type; | |
178 aim_conn_t *conn; | |
179 struct file_transfer *xfer; | |
180 char *sn; | |
181 char ip[64]; | |
182 fu16_t port; | |
183 fu8_t cookie[8]; | |
184 int totsize; | |
185 int filesdone; | |
186 int totfiles; | |
187 int watcher; | |
188 }; | |
189 | |
2086 | 190 struct icon_req { |
191 char *user; | |
192 time_t timestamp; | |
2196
016c5307f26b
[gaim-migrate @ 2206]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2194
diff
changeset
|
193 unsigned long length; |
2191
657dbe515608
[gaim-migrate @ 2201]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2172
diff
changeset
|
194 unsigned long checksum; |
2086 | 195 gboolean request; |
196 }; | |
197 | |
3453 | 198 struct channel4_data { |
3141 | 199 struct gaim_connection *gc; |
3453 | 200 gchar *uin; |
201 gchar *nick; | |
3141 | 202 }; |
203 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
204 static struct direct_im *find_direct_im(struct oscar_data *od, const char *who) { |
2086 | 205 GSList *d = od->direct_ims; |
206 char *n = g_strdup(normalize(who)); | |
207 struct direct_im *m = NULL; | |
208 | |
209 while (d) { | |
210 m = (struct direct_im *)d->data; | |
211 if (!strcmp(n, normalize(m->name))) | |
212 break; | |
213 m = NULL; | |
214 d = d->next; | |
215 } | |
216 | |
217 g_free(n); | |
218 return m; | |
219 } | |
220 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
221 static char *extract_name(const char *name) { |
4121 | 222 char *tmp, *x; |
2086 | 223 int i, j; |
4120 | 224 |
225 if (!name) | |
4121 | 226 return NULL; |
227 | |
4120 | 228 x = strchr(name, '-'); |
4121 | 229 |
2086 | 230 if (!x) return NULL; |
231 x = strchr(++x, '-'); | |
232 if (!x) return NULL; | |
233 tmp = g_strdup(++x); | |
234 | |
235 for (i = 0, j = 0; x[i]; i++) { | |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
236 char hex[3]; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
237 if (x[i] != '%') { |
2086 | 238 tmp[j++] = x[i]; |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
239 continue; |
2086 | 240 } |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
241 strncpy(hex, x + ++i, 2); hex[2] = 0; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
242 i++; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
243 tmp[j++] = strtol(hex, NULL, 16); |
2086 | 244 } |
245 | |
246 tmp[j] = 0; | |
247 return tmp; | |
248 } | |
249 | |
250 static struct chat_connection *find_oscar_chat(struct gaim_connection *gc, int id) { | |
251 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; | |
252 struct chat_connection *c = NULL; | |
253 | |
254 while (g) { | |
255 c = (struct chat_connection *)g->data; | |
256 if (c->id == id) | |
257 break; | |
258 g = g->next; | |
259 c = NULL; | |
260 } | |
261 | |
262 return c; | |
263 } | |
264 | |
265 static struct chat_connection *find_oscar_chat_by_conn(struct gaim_connection *gc, | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
266 aim_conn_t *conn) { |
2086 | 267 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; |
268 struct chat_connection *c = NULL; | |
269 | |
270 while (g) { | |
271 c = (struct chat_connection *)g->data; | |
272 if (c->conn == conn) | |
273 break; | |
274 g = g->next; | |
275 c = NULL; | |
276 } | |
277 | |
278 return c; | |
279 } | |
280 | |
3630 | 281 /* XXX there must be a better way than this.... -- wtm */ |
282 static struct oscar_file_transfer *find_oft_by_conn(struct gaim_connection *gc, | |
283 aim_conn_t *conn) { | |
284 GSList *g = ((struct oscar_data *)gc->proto_data)->file_transfers; | |
285 struct oscar_file_transfer *f = NULL; | |
286 | |
287 while (g) { | |
288 f = (struct oscar_file_transfer *)g->data; | |
289 if (f->conn == conn) | |
290 break; | |
291 g = g->next; | |
292 f = NULL; | |
293 } | |
294 | |
295 return f; | |
296 } | |
297 | |
298 static struct oscar_file_transfer *find_oft_by_xfer(struct gaim_connection *gc, | |
299 struct file_transfer *xfer) { | |
300 GSList *g = ((struct oscar_data *)gc->proto_data)->file_transfers; | |
301 struct oscar_file_transfer *f = NULL; | |
302 | |
303 while (g) { | |
304 f = (struct oscar_file_transfer *)g->data; | |
305 if (f->xfer == xfer) | |
306 break; | |
307 g = g->next; | |
308 f = NULL; | |
309 } | |
310 | |
311 return f; | |
312 } | |
313 | |
314 static struct oscar_file_transfer *find_oft_by_cookie(struct gaim_connection *gc, | |
315 const char *cookie) { | |
316 GSList *g = ((struct oscar_data *)gc->proto_data)->file_transfers; | |
317 struct oscar_file_transfer *f = NULL; | |
318 | |
319 while (g) { | |
320 f = (struct oscar_file_transfer *)g->data; | |
321 if (!strncmp(f->cookie, cookie, 8)) | |
322 break; | |
323 g = g->next; | |
324 f = NULL; | |
325 } | |
326 | |
327 return f; | |
328 } | |
329 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
330 static int gaim_parse_auth_resp (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
331 static int gaim_parse_login (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
332 static int gaim_handle_redirect (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
333 static int gaim_info_change (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
334 static int gaim_account_confirm (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
335 static int gaim_parse_oncoming (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
336 static int gaim_parse_offgoing (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
337 static int gaim_parse_incoming_im(aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
338 static int gaim_parse_misses (aim_session_t *, aim_frame_t *, ...); |
3212 | 339 static int gaim_parse_clientauto (aim_session_t *, aim_frame_t *, ...); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
340 static int gaim_parse_user_info (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
341 static int gaim_parse_motd (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
342 static int gaim_chatnav_info (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
343 static int gaim_chat_join (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
344 static int gaim_chat_leave (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
345 static int gaim_chat_info_update (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
346 static int gaim_chat_incoming_msg(aim_session_t *, aim_frame_t *, ...); |
3694 | 347 static int gaim_email_parseupdate(aim_session_t *, aim_frame_t *, ...); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
348 static int gaim_parse_msgack (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
349 static int gaim_parse_ratechange (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
350 static int gaim_parse_evilnotify (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
351 static int gaim_parse_searcherror(aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
352 static int gaim_parse_searchreply(aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
353 static int gaim_bosrights (aim_session_t *, aim_frame_t *, ...); |
3952 | 354 static int conninitdone_admin (aim_session_t *, aim_frame_t *, ...); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
355 static int conninitdone_bos (aim_session_t *, aim_frame_t *, ...); |
3952 | 356 static int conninitdone_chatnav (aim_session_t *, aim_frame_t *, ...); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
357 static int conninitdone_chat (aim_session_t *, aim_frame_t *, ...); |
3694 | 358 static int conninitdone_email (aim_session_t *, aim_frame_t *, ...); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
359 static int gaim_parse_msgerr (aim_session_t *, aim_frame_t *, ...); |
3595 | 360 static int gaim_parse_mtn (aim_session_t *, aim_frame_t *, ...); |
2993 | 361 static int gaim_parse_locaterights(aim_session_t *, aim_frame_t *, ...); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
362 static int gaim_parse_buddyrights(aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
363 static int gaim_parse_locerr (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
364 static int gaim_icbm_param_info (aim_session_t *, aim_frame_t *, ...); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
365 static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
366 static int gaim_memrequest (aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
367 static int gaim_selfinfo (aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
368 static int gaim_offlinemsg (aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
369 static int gaim_offlinemsgdone (aim_session_t *, aim_frame_t *, ...); |
4151 | 370 static int gaim_icqsimpleinfo (aim_session_t *, aim_frame_t *, ...); |
371 static int gaim_icqallinfo (aim_session_t *, aim_frame_t *, ...); | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
372 static int gaim_popup (aim_session_t *, aim_frame_t *, ...); |
2991 | 373 static int gaim_ssi_parserights (aim_session_t *, aim_frame_t *, ...); |
374 static int gaim_ssi_parselist (aim_session_t *, aim_frame_t *, ...); | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
375 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
376 static int gaim_directim_initiate(aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
377 static int gaim_directim_incoming(aim_session_t *, aim_frame_t *, ...); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
378 static int gaim_directim_typing (aim_session_t *, aim_frame_t *, ...); |
2993 | 379 static int gaim_update_ui (aim_session_t *, aim_frame_t *, ...); |
2086 | 380 |
3630 | 381 static int oscar_file_transfer_do(aim_session_t *, aim_frame_t *, ...); |
382 static void oscar_file_transfer_disconnect(aim_session_t *, | |
383 aim_conn_t *); | |
3771 | 384 static void oscar_file_transfer_cancel(struct gaim_connection *, |
3630 | 385 struct file_transfer *); |
386 static int oscar_sendfile_request(aim_session_t *sess, | |
387 struct oscar_file_transfer *oft); | |
3752 | 388 static int oscar_sendfile_timeout(aim_session_t *sess, aim_frame_t *fr, ...); |
3630 | 389 |
4151 | 390 static fu32_t check_encoding(const char *utf8); |
391 static fu32_t parse_encoding(const char *enc); | |
392 | |
2086 | 393 static char *msgerrreason[] = { |
4056 | 394 N_("Invalid error"), |
395 N_("Invalid SNAC"), | |
396 N_("Rate to host"), | |
397 N_("Rate to client"), | |
398 N_("Not logged in"), | |
399 N_("Service unavailable"), | |
400 N_("Service not defined"), | |
401 N_("Obsolete SNAC"), | |
402 N_("Not supported by host"), | |
403 N_("Not supported by client"), | |
404 N_("Refused by client"), | |
405 N_("Reply too big"), | |
406 N_("Responses lost"), | |
407 N_("Request denied"), | |
408 N_("Busted SNAC payload"), | |
409 N_("Insufficient rights"), | |
410 N_("In local permit/deny"), | |
411 N_("Too evil (sender)"), | |
412 N_("Too evil (receiver)"), | |
413 N_("User temporarily unavailable"), | |
414 N_("No match"), | |
415 N_("List overflow"), | |
416 N_("Request ambiguous"), | |
417 N_("Queue full"), | |
418 N_("Not while on AOL") | |
2086 | 419 }; |
420 static int msgerrreasonlen = 25; | |
421 | |
3952 | 422 /* |
423 * This is called to clean up whenever a file transfer is no longer in progress, | |
424 * whether because it finished sucessfully, it was canceled, or there was an error. | |
425 */ | |
426 static void oscar_file_transfer_disconnect(aim_session_t *sess, aim_conn_t *conn) { | |
3630 | 427 struct gaim_connection *gc = sess->aux_data; |
428 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
429 struct oscar_file_transfer *oft = find_oft_by_conn(gc, | |
430 conn); | |
431 | |
432 od->file_transfers = g_slist_remove(od->file_transfers, oft); | |
433 | |
434 if (oft->watcher) { | |
435 gaim_input_remove(oft->watcher); | |
436 oft->watcher = 0; | |
437 } | |
438 | |
439 aim_conn_kill(sess, &conn); | |
440 | |
441 g_free(oft->sn); | |
442 g_free(oft); | |
443 } | |
444 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
445 static void gaim_directim_disconnect(aim_session_t *sess, aim_conn_t *conn) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
446 struct gaim_connection *gc = sess->aux_data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
447 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
448 struct conversation *cnv; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
449 struct direct_im *dim; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
450 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
451 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
452 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
453 sn = g_strdup(aim_directim_getsn(conn)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
454 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
455 debug_printf("%s disconnected Direct IM.\n", sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
456 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
457 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
458 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
459 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
460 |
3008 | 461 if (dim->connected) |
462 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn); | |
463 else | |
464 g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), sn); | |
465 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
466 if ((cnv = find_conversation(sn))) |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2833
diff
changeset
|
467 write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL, time(NULL), -1); |
2993 | 468 update_progress(cnv, 100); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
469 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
470 g_free(dim); /* I guess? I don't see it anywhere else... -- mid */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
471 g_free(sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
472 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
473 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
474 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
475 |
2086 | 476 static void oscar_callback(gpointer data, gint source, |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
477 GaimInputCondition condition) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
478 aim_conn_t *conn = (aim_conn_t *)data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
479 aim_session_t *sess = aim_conn_getsess(conn); |
2086 | 480 struct gaim_connection *gc = sess ? sess->aux_data : NULL; |
481 struct oscar_data *odata; | |
482 | |
483 if (!gc) { | |
484 /* gc is null. we return, else we seg SIGSEG on next line. */ | |
485 debug_printf("oscar callback for closed connection (1).\n"); | |
486 return; | |
487 } | |
488 | |
489 odata = (struct oscar_data *)gc->proto_data; | |
490 | |
491 if (!g_slist_find(connections, gc)) { | |
492 /* oh boy. this is probably bad. i guess the only thing we | |
493 * can really do is return? */ | |
494 debug_printf("oscar callback for closed connection (2).\n"); | |
495 return; | |
496 } | |
497 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
498 if (condition & GAIM_INPUT_READ) { |
2086 | 499 if (conn->type == AIM_CONN_TYPE_RENDEZVOUS_OUT) { |
500 debug_printf("got information on rendezvous\n"); | |
501 if (aim_handlerendconnect(odata->sess, conn) < 0) { | |
502 debug_printf(_("connection error (rend)\n")); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
503 aim_conn_kill(odata->sess, &conn); |
2086 | 504 } |
505 } else { | |
506 if (aim_get_command(odata->sess, conn) >= 0) { | |
507 aim_rxdispatch(odata->sess); | |
508 if (odata->killme) | |
509 signoff(gc); | |
510 } else { | |
511 if ((conn->type == AIM_CONN_TYPE_BOS) || | |
512 !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) { | |
513 debug_printf(_("major connection error\n")); | |
3074 | 514 hide_login_progress_error(gc, _("Disconnected.")); |
2086 | 515 signoff(gc); |
516 } else if (conn->type == AIM_CONN_TYPE_CHAT) { | |
517 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); | |
518 char buf[BUF_LONG]; | |
519 debug_printf("disconnected from chat room %s\n", c->name); | |
520 c->conn = NULL; | |
521 if (c->inpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
522 gaim_input_remove(c->inpa); |
2086 | 523 c->inpa = 0; |
524 c->fd = -1; | |
525 aim_conn_kill(odata->sess, &conn); | |
3574 | 526 snprintf(buf, sizeof(buf), _("You have been disconnected from chat room %s."), c->name); |
3427 | 527 do_error_dialog(buf, NULL, GAIM_ERROR); |
2086 | 528 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { |
529 if (odata->cnpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
530 gaim_input_remove(odata->cnpa); |
2086 | 531 odata->cnpa = 0; |
532 debug_printf("removing chatnav input watcher\n"); | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
533 while (odata->create_rooms) { |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
534 struct create_room *cr = odata->create_rooms->data; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
535 g_free(cr->name); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
536 odata->create_rooms = |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
537 g_slist_remove(odata->create_rooms, cr); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
538 g_free(cr); |
3427 | 539 do_error_dialog(_("Chat is currently unavailable"), NULL, GAIM_ERROR); |
2086 | 540 } |
541 aim_conn_kill(odata->sess, &conn); | |
542 } else if (conn->type == AIM_CONN_TYPE_AUTH) { | |
543 if (odata->paspa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
544 gaim_input_remove(odata->paspa); |
2086 | 545 odata->paspa = 0; |
546 debug_printf("removing authconn input watcher\n"); | |
547 aim_conn_kill(odata->sess, &conn); | |
3694 | 548 } else if (conn->type == AIM_CONN_TYPE_EMAIL) { |
549 if (odata->emlpa > 0) | |
550 gaim_input_remove(odata->emlpa); | |
551 odata->emlpa = 0; | |
552 debug_printf("removing email input watcher\n"); | |
553 aim_conn_kill(odata->sess, &conn); | |
2086 | 554 } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
555 if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
556 gaim_directim_disconnect(odata->sess, conn); |
3630 | 557 else if (conn->subtype == AIM_CONN_SUBTYPE_OFT_SENDFILE) { |
558 struct oscar_file_transfer *oft = find_oft_by_conn(gc, conn); | |
559 if (oft) { | |
560 transfer_abort(oft->xfer, _("Buddy canceled transfer")); | |
561 } | |
562 oscar_file_transfer_disconnect(odata->sess, conn); | |
563 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
564 else { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
565 debug_printf("No handler for rendezvous disconnect (%d).\n", |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
566 source); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
567 } |
2086 | 568 aim_conn_kill(odata->sess, &conn); |
569 } else { | |
4194 | 570 debug_printf("holy crap! generic connection error! %hu\n", |
2086 | 571 conn->type); |
572 aim_conn_kill(odata->sess, &conn); | |
573 } | |
574 } | |
575 } | |
576 } | |
577 } | |
578 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
579 static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) { |
2086 | 580 char *s = g_strdup_vprintf(format, va); |
581 char buf[256]; | |
582 char *t; | |
583 struct gaim_connection *gc = sess->aux_data; | |
584 | |
585 g_snprintf(buf, sizeof(buf), "%s %d: ", gc->username, level); | |
586 t = g_strconcat(buf, s, NULL); | |
587 debug_printf(t); | |
588 if (t[strlen(t)-1] != '\n') | |
589 debug_printf("\n"); | |
590 g_free(t); | |
591 g_free(s); | |
592 } | |
593 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
594 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 595 { |
596 struct gaim_connection *gc = data; | |
597 struct oscar_data *odata; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
598 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
599 aim_conn_t *conn; |
2086 | 600 |
601 if (!g_slist_find(connections, gc)) { | |
602 close(source); | |
603 return; | |
604 } | |
605 | |
606 odata = gc->proto_data; | |
607 sess = odata->sess; | |
608 conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); | |
609 | |
610 if (source < 0) { | |
611 hide_login_progress(gc, _("Couldn't connect to host")); | |
612 signoff(gc); | |
613 return; | |
614 } | |
615 | |
616 aim_conn_completeconnect(sess, conn); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
617 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, |
2086 | 618 oscar_callback, conn); |
619 debug_printf(_("Password sent, waiting for response\n")); | |
620 } | |
621 | |
622 static void oscar_login(struct aim_user *user) { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
623 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
624 aim_conn_t *conn; |
2086 | 625 char buf[256]; |
626 struct gaim_connection *gc = new_gaim_conn(user); | |
627 struct oscar_data *odata = gc->proto_data = g_new0(struct oscar_data, 1); | |
628 | |
2589
4e149a0b9665
[gaim-migrate @ 2602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2507
diff
changeset
|
629 if (isdigit(*user->username)) { |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
630 odata->icq = TRUE; |
2589
4e149a0b9665
[gaim-migrate @ 2602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2507
diff
changeset
|
631 /* this is odd but it's necessary for a proper do_import and do_export */ |
4e149a0b9665
[gaim-migrate @ 2602]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2507
diff
changeset
|
632 gc->protocol = PROTO_ICQ; |
3064 | 633 gc->password[8] = 0; |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
634 } else { |
2590
2dd86a1af92b
[gaim-migrate @ 2603]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2589
diff
changeset
|
635 gc->protocol = PROTO_TOC; |
2918
4df759d607f3
[gaim-migrate @ 2931]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2916
diff
changeset
|
636 gc->flags |= OPT_CONN_HTML; |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
637 gc->flags |= OPT_CONN_AUTO_RESP; |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
638 } |
3600 | 639 odata->supports_tn = g_hash_table_new(g_str_hash, g_str_equal); |
2086 | 640 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
641 sess = g_new0(aim_session_t, 1); |
2086 | 642 |
643 aim_session_init(sess, AIM_SESS_FLAGS_NONBLOCKCONNECT, 0); | |
644 aim_setdebuggingcb(sess, oscar_debug); | |
645 | |
646 /* we need an immediate queue because we don't use a while-loop to | |
647 * see if things need to be sent. */ | |
648 aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL); | |
649 odata->sess = sess; | |
650 sess->aux_data = gc; | |
651 | |
652 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); | |
653 if (conn == NULL) { | |
654 debug_printf(_("internal connection error\n")); | |
655 hide_login_progress(gc, _("Unable to login to AIM")); | |
656 signoff(gc); | |
657 return; | |
658 } | |
659 | |
660 g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username); | |
661 set_login_progress(gc, 2, buf); | |
662 | |
663 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); | |
664 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); | |
665 | |
666 conn->status |= AIM_CONN_STATUS_INPROGRESS; | |
667 conn->fd = proxy_connect(user->proto_opt[USEROPT_AUTH][0] ? | |
668 user->proto_opt[USEROPT_AUTH] : FAIM_LOGIN_SERVER, | |
669 user->proto_opt[USEROPT_AUTHPORT][0] ? | |
670 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, | |
671 oscar_login_connect, gc); | |
672 if (conn->fd < 0) { | |
673 hide_login_progress(gc, _("Couldn't connect to host")); | |
674 signoff(gc); | |
675 return; | |
676 } | |
677 aim_request_login(sess, conn, gc->username); | |
678 } | |
679 | |
680 static void oscar_close(struct gaim_connection *gc) { | |
681 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; | |
682 | |
683 while (odata->oscar_chats) { | |
684 struct chat_connection *n = odata->oscar_chats->data; | |
685 if (n->inpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
686 gaim_input_remove(n->inpa); |
2086 | 687 g_free(n->name); |
688 g_free(n->show); | |
689 odata->oscar_chats = g_slist_remove(odata->oscar_chats, n); | |
690 g_free(n); | |
691 } | |
692 while (odata->direct_ims) { | |
693 struct direct_im *n = odata->direct_ims->data; | |
694 if (n->watcher > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
695 gaim_input_remove(n->watcher); |
2086 | 696 odata->direct_ims = g_slist_remove(odata->direct_ims, n); |
697 g_free(n); | |
698 } | |
3630 | 699 while (odata->file_transfers) { |
700 struct oscar_file_transfer *n = odata->file_transfers->data; | |
701 if (n->watcher > 0) | |
702 gaim_input_remove(n->watcher); | |
703 odata->file_transfers = g_slist_remove(odata->file_transfers, n); | |
704 g_free(n); | |
705 } | |
2086 | 706 while (odata->hasicons) { |
707 struct icon_req *n = odata->hasicons->data; | |
708 g_free(n->user); | |
709 odata->hasicons = g_slist_remove(odata->hasicons, n); | |
710 g_free(n); | |
711 } | |
3600 | 712 g_hash_table_destroy(odata->supports_tn); |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
713 while (odata->evilhack) { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
714 g_free(odata->evilhack->data); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
715 odata->evilhack = g_slist_remove(odata->evilhack, odata->evilhack->data); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
716 } |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
717 while (odata->create_rooms) { |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
718 struct create_room *cr = odata->create_rooms->data; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
719 g_free(cr->name); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
720 odata->create_rooms = g_slist_remove(odata->create_rooms, cr); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
721 g_free(cr); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
722 } |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
723 if (odata->email) |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
724 g_free(odata->email); |
2754
642413968b03
[gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2742
diff
changeset
|
725 if (odata->newp) |
642413968b03
[gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2742
diff
changeset
|
726 g_free(odata->newp); |
642413968b03
[gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2742
diff
changeset
|
727 if (odata->oldp) |
642413968b03
[gaim-migrate @ 2767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2742
diff
changeset
|
728 g_free(odata->oldp); |
2086 | 729 if (gc->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
730 gaim_input_remove(gc->inpa); |
2086 | 731 if (odata->cnpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
732 gaim_input_remove(odata->cnpa); |
2086 | 733 if (odata->paspa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
734 gaim_input_remove(odata->paspa); |
3694 | 735 if (odata->emlpa > 0) |
736 gaim_input_remove(odata->emlpa); | |
2086 | 737 aim_session_kill(odata->sess); |
738 g_free(odata->sess); | |
739 odata->sess = NULL; | |
740 g_free(gc->proto_data); | |
741 gc->proto_data = NULL; | |
742 debug_printf(_("Signed off.\n")); | |
743 } | |
744 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
745 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { |
2086 | 746 struct gaim_connection *gc = data; |
747 struct oscar_data *odata; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
748 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
749 aim_conn_t *bosconn; |
2086 | 750 |
751 if (!g_slist_find(connections, gc)) { | |
752 close(source); | |
753 return; | |
754 } | |
755 | |
756 odata = gc->proto_data; | |
757 sess = odata->sess; | |
758 bosconn = odata->conn; | |
759 | |
760 if (source < 0) { | |
761 hide_login_progress(gc, _("Could Not Connect")); | |
762 signoff(gc); | |
763 return; | |
764 } | |
765 | |
766 aim_conn_completeconnect(sess, bosconn); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
767 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, |
2086 | 768 oscar_callback, bosconn); |
769 set_login_progress(gc, 4, _("Connection established, cookie sent")); | |
770 } | |
771 | |
3630 | 772 static void oscar_ask_send_file(struct gaim_connection *gc, char *destsn) { |
773 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
3752 | 774 |
775 struct oscar_file_transfer *oft = g_new0(struct oscar_file_transfer, | |
776 1); | |
777 | |
778 oft->type = OFT_SENDFILE_OUT; | |
779 oft->sn = g_strdup(destsn); | |
780 | |
781 od->file_transfers = g_slist_append(od->file_transfers, oft); | |
782 | |
783 oft->xfer = transfer_out_add(gc, oft->sn); | |
3630 | 784 } |
785 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
786 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 787 va_list ap; |
2704 | 788 struct aim_authresp_info *info; |
2086 | 789 int i; char *host; int port; |
790 struct aim_user *user; | |
2704 | 791 aim_conn_t *bosconn; |
2086 | 792 |
793 struct gaim_connection *gc = sess->aux_data; | |
794 struct oscar_data *od = gc->proto_data; | |
795 user = gc->user; | |
796 port = user->proto_opt[USEROPT_AUTHPORT][0] ? | |
797 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, | |
798 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
799 va_start(ap, fr); |
2704 | 800 info = va_arg(ap, struct aim_authresp_info *); |
2086 | 801 va_end(ap); |
802 | |
2704 | 803 debug_printf("inside auth_resp (Screen name: %s)\n", info->sn); |
804 | |
805 if (info->errorcode || !info->bosip || !info->cookie) { | |
4056 | 806 char buf[256]; |
2704 | 807 switch (info->errorcode) { |
2086 | 808 case 0x05: |
809 /* Incorrect nick/password */ | |
810 hide_login_progress(gc, _("Incorrect nickname or password.")); | |
811 plugin_event(event_error, (void *)980, 0, 0, 0); | |
812 break; | |
813 case 0x11: | |
814 /* Suspended account */ | |
815 hide_login_progress(gc, _("Your account is currently suspended.")); | |
816 break; | |
3498 | 817 case 0x14: |
818 /* service temporarily unavailable */ | |
819 hide_login_progress(gc, _("The AOL Instant Messenger service is temporarily unavailable.")); | |
820 break; | |
2086 | 821 case 0x18: |
822 /* connecting too frequently */ | |
823 hide_login_progress(gc, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); | |
824 plugin_event(event_error, (void *)983, 0, 0, 0); | |
825 break; | |
826 case 0x1c: | |
827 /* client too old */ | |
4056 | 828 g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), WEBSITE); |
829 hide_login_progress(gc, buf); | |
2086 | 830 plugin_event(event_error, (void *)989, 0, 0, 0); |
831 break; | |
832 default: | |
833 hide_login_progress(gc, _("Authentication Failed")); | |
834 break; | |
835 } | |
4194 | 836 debug_printf("Login Error Code 0x%04hx\n", info->errorcode); |
2704 | 837 debug_printf("Error URL: %s\n", info->errorurl); |
2086 | 838 od->killme = TRUE; |
839 return 1; | |
840 } | |
841 | |
842 | |
4194 | 843 debug_printf("Reg status: %hu\n", info->regstatus); |
2704 | 844 if (info->email) { |
845 debug_printf("Email: %s\n", info->email); | |
2086 | 846 } else { |
847 debug_printf("Email is NULL\n"); | |
848 } | |
2704 | 849 debug_printf("BOSIP: %s\n", info->bosip); |
2086 | 850 debug_printf("Closing auth connection...\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
851 aim_conn_kill(sess, &fr->conn); |
2086 | 852 |
853 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL); | |
854 if (bosconn == NULL) { | |
855 hide_login_progress(gc, _("Internal Error")); | |
856 od->killme = TRUE; | |
857 return 0; | |
858 } | |
859 | |
2675 | 860 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_bos, 0); |
2086 | 861 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, gaim_bosrights, 0); |
862 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0); | |
863 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, gaim_handle_redirect, 0); | |
2993 | 864 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_RIGHTSINFO, gaim_parse_locaterights, 0); |
2086 | 865 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_RIGHTSINFO, gaim_parse_buddyrights, 0); |
866 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, gaim_parse_oncoming, 0); | |
867 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, gaim_parse_offgoing, 0); | |
868 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, gaim_parse_incoming_im, 0); | |
869 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, gaim_parse_locerr, 0); | |
870 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, gaim_parse_misses, 0); | |
3212 | 871 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_CLIENTAUTORESP, gaim_parse_clientauto, 0); |
2086 | 872 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, gaim_parse_ratechange, 0); |
873 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL, gaim_parse_evilnotify, 0); | |
874 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, AIM_CB_LOK_ERROR, gaim_parse_searcherror, 0); | |
875 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, 0x0003, gaim_parse_searchreply, 0); | |
876 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, gaim_parse_msgerr, 0); | |
3595 | 877 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parse_mtn, 0); |
2086 | 878 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parse_user_info, 0); |
879 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK, gaim_parse_msgack, 0); | |
880 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_MOTD, gaim_parse_motd, 0); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
881 aim_conn_addhandler(sess, bosconn, 0x0004, 0x0005, gaim_icbm_param_info, 0); |
2086 | 882 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, gaim_parse_genericerr, 0); |
883 aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, gaim_parse_genericerr, 0); | |
884 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, gaim_parse_genericerr, 0); | |
885 aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, gaim_memrequest, 0); | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
886 aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0); |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
887 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG, gaim_offlinemsg, 0); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
888 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSGCOMPLETE, gaim_offlinemsgdone, 0); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
889 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_POP, 0x0002, gaim_popup, 0); |
4151 | 890 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_SIMPLEINFO, gaim_icqsimpleinfo, 0); |
891 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_ALLINFO, gaim_icqallinfo, 0); | |
2991 | 892 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RIGHTSINFO, gaim_ssi_parserights, 0); |
893 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_LIST, gaim_ssi_parselist, 0); | |
894 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_NOLIST, gaim_ssi_parselist, 0); | |
3752 | 895 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_MSGTIMEOUT, oscar_sendfile_timeout, 0); |
2086 | 896 |
897 ((struct oscar_data *)gc->proto_data)->conn = bosconn; | |
2704 | 898 for (i = 0; i < (int)strlen(info->bosip); i++) { |
899 if (info->bosip[i] == ':') { | |
900 port = atoi(&(info->bosip[i+1])); | |
2086 | 901 break; |
902 } | |
903 } | |
2704 | 904 host = g_strndup(info->bosip, i); |
2086 | 905 bosconn->status |= AIM_CONN_STATUS_INPROGRESS; |
906 bosconn->fd = proxy_connect(host, port, oscar_bos_connect, gc); | |
907 g_free(host); | |
908 if (bosconn->fd < 0) { | |
909 hide_login_progress(gc, _("Could Not Connect")); | |
910 od->killme = TRUE; | |
911 return 0; | |
912 } | |
2704 | 913 aim_sendcookie(sess, bosconn, info->cookie); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
914 gaim_input_remove(gc->inpa); |
2704 | 915 |
2086 | 916 return 1; |
917 } | |
918 | |
919 struct pieceofcrap { | |
920 struct gaim_connection *gc; | |
921 unsigned long offset; | |
922 unsigned long len; | |
923 char *modname; | |
924 int fd; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
925 aim_conn_t *conn; |
2086 | 926 unsigned int inpa; |
927 }; | |
928 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
929 static void damn_you(gpointer data, gint source, GaimInputCondition c) |
2086 | 930 { |
931 struct pieceofcrap *pos = data; | |
932 struct oscar_data *od = pos->gc->proto_data; | |
933 char in = '\0'; | |
934 int x = 0; | |
935 unsigned char m[17]; | |
936 | |
937 while (read(pos->fd, &in, 1) == 1) { | |
938 if (in == '\n') | |
939 x++; | |
940 else if (in != '\r') | |
941 x = 0; | |
942 if (x == 2) | |
943 break; | |
944 in = '\0'; | |
945 } | |
946 if (in != '\n') { | |
4056 | 947 char buf[256]; |
948 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until " | |
949 "this is fixed. Check %s for updates."), WEBSITE); | |
3427 | 950 do_error_dialog(_("Gaim was Unable to get a valid AIM login hash."), |
4056 | 951 buf, GAIM_WARNING); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
952 gaim_input_remove(pos->inpa); |
2086 | 953 close(pos->fd); |
954 g_free(pos); | |
955 return; | |
956 } | |
957 read(pos->fd, m, 16); | |
958 m[16] = '\0'; | |
959 debug_printf("Sending hash: "); | |
960 for (x = 0; x < 16; x++) | |
4194 | 961 debug_printf("%02hhx ", (unsigned char)m[x]); |
2086 | 962 debug_printf("\n"); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
963 gaim_input_remove(pos->inpa); |
2086 | 964 close(pos->fd); |
965 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); | |
966 g_free(pos); | |
967 } | |
968 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
969 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) { |
2086 | 970 struct pieceofcrap *pos = data; |
971 char buf[BUF_LONG]; | |
972 | |
973 if (source < 0) { | |
4056 | 974 char buf[256]; |
975 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until " | |
976 "this is fixed. Check %s for updates."), WEBSITE); | |
3427 | 977 do_error_dialog(_("Gaim was Unable to get a valid AIM login hash."), |
4056 | 978 buf, GAIM_WARNING); |
2086 | 979 if (pos->modname) |
980 g_free(pos->modname); | |
981 g_free(pos); | |
982 return; | |
983 } | |
984 | |
985 g_snprintf(buf, sizeof(buf), "GET " AIMHASHDATA | |
986 "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n", | |
987 pos->offset, pos->len, pos->modname ? pos->modname : ""); | |
988 write(pos->fd, buf, strlen(buf)); | |
989 if (pos->modname) | |
990 g_free(pos->modname); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
991 pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); |
2086 | 992 return; |
993 } | |
994 | |
995 /* size of icbmui.ocm, the largest module in AIM 3.5 */ | |
996 #define AIM_MAX_FILE_SIZE 98304 | |
997 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
998 int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 999 va_list ap; |
1000 struct pieceofcrap *pos; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1001 fu32_t offset, len; |
2086 | 1002 char *modname; |
1003 int fd; | |
1004 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1005 va_start(ap, fr); |
4200 | 1006 offset = va_arg(ap, fu32_t); |
1007 len = va_arg(ap, fu32_t); | |
2086 | 1008 modname = va_arg(ap, char *); |
1009 va_end(ap); | |
1010 | |
4194 | 1011 debug_printf("offset: %lu, len: %lu, file: %s\n", offset, len, (modname ? modname : "aim.exe")); |
2086 | 1012 if (len == 0) { |
1013 debug_printf("len is 0, hashing NULL\n"); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1014 aim_sendmemblock(sess, fr->conn, offset, len, NULL, |
2086 | 1015 AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
1016 return 1; | |
1017 } | |
1018 /* uncomment this when you're convinced it's right. remember, it's been wrong before. | |
1019 if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) { | |
1020 char *buf; | |
1021 int i = 8; | |
1022 if (modname) | |
1023 i += strlen(modname); | |
1024 buf = g_malloc(i); | |
1025 i = 0; | |
1026 if (modname) { | |
1027 memcpy(buf, modname, strlen(modname)); | |
1028 i += strlen(modname); | |
1029 } | |
1030 buf[i++] = offset & 0xff; | |
1031 buf[i++] = (offset >> 8) & 0xff; | |
1032 buf[i++] = (offset >> 16) & 0xff; | |
1033 buf[i++] = (offset >> 24) & 0xff; | |
1034 buf[i++] = len & 0xff; | |
1035 buf[i++] = (len >> 8) & 0xff; | |
1036 buf[i++] = (len >> 16) & 0xff; | |
1037 buf[i++] = (len >> 24) & 0xff; | |
1038 debug_printf("len + offset is invalid, hashing request\n"); | |
1039 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); | |
1040 g_free(buf); | |
1041 return 1; | |
1042 } | |
1043 */ | |
1044 | |
1045 pos = g_new0(struct pieceofcrap, 1); | |
1046 pos->gc = sess->aux_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1047 pos->conn = fr->conn; |
2086 | 1048 |
1049 pos->offset = offset; | |
1050 pos->len = len; | |
1051 pos->modname = modname ? g_strdup(modname) : NULL; | |
1052 | |
1053 fd = proxy_connect("gaim.sourceforge.net", 80, straight_to_hell, pos); | |
1054 if (fd < 0) { | |
4056 | 1055 char buf[256]; |
2086 | 1056 if (pos->modname) |
1057 g_free(pos->modname); | |
1058 g_free(pos); | |
4056 | 1059 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until " |
1060 "this is fixed. Check %s for updates."), WEBSITE); | |
3427 | 1061 do_error_dialog(_("Gaim was Unable to get valid login hash."), |
4056 | 1062 buf, GAIM_WARNING); |
2086 | 1063 } |
1064 pos->fd = fd; | |
1065 | |
1066 return 1; | |
1067 } | |
1068 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1069 static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1070 char *key; |
1071 va_list ap; | |
1072 struct gaim_connection *gc = sess->aux_data; | |
3458 | 1073 struct oscar_data *odata = gc->proto_data; |
2086 | 1074 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1075 va_start(ap, fr); |
2086 | 1076 key = va_arg(ap, char *); |
1077 va_end(ap); | |
1078 | |
3458 | 1079 if (odata->icq) { |
1080 struct client_info_s info = CLIENTINFO_ICQ_KNOWNGOOD; | |
1081 aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key); | |
1082 } else { | |
1083 #if 0 | |
1084 struct client_info_s info = {"gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b}; | |
1085 #endif | |
1086 struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD; | |
1087 aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key); | |
1088 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1089 |
2086 | 1090 return 1; |
1091 } | |
1092 | |
2675 | 1093 static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { |
2647 | 1094 struct gaim_connection *gc = sess->aux_data; |
1095 struct chat_connection *chatcon; | |
1096 static int id = 1; | |
1097 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1098 aim_conn_addhandler(sess, fr->conn, 0x000e, 0x0001, gaim_parse_genericerr, 0); |
2675 | 1099 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN, gaim_chat_join, 0); |
1100 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERLEAVE, gaim_chat_leave, 0); | |
1101 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE, gaim_chat_info_update, 0); | |
1102 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_chat_incoming_msg, 0); | |
1103 | |
2672 | 1104 aim_clientready(sess, fr->conn); |
2675 | 1105 |
2647 | 1106 chatcon = find_oscar_chat_by_conn(gc, fr->conn); |
1107 chatcon->id = id; | |
1108 chatcon->cnv = serv_got_joined_chat(gc, id++, chatcon->show); | |
1109 | |
1110 return 1; | |
1111 } | |
1112 | |
2675 | 1113 static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...) { |
1114 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1115 aim_conn_addhandler(sess, fr->conn, 0x000d, 0x0001, gaim_parse_genericerr, 0); |
2647 | 1116 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_INFO, gaim_chatnav_info, 0); |
2675 | 1117 |
1118 aim_clientready(sess, fr->conn); | |
1119 | |
1120 aim_chatnav_reqrights(sess, fr->conn); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1121 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1122 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1123 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1124 |
3694 | 1125 static int conninitdone_email(aim_session_t *sess, aim_frame_t *fr, ...) { |
1126 | |
1127 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); | |
1128 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_EML, AIM_CB_EML_MAILSTATUS, gaim_email_parseupdate, 0); | |
1129 | |
1130 aim_email_sendcookies(sess, fr->conn); | |
1131 aim_email_activate(sess, fr->conn); | |
1132 aim_clientready(sess, fr->conn); | |
1133 | |
1134 return 1; | |
1135 } | |
1136 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1137 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { |
2086 | 1138 struct gaim_connection *gc = data; |
1139 struct oscar_data *odata; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1140 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1141 aim_conn_t *tstconn; |
2086 | 1142 |
1143 if (!g_slist_find(connections, gc)) { | |
1144 close(source); | |
1145 return; | |
1146 } | |
1147 | |
1148 odata = gc->proto_data; | |
1149 sess = odata->sess; | |
1150 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV); | |
1151 | |
1152 if (source < 0) { | |
1153 aim_conn_kill(sess, &tstconn); | |
1154 debug_printf("unable to connect to chatnav server\n"); | |
1155 return; | |
1156 } | |
1157 | |
1158 aim_conn_completeconnect(sess, tstconn); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1159 odata->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1160 oscar_callback, tstconn); |
2086 | 1161 debug_printf("chatnav: connected\n"); |
1162 } | |
1163 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1164 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 1165 { |
1166 struct gaim_connection *gc = data; | |
1167 struct oscar_data *odata; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1168 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1169 aim_conn_t *tstconn; |
2086 | 1170 |
1171 if (!g_slist_find(connections, gc)) { | |
1172 close(source); | |
1173 return; | |
1174 } | |
1175 | |
1176 odata = gc->proto_data; | |
1177 sess = odata->sess; | |
1178 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); | |
1179 | |
1180 if (source < 0) { | |
1181 aim_conn_kill(sess, &tstconn); | |
1182 debug_printf("unable to connect to authorizer\n"); | |
1183 return; | |
1184 } | |
1185 | |
1186 aim_conn_completeconnect(sess, tstconn); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1187 odata->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, |
2086 | 1188 oscar_callback, tstconn); |
1189 debug_printf("chatnav: connected\n"); | |
1190 } | |
1191 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1192 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 1193 { |
1194 struct chat_connection *ccon = data; | |
1195 struct gaim_connection *gc = ccon->gc; | |
1196 struct oscar_data *odata; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1197 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1198 aim_conn_t *tstconn; |
2086 | 1199 |
1200 if (!g_slist_find(connections, gc)) { | |
1201 close(source); | |
1202 g_free(ccon->show); | |
1203 g_free(ccon->name); | |
1204 g_free(ccon); | |
1205 return; | |
1206 } | |
1207 | |
1208 odata = gc->proto_data; | |
1209 sess = odata->sess; | |
1210 tstconn = ccon->conn; | |
1211 | |
1212 if (source < 0) { | |
1213 aim_conn_kill(sess, &tstconn); | |
1214 g_free(ccon->show); | |
1215 g_free(ccon->name); | |
1216 g_free(ccon); | |
1217 return; | |
1218 } | |
1219 | |
1220 aim_conn_completeconnect(sess, ccon->conn); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1221 ccon->inpa = gaim_input_add(tstconn->fd, |
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1222 GAIM_INPUT_READ, |
2086 | 1223 oscar_callback, tstconn); |
1224 odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon); | |
1225 } | |
1226 | |
3694 | 1227 static void oscar_email_connect(gpointer data, gint source, GaimInputCondition cond) { |
1228 struct gaim_connection *gc = data; | |
1229 struct oscar_data *odata; | |
1230 aim_session_t *sess; | |
1231 aim_conn_t *tstconn; | |
1232 | |
1233 if (!g_slist_find(connections, gc)) { | |
1234 close(source); | |
1235 return; | |
1236 } | |
1237 | |
1238 odata = gc->proto_data; | |
1239 sess = odata->sess; | |
1240 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_EMAIL); | |
1241 | |
1242 if (source < 0) { | |
1243 aim_conn_kill(sess, &tstconn); | |
1244 debug_printf("unable to connect to email server\n"); | |
1245 return; | |
1246 } | |
1247 | |
1248 aim_conn_completeconnect(sess, tstconn); | |
1249 odata->emlpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); | |
1250 debug_printf("email: connected\n"); | |
1251 } | |
1252 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1253 /* Hrmph. I don't know how to make this look better. --mid */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1254 static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1255 va_list ap; |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1256 struct aim_redirect_data *redir; |
2086 | 1257 struct gaim_connection *gc = sess->aux_data; |
1258 struct aim_user *user = gc->user; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1259 aim_conn_t *tstconn; |
2086 | 1260 int i; |
1261 char *host; | |
1262 int port; | |
1263 | |
1264 port = user->proto_opt[USEROPT_AUTHPORT][0] ? | |
1265 atoi(user->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, | |
1266 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1267 va_start(ap, fr); |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1268 redir = va_arg(ap, struct aim_redirect_data *); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1269 va_end(ap); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1270 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1271 for (i = 0; i < (int)strlen(redir->ip); i++) { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1272 if (redir->ip[i] == ':') { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1273 port = atoi(&(redir->ip[i+1])); |
2086 | 1274 break; |
1275 } | |
1276 } | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1277 host = g_strndup(redir->ip, i); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1278 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1279 switch(redir->group) { |
2086 | 1280 case 0x7: /* Authorizer */ |
1281 debug_printf("Reconnecting with authorizor...\n"); | |
1282 tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); | |
1283 if (tstconn == NULL) { | |
1284 debug_printf("unable to reconnect with authorizer\n"); | |
1285 g_free(host); | |
1286 return 1; | |
1287 } | |
2675 | 1288 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_admin, 0); |
2086 | 1289 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0003, gaim_info_change, 0); |
1290 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0005, gaim_info_change, 0); | |
1291 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0007, gaim_account_confirm, 0); | |
1292 | |
1293 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
1294 tstconn->fd = proxy_connect(host, port, oscar_auth_connect, gc); | |
1295 if (tstconn->fd < 0) { | |
1296 aim_conn_kill(sess, &tstconn); | |
1297 debug_printf("unable to reconnect with authorizer\n"); | |
1298 g_free(host); | |
1299 return 1; | |
1300 } | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1301 aim_sendcookie(sess, tstconn, redir->cookie); |
4194 | 1302 break; |
1303 | |
2086 | 1304 case 0xd: /* ChatNav */ |
1305 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, NULL); | |
1306 if (tstconn == NULL) { | |
1307 debug_printf("unable to connect to chatnav server\n"); | |
1308 g_free(host); | |
1309 return 1; | |
1310 } | |
2675 | 1311 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chatnav, 0); |
2086 | 1312 |
1313 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
1314 tstconn->fd = proxy_connect(host, port, oscar_chatnav_connect, gc); | |
1315 if (tstconn->fd < 0) { | |
1316 aim_conn_kill(sess, &tstconn); | |
1317 debug_printf("unable to connect to chatnav server\n"); | |
1318 g_free(host); | |
1319 return 1; | |
1320 } | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1321 aim_sendcookie(sess, tstconn, redir->cookie); |
4194 | 1322 break; |
1323 | |
1324 case 0xe: { /* Chat */ | |
2086 | 1325 struct chat_connection *ccon; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1326 |
2086 | 1327 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, NULL); |
1328 if (tstconn == NULL) { | |
1329 debug_printf("unable to connect to chat server\n"); | |
1330 g_free(host); | |
1331 return 1; | |
1332 } | |
1333 | |
2675 | 1334 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chat, 0); |
1335 | |
2086 | 1336 ccon = g_new0(struct chat_connection, 1); |
1337 ccon->conn = tstconn; | |
1338 ccon->gc = gc; | |
1339 ccon->fd = -1; | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1340 ccon->name = g_strdup(redir->chat.room); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1341 ccon->exchange = redir->chat.exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1342 ccon->instance = redir->chat.instance; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1343 ccon->show = extract_name(redir->chat.room); |
2086 | 1344 |
1345 ccon->conn->status |= AIM_CONN_STATUS_INPROGRESS; | |
1346 ccon->conn->fd = proxy_connect(host, port, oscar_chat_connect, ccon); | |
1347 if (ccon->conn->fd < 0) { | |
1348 aim_conn_kill(sess, &tstconn); | |
1349 debug_printf("unable to connect to chat server\n"); | |
1350 g_free(host); | |
1351 g_free(ccon->show); | |
1352 g_free(ccon->name); | |
1353 g_free(ccon); | |
1354 return 1; | |
1355 } | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1356 aim_sendcookie(sess, tstconn, redir->cookie); |
4194 | 1357 debug_printf("Connected to chat room %s exchange %hu\n", ccon->name, ccon->exchange); |
1358 } break; | |
3694 | 1359 |
1360 case 0x0018: { /* email */ | |
1361 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_EMAIL, NULL))) { | |
1362 debug_printf("unable to connect to email server\n"); | |
1363 g_free(host); | |
1364 return 1; | |
1365 } | |
1366 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_email, 0); | |
1367 | |
1368 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
1369 tstconn->fd = proxy_connect(host, port, oscar_email_connect, gc); | |
1370 if (tstconn->fd < 0) { | |
1371 aim_conn_kill(sess, &tstconn); | |
1372 debug_printf("unable to connect to email server\n"); | |
1373 g_free(host); | |
1374 return 1; | |
1375 } | |
1376 aim_sendcookie(sess, tstconn, redir->cookie); | |
1377 } break; | |
1378 | |
2086 | 1379 default: /* huh? */ |
4194 | 1380 debug_printf("got redirect for unknown service 0x%04hx\n", redir->group); |
2086 | 1381 break; |
1382 } | |
1383 | |
1384 g_free(host); | |
1385 return 1; | |
1386 } | |
1387 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1388 static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1389 struct gaim_connection *gc = sess->aux_data; |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1390 struct oscar_data *od = gc->proto_data; |
2993 | 1391 aim_userinfo_t *info; |
1392 time_t time_idle = 0, signon = 0; | |
1393 int type = 0; | |
1394 int caps = 0; | |
2305
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1395 char *tmp; |
2086 | 1396 va_list ap; |
4194 | 1397 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1398 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1399 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1400 va_end(ap); |
1401 | |
2993 | 1402 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) |
1403 caps = info->capabilities; | |
3267 | 1404 if (info->flags & AIM_FLAG_ACTIVEBUDDY) |
1405 type |= UC_AB; | |
1406 | |
1407 if ((!od->icq) && (info->present & AIM_USERINFO_PRESENT_FLAGS)) { | |
1408 if (info->flags & AIM_FLAG_UNCONFIRMED) | |
1409 type |= UC_UNCONFIRMED; | |
1410 if (info->flags & AIM_FLAG_ADMINISTRATOR) | |
1411 type |= UC_ADMIN; | |
1412 if (info->flags & AIM_FLAG_AOL) | |
1413 type |= UC_AOL; | |
1414 if (info->flags & AIM_FLAG_FREE) | |
1415 type |= UC_NORMAL; | |
1416 if (info->flags & AIM_FLAG_AWAY) | |
1417 type |= UC_UNAVAILABLE; | |
1418 if (info->flags & AIM_FLAG_WIRELESS) | |
1419 type |= UC_WIRELESS; | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1420 } |
2993 | 1421 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) { |
3595 | 1422 type = (info->icqinfo.status << 16); |
3013 | 1423 if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) && |
1424 (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) { | |
2993 | 1425 type |= UC_UNAVAILABLE; |
3013 | 1426 } |
2993 | 1427 } |
1428 | |
1429 if (caps & AIM_CAPS_ICQ) | |
1430 caps ^= AIM_CAPS_ICQ; | |
1431 | |
1432 if (info->present & AIM_USERINFO_PRESENT_IDLE) { | |
2086 | 1433 time(&time_idle); |
1434 time_idle -= info->idletime*60; | |
2993 | 1435 } |
1436 | |
1437 if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) | |
1438 signon = time(NULL) - info->sessionlen; | |
2086 | 1439 |
2305
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1440 tmp = g_strdup(normalize(gc->username)); |
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1441 if (!strcmp(tmp, normalize(info->sn))) |
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1442 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", info->sn); |
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1443 g_free(tmp); |
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1444 |
2993 | 1445 serv_got_update(gc, info->sn, 1, info->warnlevel/10, signon, |
2713
34ddcb44a4d2
[gaim-migrate @ 2726]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2706
diff
changeset
|
1446 time_idle, type, caps); |
2086 | 1447 |
1448 return 1; | |
1449 } | |
1450 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1451 static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1452 aim_userinfo_t *info; |
2086 | 1453 va_list ap; |
1454 struct gaim_connection *gc = sess->aux_data; | |
1455 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1456 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1457 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1458 va_end(ap); |
1459 | |
1460 serv_got_update(gc, info->sn, 0, 0, 0, 0, 0, 0); | |
1461 | |
1462 return 1; | |
1463 } | |
1464 | |
3730 | 1465 static void cancel_direct_im(struct ask_direct *d) { |
2086 | 1466 debug_printf("Freeing DirectIM prompts.\n"); |
1467 | |
1468 g_free(d->sn); | |
1469 g_free(d); | |
1470 } | |
1471 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1472 static void oscar_directim_callback(gpointer data, gint source, GaimInputCondition condition) { |
2086 | 1473 struct direct_im *dim = data; |
1474 struct gaim_connection *gc = dim->gc; | |
1475 struct oscar_data *od = gc->proto_data; | |
2235
5d8b6100a9cc
[gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
1476 struct conversation *cnv; |
2086 | 1477 char buf[256]; |
3008 | 1478 struct sockaddr name; |
1479 socklen_t name_len = 1; | |
1480 | |
2086 | 1481 if (!g_slist_find(connections, gc)) { |
1482 g_free(dim); | |
1483 return; | |
1484 } | |
1485 | |
1486 if (source < 0) { | |
1487 g_free(dim); | |
1488 return; | |
1489 } | |
1490 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1491 if (dim->conn->fd != source) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1492 dim->conn->fd = source; |
2086 | 1493 aim_conn_completeconnect(od->sess, dim->conn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1494 if (!(cnv = find_conversation(dim->name))) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1495 cnv = new_conversation(dim->name); |
3008 | 1496 |
1497 /* This is the best way to see if we're connected or not */ | |
1498 if (getpeername(source, &name, &name_len) == 0) { | |
1499 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name); | |
1500 dim->connected = TRUE; | |
1501 write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL, time(NULL), -1); | |
1502 } | |
2086 | 1503 od->direct_ims = g_slist_append(od->direct_ims, dim); |
3008 | 1504 |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1505 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
3008 | 1506 oscar_callback, dim->conn); |
2086 | 1507 } |
1508 | |
3952 | 1509 /* |
1510 * This is called every time we are finished sending a file and the receiving buddy | |
1511 * has sent back an acknowledgement; we start the next file or tear down the | |
1512 * connection as appropriate. | |
1513 */ | |
3630 | 1514 static int oscar_sendfile_out_done(aim_session_t *sess, aim_frame_t *fr, ...) { |
1515 struct gaim_connection *gc = sess->aux_data; | |
1516 va_list ap; | |
1517 aim_conn_t *conn; | |
1518 const char *cook; | |
1519 struct oscar_file_transfer *oft; | |
1520 | |
1521 va_start(ap, fr); | |
1522 conn = va_arg(ap, aim_conn_t *); | |
1523 cook = va_arg(ap, const char *); | |
1524 va_end(ap); | |
1525 | |
1526 oft = find_oft_by_cookie(gc, cook); | |
1527 if (oft->filesdone == oft->totfiles) | |
1528 oscar_file_transfer_disconnect(sess, conn); | |
1529 else | |
1530 /* Send header for next file */ | |
1531 oscar_sendfile_request(sess, oft); | |
1532 | |
1533 return 0; | |
1534 } | |
1535 | |
1536 /* Called once for each file before sending the raw data. */ | |
1537 static int oscar_sendfile_request(aim_session_t *sess, | |
1538 struct oscar_file_transfer *oft) { | |
1539 char *name; | |
1540 int size; | |
1541 | |
1542 transfer_get_file_info(oft->xfer, &size, &name); | |
3952 | 1543 /* AAA convert the name to UCS-2 if necessary, and pass the encoding to the call below */ |
3630 | 1544 aim_oft_sendfile_request(sess, oft->conn, name, oft->filesdone, |
1545 oft->totfiles, size, oft->totsize); | |
1546 | |
1547 return 0; | |
1548 } | |
1549 | |
3952 | 1550 /* |
1551 * This is called when sending a file and a direct connection has been set up with | |
1552 * the buddy; we can now transmit the appropriate headers describing the transfer. | |
1553 */ | |
3630 | 1554 static int oscar_sendfile_accepted(aim_session_t *sess, aim_frame_t *fr, ...) { |
1555 struct gaim_connection *gc = sess->aux_data; | |
1556 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
1557 struct oscar_file_transfer *oft; | |
1558 va_list ap; | |
1559 aim_conn_t *conn, *listenerconn; | |
3752 | 1560 |
3630 | 1561 va_start(ap, fr); |
1562 conn = va_arg(ap, aim_conn_t *); | |
1563 listenerconn = va_arg(ap, aim_conn_t *); | |
1564 va_end(ap); | |
1565 | |
1566 oft = find_oft_by_conn(gc, listenerconn); | |
1567 oft->conn = conn; | |
1568 /* Stop watching listener conn; watch transfer conn instead */ | |
1569 gaim_input_remove(oft->watcher); | |
1570 aim_conn_kill(sess, &listenerconn); | |
1571 | |
1572 aim_conn_addhandler(od->sess, oft->conn, AIM_CB_FAM_OFT, | |
3771 | 1573 AIM_CB_OFT_SENDFILEFILESEND, |
3630 | 1574 oscar_file_transfer_do, |
1575 0); | |
1576 aim_conn_addhandler(sess, conn, | |
1577 AIM_CB_FAM_OFT, | |
3771 | 1578 AIM_CB_OFT_SENDFILECOMPLETE, |
3630 | 1579 oscar_sendfile_out_done, |
1580 0); | |
1581 oft->watcher = gaim_input_add(oft->conn->fd, GAIM_INPUT_READ, | |
1582 oscar_callback, oft->conn); | |
1583 | |
1584 oscar_sendfile_request(sess, oft); | |
1585 | |
1586 return 0; | |
1587 } | |
1588 | |
3952 | 1589 /* |
1590 * This is called when we requested to send a file to a buddy, but he or she didn't | |
1591 * respond; we need to clean up. | |
1592 */ | |
3752 | 1593 static int oscar_sendfile_timeout(aim_session_t *sess, aim_frame_t *fr, ...) { |
1594 struct gaim_connection *gc = sess->aux_data; | |
1595 va_list ap; | |
1596 struct oscar_file_transfer *oft; | |
1597 char *cookie; | |
1598 aim_conn_t *bosconn; | |
1599 | |
1600 va_start(ap, fr); | |
1601 bosconn = va_arg(ap, aim_conn_t *); | |
1602 cookie = va_arg(ap, char *); | |
1603 va_end(ap); | |
1604 | |
1605 if ((oft = find_oft_by_cookie(gc, cookie))) { | |
3630 | 1606 aim_canceltransfer(sess, bosconn, oft->cookie, |
1607 oft->sn, AIM_CAPS_SENDFILE); | |
1608 | |
1609 transfer_abort(oft->xfer, _("Transfer timed out")); | |
1610 oscar_file_transfer_disconnect(sess, oft->conn); | |
1611 } | |
3752 | 1612 |
1613 return 1; /* success */ | |
3630 | 1614 } |
1615 | |
1616 /* Called once at the beginning of an outgoing transfer session. */ | |
3771 | 1617 static void oscar_file_transfer_out(struct gaim_connection *gc, |
3630 | 1618 struct file_transfer *xfer, const char *name, int totfiles, |
1619 int totsize) { | |
1620 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
1621 struct oscar_file_transfer *oft = find_oft_by_xfer(gc, xfer); | |
1622 | |
1623 oft->xfer = xfer; | |
1624 oft->totsize = totsize; | |
1625 oft->totfiles = totfiles; | |
1626 oft->filesdone = 0; | |
1627 | |
1628 oft->conn = aim_sendfile_initiate(od->sess, oft->sn, | |
1629 name, totfiles, oft->totsize, oft->cookie); | |
1630 if (!oft->conn) { | |
1631 do_error_dialog(_("Couldn't open listener to send file"), | |
1632 _("File transfer aborted"), | |
1633 GAIM_ERROR); | |
1634 return; | |
1635 } | |
3752 | 1636 |
3630 | 1637 aim_conn_addhandler(od->sess, oft->conn, AIM_CB_FAM_OFT, |
3771 | 1638 AIM_CB_OFT_SENDFILEINITIATE, |
3630 | 1639 oscar_sendfile_accepted, |
1640 0); | |
1641 oft->watcher = gaim_input_add(oft->conn->fd, GAIM_INPUT_READ, | |
1642 oscar_callback, oft->conn); | |
1643 } | |
1644 | |
3952 | 1645 /* |
1646 * This is called after a chunk of data has been sent out or received; it is used | |
1647 * to update the checksum. | |
1648 */ | |
3771 | 1649 static void oscar_file_transfer_data_chunk(struct gaim_connection *gc, |
3630 | 1650 struct file_transfer *xfer, const char *buf, int len) |
1651 { | |
1652 struct oscar_file_transfer *oft = find_oft_by_xfer(gc, xfer); | |
1653 aim_session_t *sess = aim_conn_getsess(oft->conn); | |
1654 | |
1655 if (oft->type == OFT_SENDFILE_IN) | |
1656 aim_update_checksum(sess, oft->conn, buf, len); | |
1657 } | |
1658 | |
3952 | 1659 /* Called once at the beginning of an incoming transfer session. */ |
3771 | 1660 static void oscar_file_transfer_in(struct gaim_connection *gc, |
3630 | 1661 struct file_transfer *xfer, int offset) { |
1662 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
1663 struct oscar_file_transfer *oft = find_oft_by_xfer(gc, xfer); | |
1664 | |
1665 oft->xfer = xfer; | |
1666 oft->conn = aim_accepttransfer(od->sess, od->conn, oft->sn, | |
1667 oft->cookie, oft->ip, | |
1668 oft->port, | |
1669 AIM_CAPS_SENDFILE); | |
1670 if (!oft->conn) { | |
3952 | 1671 /* XXX implement reverse connections for receiving from behind a firewall */ |
3630 | 1672 char *buf = g_strdup_printf("Couldn't connect to remote host"); |
1673 do_error_dialog(buf, NULL, GAIM_ERROR); | |
1674 g_free(buf); | |
1675 return; | |
1676 } | |
1677 | |
1678 aim_conn_addhandler(od->sess, oft->conn, AIM_CB_FAM_OFT, | |
3771 | 1679 AIM_CB_OFT_SENDFILEFILEREQ, oscar_file_transfer_do, |
3630 | 1680 0); |
1681 | |
1682 oft->watcher = gaim_input_add(oft->conn->fd, GAIM_INPUT_READ, | |
1683 oscar_callback, oft->conn); | |
1684 } | |
1685 | |
3952 | 1686 /* |
1687 * This is called when the user began a file transfer, but subsequently canceled. | |
1688 */ | |
1689 static void oscar_file_transfer_cancel(struct gaim_connection *gc, struct file_transfer *xfer) { | |
3630 | 1690 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
1691 struct oscar_file_transfer *oft = find_oft_by_xfer(gc, xfer); | |
1692 | |
1693 if (oft->type == OFT_SENDFILE_IN) | |
1694 aim_denytransfer(od->sess, oft->sn, oft->cookie, | |
1695 AIM_TRANSFER_DENY_DECLINE); | |
1696 | |
1697 od->file_transfers = g_slist_remove(od->file_transfers, oft); | |
1698 aim_conn_kill(od->sess, &oft->conn); | |
1699 g_free(oft->sn); | |
1700 g_free(oft); | |
1701 } | |
1702 | |
3730 | 1703 static int accept_direct_im(struct ask_direct *d) { |
2086 | 1704 struct gaim_connection *gc = d->gc; |
1705 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
1706 struct direct_im *dim; | |
2945 | 1707 char *host; int port = 4443; |
2086 | 1708 int i; |
1709 | |
1710 debug_printf("Accepted DirectIM.\n"); | |
1711 | |
1712 dim = find_direct_im(od, d->sn); | |
1713 if (dim) { | |
3730 | 1714 cancel_direct_im(d); /* 40 */ |
2086 | 1715 return TRUE; |
1716 } | |
1717 dim = g_new0(struct direct_im, 1); | |
1718 dim->gc = d->gc; | |
1719 g_snprintf(dim->name, sizeof dim->name, "%s", d->sn); | |
1720 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1721 dim->conn = aim_directim_connect(od->sess, d->sn, NULL, d->cookie); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1722 if (!dim->conn) { |
2086 | 1723 g_free(dim); |
3730 | 1724 cancel_direct_im(d); |
2086 | 1725 return TRUE; |
1726 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1727 |
2086 | 1728 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, |
1729 gaim_directim_incoming, 0); | |
1730 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, | |
1731 gaim_directim_typing, 0); | |
3033 | 1732 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, |
2993 | 1733 gaim_update_ui, 0); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1734 for (i = 0; i < (int)strlen(d->ip); i++) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1735 if (d->ip[i] == ':') { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1736 port = atoi(&(d->ip[i+1])); |
2086 | 1737 break; |
1738 } | |
1739 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1740 host = g_strndup(d->ip, i); |
2086 | 1741 dim->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
1742 dim->conn->fd = proxy_connect(host, port, oscar_directim_callback, dim); | |
1743 g_free(host); | |
1744 if (dim->conn->fd < 0) { | |
1745 aim_conn_kill(od->sess, &dim->conn); | |
1746 g_free(dim); | |
3730 | 1747 cancel_direct_im(d); |
2086 | 1748 return TRUE; |
1749 } | |
1750 | |
3730 | 1751 cancel_direct_im(d); |
2086 | 1752 |
1753 return TRUE; | |
1754 } | |
1755 | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1756 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { |
3642 | 1757 char *tmp; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1758 struct gaim_connection *gc = sess->aux_data; |
3600 | 1759 struct oscar_data *od = gc->proto_data; |
2273
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
1760 int flags = 0; |
3659 | 1761 int convlen; |
1762 GError *err = NULL; | |
2273
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
1763 |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
1764 if (args->icbmflags & AIM_IMFLAGS_AWAY) |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
1765 flags |= IM_FLAG_AWAY; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1766 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1767 if (args->icbmflags & AIM_IMFLAGS_HASICON) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1768 struct icon_req *ir = NULL; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1769 GSList *h = od->hasicons; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1770 char *who = normalize(userinfo->sn); |
4121 | 1771 |
1772 if (!args->iconlen || !args->iconsum || !args->iconstamp) | |
1773 return 1; | |
1774 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1775 debug_printf("%s has an icon\n", userinfo->sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1776 while (h) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1777 ir = h->data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1778 if (!strcmp(ir->user, who)) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1779 break; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1780 h = h->next; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1781 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1782 if (!h) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1783 ir = g_new0(struct icon_req, 1); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1784 ir->user = g_strdup(who); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1785 od->hasicons = g_slist_append(od->hasicons, ir); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1786 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1787 if ((args->iconlen != ir->length) || |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1788 (args->iconsum != ir->checksum) || |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1789 (args->iconstamp != ir->timestamp)) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1790 ir->request = TRUE; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1791 ir->length = args->iconlen; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1792 ir->checksum = args->iconsum; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1793 ir->timestamp = args->iconstamp; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1794 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1795 |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
1796 if (gc->user->iconfile[0] && (args->icbmflags & AIM_IMFLAGS_BUDDYREQ)) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1797 FILE *file; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1798 struct stat st; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1799 |
2248
cef6d4e81aec
[gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
1800 if (!stat(gc->user->iconfile, &st)) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1801 char *buf = g_malloc(st.st_size); |
2248
cef6d4e81aec
[gaim-migrate @ 2258]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2246
diff
changeset
|
1802 file = fopen(gc->user->iconfile, "r"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1803 if (file) { |
2603
24664768a739
[gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
1804 int len = fread(buf, 1, st.st_size, file); |
4194 | 1805 debug_printf("Sending buddy icon to %s (%d bytes, %lu reported)\n", |
2603
24664768a739
[gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
1806 userinfo->sn, len, st.st_size); |
2673
81d658e6ac1e
[gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
1807 aim_send_icon(sess, userinfo->sn, buf, st.st_size, |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1808 st.st_mtime, aim_iconsum(buf, st.st_size)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1809 fclose(file); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
1810 } else |
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
1811 debug_printf("Can't open buddy icon file!\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1812 g_free(buf); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
1813 } else |
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
1814 debug_printf("Can't stat buddy icon file!\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1815 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1816 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1817 if (args->icbmflags & AIM_IMFLAGS_UNICODE) { |
3722 | 1818 /* This message is marked as UNICODE, so we have to |
1819 * convert it to utf-8 before handing it to the gaim core. | |
1820 * This conversion should *never* fail, if it does it | |
1821 * means that either the incoming ICBM is corrupted or | |
1822 * there is something we don't understand about it. */ | |
1823 /* For the record, AIM Unicode is big-endian UCS-2 */ | |
4121 | 1824 |
1825 if (!args->msg || !args->msglen) | |
1826 return 1; | |
1827 | |
3659 | 1828 tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err); |
1829 if (err) { | |
1830 debug_printf("Unicode IM conversion: %s\n", err->message); | |
1831 tmp = strdup(_("(There was an error receiving this message)")); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1832 } |
3722 | 1833 } else { |
3850 | 1834 /* This will get executed for both AIM_IMFLAGS_ISO_8859_1 and |
3722 | 1835 * unflagged messages, which are ASCII. That's OK because |
1836 * ASCII is a strict subset of ISO-8859-1; this should | |
1837 * help with compatibility with old, broken versions of | |
1838 * gaim (everything before 0.60) and other broken clients | |
1839 * that will happily send ISO-8859-1 without marking it as | |
1840 * such */ | |
3850 | 1841 if (args->icbmflags & AIM_IMFLAGS_ISO_8859_1) { |
4194 | 1842 debug_printf("Received ISO-8859-1 IM\n"); |
3850 | 1843 } |
4121 | 1844 |
1845 if (!args->msg || !args->msglen) | |
1846 return 1; | |
1847 | |
3659 | 1848 tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &convlen, &err); |
1849 if (err) { | |
1850 debug_printf("ISO-8859-1 IM conversion: %s\n", err->message); | |
1851 tmp = strdup(_("(There was an error receiving this message)")); | |
1852 } | |
3642 | 1853 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1854 |
3850 | 1855 if (args->icbmflags & AIM_IMFLAGS_CUSTOMCHARSET) { |
4194 | 1856 debug_printf("Custom character set: %hu %hu\n", args->charset, args->charsubset); |
3850 | 1857 } |
1858 | |
3595 | 1859 if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT) { |
3600 | 1860 char *who = normalize(userinfo->sn); |
1861 if (!g_hash_table_lookup(od->supports_tn, who)) | |
1862 g_hash_table_insert(od->supports_tn, who, who); | |
3595 | 1863 } |
1864 | |
3642 | 1865 //strip_linefeed(tmp); |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2833
diff
changeset
|
1866 serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL), -1); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1867 g_free(tmp); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1868 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1869 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1870 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1871 |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1872 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1873 struct gaim_connection *gc = sess->aux_data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1874 |
4121 | 1875 if (!args) |
1876 return 0; | |
4194 | 1877 |
1878 debug_printf("rendezvous status %hu (%s)\n", args->status, userinfo->sn); | |
1879 | |
3630 | 1880 if (args->status == AIM_RENDEZVOUS_CANCEL) { |
1881 struct oscar_file_transfer *oft; | |
4121 | 1882 if (!args->cookie) |
1883 return 1; | |
3630 | 1884 oft = find_oft_by_cookie(gc, args->cookie); |
1885 if (oft) { | |
1886 transfer_abort(oft->xfer, _("Buddy canceled transfer")); | |
1887 oscar_file_transfer_disconnect(sess, oft->conn); | |
1888 } | |
1889 return 0; | |
1890 } | |
1891 else if (args->status == AIM_RENDEZVOUS_ACCEPT) { | |
1892 /* The user accepted our transfer request, but we don't | |
1893 * really need to do anything yet. | |
1894 * -- wtm | |
1895 */ | |
1896 return 0; | |
1897 } | |
1898 else if (args->status != AIM_RENDEZVOUS_PROPOSE) { | |
3752 | 1899 debug_printf("unknown rendezvous status\n"); |
2869 | 1900 return 1; |
3630 | 1901 } |
2869 | 1902 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1903 if (args->reqclass & AIM_CAPS_CHAT) { |
4121 | 1904 char *name; |
4120 | 1905 int *exch; |
4121 | 1906 GList *m = NULL; |
4120 | 1907 |
4121 | 1908 if (!args->info.chat.roominfo.name || !args->info.chat.roominfo.exchange || !args->msg) |
1909 return 1; | |
1910 name = extract_name(args->info.chat.roominfo.name); | |
4120 | 1911 exch = g_new0(int, 1); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1912 m = g_list_append(m, g_strdup(name ? name : args->info.chat.roominfo.name)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1913 *exch = args->info.chat.roominfo.exchange; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1914 m = g_list_append(m, exch); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1915 serv_got_chat_invite(gc, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1916 name ? name : args->info.chat.roominfo.name, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1917 userinfo->sn, |
2869 | 1918 (char *)args->msg, |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1919 m); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1920 if (name) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1921 g_free(name); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1922 } else if (args->reqclass & AIM_CAPS_SENDFILE) { |
3630 | 1923 struct oscar_file_transfer *oft; |
3752 | 1924 struct oscar_data *od = gc->proto_data; |
1925 | |
4121 | 1926 if (!args->cookie || !args->verifiedip || !args->port || |
1927 !args->info.sendfile.filename || !args->info.sendfile.totsize || | |
1928 !args->info.sendfile.totfiles || !args->msg || !args->reqclass) | |
1929 return 1; | |
3752 | 1930 if ((oft = find_oft_by_cookie(sess->aux_data, args->cookie))) |
1931 { | |
1932 /* This is a request for a reverse connection, | |
1933 * which is used by newer clients when for some | |
1934 * reason they are unable to connect to our listener | |
1935 * (e.g. they are behind a firewall). | |
1936 */ | |
1937 if (oft->type != OFT_SENDFILE_OUT) | |
1938 return -1; | |
1939 | |
1940 /* It seems that Trillian sends some weird | |
1941 * packets. Sanity check. | |
1942 */ | |
1943 if (!args->verifiedip) | |
1944 return -1; | |
1945 | |
1946 /* This connection isn't used for anything, since | |
1947 * we're using a reverse connection instead. | |
3630 | 1948 */ |
3752 | 1949 gaim_input_remove(oft->watcher); |
1950 aim_conn_kill(sess, &oft->conn); | |
1951 | |
4194 | 1952 debug_printf("sendfile: doing reverse connection to %s:%hu\n", args->verifiedip, args->port); |
3752 | 1953 |
1954 oft->conn = aim_accepttransfer(sess, od->conn, | |
1955 userinfo->sn, | |
1956 args->cookie, args->verifiedip, | |
1957 args->port, | |
1958 AIM_CAPS_SENDFILE); | |
1959 | |
1960 /* XXX: this is a bit of a hack: ideally | |
1961 * we should wait on GAIM_INPUT_WRITE. -- wtm | |
1962 */ | |
1963 aim_conn_completeconnect(sess, oft->conn); | |
1964 | |
1965 oscar_sendfile_request(sess, oft); | |
1966 | |
1967 aim_conn_addhandler(sess, oft->conn, | |
1968 AIM_CB_FAM_OFT, | |
3771 | 1969 AIM_CB_OFT_SENDFILECOMPLETE, |
3752 | 1970 oscar_sendfile_out_done, |
1971 0); | |
1972 aim_conn_addhandler(sess, oft->conn, | |
1973 AIM_CB_FAM_OFT, | |
3771 | 1974 AIM_CB_OFT_SENDFILEFILESEND, |
3752 | 1975 oscar_file_transfer_do, |
1976 0); | |
1977 oft->watcher = gaim_input_add(oft->conn->fd, | |
1978 GAIM_INPUT_READ, oscar_callback, | |
1979 oft->conn); | |
1980 return 0; | |
3630 | 1981 } |
1982 | |
3952 | 1983 /* Someone wants to send a file (or files) to us */ |
3630 | 1984 debug_printf("%s (%s) requests to send a file to %s\n", |
1985 userinfo->sn, args->verifiedip, gc->username); | |
3752 | 1986 |
1987 oft = g_new0(struct oscar_file_transfer, 1); | |
3630 | 1988 |
1989 oft->type = OFT_SENDFILE_IN; | |
1990 oft->sn = g_strdup(userinfo->sn); | |
1991 strncpy(oft->ip, args->verifiedip, sizeof(oft->ip)); | |
1992 oft->port = args->port; | |
1993 memcpy(oft->cookie, args->cookie, 8); | |
1994 | |
3752 | 1995 od->file_transfers = g_slist_append(od->file_transfers, oft); |
3630 | 1996 |
1997 oft->xfer = transfer_in_add(gc, userinfo->sn, | |
1998 args->info.sendfile.filename, | |
1999 args->info.sendfile.totsize, | |
2000 args->info.sendfile.totfiles, | |
2001 args->msg); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2002 } else if (args->reqclass & AIM_CAPS_GETFILE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2003 } else if (args->reqclass & AIM_CAPS_VOICE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2004 } else if (args->reqclass & AIM_CAPS_BUDDYICON) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2005 set_icon_data(gc, normalize(userinfo->sn), args->info.icon.icon, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2006 args->info.icon.length); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2007 } else if (args->reqclass & AIM_CAPS_IMIMAGE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2008 struct ask_direct *d = g_new0(struct ask_direct, 1); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2009 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2010 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2011 debug_printf("%s received direct im request from %s (%s)\n", |
2869 | 2012 gc->username, userinfo->sn, args->verifiedip); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2013 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2014 d->gc = gc; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2015 d->sn = g_strdup(userinfo->sn); |
2869 | 2016 strncpy(d->ip, args->verifiedip, sizeof(d->ip)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2017 memcpy(d->cookie, args->cookie, 8); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2018 g_snprintf(buf, sizeof buf, "%s has just asked to directly connect to %s.", |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2019 userinfo->sn, gc->username); |
3730 | 2020 do_ask_dialog(buf, _("This requires a direct connection between the two computers and is necessary for IM Images. Because your IP address will be revealed, this may be considered a privacy risk."), d, _("Connect"), accept_direct_im, _("Cancel"), cancel_direct_im); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2021 } else { |
4194 | 2022 debug_printf("Unknown reqclass %hu\n", args->reqclass); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2023 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2024 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2025 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2026 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2027 |
3453 | 2028 /* |
2029 * Next 2 functions are for when other people ask you for authorization | |
2030 */ | |
3730 | 2031 static void gaim_icq_authgrant(struct channel4_data *data) { |
4194 | 2032 gchar message; |
3141 | 2033 struct oscar_data *od = (struct oscar_data *)data->gc->proto_data; |
2034 message = 0; | |
3453 | 2035 aim_send_im_ch4(od->sess, data->uin, AIM_ICQMSG_AUTHGRANTED, &message); |
2036 show_got_added(data->gc, NULL, data->uin, NULL, NULL); | |
2037 g_free(data->uin); | |
3730 | 2038 g_free(data); |
3141 | 2039 } |
2040 | |
3730 | 2041 static void gaim_icq_authdeny(struct channel4_data *data) { |
2042 gchar *message; | |
2043 struct oscar_data *od = (struct oscar_data *)data->gc->proto_data; | |
2044 message = g_strdup_printf("No reason given."); | |
2045 aim_send_im_ch4(od->sess, data->uin, AIM_ICQMSG_AUTHDENIED, message); | |
2046 g_free(data->uin); | |
2047 g_free(message); | |
3141 | 2048 g_free(data); |
2049 } | |
2050 | |
2051 /* | |
3453 | 2052 * Next 2 functions are for when someone sends you contacts |
2053 */ | |
3730 | 2054 static void gaim_icq_contactadd(struct channel4_data *data) { |
3453 | 2055 show_add_buddy(data->gc, data->uin, NULL, data->nick); |
3730 | 2056 free(data->uin); |
2057 free(data->nick); | |
2058 g_free(data); | |
3453 | 2059 } |
2060 | |
3730 | 2061 static void gaim_icq_contactdontadd(struct channel4_data *data) { |
3453 | 2062 free(data->uin); |
2063 free(data->nick); | |
2064 g_free(data); | |
2065 } | |
2066 | |
4075 | 2067 static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args, time_t t) { |
3141 | 2068 struct gaim_connection *gc = sess->aux_data; |
4076 | 2069 gchar **msg1, **msg2; |
2070 GError *err = NULL; | |
2071 int i; | |
2072 | |
4121 | 2073 if (!args->type || !args->msg || !args->uin) |
2074 return 1; | |
4194 | 2075 |
2076 debug_printf("Received a channel 4 message of type 0x%02hhx.\n", args->type); | |
4076 | 2077 |
2078 /* Split up the message at the delimeter character, then convert each string to UTF-8 */ | |
4173 | 2079 msg1 = g_strsplit(args->msg, "\376", 0); |
4194 | 2080 msg2 = (gchar **)g_malloc(10*sizeof(gchar *)); /* XXX - 10 is a guess */ |
4076 | 2081 for (i=0; msg1[i]; i++) { |
2082 strip_linefeed(msg1[i]); | |
2083 msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err); | |
2084 if (err) | |
2085 debug_printf("Error converting a string from ISO-8859-1 to UTF-8 in oscar ICBM channel 4 parsing\n"); | |
2086 } | |
2087 msg2[i] = NULL; | |
2088 | |
3952 | 2089 switch (args->type) { |
4173 | 2090 case 0x01: { /* MacICQ message or basic offline message */ |
4076 | 2091 if (i >= 1) { |
2092 gchar *uin = g_strdup_printf("%lu", args->uin); | |
2093 if (t) { /* This is an offline message */ | |
2094 /* I think this timestamp is in UTC, or something */ | |
2095 serv_got_im(gc, uin, msg2[0], 0, t, -1); | |
2096 } else { /* This is a message from MacICQ/Miranda */ | |
2097 serv_got_im(gc, uin, msg2[0], 0, time(NULL), -1); | |
2098 } | |
2099 g_free(uin); | |
4075 | 2100 } |
3316 | 2101 } break; |
2102 | |
4173 | 2103 case 0x04: { /* Someone sent you a URL */ |
4076 | 2104 if (i >= 2) { |
2105 gchar *uin = g_strdup_printf("%lu", args->uin); | |
2106 gchar *message = g_strdup_printf("<A HREF=\"%s\">%s</A>", msg2[1], msg2[0]); | |
3453 | 2107 serv_got_im(gc, uin, message, 0, time(NULL), -1); |
2108 g_free(uin); | |
2109 g_free(message); | |
2110 } | |
2111 } break; | |
2112 | |
4173 | 2113 case 0x06: { /* Someone requested authorization */ |
4076 | 2114 if (i >= 6) { |
2115 struct channel4_data *data = g_new(struct channel4_data, 1); | |
4194 | 2116 gchar *dialog_msg = g_strdup_printf(_("The user %lu wants to add you to their buddy list for the following reason: %s"), args->uin, msg2[5] ? msg2[5] : _("No reason given.")); |
4076 | 2117 debug_printf("Received an authorization request from UIN %lu\n", args->uin); |
2118 data->gc = gc; | |
2119 data->uin = g_strdup_printf("%lu", args->uin); | |
2120 do_ask_dialog(_("Authorization Request"), dialog_msg, data, _("Authorize"), gaim_icq_authgrant, _("Deny"), gaim_icq_authdeny); | |
2121 g_free(dialog_msg); | |
2122 } | |
3141 | 2123 } break; |
2124 | |
4173 | 2125 case 0x07: { /* Someone has denied you authorization */ |
4076 | 2126 if (i >= 1) { |
4194 | 2127 gchar *dialog_msg = g_strdup_printf(_("The user %lu has denied your request to add them to your contact list for the following reason:\n%s"), args->uin, msg2[0] ? msg2[0] : _("No reason given.")); |
4076 | 2128 do_error_dialog(_("ICQ authorization denied."), dialog_msg, GAIM_ERROR); |
2129 g_free(dialog_msg); | |
2130 } | |
3141 | 2131 } break; |
2132 | |
4173 | 2133 case 0x08: { /* Someone has granted you authorization */ |
4194 | 2134 gchar *dialog_msg = g_strdup_printf(_("The user %lu has granted your request to add them to your contact list."), args->uin); |
3427 | 2135 do_error_dialog("ICQ authorization accepted.", dialog_msg, GAIM_INFO); |
3141 | 2136 g_free(dialog_msg); |
2137 } break; | |
2138 | |
4173 | 2139 case 0x0d: { /* Someone has sent you a pager message from http://www.icq.com/your_uin */ |
4076 | 2140 if (i >= 6) { |
4194 | 2141 gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ page\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]); |
4076 | 2142 do_error_dialog("ICQ Page", dialog_msg, GAIM_INFO); |
2143 g_free(dialog_msg); | |
2144 } | |
4075 | 2145 } break; |
2146 | |
4173 | 2147 case 0x0e: { /* Someone has emailed you at your_uin@pager.icq.com */ |
4076 | 2148 if (i >= 6) { |
4194 | 2149 gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ email\n\n1=%s\n2=%s\n3=%s\n4=%s\n5=%s\n6=%s\n"), msg2[0], msg2[1], msg2[2], msg2[3], msg2[4], msg2[5]); |
4076 | 2150 do_error_dialog("ICQ Email", dialog_msg, GAIM_INFO); |
2151 g_free(dialog_msg); | |
2152 } | |
4075 | 2153 } break; |
2154 | |
4173 | 2155 case 0x12: { |
3141 | 2156 /* Ack for authorizing/denying someone. Or possibly an ack for sending any system notice */ |
4173 | 2157 /* Someone added you to their contact list? */ |
3141 | 2158 } break; |
2159 | |
4173 | 2160 case 0x13: { /* Someone has sent you some ICQ contacts */ |
3453 | 2161 int i, num; |
2162 gchar **text; | |
4173 | 2163 text = g_strsplit(args->msg, "\376", 0); |
3453 | 2164 if (text) { |
2165 num = 0; | |
2166 for (i=0; i<strlen(text[0]); i++) | |
2167 num = num*10 + text[0][i]-48; | |
2168 for (i=0; i<num; i++) { | |
2169 struct channel4_data *data = g_new(struct channel4_data, 1); | |
3730 | 2170 gchar *message = g_strdup_printf(_("ICQ user %lu has sent you a contact: %s (%s)"), args->uin, text[i*2+2], text[i*2+1]); |
3453 | 2171 data->gc = gc; |
2172 data->uin = g_strdup(text[i*2+2]); | |
2173 data->nick = g_strdup(text[i*2+1]); | |
4076 | 2174 do_ask_dialog(message, _("Do you want to add this contact to your Buddy List?"), data, _("Add"), gaim_icq_contactadd, _("Deny"), gaim_icq_contactdontadd); |
3453 | 2175 g_free(message); |
2176 } | |
2177 g_strfreev(text); | |
2178 } | |
2179 } break; | |
2180 | |
4173 | 2181 case 0x1a: { /* Someone has sent you a greeting card or requested contacts? */ |
3453 | 2182 /* This is boring and silly. */ |
2183 } break; | |
2184 | |
3141 | 2185 default: { |
4194 | 2186 debug_printf("Received a channel 4 message of unknown type (type 0x%02hhx).\n", args->type); |
3141 | 2187 } break; |
2188 } | |
2189 | |
4076 | 2190 g_strfreev(msg1); |
2191 g_strfreev(msg2); | |
2192 | |
3141 | 2193 return 1; |
2194 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2195 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2196 static int gaim_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...) { |
4200 | 2197 fu16_t channel; |
2198 int ret = 0; | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2199 aim_userinfo_t *userinfo; |
2086 | 2200 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2201 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2202 va_start(ap, fr); |
4200 | 2203 channel = (fu16_t)va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2204 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 2205 |
3141 | 2206 switch (channel) { |
2207 case 1: { /* standard message */ | |
2208 struct aim_incomingim_ch1_args *args; | |
2209 args = va_arg(ap, struct aim_incomingim_ch1_args *); | |
2210 ret = incomingim_chan1(sess, fr->conn, userinfo, args); | |
2211 } break; | |
2212 | |
2213 case 2: { /* rendevous */ | |
2214 struct aim_incomingim_ch2_args *args; | |
2215 args = va_arg(ap, struct aim_incomingim_ch2_args *); | |
2216 ret = incomingim_chan2(sess, fr->conn, userinfo, args); | |
2217 } break; | |
2218 | |
2219 case 4: { /* ICQ */ | |
2220 struct aim_incomingim_ch4_args *args; | |
2221 args = va_arg(ap, struct aim_incomingim_ch4_args *); | |
4075 | 2222 ret = incomingim_chan4(sess, fr->conn, userinfo, args, 0); |
3141 | 2223 } break; |
2224 | |
2225 default: { | |
4194 | 2226 debug_printf("ICBM received on unsupported channel (channel 0x%04hx).", channel); |
3141 | 2227 } break; |
2086 | 2228 } |
2229 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2230 va_end(ap); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2231 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2232 return ret; |
2086 | 2233 } |
2234 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2235 static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2236 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2237 fu16_t chan, nummissed, reason; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2238 aim_userinfo_t *userinfo; |
2086 | 2239 char buf[1024]; |
2240 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2241 va_start(ap, fr); |
4200 | 2242 chan = (fu16_t)va_arg(ap, unsigned int); |
2243 userinfo = va_arg(ap, aim_userinfo_t *); | |
2244 nummissed = (fu16_t)va_arg(ap, unsigned int); | |
2245 reason = (fu16_t)va_arg(ap, unsigned int); | |
2086 | 2246 va_end(ap); |
2247 | |
2248 switch(reason) { | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2249 case 0: |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2250 /* Invalid (0) */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2251 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2252 sizeof(buf), |
2946 | 2253 nummissed == 1 ? |
4194 | 2254 _("You missed %hu message from %s because it was invalid.") : |
2255 _("You missed %hu messages from %s because they were invalid."), | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2256 nummissed, |
2947 | 2257 userinfo->sn); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2258 break; |
2086 | 2259 case 1: |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2260 /* Message too large */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2261 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2262 sizeof(buf), |
2943 | 2263 nummissed == 1 ? |
4194 | 2264 _("You missed %hu message from %s because it was too large.") : |
2265 _("You missed %hu messages from %s because they were too large."), | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2266 nummissed, |
2943 | 2267 userinfo->sn); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2268 break; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2269 case 2: |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2270 /* Rate exceeded */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2271 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2272 sizeof(buf), |
2943 | 2273 nummissed == 1 ? |
4194 | 2274 _("You missed %hu message from %s because the rate limit has been exceeded.") : |
2275 _("You missed %hu messages from %s because the rate limit has been exceeded."), | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2276 nummissed, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2277 userinfo->sn); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2278 break; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2279 case 3: |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2280 /* Evil Sender */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2281 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2282 sizeof(buf), |
2943 | 2283 nummissed == 1 ? |
4194 | 2284 _("You missed %hu message from %s because he/she was too evil.") : |
2285 _("You missed %hu messages from %s because he/she was too evil."), | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2286 nummissed, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2287 userinfo->sn); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2288 break; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2289 case 4: |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2290 /* Evil Receiver */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2291 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2292 sizeof(buf), |
2943 | 2293 nummissed == 1 ? |
4194 | 2294 _("You missed %hu message from %s because you are too evil.") : |
2295 _("You missed %hu messages from %s because you are too evil."), | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2296 nummissed, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2297 userinfo->sn); |
2086 | 2298 break; |
2299 default: | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2300 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2301 sizeof(buf), |
2943 | 2302 nummissed == 1 ? |
4194 | 2303 _("You missed %hu message from %s for an unknown reason.") : |
2304 _("You missed %hu messages from %s for an unknown reason."), | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2305 nummissed, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2306 userinfo->sn); |
2086 | 2307 break; |
2308 } | |
3427 | 2309 do_error_dialog(buf, NULL, GAIM_ERROR); |
2086 | 2310 |
2311 return 1; | |
2312 } | |
2313 | |
3212 | 2314 static char *gaim_icq_status(int state) { |
2315 /* Make a cute little string that shows the status of the dude or dudet */ | |
2316 if (state & AIM_ICQ_STATE_CHAT) | |
2317 return g_strdup_printf("Free For Chat"); | |
2318 else if (state & AIM_ICQ_STATE_DND) | |
2319 return g_strdup_printf("Do Not Disturb"); | |
2320 else if (state & AIM_ICQ_STATE_OUT) | |
2321 return g_strdup_printf("Not Available"); | |
2322 else if (state & AIM_ICQ_STATE_BUSY) | |
2323 return g_strdup_printf("Occupied"); | |
2324 else if (state & AIM_ICQ_STATE_AWAY) | |
2325 return g_strdup_printf("Away"); | |
2326 else if (state & AIM_ICQ_STATE_WEBAWARE) | |
2327 return g_strdup_printf("Web Aware"); | |
2328 else if (state & AIM_ICQ_STATE_INVISIBLE) | |
2329 return g_strdup_printf("Invisible"); | |
2330 else | |
2331 return g_strdup_printf("Online"); | |
2332 } | |
2333 | |
4194 | 2334 static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const char *cookie) { |
3630 | 2335 struct gaim_connection *gc = sess->aux_data; |
2336 | |
2337 switch (reason) { | |
4151 | 2338 case 3: { /* Decline sendfile. */ |
2339 struct oscar_file_transfer *oft = find_oft_by_cookie(gc, cookie); | |
3630 | 2340 |
2341 if (oft) { | |
4151 | 2342 char *buf = g_strdup_printf(_("%s has declined to receive a file from %s.\n"), |
3630 | 2343 who, gc->username); |
2344 transfer_abort(oft->xfer, buf); | |
2345 g_free(buf); | |
2346 oscar_file_transfer_disconnect(sess, oft->conn); | |
2347 } | |
4151 | 2348 } break; |
2349 | |
2350 default: { | |
4194 | 2351 debug_printf("Received an unknown rendezvous client auto-response from %s. Type 0x%04hx\n", who, reason); |
4151 | 2352 } |
3630 | 2353 |
2354 } | |
2355 | |
2356 return 0; | |
2357 } | |
2358 | |
4194 | 2359 static int gaim_parse_clientauto_ch4(aim_session_t *sess, char *who, fu16_t reason, fu32_t state, char *msg) { |
4151 | 2360 struct gaim_connection *gc = sess->aux_data; |
2361 | |
2362 switch(reason) { | |
2363 case 0x0003: { /* Reply from an ICQ status message request */ | |
2364 char *status_msg = gaim_icq_status(state); | |
2365 char *dialog_msg, **splitmsg; | |
2366 struct oscar_data *od = gc->proto_data; | |
2367 GSList *l = od->evilhack; | |
2368 gboolean evilhack = FALSE; | |
2369 | |
2370 /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ | |
2371 splitmsg = g_strsplit(msg, "\r\n", 0); | |
2372 | |
2373 /* If who is in od->evilhack, then we're just getting the away message, otherwise this | |
2374 * will just get appended to the info box (which is already showing). */ | |
2375 while (l) { | |
2376 char *x = l->data; | |
2377 if (!strcmp(x, normalize(who))) { | |
2378 evilhack = TRUE; | |
2379 g_free(x); | |
2380 od->evilhack = g_slist_remove(od->evilhack, x); | |
2381 break; | |
2382 } | |
2383 l = l->next; | |
2384 } | |
2385 | |
2386 if (evilhack) | |
2387 dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<BR><HR>%s<BR>"), who, status_msg, g_strjoinv("<BR>", splitmsg)); | |
2388 else | |
2389 dialog_msg = g_strdup_printf(_("<B>Status:</B> %s<BR><HR>%s<BR>"), status_msg, g_strjoinv("<BR>", splitmsg)); | |
2390 g_show_info_text(gc, who, 2, dialog_msg, NULL); | |
2391 | |
2392 g_free(status_msg); | |
2393 g_free(dialog_msg); | |
2394 g_strfreev(splitmsg); | |
2395 } break; | |
2396 | |
2397 default: { | |
4194 | 2398 debug_printf("Received an unknown client auto-response from %s. Type 0x%04hx\n", who, reason); |
4151 | 2399 } break; |
2400 } /* end of switch */ | |
2401 | |
2402 return 0; | |
2403 } | |
2404 | |
3212 | 2405 static int gaim_parse_clientauto(aim_session_t *sess, aim_frame_t *fr, ...) { |
2406 va_list ap; | |
2407 fu16_t chan, reason; | |
2408 char *who; | |
2409 | |
2410 va_start(ap, fr); | |
4200 | 2411 chan = (fu16_t)va_arg(ap, unsigned int); |
3212 | 2412 who = va_arg(ap, char *); |
4200 | 2413 reason = (fu16_t)va_arg(ap, unsigned int); |
3212 | 2414 |
3952 | 2415 if (chan == 0x0002) { /* File transfer declined */ |
3630 | 2416 char *cookie = va_arg(ap, char *); |
4151 | 2417 return gaim_parse_clientauto_ch2(sess, who, reason, cookie); |
3952 | 2418 } else if (chan == 0x0004) { /* ICQ message */ |
4200 | 2419 fu32_t state = 0; |
4151 | 2420 char *msg = NULL; |
2421 if (reason == 0x0003) { | |
4200 | 2422 state = va_arg(ap, fu32_t); |
4151 | 2423 msg = va_arg(ap, char *); |
2424 } | |
2425 return gaim_parse_clientauto_ch4(sess, who, reason, state, msg); | |
2426 } | |
3952 | 2427 |
3212 | 2428 va_end(ap); |
2429 | |
2430 return 1; | |
2431 } | |
2432 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2433 static int gaim_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2434 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2435 fu16_t reason; |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2436 char *m; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2437 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2438 va_start(ap, fr); |
4199 | 2439 reason = (fu16_t) va_arg(ap, unsigned int); |
2086 | 2440 va_end(ap); |
2441 | |
4194 | 2442 debug_printf("snac threw error (reason 0x%04hx: %s)\n", reason, |
2086 | 2443 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown"); |
2444 | |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2445 m = g_strdup_printf(_("SNAC threw error: %s\n"), |
4056 | 2446 reason < msgerrreasonlen ? gettext(msgerrreason[reason]) : _("Unknown error")); |
3427 | 2447 do_error_dialog(m, NULL, GAIM_ERROR); |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2448 g_free(m); |
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2449 |
2086 | 2450 return 1; |
2451 } | |
2452 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2453 static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2454 va_list ap; |
3752 | 2455 char *data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2456 fu16_t reason; |
2086 | 2457 char buf[1024]; |
3752 | 2458 struct gaim_connection *gc = sess->aux_data; |
2459 struct oscar_file_transfer *oft; | |
2460 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2461 va_start(ap, fr); |
4199 | 2462 reason = (fu16_t) va_arg(ap, unsigned int); |
3752 | 2463 data = va_arg(ap, char *); |
2086 | 2464 va_end(ap); |
2465 | |
3752 | 2466 /* If this was a file transfer request, data is a cookie. */ |
2467 if ((oft = find_oft_by_cookie(gc, data))) { | |
3630 | 2468 transfer_abort(oft->xfer, |
4056 | 2469 (reason < msgerrreasonlen) ? gettext(msgerrreason[reason]) : _("No reason was given.")); |
3630 | 2470 |
2471 oscar_file_transfer_disconnect(sess, oft->conn); | |
2472 return 1; | |
2473 } | |
2474 | |
3752 | 2475 /* Data is assumed to be the destination sn. */ |
2476 snprintf(buf, sizeof(buf), _("Your message to %s did not get sent:"), data); | |
4056 | 2477 do_error_dialog(buf, (reason < msgerrreasonlen) ? gettext(msgerrreason[reason]) : _("No reason was given."), GAIM_ERROR); |
2086 | 2478 |
2479 return 1; | |
2480 } | |
2481 | |
3595 | 2482 static int gaim_parse_mtn(aim_session_t *sess, aim_frame_t *fr, ...) { |
2483 struct gaim_connection *gc = sess->aux_data; | |
2484 va_list ap; | |
2485 fu16_t type1, type2; | |
2486 char *sn; | |
2487 | |
2488 va_start(ap, fr); | |
4199 | 2489 type1 = (fu16_t) va_arg(ap, unsigned int); |
3595 | 2490 sn = va_arg(ap, char *); |
4199 | 2491 type2 = (fu16_t) va_arg(ap, unsigned int); |
3595 | 2492 va_end(ap); |
2493 | |
4194 | 2494 debug_printf("Received an mtn from %s. Type1 is 0x%04hx and type2 is 0x%04hx.\n", sn, type1, type2); |
3595 | 2495 |
2496 switch (type2) { | |
2497 case 0x0000: { /* Text has been cleared */ | |
2498 serv_got_typing_stopped(gc, sn); | |
2499 } break; | |
2500 | |
2501 case 0x0001: { /* Paused typing */ | |
3768 | 2502 serv_got_typing(gc, sn, 0, TYPED); |
3595 | 2503 } break; |
2504 | |
2505 case 0x0002: { /* Typing */ | |
3768 | 2506 serv_got_typing(gc, sn, 0, TYPING); |
3595 | 2507 } break; |
2508 | |
2509 default: { | |
2510 printf("Received unknown typing notification type.\n"); | |
2511 } break; | |
2512 } | |
2513 | |
2514 return 1; | |
2515 } | |
2516 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2517 static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2518 va_list ap; |
2519 char *destn; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2520 fu16_t reason; |
2086 | 2521 char buf[1024]; |
2522 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2523 va_start(ap, fr); |
4199 | 2524 reason = (fu16_t) va_arg(ap, unsigned int); |
2086 | 2525 destn = va_arg(ap, char *); |
2526 va_end(ap); | |
2527 | |
3574 | 2528 snprintf(buf, sizeof(buf), _("User information for %s unavailable:"), destn); |
4056 | 2529 do_error_dialog(buf, (reason < msgerrreasonlen) ? gettext(msgerrreason[reason]) : _("No reason was given."), GAIM_ERROR); |
2086 | 2530 |
2531 return 1; | |
2532 } | |
2533 | |
2534 static char *images(int flags) { | |
2535 static char buf[1024]; | |
3101 | 2536 g_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s", |
2679 | 2537 (flags & AIM_FLAG_ACTIVEBUDDY) ? "<IMG SRC=\"ab_icon.gif\">" : "", |
2086 | 2538 (flags & AIM_FLAG_UNCONFIRMED) ? "<IMG SRC=\"dt_icon.gif\">" : "", |
2539 (flags & AIM_FLAG_AOL) ? "<IMG SRC=\"aol_icon.gif\">" : "", | |
3101 | 2540 (flags & AIM_FLAG_ICQ) ? "<IMG SRC=\"icq_icon.gif\">" : "", |
2086 | 2541 (flags & AIM_FLAG_ADMINISTRATOR) ? "<IMG SRC=\"admin_icon.gif\">" : "", |
3079 | 2542 (flags & AIM_FLAG_FREE) ? "<IMG SRC=\"free_icon.gif\">" : "", |
2543 (flags & AIM_FLAG_WIRELESS) ? "<IMG SRC=\"wireless_icon.gif\">" : ""); | |
2086 | 2544 return buf; |
2545 } | |
2546 | |
3101 | 2547 |
2920 | 2548 /* XXX This is horribly copied from ../../buddy.c. */ |
2549 static char *caps_string(guint caps) | |
2550 { | |
2551 static char buf[512], *tmp; | |
2552 int count = 0, i = 0; | |
2553 guint bit = 1; | |
2554 while (bit <= 0x10000) { | |
2555 if (bit & caps) { | |
2556 switch (bit) { | |
2557 case 0x1: | |
2558 tmp = _("Buddy Icon"); | |
2559 break; | |
2560 case 0x2: | |
2561 tmp = _("Voice"); | |
2562 break; | |
2563 case 0x4: | |
2564 tmp = _("IM Image"); | |
2565 break; | |
2566 case 0x8: | |
2567 tmp = _("Chat"); | |
2568 break; | |
2569 case 0x10: | |
2570 tmp = _("Get File"); | |
2571 break; | |
2572 case 0x20: | |
2573 tmp = _("Send File"); | |
2574 break; | |
2575 case 0x40: | |
2576 case 0x200: | |
2577 tmp = _("Games"); | |
2578 break; | |
2579 case 0x80: | |
2580 tmp = _("Stocks"); | |
2581 break; | |
2582 case 0x100: | |
2583 tmp = _("Send Buddy List"); | |
2584 break; | |
2585 case 0x400: | |
2586 tmp = _("EveryBuddy Bug"); | |
2587 break; | |
2588 case 0x800: | |
2589 tmp = _("AP User"); | |
2590 break; | |
2591 case 0x1000: | |
2592 tmp = _("ICQ RTF"); | |
2593 break; | |
2594 case 0x2000: | |
2595 tmp = _("Nihilist"); | |
2596 break; | |
2597 case 0x4000: | |
2598 tmp = _("ICQ Server Relay"); | |
2599 break; | |
2600 case 0x8000: | |
2601 tmp = _("ICQ Unknown"); | |
2602 break; | |
2603 case 0x10000: | |
2604 tmp = _("Trillian Encryption"); | |
2605 break; | |
2606 default: | |
2607 tmp = NULL; | |
2608 break; | |
2609 } | |
2610 if (tmp) | |
2611 i += g_snprintf(buf + i, sizeof(buf) - i, "%s%s", (count ? ", " : ""), | |
2612 tmp); | |
2613 count++; | |
2614 } | |
2615 bit <<= 1; | |
2616 } | |
2617 return buf; | |
2618 } | |
2619 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2620 static int gaim_parse_user_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2621 aim_userinfo_t *info; |
4151 | 2622 char *text_enc = NULL, *text = NULL, *utf8 = NULL; |
2623 int text_len; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2624 fu16_t infotype; |
4151 | 2625 fu32_t flags; |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2626 char header[BUF_LONG]; |
2137
18722ae5b882
[gaim-migrate @ 2147]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2131
diff
changeset
|
2627 char legend[BUF_LONG]; |
2086 | 2628 struct gaim_connection *gc = sess->aux_data; |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2629 struct oscar_data *od = gc->proto_data; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2630 GSList *l = od->evilhack; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2631 gboolean evilhack = FALSE; |
2086 | 2632 va_list ap; |
2993 | 2633 gchar *membersince = NULL, *onlinesince = NULL, *idle = NULL; |
2086 | 2634 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2635 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2636 info = va_arg(ap, aim_userinfo_t *); |
4199 | 2637 infotype = (fu16_t) va_arg(ap, unsigned int); |
4151 | 2638 text_enc = va_arg(ap, char *); |
2639 text = va_arg(ap, char *); | |
2640 text_len = va_arg(ap, int); | |
2086 | 2641 va_end(ap); |
2642 | |
4151 | 2643 if (text_len > 0) { |
2644 flags = parse_encoding (text_enc); | |
2645 switch (flags) { | |
2646 case 0: | |
4159 | 2647 utf8 = g_strndup(text, text_len); |
4151 | 2648 break; |
4166 | 2649 case AIM_IMFLAGS_ISO_8859_1: |
2650 utf8 = g_convert(text, text_len, "UTF-8", "ISO-8859-1", NULL, NULL, NULL); | |
2651 break; | |
4151 | 2652 case AIM_IMFLAGS_UNICODE: |
2653 utf8 = g_convert(text, text_len, "UTF-8", "UCS-2BE", NULL, NULL, NULL); | |
2654 break; | |
2655 default: | |
4152 | 2656 utf8 = g_strdup(_("<I>Unable to display information because it was sent in an unknown encoding.</I>")); |
4194 | 2657 debug_printf("Encountered an unknown encoding while parsing userinfo\n"); |
4151 | 2658 } |
2659 } | |
2660 | |
3101 | 2661 if (!od->icq) { |
2662 g_snprintf(legend, sizeof legend, | |
3952 | 2663 _("<BODY BGCOLOR=WHITE><hr><I>Legend:</I><br><br>" |
3101 | 2664 "<IMG SRC=\"free_icon.gif\"> : Normal AIM User<br>" |
2665 "<IMG SRC=\"aol_icon.gif\"> : AOL User <br>" | |
2666 "<IMG SRC=\"dt_icon.gif\"> : Trial AIM User <br>" | |
2667 "<IMG SRC=\"admin_icon.gif\"> : Administrator <br>" | |
2668 "<IMG SRC=\"ab_icon.gif\"> : ActiveBuddy Interactive Agent<br>" | |
2669 "<IMG SRC=\"wireless_icon.gif\"> : Wireless Device User<br>")); | |
3106 | 2670 } else { |
2671 legend[0] = 0; | |
3101 | 2672 } |
2673 | |
2993 | 2674 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) { |
2675 onlinesince = g_strdup_printf("Online Since : <B>%s</B><BR>\n", | |
2676 asctime(localtime(&info->onlinesince))); | |
2677 } | |
2678 | |
2679 if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE) { | |
2680 membersince = g_strdup_printf("Member Since : <B>%s</B><BR>\n", | |
2681 asctime(localtime(&info->membersince))); | |
2682 } | |
2683 | |
2684 if (info->present & AIM_USERINFO_PRESENT_IDLE) { | |
4194 | 2685 idle = g_strdup_printf("Idle : <B>%hu minutes</B>", |
2993 | 2686 info->idletime); |
2687 } else | |
2688 idle = g_strdup("Idle: <B>Active</B>"); | |
2689 | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2690 g_snprintf(header, sizeof header, |
2086 | 2691 _("Username : <B>%s</B> %s <BR>\n" |
2993 | 2692 "Warning Level : <B>%d %%</B><BR>\n" |
2086 | 2693 "%s" |
2993 | 2694 "%s" |
2695 "%s<BR>\n" | |
3952 | 2696 "<HR>\n"), |
2086 | 2697 info->sn, images(info->flags), |
2698 info->warnlevel/10, | |
2993 | 2699 onlinesince ? onlinesince : "", |
2700 membersince ? membersince : "", | |
2701 idle ? idle : ""); | |
2702 | |
2703 g_free(onlinesince); | |
2704 g_free(membersince); | |
2705 g_free(idle); | |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
2706 |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2707 while (l) { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2708 char *x = l->data; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2709 if (!strcmp(x, normalize(info->sn))) { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2710 evilhack = TRUE; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2711 g_free(x); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2712 od->evilhack = g_slist_remove(od->evilhack, x); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2713 break; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2714 } |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2715 l = l->next; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2716 } |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2717 |
2920 | 2718 if (infotype == AIM_GETINFO_AWAYMESSAGE) { |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2719 if (evilhack) { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2720 g_show_info_text(gc, info->sn, 2, |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2721 header, |
4151 | 2722 (utf8 && *utf8) ? away_subs(utf8, gc->username) : |
2723 _("<i>User has no away message</i>"), | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2724 legend, NULL); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2725 } else { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2726 g_show_info_text(gc, info->sn, 0, |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2727 header, |
4151 | 2728 (utf8 && *utf8) ? away_subs(utf8, gc->username) : NULL, |
2729 (utf8 && *utf8) ? "<BR><HR>" : NULL, | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2730 NULL); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2731 } |
2920 | 2732 } else if (infotype == AIM_GETINFO_CAPABILITIES) { |
2733 g_show_info_text(gc, info->sn, 2, | |
2734 header, | |
2735 "<i>", _("Client Capabilities: "), | |
2736 caps_string(info->capabilities), | |
2737 "</i>", | |
2738 legend, | |
2739 NULL); | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2740 } else { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2741 g_show_info_text(gc, info->sn, 1, |
4151 | 2742 (utf8 && *utf8) ? away_subs(utf8, gc->username) : |
2743 _("<i>No Information Provided</i>"), | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2744 legend, |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2745 NULL); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
2746 } |
2086 | 2747 |
4151 | 2748 g_free(utf8); |
2749 | |
2086 | 2750 return 1; |
2751 } | |
2752 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2753 static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2754 char *msg; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2755 fu16_t id; |
2086 | 2756 va_list ap; |
2757 char buildbuf[150]; | |
2758 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2759 va_start(ap, fr); |
4199 | 2760 id = (fu16_t) va_arg(ap, unsigned int); |
2086 | 2761 msg = va_arg(ap, char *); |
2762 va_end(ap); | |
2763 | |
2764 aim_getbuildstring(buildbuf, sizeof(buildbuf)); | |
2765 | |
4194 | 2766 debug_printf("MOTD: %s (%hu)\n", msg ? msg : "Unknown", id); |
2092
59b0377d18aa
[gaim-migrate @ 2102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
2767 if (id < 4) |
3427 | 2768 do_error_dialog(_("Your AIM connection may be lost."), NULL, GAIM_WARNING); |
2086 | 2769 |
2770 return 1; | |
2771 } | |
2772 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2773 static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2774 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2775 fu16_t type; |
2086 | 2776 struct gaim_connection *gc = sess->aux_data; |
2777 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; | |
2778 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2779 va_start(ap, fr); |
4199 | 2780 type = (fu16_t) va_arg(ap, unsigned int); |
2086 | 2781 |
2782 switch(type) { | |
2783 case 0x0002: { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2784 fu8_t maxrooms; |
2086 | 2785 struct aim_chat_exchangeinfo *exchanges; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2786 int exchangecount, i; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2787 |
4199 | 2788 maxrooms = (fu8_t) va_arg(ap, unsigned int); |
2086 | 2789 exchangecount = va_arg(ap, int); |
2790 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *); | |
2791 | |
2792 debug_printf("chat info: Chat Rights:\n"); | |
4194 | 2793 debug_printf("chat info: \tMax Concurrent Rooms: %hhd\n", maxrooms); |
2086 | 2794 debug_printf("chat info: \tExchange List: (%d total)\n", exchangecount); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2795 for (i = 0; i < exchangecount; i++) |
4194 | 2796 debug_printf("chat info: \t\t%hu %s\n", exchanges[i].number, exchanges[i].name ? exchanges[i].name : ""); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
2797 while (odata->create_rooms) { |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
2798 struct create_room *cr = odata->create_rooms->data; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
2799 debug_printf("creating room %s\n", cr->name); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
2800 aim_chatnav_createroom(sess, fr->conn, cr->name, cr->exchange); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
2801 g_free(cr->name); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
2802 odata->create_rooms = g_slist_remove(odata->create_rooms, cr); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
2803 g_free(cr); |
2086 | 2804 } |
2805 } | |
2806 break; | |
2807 case 0x0008: { | |
2808 char *fqcn, *name, *ck; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2809 fu16_t instance, flags, maxmsglen, maxoccupancy, unknown, exchange; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2810 fu8_t createperms; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2811 fu32_t createtime; |
2086 | 2812 |
2813 fqcn = va_arg(ap, char *); | |
4200 | 2814 instance = (fu16_t)va_arg(ap, unsigned int); |
2815 exchange = (fu16_t)va_arg(ap, unsigned int); | |
2816 flags = (fu16_t)va_arg(ap, unsigned int); | |
2817 createtime = va_arg(ap, fu32_t); | |
2818 maxmsglen = (fu16_t)va_arg(ap, unsigned int); | |
2819 maxoccupancy = (fu16_t)va_arg(ap, unsigned int); | |
2820 createperms = (fu8_t)va_arg(ap, unsigned int); | |
2821 unknown = (fu16_t)va_arg(ap, unsigned int); | |
2822 name = va_arg(ap, char *); | |
2823 ck = va_arg(ap, char *); | |
4194 | 2824 |
2825 debug_printf("created room: %s %hu %hu %hu %lu %hu %hu %hhu %hu %s %s\n", | |
2086 | 2826 fqcn, |
2827 exchange, instance, flags, | |
2828 createtime, | |
2829 maxmsglen, maxoccupancy, createperms, unknown, | |
2830 name, ck); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2831 aim_chat_join(odata->sess, odata->conn, exchange, ck, instance); |
2086 | 2832 } |
2833 break; | |
2834 default: | |
4194 | 2835 debug_printf("chatnav info: unknown type (%04hx)\n", type); |
2086 | 2836 break; |
2837 } | |
4194 | 2838 |
2839 va_end(ap); | |
2840 | |
2086 | 2841 return 1; |
2842 } | |
2843 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2844 static int gaim_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2845 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2846 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2847 aim_userinfo_t *info; |
2086 | 2848 struct gaim_connection *g = sess->aux_data; |
2849 | |
2850 struct chat_connection *c = NULL; | |
2851 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2852 va_start(ap, fr); |
2086 | 2853 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2854 info = va_arg(ap, aim_userinfo_t *); |
2086 | 2855 va_end(ap); |
2856 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2857 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 2858 if (!c) |
2859 return 1; | |
2860 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2861 for (i = 0; i < count; i++) |
3708 | 2862 add_chat_buddy(c->cnv, info[i].sn, NULL); |
2086 | 2863 |
2864 return 1; | |
2865 } | |
2866 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2867 static int gaim_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2868 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2869 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2870 aim_userinfo_t *info; |
2086 | 2871 struct gaim_connection *g = sess->aux_data; |
2872 | |
2873 struct chat_connection *c = NULL; | |
2874 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2875 va_start(ap, fr); |
2086 | 2876 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2877 info = va_arg(ap, aim_userinfo_t *); |
2086 | 2878 va_end(ap); |
2879 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2880 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 2881 if (!c) |
2882 return 1; | |
2883 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2884 for (i = 0; i < count; i++) |
2820
b917845dad3c
[gaim-migrate @ 2833]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2817
diff
changeset
|
2885 remove_chat_buddy(c->cnv, info[i].sn, NULL); |
2086 | 2886 |
2887 return 1; | |
2888 } | |
2889 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2890 static int gaim_chat_info_update(aim_session_t *sess, aim_frame_t *fr, ...) { |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2891 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2892 aim_userinfo_t *userinfo; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2893 struct aim_chat_roominfo *roominfo; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2894 char *roomname; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2895 int usercount; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2896 char *roomdesc; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2897 fu16_t unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2898 fu32_t creationtime; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2899 struct gaim_connection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2900 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2901 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2902 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2903 roominfo = va_arg(ap, struct aim_chat_roominfo *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2904 roomname = va_arg(ap, char *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2905 usercount= va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2906 userinfo = va_arg(ap, aim_userinfo_t *); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2907 roomdesc = va_arg(ap, char *); |
4200 | 2908 unknown_c9 = (fu16_t)va_arg(ap, unsigned int); |
2909 creationtime = va_arg(ap, fu32_t); | |
2910 maxmsglen = (fu16_t)va_arg(ap, unsigned int); | |
2911 unknown_d2 = (fu16_t)va_arg(ap, unsigned int); | |
2912 unknown_d5 = (fu16_t)va_arg(ap, unsigned int); | |
2913 maxvisiblemsglen = (fu16_t)va_arg(ap, unsigned int); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2914 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2915 |
4194 | 2916 debug_printf("inside chat_info_update (maxmsglen = %hu, maxvislen = %hu)\n", |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2917 maxmsglen, maxvisiblemsglen); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2918 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2919 ccon->maxlen = maxmsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2920 ccon->maxvis = maxvisiblemsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2921 |
2086 | 2922 return 1; |
2923 } | |
2924 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2925 static int gaim_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2926 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2927 aim_userinfo_t *info; |
2086 | 2928 char *msg; |
2929 struct gaim_connection *gc = sess->aux_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2930 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); |
2086 | 2931 char *tmp; |
2932 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2933 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2934 info = va_arg(ap, aim_userinfo_t *); |
4194 | 2935 msg = va_arg(ap, char *); |
2936 va_end(ap); | |
2086 | 2937 |
2938 tmp = g_malloc(BUF_LONG); | |
2939 g_snprintf(tmp, BUF_LONG, "%s", msg); | |
2940 serv_got_chat_in(gc, ccon->id, info->sn, 0, tmp, time((time_t)NULL)); | |
2941 g_free(tmp); | |
2942 | |
2943 return 1; | |
2944 } | |
2945 | |
3694 | 2946 static int gaim_email_parseupdate(aim_session_t *sess, aim_frame_t *fr, ...) { |
2947 va_list ap; | |
2948 struct gaim_connection *gc = sess->aux_data; | |
2949 struct aim_emailinfo *emailinfo; | |
3725 | 2950 int havenewmail; |
3694 | 2951 |
2952 va_start(ap, fr); | |
2953 emailinfo = va_arg(ap, struct aim_emailinfo *); | |
3725 | 2954 havenewmail = va_arg(ap, int); |
3694 | 2955 va_end(ap); |
2956 | |
3725 | 2957 if (emailinfo) { |
4194 | 2958 debug_printf("Got email info. webmail address for screenname@%s is %s, new email: %hhu, number new: %hu, flag is %hu, havenewmail is %d\n", emailinfo->domain, emailinfo->url, emailinfo->unread, emailinfo->nummsgs, emailinfo->flag, havenewmail); |
3725 | 2959 if (emailinfo->unread) { |
2960 if (havenewmail) | |
2961 connection_has_mail(gc, emailinfo->nummsgs ? emailinfo->nummsgs : -1, NULL, NULL, emailinfo->url); | |
2962 } else | |
3694 | 2963 connection_has_mail(gc, 0, NULL, NULL, emailinfo->url); |
2964 } | |
2965 | |
2966 return 1; | |
2967 } | |
2968 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2969 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2970 * Recieved in response to an IM sent with the AIM_IMFLAGS_ACK option. |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2971 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2972 static int gaim_parse_msgack(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2973 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2974 fu16_t type; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2975 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2976 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2977 va_start(ap, fr); |
4199 | 2978 type = (fu16_t) va_arg(ap, unsigned int); |
2086 | 2979 sn = va_arg(ap, char *); |
2980 va_end(ap); | |
2981 | |
2982 debug_printf("Sent message to %s.\n", sn); | |
2983 | |
2984 return 1; | |
2985 } | |
2986 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2987 static int gaim_parse_ratechange(aim_session_t *sess, aim_frame_t *fr, ...) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2988 static const char *codes[5] = { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2989 "invalid", |
4194 | 2990 "change", |
2991 "warning", | |
2992 "limit", | |
2993 "limit cleared", | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2994 }; |
2086 | 2995 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2996 fu16_t code, rateclass; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2997 fu32_t windowsize, clear, alert, limit, disconnect, currentavg, maxavg; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2998 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2999 va_start(ap, fr); |
4200 | 3000 code = (fu16_t)va_arg(ap, unsigned int); |
3001 rateclass= (fu16_t)va_arg(ap, unsigned int); | |
3002 windowsize = va_arg(ap, fu32_t); | |
3003 clear = va_arg(ap, fu32_t); | |
3004 alert = va_arg(ap, fu32_t); | |
3005 limit = va_arg(ap, fu32_t); | |
3006 disconnect = va_arg(ap, fu32_t); | |
3007 currentavg = va_arg(ap, fu32_t); | |
3008 maxavg = va_arg(ap, fu32_t); | |
2086 | 3009 va_end(ap); |
3010 | |
4194 | 3011 debug_printf("rate %s (param ID 0x%04hx): curavg = %lu, maxavg = %lu, alert at %lu, " |
3012 "clear warning at %lu, limit at %lu, disconnect at %lu (window size = %lu)\n", | |
2086 | 3013 (code < 5) ? codes[code] : codes[0], |
3014 rateclass, | |
3015 currentavg, maxavg, | |
3016 alert, clear, | |
3017 limit, disconnect, | |
3018 windowsize); | |
3019 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3020 /* XXX fix these values */ |
2086 | 3021 if (code == AIM_RATE_CODE_CHANGE) { |
3022 if (currentavg >= clear) | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3023 aim_conn_setlatency(fr->conn, 0); |
2086 | 3024 } else if (code == AIM_RATE_CODE_WARNING) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3025 aim_conn_setlatency(fr->conn, windowsize/4); |
2909
48ec70928d7f
[gaim-migrate @ 2922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2906
diff
changeset
|
3026 } else if (code == AIM_RATE_CODE_LIMIT) { |
3427 | 3027 do_error_dialog(_("Rate limiting error."), |
3028 _("The last message was not sent because you are over the rate limit. " | |
3029 "Please wait 10 seconds and try again."), GAIM_ERROR); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3030 aim_conn_setlatency(fr->conn, windowsize/2); |
2086 | 3031 } else if (code == AIM_RATE_CODE_CLEARLIMIT) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3032 aim_conn_setlatency(fr->conn, 0); |
2086 | 3033 } |
3034 | |
3035 return 1; | |
3036 } | |
3037 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3038 static int gaim_parse_evilnotify(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3039 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3040 fu16_t newevil; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3041 aim_userinfo_t *userinfo; |
2086 | 3042 struct gaim_connection *gc = sess->aux_data; |
3043 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3044 va_start(ap, fr); |
4199 | 3045 newevil = (fu16_t) va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3046 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 3047 va_end(ap); |
3048 | |
3049 serv_got_eviled(gc, (userinfo && userinfo->sn[0]) ? userinfo->sn : NULL, newevil / 10); | |
3050 | |
3051 return 1; | |
3052 } | |
3053 | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3054 static int gaim_selfinfo(aim_session_t *sess, aim_frame_t *fr, ...) { |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3055 va_list ap; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3056 aim_userinfo_t *info; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3057 struct gaim_connection *gc = sess->aux_data; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3058 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3059 va_start(ap, fr); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3060 info = va_arg(ap, aim_userinfo_t *); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3061 va_end(ap); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3062 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3063 gc->evil = info->warnlevel/10; |
2698
e80f4b4f840f
[gaim-migrate @ 2711]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2689
diff
changeset
|
3064 /* gc->correction_time = (info->onlinesince - gc->login_time); */ |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3065 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3066 return 1; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3067 } |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3068 |
2675 | 3069 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) { |
3458 | 3070 struct gaim_connection *gc = sess->aux_data; |
3071 struct oscar_data *od = gc->proto_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3072 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3073 aim_reqpersonalinfo(sess, fr->conn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3074 aim_bos_reqlocaterights(sess, fr->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3075 aim_bos_reqbuddyrights(sess, fr->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3076 |
2673
81d658e6ac1e
[gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
3077 aim_reqicbmparams(sess); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3078 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3079 aim_bos_reqrights(sess, fr->conn); |
3458 | 3080 if (od->icq) { |
3081 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS); | |
3082 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE | | |
3083 AIM_PRIVFLAGS_ALLOWMEMBERSINCE); | |
3084 } | |
2086 | 3085 |
3086 return 1; | |
3087 } | |
3088 | |
2675 | 3089 static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) { |
2647 | 3090 struct gaim_connection *gc = sess->aux_data; |
3091 struct oscar_data *od = gc->proto_data; | |
3092 | |
2672 | 3093 aim_clientready(sess, fr->conn); |
2675 | 3094 debug_printf("connected to admin\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3095 |
2647 | 3096 if (od->chpass) { |
3097 debug_printf("changing password\n"); | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3098 aim_admin_changepasswd(sess, fr->conn, od->newp, od->oldp); |
2647 | 3099 g_free(od->oldp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3100 od->oldp = NULL; |
2647 | 3101 g_free(od->newp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3102 od->newp = NULL; |
2647 | 3103 od->chpass = FALSE; |
3104 } | |
2979 | 3105 if (od->setnick) { |
3106 debug_printf("formatting screenname\n"); | |
3107 aim_admin_setnick(sess, fr->conn, od->newsn); | |
3108 g_free(od->newsn); | |
3109 od->newsn = NULL; | |
3110 od->setnick = FALSE; | |
3111 } | |
2647 | 3112 if (od->conf) { |
3113 debug_printf("confirming account\n"); | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3114 aim_admin_reqconfirm(sess, fr->conn); |
2647 | 3115 od->conf = FALSE; |
3116 } | |
3117 if (od->reqemail) { | |
3118 debug_printf("requesting email\n"); | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3119 aim_admin_getinfo(sess, fr->conn, 0x0011); |
2647 | 3120 od->reqemail = FALSE; |
3121 } | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3122 if (od->setemail) { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3123 debug_printf("setting email\n"); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3124 aim_admin_setemail(sess, fr->conn, od->email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3125 g_free(od->email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3126 od->setemail = FALSE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3127 } |
2647 | 3128 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3129 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3130 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3131 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3132 static int gaim_icbm_param_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3133 struct aim_icbmparameters *params; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3134 va_list ap; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3135 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3136 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3137 params = va_arg(ap, struct aim_icbmparameters *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3138 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3139 |
4194 | 3140 /* XXX - evidently this crashes on solaris. i have no clue why |
3141 debug_printf("ICBM Parameters: maxchannel = %hu, default flags = 0x%08lx, max msg len = %hu, " | |
3142 "max sender evil = %f, max receiver evil = %f, min msg interval = %lu\n", | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3143 params->maxchan, params->flags, params->maxmsglen, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3144 ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3145 params->minmsginterval); |
2427
5bc3b39fc0a5
[gaim-migrate @ 2440]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2421
diff
changeset
|
3146 */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3147 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3148 /* Maybe senderwarn and recverwarn should be user preferences... */ |
3595 | 3149 params->flags = 0x0000000b; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3150 params->maxmsglen = 8000; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3151 params->minmsginterval = 0; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3152 |
2673
81d658e6ac1e
[gaim-migrate @ 2686]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2672
diff
changeset
|
3153 aim_seticbmparam(sess, params); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3154 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3155 return 1; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3156 } |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3157 |
2993 | 3158 static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) |
3159 { | |
3160 va_list ap; | |
3161 fu16_t maxsiglen; | |
3162 struct gaim_connection *gc = sess->aux_data; | |
3163 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; | |
4151 | 3164 char *unicode; |
3165 int unicode_len; | |
3166 fu32_t flags; | |
2993 | 3167 |
3168 va_start(ap, fr); | |
4199 | 3169 maxsiglen = (fu16_t) va_arg(ap, int); |
2993 | 3170 va_end(ap); |
3171 | |
3172 debug_printf("locate rights: max sig len = %d\n", maxsiglen); | |
3173 | |
3174 odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen; | |
3175 | |
3458 | 3176 if (odata->icq) |
4151 | 3177 aim_bos_setprofile(sess, fr->conn, NULL, NULL, 0, NULL, NULL, 0, caps_icq); |
3178 else { | |
3179 flags = check_encoding (gc->user->user_info); | |
3180 | |
3181 if (flags == 0) { | |
3182 aim_bos_setprofile(sess, fr->conn, "us-ascii", gc->user->user_info, | |
3183 strlen(gc->user->user_info), NULL, NULL, 0, caps_aim); | |
3184 } else { | |
3185 unicode = g_convert (gc->user->user_info, strlen(gc->user->user_info), | |
3186 "UCS-2BE", "UTF-8", NULL, &unicode_len, NULL); | |
3187 aim_bos_setprofile(sess, fr->conn, "unicode-2-0", unicode, unicode_len, | |
3188 NULL, NULL, 0, caps_aim); | |
3189 g_free(unicode); | |
3190 } | |
3191 } | |
2993 | 3192 |
3193 return 1; | |
3194 } | |
3195 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3196 static int gaim_parse_buddyrights(aim_session_t *sess, aim_frame_t *fr, ...) { |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3197 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3198 fu16_t maxbuddies, maxwatchers; |
2993 | 3199 struct gaim_connection *gc = sess->aux_data; |
3200 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3201 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3202 va_start(ap, fr); |
4199 | 3203 maxbuddies = (fu16_t) va_arg(ap, unsigned int); |
3204 maxwatchers = (fu16_t) va_arg(ap, unsigned int); | |
2086 | 3205 va_end(ap); |
3206 | |
4194 | 3207 debug_printf("buddy list rights: Max buddies = %hu / Max watchers = %hu\n", maxbuddies, maxwatchers); |
2086 | 3208 |
2993 | 3209 odata->rights.maxbuddies = (guint)maxbuddies; |
3210 odata->rights.maxwatchers = (guint)maxwatchers; | |
3211 | |
2086 | 3212 return 1; |
3213 } | |
3214 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3215 static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3216 fu16_t maxpermits, maxdenies; |
2086 | 3217 va_list ap; |
2993 | 3218 struct gaim_connection *gc = sess->aux_data; |
3219 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; | |
2086 | 3220 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3221 va_start(ap, fr); |
4199 | 3222 maxpermits = (fu16_t) va_arg(ap, unsigned int); |
3223 maxdenies = (fu16_t) va_arg(ap, unsigned int); | |
2086 | 3224 va_end(ap); |
3225 | |
4194 | 3226 debug_printf("BOS rights: Max permit = %hu / Max deny = %hu\n", maxpermits, maxdenies); |
2086 | 3227 |
2993 | 3228 odata->rights.maxpermits = (guint)maxpermits; |
3229 odata->rights.maxdenies = (guint)maxdenies; | |
3230 | |
3231 account_online(gc); | |
3232 serv_finish_login(gc); | |
3233 | |
3234 if (bud_list_cache_exists(gc)) | |
3235 do_import(gc, NULL); | |
3236 | |
3237 debug_printf("buddy list loaded\n"); | |
3238 | |
2672 | 3239 aim_clientready(sess, fr->conn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3240 |
3952 | 3241 /* XXX - Should call aim_bos_setidle with 0x0000 */ |
3242 | |
3243 /* XXX - Should only call reqofflinemsgs when using ICQ? */ | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3244 aim_icq_reqofflinemsgs(sess); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3245 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3246 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV); |
4102 | 3247 if (sess->authinfo->email) |
3248 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_EMAIL); | |
2086 | 3249 |
3109 | 3250 if (!odata->icq) { |
3251 debug_printf("ssi: requesting ssi list\n"); | |
3092 | 3252 aim_ssi_reqrights(sess, fr->conn); |
3109 | 3253 aim_ssi_reqdata(sess, fr->conn, sess->ssi.timestamp, sess->ssi.revision); |
3254 } | |
2991 | 3255 |
2086 | 3256 return 1; |
3257 } | |
3258 | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3259 static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3260 va_list ap; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3261 struct aim_icq_offlinemsg *msg; |
4075 | 3262 struct aim_incomingim_ch4_args args; |
3263 time_t t; | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3264 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3265 va_start(ap, fr); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3266 msg = va_arg(ap, struct aim_icq_offlinemsg *); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3267 va_end(ap); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3268 |
4075 | 3269 debug_printf("Received offline message. Converting to channel 4 ICBM...\n"); |
3270 args.uin = msg->sender; | |
3271 args.type = msg->type; | |
4173 | 3272 args.flags = msg->flags; |
4076 | 3273 args.msglen = msg->msglen; |
4075 | 3274 args.msg = msg->msg; |
3275 t = get_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0); | |
3276 incomingim_chan4(sess, fr->conn, NULL, &args, t); | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3277 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3278 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3279 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3280 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3281 static int gaim_offlinemsgdone(aim_session_t *sess, aim_frame_t *fr, ...) |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3282 { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3283 aim_icq_ackofflinemsgs(sess); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3284 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3285 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3286 |
4151 | 3287 static int gaim_icqsimpleinfo(aim_session_t *sess, aim_frame_t *fr, ...) |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3288 { |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
3289 struct gaim_connection *gc = sess->aux_data; |
3212 | 3290 struct buddy *budlight; |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3291 va_list ap; |
4151 | 3292 struct aim_icq_info *info; |
3293 gchar *buf, *tmp; | |
3294 gchar who[16]; | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3295 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3296 va_start(ap, fr); |
4151 | 3297 info = va_arg(ap, struct aim_icq_info *); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3298 va_end(ap); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3299 |
4151 | 3300 g_snprintf(who, sizeof(who), "%lu", info->uin); |
3301 buf = g_strdup_printf("<b>UIN:</b> %s<br>", who); | |
3302 if (info->nick) { | |
3303 tmp = buf; | |
3304 buf = g_strconcat(tmp, "<b>Nick:</b> ", info->nick, "<br>\n", NULL); | |
3305 g_free(tmp); | |
3306 } | |
3307 if (info->first) { | |
3308 tmp = buf; | |
3309 buf = g_strconcat(tmp, "<b>First Name:</b> ", info->first, "<br>\n", NULL); | |
3310 g_free(tmp); | |
3311 } | |
3312 if (info->last) { | |
3313 tmp = buf; | |
3314 buf = g_strconcat(tmp, "<b>Last Name:</b> ", info->last, "<br>\n", NULL); | |
3315 g_free(tmp); | |
3316 } | |
3317 if (info->email) { | |
3318 tmp = buf; | |
3319 buf = g_strconcat(tmp, "<b>Email Address:</b> ", info->email, "<br>\n", NULL); | |
3320 g_free(tmp); | |
3321 } | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3322 |
3212 | 3323 /* If the contact is away, then we also want to get their status message |
3324 * and show it in the same window as info. g_show_info_text gets the status | |
3325 * message if the third arg is 0 (this seems really gross to me). The | |
3326 * parse-icq-status-message function knows if it is putting it's message in | |
3327 * an info window because the name will _not_ be in od->evilhack. For getting | |
3328 * only the away message the contact's UIN is put in od->evilhack. */ | |
3279 | 3329 if ((budlight = find_buddy(gc, who))) { |
3595 | 3330 if ((budlight->uc >> 16) & (AIM_ICQ_STATE_AWAY || AIM_ICQ_STATE_DND || AIM_ICQ_STATE_OUT || AIM_ICQ_STATE_BUSY || AIM_ICQ_STATE_CHAT)) { |
3270 | 3331 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY) |
3332 g_show_info_text(gc, who, 0, buf, NULL); | |
3333 else { | |
3595 | 3334 char *state_msg = gaim_icq_status((budlight->uc & 0xffff0000) >> 16); |
3952 | 3335 g_show_info_text(gc, who, 2, buf, "<B>Status:</B> ", state_msg, "<BR>\n<HR><I>Remote client does not support sending status messages.</I><BR>\n", NULL); |
3270 | 3336 free(state_msg); |
3337 } | |
3338 } else { | |
3595 | 3339 char *state_msg = gaim_icq_status((budlight->uc & 0xffff0000) >> 16); |
3270 | 3340 g_show_info_text(gc, who, 2, buf, "<B>Status:</B> ", state_msg, NULL); |
3212 | 3341 free(state_msg); |
3342 } | |
3270 | 3343 } else |
3344 g_show_info_text(gc, who, 2, buf, NULL); | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3345 |
4151 | 3346 g_free(buf); |
3347 | |
3348 return 1; | |
3349 } | |
3350 | |
3351 static int gaim_icqallinfo(aim_session_t *sess, aim_frame_t *fr, ...) | |
3352 { | |
3353 struct gaim_connection *gc = sess->aux_data; | |
3354 va_list ap; | |
3355 struct aim_icq_info *info; | |
3356 gchar *buf, *tmp; | |
3357 gchar who[16]; | |
3358 | |
3359 va_start(ap, fr); | |
3360 info = va_arg(ap, struct aim_icq_info *); | |
3361 va_end(ap); | |
3362 | |
3363 g_snprintf(who, sizeof(who), "%lu", info->uin); | |
3364 buf = g_strdup_printf("<b>UIN:</b> %s<br>", who); | |
3365 if (info->nick) { | |
3366 tmp = buf; | |
3367 buf = g_strconcat(tmp, "<b>Nick:</b> ", info->nick, "<br>\n", NULL); | |
3368 g_free(tmp); | |
3369 } | |
3370 if (info->first) { | |
3371 tmp = buf; | |
3372 buf = g_strconcat(tmp, "<b>First Name:</b> ", info->first, "<br>\n", NULL); | |
3373 g_free(tmp); | |
3374 } | |
3375 if (info->last) { | |
3376 tmp = buf; | |
3377 buf = g_strconcat(tmp, "<b>Last Name:</b> ", info->last, "<br>\n", NULL); | |
3378 g_free(tmp); | |
3379 } | |
3380 if (info->email) { | |
3381 tmp = buf; | |
3382 buf = g_strconcat(tmp, "<b>Email Address:</b> ", info->email, "<br>\n", NULL); | |
3383 g_free(tmp); | |
3384 } | |
3385 if (info->personalwebpage) { | |
3386 tmp = buf; | |
3387 buf = g_strconcat(tmp, "<b>Personal Webpage:</b> ", info->personalwebpage, "<br>\n", NULL); | |
3388 g_free(tmp); | |
3389 } | |
3390 if (info->info) { | |
3391 tmp = buf; | |
3392 buf = g_strconcat(tmp, "<br><b>Additional Information:</b><br>", info->info, "<br><hr>\n", NULL); | |
3393 g_free(tmp); | |
3394 } | |
3395 if (info->homecity && info->homestate && info->homeaddr && info->homezip) { | |
3396 tmp = buf; | |
3397 buf = g_strconcat(tmp, "<br><b>Home Address:</b><br>\n", info->homeaddr, "<br>\n", info->homecity, ", ", info->homestate, " ", info->homezip, "<hr>\n", NULL); | |
3398 g_free(tmp); | |
3399 } | |
3400 | |
3401 g_show_info_text(gc, who, 2, buf, NULL); | |
3402 g_free(buf); | |
3403 | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3404 return 1; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3405 } |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3406 |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3407 static int gaim_popup(aim_session_t *sess, aim_frame_t *fr, ...) |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3408 { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3409 char *msg, *url; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3410 fu16_t wid, hei, delay; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3411 va_list ap; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3412 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3413 va_start(ap, fr); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3414 msg = va_arg(ap, char *); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3415 url = va_arg(ap, char *); |
4199 | 3416 wid = (fu16_t) va_arg(ap, int); |
3417 hei = (fu16_t) va_arg(ap, int); | |
3418 delay = (fu16_t) va_arg(ap, int); | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3419 va_end(ap); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3420 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3421 serv_got_popup(msg, url, wid, hei); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3422 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3423 return 1; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3424 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3425 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3426 static int gaim_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3427 va_list ap; |
3428 char *address, *SNs; | |
3429 int i, num; | |
3430 char *buf; | |
3431 int at = 0, len; | |
3432 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3433 va_start(ap, fr); |
2086 | 3434 address = va_arg(ap, char *); |
3435 num = va_arg(ap, int); | |
3436 SNs = va_arg(ap, char *); | |
3437 va_end(ap); | |
3438 | |
3439 len = num * (MAXSNLEN + 1) + 1024; | |
3440 buf = g_malloc(len); | |
3441 at += g_snprintf(buf + at, len - at, "<B>%s has the following screen names:</B><BR>", address); | |
3442 for (i = 0; i < num; i++) | |
3443 at += g_snprintf(buf + at, len - at, "%s<BR>", &SNs[i * (MAXSNLEN + 1)]); | |
3212 | 3444 g_show_info_text(NULL, NULL, 2, buf, NULL); |
2086 | 3445 g_free(buf); |
3446 | |
3447 return 1; | |
3448 } | |
3449 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3450 static int gaim_parse_searcherror(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3451 va_list ap; |
3452 char *address; | |
3453 char buf[BUF_LONG]; | |
3454 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3455 va_start(ap, fr); |
2086 | 3456 address = va_arg(ap, char *); |
3457 va_end(ap); | |
3458 | |
3459 g_snprintf(buf, sizeof(buf), "No results found for email address %s", address); | |
3427 | 3460 do_error_dialog(buf, NULL, GAIM_ERROR); |
2086 | 3461 |
3462 return 1; | |
3463 } | |
3464 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3465 static int gaim_account_confirm(aim_session_t *sess, aim_frame_t *fr, ...) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3466 fu16_t status; |
2086 | 3467 va_list ap; |
3468 char msg[256]; | |
3469 struct gaim_connection *gc = sess->aux_data; | |
3470 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3471 va_start(ap, fr); |
4199 | 3472 status = (fu16_t) va_arg(ap, unsigned int); /* status code of confirmation request */ |
2086 | 3473 va_end(ap); |
3474 | |
3475 debug_printf("account confirmation returned status 0x%04x (%s)\n", status, | |
3912 | 3476 status ? "unknown" : "email sent"); |
3477 if (!status) { | |
2086 | 3478 g_snprintf(msg, sizeof(msg), "You should receive an email asking to confirm %s.", |
3479 gc->username); | |
4056 | 3480 do_error_dialog(_("Account Confirmation Requested"), msg, GAIM_INFO); |
2086 | 3481 } |
3482 | |
3483 return 1; | |
3484 } | |
3485 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3486 static int gaim_info_change(aim_session_t *sess, aim_frame_t *fr, ...) { |
3912 | 3487 struct gaim_connection *gc = sess->aux_data; |
2086 | 3488 va_list ap; |
3912 | 3489 fu16_t perms, err; |
3490 char *url, *sn, *email; | |
3491 int change; | |
2086 | 3492 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3493 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3494 change = va_arg(ap, int); |
4199 | 3495 perms = (fu16_t) va_arg(ap, unsigned int); |
3496 err = (fu16_t) va_arg(ap, unsigned int); | |
3912 | 3497 url = va_arg(ap, char *); |
3498 sn = va_arg(ap, char *); | |
3499 email = va_arg(ap, char *); | |
2086 | 3500 va_end(ap); |
3501 | |
3912 | 3502 debug_printf("account info: because of %s, perms=0x%04x, err=0x%04x, url=%s, sn=%s, email=%s\n", |
3503 change ? "change" : "request", perms, err, url, sn, email); | |
3504 | |
3505 if (err && url) { | |
3506 char *dialog_msg; | |
3507 char *dialog_top = g_strdup_printf(_("Error Changing Account Info")); | |
3508 switch (err) { | |
3509 case 0x0001: { | |
3510 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name differs from the original."), err); | |
3511 } break; | |
3512 case 0x0006: { | |
3513 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name ends in a space."), err); | |
3514 } break; | |
3515 case 0x000b: { | |
3516 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name is too long."), err); | |
3517 } break; | |
3518 case 0x001d: { | |
3519 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because there is already a request pending for this screen name."), err); | |
3520 } break; | |
3521 case 0x0021: { | |
3522 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because the given address has too many screen names associated with it."), err); | |
3523 } break; | |
3524 case 0x0023: { | |
3525 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because the given address is invalid."), err); | |
3526 } break; | |
3527 default: { | |
3528 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unknown error."), err); | |
3529 } break; | |
3530 } | |
3531 do_error_dialog(dialog_top, dialog_msg, GAIM_ERROR); | |
3532 g_free(dialog_top); | |
3533 g_free(dialog_msg); | |
3534 return 1; | |
3535 } | |
3536 | |
3537 if (sn) { | |
3538 char *dialog_msg = g_strdup_printf(_("Your screen name is currently formated as follows:\n%s"), sn); | |
4056 | 3539 do_error_dialog(_("Account Info"), dialog_msg, GAIM_INFO); |
3912 | 3540 g_free(dialog_msg); |
3541 } | |
3542 | |
3543 if (email) { | |
3544 char *dialog_msg = g_strdup_printf(_("The email address for %s is %s"), gc->username, email); | |
4056 | 3545 do_error_dialog(_("Account Info"), dialog_msg, GAIM_INFO); |
3912 | 3546 g_free(dialog_msg); |
2086 | 3547 } |
3548 | |
3549 return 1; | |
3550 } | |
3551 | |
3552 static void oscar_keepalive(struct gaim_connection *gc) { | |
3553 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; | |
3554 aim_flap_nop(odata->sess, odata->conn); | |
3555 } | |
3556 | |
3001 | 3557 static int oscar_send_typing(struct gaim_connection *gc, char *name, int typing) { |
2993 | 3558 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; |
3559 struct direct_im *dim = find_direct_im(odata, name); | |
3595 | 3560 if (dim) |
3561 aim_send_typing(odata->sess, dim->conn, typing); | |
3562 else { | |
3600 | 3563 char *who = normalize(name); |
3564 if (g_hash_table_lookup(odata->supports_tn, who)) { | |
3596 | 3565 if (typing == TYPING) |
3595 | 3566 aim_mtn_send(odata->sess, 0x0001, name, 0x0002); |
3596 | 3567 else if (typing == TYPED) |
3568 aim_mtn_send(odata->sess, 0x0001, name, 0x0001); | |
3595 | 3569 else |
3570 aim_mtn_send(odata->sess, 0x0001, name, 0x0000); | |
3571 } | |
3572 } | |
2993 | 3573 return 0; |
3574 } | |
3048 | 3575 static void oscar_ask_direct_im(struct gaim_connection *gc, char *name); |
2993 | 3576 |
3033 | 3577 static int oscar_send_im(struct gaim_connection *gc, char *name, char *message, int len, int imflags) { |
2086 | 3578 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; |
3579 struct direct_im *dim = find_direct_im(odata, name); | |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
3580 int ret = 0; |
3659 | 3581 GError *err = NULL; |
3458 | 3582 |
2086 | 3583 if (dim) { |
3009 | 3584 if (dim->connected) { /* If we're not connected yet, send through server */ |
3952 | 3585 /* AAA - The last parameter below is the encoding. Let Paco-Paco do something with it. */ |
3586 ret = aim_send_im_direct(odata->sess, dim->conn, message, len == -1 ? strlen(message) : len, 0); | |
3009 | 3587 if (ret == 0) |
3588 return 1; | |
3589 else return ret; | |
3590 } | |
3008 | 3591 debug_printf("Direct IM pending, but not connected; sending through server\n"); |
3044 | 3592 } else if (len != -1) { |
3593 /* Trying to send an IM image outside of a direct connection. */ | |
3594 oscar_ask_direct_im(gc, name); | |
3595 return -ENOTCONN; | |
3596 } | |
3008 | 3597 if (imflags & IM_FLAG_AWAY) { |
3598 ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message); | |
2086 | 3599 } else { |
3008 | 3600 struct aim_sendimext_args args; |
3601 GSList *h = odata->hasicons; | |
3602 struct icon_req *ir = NULL; | |
3603 char *who = normalize(name); | |
3604 struct stat st; | |
4151 | 3605 int len; |
3008 | 3606 |
3607 args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES; | |
3608 if (odata->icq) | |
3609 args.flags |= AIM_IMFLAGS_OFFLINE; | |
3610 | |
3611 args.features = gaim_features; | |
3612 args.featureslen = sizeof(gaim_features); | |
3613 | |
3614 while (h) { | |
3615 ir = h->data; | |
3616 if (ir->request && !strcmp(who, ir->user)) | |
3617 break; | |
3618 h = h->next; | |
2086 | 3619 } |
3008 | 3620 if (h) { |
3621 ir->request = FALSE; | |
3622 args.flags |= AIM_IMFLAGS_BUDDYREQ; | |
3623 debug_printf("sending buddy icon request with message\n"); | |
3624 } | |
3625 | |
3626 if (gc->user->iconfile[0] && !stat(gc->user->iconfile, &st)) { | |
3627 FILE *file = fopen(gc->user->iconfile, "r"); | |
3628 if (file) { | |
3629 char *buf = g_malloc(st.st_size); | |
3630 fread(buf, 1, st.st_size, file); | |
3631 | |
3632 args.iconlen = st.st_size; | |
3633 args.iconsum = aim_iconsum(buf, st.st_size); | |
3634 args.iconstamp = st.st_mtime; | |
3635 | |
3636 args.flags |= AIM_IMFLAGS_HASICON; | |
3637 debug_printf("Claiming to have an icon.\n"); | |
3638 | |
3639 fclose(file); | |
3640 g_free(buf); | |
2086 | 3641 } |
3642 } | |
3008 | 3643 |
3644 args.destsn = name; | |
3642 | 3645 |
3646 len = strlen(message); | |
4151 | 3647 args.flags |= check_encoding(message); |
3642 | 3648 if (args.flags & AIM_IMFLAGS_UNICODE) { |
4194 | 3649 debug_printf("Sending Unicode IM\n"); |
3659 | 3650 args.msg = g_convert(message, len, "UCS-2BE", "UTF-8", NULL, &len, &err); |
3651 if (err) { | |
3652 debug_printf("Error converting a unicode message: %s\n", err->message); | |
3653 debug_printf("This really shouldn't happen!\n"); | |
3654 /* We really shouldn't try to send the | |
3655 * IM now, but I'm not sure what to do */ | |
3656 } | |
3850 | 3657 } else if (args.flags & AIM_IMFLAGS_ISO_8859_1) { |
4194 | 3658 debug_printf("Sending ISO-8859-1 IM\n"); |
3659 | 3659 args.msg = g_convert(message, len, "ISO-8859-1", "UTF-8", NULL, &len, &err); |
3660 if (err) { | |
3661 debug_printf("conversion error: %s\n", err->message); | |
3642 | 3662 debug_printf("Someone tell Ethan his 8859-1 detection is wrong\n"); |
3663 args.flags ^= AIM_IMFLAGS_ISO_8859_1 | AIM_IMFLAGS_UNICODE; | |
3664 len = strlen(message); | |
3659 | 3665 args.msg = g_convert(message, len, "UCS-2BE", "UTF8", NULL, &len, &err); |
3666 if (err) { | |
4194 | 3667 debug_printf("Error in unicode fallback: %s\n", err->message); |
3659 | 3668 } |
3642 | 3669 } |
3670 } else { | |
3671 args.msg = message; | |
3672 } | |
3673 args.msglen = len; | |
3008 | 3674 |
3675 ret = aim_send_im_ext(odata->sess, &args); | |
2086 | 3676 } |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
3677 if (ret >= 0) |
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
3678 return 1; |
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
3679 return ret; |
2086 | 3680 } |
3681 | |
3682 static void oscar_get_info(struct gaim_connection *g, char *name) { | |
3683 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3684 if (odata->icq) |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3685 aim_icq_getsimpleinfo(odata->sess, name); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3686 else |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3687 /* people want the away message on the top, so we get the away message |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3688 * first and then get the regular info, since it's too difficult to |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3689 * insert in the middle. i hate people. */ |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3690 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_AWAYMESSAGE); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3691 } |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3692 |
3212 | 3693 static void oscar_get_away(struct gaim_connection *g, char *who) { |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3694 struct oscar_data *odata = (struct oscar_data *)g->proto_data; |
3212 | 3695 if (odata->icq) { |
3696 struct buddy *budlight = find_buddy(g, who); | |
3697 if (budlight) | |
3595 | 3698 if ((budlight->uc & 0xffff0000) >> 16) |
3212 | 3699 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY) |
3595 | 3700 aim_send_im_ch2_geticqmessage(odata->sess, who, (budlight->uc & 0xffff0000) >> 16); |
3212 | 3701 else |
3702 debug_printf("Error: Remote client does not support retrieval of status messages.\n"); | |
3703 else | |
3704 debug_printf("Error: The user %s has no status message, therefore not requesting.\n", who); | |
3705 else | |
3706 debug_printf("Error: Could not find %s in local contact list, therefore unable to request status message.\n", who); | |
3707 } else | |
3708 aim_getinfo(odata->sess, odata->conn, who, AIM_GETINFO_GENERALINFO); | |
2086 | 3709 } |
3710 | |
2920 | 3711 static void oscar_get_caps(struct gaim_connection *g, char *name) { |
3712 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
3713 aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_CAPABILITIES); | |
3714 } | |
3715 | |
3466 | 3716 static void oscar_set_dir(struct gaim_connection *g, const char *first, const char *middle, const char *last, |
3717 const char *maiden, const char *city, const char *state, const char *country, int web) { | |
2086 | 3718 /* FIXME : some of these things are wrong, but i'm lazy */ |
3719 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
3720 aim_setdirectoryinfo(odata->sess, odata->conn, first, middle, last, | |
3721 maiden, NULL, NULL, city, state, NULL, 0, web); | |
3722 } | |
3723 | |
3724 | |
3725 static void oscar_set_idle(struct gaim_connection *g, int time) { | |
3726 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
3727 aim_bos_setidle(odata->sess, odata->conn, time); | |
3728 } | |
3729 | |
3730 static void oscar_set_info(struct gaim_connection *g, char *info) { | |
3731 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
4151 | 3732 gchar *inforeal, *unicode; |
3733 fu32_t flags; | |
3734 int unicode_len; | |
2993 | 3735 |
3736 if (odata->rights.maxsiglen == 0) | |
3427 | 3737 do_error_dialog(_("Unable to set AIM profile."), |
3738 _("You have probably requested to set your profile before the login procedure completed. " | |
3739 "Your profile remains unset; try setting it again when you are fully connected."), GAIM_ERROR); | |
2993 | 3740 |
3741 if (strlen(info) > odata->rights.maxsiglen) { | |
3742 gchar *errstr; | |
3743 | |
3427 | 3744 errstr = g_strdup_printf(_("The maximum profile length of %d bytes has been exceeded. " |
3745 "Gaim has truncated and set it."), odata->rights.maxsiglen); | |
3746 do_error_dialog("Profile too long.", errstr, GAIM_WARNING); | |
2993 | 3747 |
3748 g_free(errstr); | |
3749 } | |
3750 | |
3751 inforeal = g_strndup(info, odata->rights.maxsiglen); | |
3752 | |
3458 | 3753 if (odata->icq) |
4151 | 3754 aim_bos_setprofile(odata->sess, odata->conn, NULL, NULL, 0, NULL, NULL, 0, caps_icq); |
3755 else { | |
3756 flags = check_encoding(inforeal); | |
3757 | |
3758 if (flags == 0) { | |
3759 aim_bos_setprofile(odata->sess, odata->conn, "us-ascii", inforeal, strlen (inforeal), | |
3760 NULL, NULL, 0, caps_aim); | |
3761 } else { | |
3762 unicode = g_convert (inforeal, strlen(inforeal), "UCS-2BE", "UTF-8", NULL, | |
3763 &unicode_len, NULL); | |
3764 aim_bos_setprofile(odata->sess, odata->conn, "unicode-2-0", unicode, unicode_len, | |
3765 NULL, NULL, 0, caps_aim); | |
3766 g_free(unicode); | |
3767 } | |
3768 } | |
2993 | 3769 g_free(inforeal); |
3770 | |
3771 return; | |
2086 | 3772 } |
3773 | |
2993 | 3774 static void oscar_set_away_aim(struct gaim_connection *gc, struct oscar_data *od, const char *message) |
3775 { | |
4151 | 3776 fu32_t flags; |
3777 char *unicode; | |
3778 int unicode_len; | |
2993 | 3779 |
3780 if (od->rights.maxawaymsglen == 0) | |
3427 | 3781 do_error_dialog(_("Unable to set AIM away message."), |
3782 _("You have probably requested to set your away message before the login procedure completed. " | |
3783 "You remain in a \"present\" state; try setting it again when you are fully connected."), GAIM_ERROR); | |
3784 | |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
3785 if (gc->away) { |
2993 | 3786 g_free(gc->away); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
3787 gc->away = NULL; |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
3788 } |
2993 | 3789 |
3790 if (!message) { | |
4151 | 3791 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, NULL, "", 0, caps_aim); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3792 return; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3793 } |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3794 |
2993 | 3795 if (strlen(message) > od->rights.maxawaymsglen) { |
3796 gchar *errstr; | |
3797 | |
3427 | 3798 errstr = g_strdup_printf(_("The away message length of %d bytes has been exceeded. " |
3799 "Gaim has truncated it and set you away."), od->rights.maxawaymsglen); | |
3800 do_error_dialog("Away message too long.", errstr, GAIM_WARNING); | |
2993 | 3801 g_free(errstr); |
3802 } | |
3803 | |
3804 gc->away = g_strndup(message, od->rights.maxawaymsglen); | |
4151 | 3805 flags = check_encoding(message); |
3806 | |
3807 if (flags == 0) { | |
3808 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "us-ascii", gc->away, strlen(gc->away), | |
3809 caps_aim); | |
3810 } else { | |
3811 unicode = g_convert(message, strlen(message), "UCS-2BE", "UTF-8", NULL, &unicode_len, NULL); | |
3812 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "unicode-2-0", unicode, unicode_len, | |
3813 caps_aim); | |
3814 g_free(unicode); | |
3815 } | |
2993 | 3816 |
3817 return; | |
3818 } | |
3819 | |
3820 static void oscar_set_away_icq(struct gaim_connection *gc, struct oscar_data *od, const char *state, const char *message) | |
3821 { | |
3822 | |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
3823 if (gc->away) { |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
3824 g_free(gc->away); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3825 gc->away = NULL; |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
3826 } |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3827 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3828 if (!strcmp(state, "Online")) |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2865
diff
changeset
|
3829 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3830 else if (!strcmp(state, "Away")) { |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3831 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
3832 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3833 } else if (!strcmp(state, "Do Not Disturb")) { |
3212 | 3834 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
3835 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3836 } else if (!strcmp(state, "Not Available")) { |
3101 | 3837 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
3838 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3839 } else if (!strcmp(state, "Occupied")) { |
3212 | 3840 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
3841 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3842 } else if (!strcmp(state, "Free For Chat")) { |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3843 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_CHAT); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
3844 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3845 } else if (!strcmp(state, "Invisible")) { |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3846 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_INVISIBLE); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
3847 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3848 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { |
2998 | 3849 if (message) { |
3101 | 3850 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
3851 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3852 } else { |
2866
6d62d4520460
[gaim-migrate @ 2879]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2865
diff
changeset
|
3853 aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
3854 } |
2086 | 3855 } |
2993 | 3856 |
3857 return; | |
3858 } | |
3859 | |
3860 static void oscar_set_away(struct gaim_connection *gc, char *state, char *message) | |
3861 { | |
3862 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
3863 | |
3864 if (od->icq) | |
3865 oscar_set_away_icq(gc, od, state, message); | |
3866 else | |
3867 oscar_set_away_aim(gc, od, message); | |
3868 | |
3869 return; | |
2086 | 3870 } |
3871 | |
3872 static void oscar_warn(struct gaim_connection *g, char *name, int anon) { | |
3873 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
2113 | 3874 aim_send_warning(odata->sess, odata->conn, name, anon ? AIM_WARN_ANON : 0); |
2086 | 3875 } |
3876 | |
3466 | 3877 static void oscar_dir_search(struct gaim_connection *g, const char *first, const char *middle, const char *last, |
3878 const char *maiden, const char *city, const char *state, const char *country, const char *email) { | |
2086 | 3879 struct oscar_data *odata = (struct oscar_data *)g->proto_data; |
3880 if (strlen(email)) | |
3881 aim_usersearch_address(odata->sess, odata->conn, email); | |
3882 } | |
3883 | |
3466 | 3884 static void oscar_add_buddy(struct gaim_connection *g, const char *name) { |
2086 | 3885 struct oscar_data *odata = (struct oscar_data *)g->proto_data; |
3092 | 3886 if (odata->icq) { |
3887 aim_add_buddy(odata->sess, odata->conn, name); | |
3888 } else { | |
3210 | 3889 if ((odata->sess->ssi.received_data) && !(aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, name, 0x0000))) { |
2995 | 3890 debug_printf("ssi: adding buddy %s to group %s\n", name, find_group_by_buddy(g, name)->name); |
3891 aim_ssi_addbuddies(odata->sess, odata->conn, find_group_by_buddy(g, name)->name, &name, 1); | |
3092 | 3892 } |
2991 | 3893 } |
2086 | 3894 } |
3895 | |
3896 static void oscar_add_buddies(struct gaim_connection *g, GList *buddies) { | |
3897 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
3092 | 3898 if (odata->icq) { |
3899 char buf[MSG_LEN]; | |
3900 int n=0; | |
3901 while (buddies) { | |
3902 if (n > MSG_LEN - 18) { | |
3903 aim_bos_setbuddylist(odata->sess, odata->conn, buf); | |
3904 n = 0; | |
3905 } | |
3906 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", (char *)buddies->data); | |
3907 buddies = buddies->next; | |
3908 } | |
3909 aim_bos_setbuddylist(odata->sess, odata->conn, buf); | |
3910 } else { | |
3911 if (odata->sess->ssi.received_data) { | |
3912 int tmp; | |
3913 GSList *curgrp, *curbud; | |
3914 for (curgrp=g->groups; curgrp; curgrp=g_slist_next(curgrp)) { | |
2995 | 3915 tmp = 0; |
3916 for (curbud=((struct group*)curgrp->data)->members; curbud; curbud=curbud->next) | |
3210 | 3917 if (!aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, ((struct buddy*)curbud->data)->name, 0x0000)) |
2995 | 3918 tmp++; |
3092 | 3919 if (tmp) { |
3920 char **sns = (char **)malloc(tmp*sizeof(char*)); | |
3921 tmp = 0; | |
3922 for (curbud=((struct group*)curgrp->data)->members; curbud; curbud=curbud->next) | |
3210 | 3923 if (!aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, ((struct buddy*)curbud->data)->name, 0x0000)) { |
3092 | 3924 debug_printf("ssi: adding buddy %s to group %s\n", ((struct buddy*)curbud->data)->name, ((struct group*)curgrp->data)->name); |
3925 sns[tmp] = (char *)((struct buddy*)curbud->data)->name; | |
3926 tmp++; | |
3927 } | |
3595 | 3928 aim_ssi_addbuddies(odata->sess, odata->conn, ((struct group*)curgrp->data)->name, (const char**)sns, tmp); |
3092 | 3929 free(sns); |
2995 | 3930 } |
3092 | 3931 } |
2995 | 3932 } |
3933 } | |
3934 } | |
3935 | |
3867 | 3936 static void oscar_move_buddy(struct gaim_connection *g, const char *name, const char *old_group, const char *new_group) { |
3140 | 3937 struct oscar_data *odata = (struct oscar_data *)g->proto_data; |
3938 if (!odata->icq) | |
3939 if (odata->sess->ssi.received_data) { | |
3940 aim_ssi_movebuddy(odata->sess, odata->conn, old_group, new_group, name); | |
3941 debug_printf("ssi: moved buddy %s from group %s to group %s\n", name, old_group, new_group); | |
3942 } | |
3943 } | |
3944 | |
2995 | 3945 static void oscar_remove_buddy(struct gaim_connection *g, char *name, char *group) { |
3946 struct oscar_data *odata = (struct oscar_data *)g->proto_data; | |
3092 | 3947 if (odata->icq) { |
3948 aim_remove_buddy(odata->sess, odata->conn, name); | |
3949 } else { | |
3950 if (odata->sess->ssi.received_data) { | |
3210 | 3951 struct aim_ssi_item *ssigroup; |
3952 while (aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, name, 0x0000) && (ssigroup = aim_ssi_itemlist_findparent(odata->sess->ssi.items, name)) && !aim_ssi_delbuddies(odata->sess, odata->conn, ssigroup->name, &name, 1)) | |
3092 | 3953 debug_printf("ssi: deleted buddy %s from group %s\n", name, group); |
3954 } | |
2995 | 3955 } |
3956 } | |
3957 | |
3867 | 3958 static void oscar_remove_buddies(struct gaim_connection *g, GList *buddies, const char *group) { |
2995 | 3959 struct oscar_data *odata = (struct oscar_data *)g->proto_data; |
3092 | 3960 if (odata->icq) { |
2995 | 3961 GList *cur; |
3962 for (cur=buddies; cur; cur=cur->next) | |
3092 | 3963 aim_remove_buddy(odata->sess, odata->conn, cur->data); |
3964 } else { | |
3965 if (odata->sess->ssi.received_data) { | |
3966 GList *cur; | |
3967 int tmp = 0; | |
2995 | 3968 for (cur=buddies; cur; cur=cur->next) |
3210 | 3969 if (aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, cur->data, 0x0000)) |
2991 | 3970 tmp++; |
3092 | 3971 if (tmp) { |
3972 char **sns; | |
3973 sns = (char **)malloc(tmp*sizeof(char*)); | |
3974 tmp = 0; | |
3975 for (cur=buddies; cur; cur=cur->next) | |
3210 | 3976 if (aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, cur->data, 0x0000)) { |
3092 | 3977 debug_printf("ssi: deleting buddy %s from group %s\n", cur->data, group); |
3978 sns[tmp] = cur->data; | |
3979 tmp++; | |
3980 } | |
3981 aim_ssi_delbuddies(odata->sess, odata->conn, group, sns, tmp); | |
3982 free(sns); | |
3983 } | |
2991 | 3984 } |
3985 } | |
3986 } | |
3987 | |
3867 | 3988 static void oscar_rename_group(struct gaim_connection *g, const char *old_group, const char *new_group, GList *members) { |
3348 | 3989 struct oscar_data *odata = (struct oscar_data *)g->proto_data; |
3990 if (!odata->icq) | |
3991 if (odata->sess->ssi.received_data) { | |
3992 if (aim_ssi_itemlist_finditem(odata->sess->ssi.items, NULL, new_group, 0x0001)) { | |
3993 oscar_remove_buddies(g, members, old_group); | |
3994 oscar_add_buddies(g, members); | |
3995 debug_printf("ssi: moved all buddies from group %s to %s\n", old_group, new_group); | |
3996 } else { | |
3997 aim_ssi_rename_group(odata->sess, odata->conn, old_group, new_group); | |
3998 debug_printf("ssi: renamed group %s to %s\n", old_group, new_group); | |
3999 } | |
4000 } | |
4001 } | |
4002 | |
2991 | 4003 static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) { |
4004 /* XXX - Fix parsing of the ssi rights packet and pass us the data | |
4005 fu16_t maxbuddies, maxgroups, maxpermits, maxdenies; | |
4006 va_list ap; | |
4007 | |
4008 va_start(ap, fr); | |
4009 maxbuddies = (fu16_t)va_arg(ap, unsigned int); | |
4010 maxgroupss = (fu16_t)va_arg(ap, unsigned int); | |
4011 maxpermits = (fu16_t)va_arg(ap, unsigned int); | |
4012 maxdenies = (fu16_t)va_arg(ap, unsigned int); | |
4013 va_end(ap); | |
4014 | |
4015 debug_printf("ssi rights: Max buddies = %d / Max groups = %d / Max permits = %d / Max denies = %d\n", maxbuddies, maxgroups, maxpermits, maxdenies); | |
4016 */ | |
4017 | |
4018 return 1; | |
4019 } | |
4020 | |
4021 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { | |
4022 struct gaim_connection *gc = sess->aux_data; | |
2995 | 4023 struct oscar_data *odata = (struct oscar_data *)gc->proto_data; |
4024 struct aim_ssi_item *curitem; | |
2991 | 4025 int tmp; |
3466 | 4026 const char **sns; |
2991 | 4027 |
4028 debug_printf("ssi: syncing local list and server list\n"); | |
4029 | |
3109 | 4030 if (odata->icq) |
3092 | 4031 return 1; |
4032 | |
2991 | 4033 /* Activate SSI */ |
4034 debug_printf("ssi: activating server-stored buddy list\n"); | |
4035 aim_ssi_enable(sess, fr->conn); | |
4036 | |
4037 /* Clean the buddy list */ | |
3210 | 4038 aim_ssi_cleanlist(sess, fr->conn); |
2991 | 4039 |
4040 /* Add from server list to local list */ | |
4041 tmp = 0; | |
4042 for (curitem=sess->ssi.items; curitem; curitem=curitem->next) { | |
4043 switch (curitem->type) { | |
4044 case 0x0000: /* Buddy */ | |
4045 if ((curitem->name) && (!find_buddy(gc, curitem->name))) { | |
2995 | 4046 struct aim_ssi_item *curgroup = sess->ssi.items; |
2991 | 4047 while (curgroup) { |
4048 if ((curgroup->type == 0x0001) && (curgroup->gid == curitem->gid) && (curgroup->name)) { | |
2995 | 4049 debug_printf("ssi: adding buddy %s to group %s to local list\n", curitem->name, curgroup->name); |
2991 | 4050 add_buddy(gc, curgroup->name, curitem->name, 0); |
4051 tmp++; | |
4052 } | |
4053 curgroup = curgroup->next; | |
4054 } | |
4055 } | |
4056 break; | |
4057 | |
2995 | 4058 case 0x0002: /* Permit buddy */ |
2991 | 4059 if (curitem->name) { |
4060 GSList *list; | |
4061 for (list=gc->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); | |
4062 if (!list) { | |
4063 char *name; | |
2995 | 4064 debug_printf("ssi: adding permit buddy %s to local list\n", curitem->name); |
2991 | 4065 name = g_strdup(normalize(curitem->name)); |
4066 gc->permit = g_slist_append(gc->permit, name); | |
4067 build_allow_list(); | |
4068 tmp++; | |
4069 } | |
4070 } | |
4071 break; | |
4072 | |
2995 | 4073 case 0x0003: /* Deny buddy */ |
2991 | 4074 if (curitem->name) { |
4075 GSList *list; | |
4076 for (list=gc->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); | |
4077 if (!list) { | |
4078 char *name; | |
2995 | 4079 debug_printf("ssi: adding deny buddy %s to local list\n", curitem->name); |
2991 | 4080 name = g_strdup(normalize(curitem->name)); |
4081 gc->deny = g_slist_append(gc->deny, name); | |
4082 build_block_list(); | |
4083 tmp++; | |
4084 } | |
4085 } | |
4086 break; | |
4087 | |
2995 | 4088 case 0x0004: /* Permit/deny setting */ |
2991 | 4089 if (curitem->data) { |
4090 fu8_t permdeny; | |
3210 | 4091 if ((permdeny = aim_ssi_getpermdeny(sess->ssi.items)) && (permdeny != gc->permdeny)) { |
2991 | 4092 debug_printf("ssi: changing permdeny from %d to %d\n", gc->permdeny, permdeny); |
4093 gc->permdeny = permdeny; | |
2995 | 4094 tmp++; |
2991 | 4095 } |
4096 } | |
4097 break; | |
3109 | 4098 |
4099 case 0x0005: /* Presence setting */ | |
4100 /* We don't want to change Gaim's setting because it applies to all accounts */ | |
4101 break; | |
2991 | 4102 } /* End of switch on curitem->type */ |
4103 } /* End of for loop */ | |
4104 if (tmp) | |
4105 do_export(gc); | |
4106 | |
4107 /* Add from local list to server list */ | |
4108 if (gc) { | |
3017 | 4109 GSList *cur; |
4110 | |
2991 | 4111 /* Buddies */ |
3017 | 4112 cur = gc->groups; |
4113 while (cur) { | |
4114 GSList *curbud; | |
2991 | 4115 tmp = 0; |
3017 | 4116 for (curbud=((struct group*)cur->data)->members; curbud; curbud=curbud->next) |
3210 | 4117 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, ((struct buddy*)curbud->data)->name, 0x0000)) |
2991 | 4118 tmp++; |
4119 if (tmp) { | |
3466 | 4120 sns = malloc(tmp*sizeof(char*)); |
3017 | 4121 tmp = 0; |
4122 for (curbud=((struct group*)cur->data)->members; curbud; curbud=curbud->next) | |
3210 | 4123 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, ((struct buddy*)curbud->data)->name, 0x0000)) { |
3017 | 4124 debug_printf("ssi: adding buddy %s from local list to server list\n", ((struct buddy*)curbud->data)->name); |
4125 sns[tmp] = ((char *)((struct buddy*)curbud->data)->name); | |
4126 tmp++; | |
4127 } | |
4128 aim_ssi_addbuddies(sess, fr->conn, ((struct group*)cur->data)->name, sns, tmp); | |
2991 | 4129 free(sns); |
4130 } | |
3017 | 4131 cur = g_slist_next(cur); |
2991 | 4132 } |
4133 | |
4134 /* Permit list */ | |
4135 if (gc->permit) { | |
4136 tmp = 0; | |
3017 | 4137 for (cur=gc->permit; cur; cur=cur->next) |
3210 | 4138 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, cur->data, 0x0002)) |
2991 | 4139 tmp++; |
4140 if (tmp) { | |
3466 | 4141 sns = malloc(tmp*sizeof(char*)); |
3017 | 4142 tmp = 0; |
4143 for (cur=gc->permit; cur; cur=cur->next) | |
3210 | 4144 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, cur->data, 0x0002)) { |
3017 | 4145 debug_printf("ssi: adding permit %s from local list to server list\n", cur->data); |
4146 sns[tmp] = cur->data; | |
4147 tmp++; | |
4148 } | |
4149 aim_ssi_addpord(sess, fr->conn, sns, tmp, AIM_SSI_TYPE_PERMIT); | |
2991 | 4150 free(sns); |
4151 } | |
4152 } | |
4153 | |
4154 /* Deny list */ | |
4155 if (gc->deny) { | |
4156 tmp = 0; | |
3017 | 4157 for (cur=gc->deny; cur; cur=cur->next) |
3210 | 4158 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, cur->data, 0x0003)) |
2991 | 4159 tmp++; |
4160 if (tmp) { | |
3466 | 4161 sns = malloc(tmp*sizeof(char*)); |
3017 | 4162 tmp = 0; |
4163 for (cur=gc->deny; cur; cur=cur->next) | |
3210 | 4164 if (!aim_ssi_itemlist_finditem(sess->ssi.items, NULL, cur->data, 0x0003)) { |
3017 | 4165 debug_printf("ssi: adding deny %s from local list to server list\n", cur->data); |
4166 sns[tmp] = cur->data; | |
4167 tmp++; | |
4168 } | |
4169 aim_ssi_addpord(sess, fr->conn, sns, tmp, AIM_SSI_TYPE_DENY); | |
2991 | 4170 free(sns); |
4171 } | |
4172 } | |
3109 | 4173 |
4174 /* Presence settings (idle time visibility) */ | |
3210 | 4175 if ((tmp = aim_ssi_getpresence(sess->ssi.items)) != 0xFFFFFFFF) |
3109 | 4176 if (report_idle && !(tmp & 0x400)) |
4177 aim_ssi_setpresence(sess, fr->conn, tmp | 0x400); | |
3210 | 4178 |
4179 /* Check for maximum number of buddies */ | |
4180 for (cur=gc->groups, tmp=0; cur; cur=g_slist_next(cur)) { | |
3214 | 4181 struct group* gr = (struct group*)cur->data; |
4182 tmp = tmp + g_slist_length(gr->members); | |
4183 } | |
3210 | 4184 if (tmp > odata->rights.maxbuddies) { |
4185 char *dialog_msg = g_strdup_printf(_("The maximum number of buddies allowed in your buddy list is %d, and you have %d." | |
4186 " Until you are below the limit, some buddies will not show up as online."), | |
4187 odata->rights.maxbuddies, tmp); | |
3427 | 4188 do_error_dialog("Maximum buddy list length exceeded.", dialog_msg, GAIM_WARNING); |
3210 | 4189 g_free(dialog_msg); |
4190 } | |
3214 | 4191 |
3210 | 4192 } /* end if (gc) */ |
3092 | 4193 |
2991 | 4194 return 1; |
2086 | 4195 } |
4196 | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4197 static GList *oscar_chat_info(struct gaim_connection *gc) { |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4198 GList *m = NULL; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4199 struct proto_chat_entry *pce; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4200 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4201 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4202 pce->label = _("Join what group:"); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4203 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4204 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4205 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4206 pce->label = _("Exchange:"); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4207 pce->is_int = TRUE; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4208 pce->min = 4; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4209 pce->max = 20; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4210 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4211 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4212 return m; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4213 } |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4214 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4215 static void oscar_join_chat(struct gaim_connection *g, GList *data) { |
2086 | 4216 struct oscar_data *odata = (struct oscar_data *)g->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4217 aim_conn_t *cur; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4218 char *name; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4219 int *exchange; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4220 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4221 if (!data || !data->next) |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4222 return; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4223 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4224 name = data->data; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4225 exchange = data->next->data; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4226 |
2086 | 4227 debug_printf("Attempting to join chat room %s.\n", name); |
4228 if ((cur = aim_getconn_type(odata->sess, AIM_CONN_TYPE_CHATNAV))) { | |
4229 debug_printf("chatnav exists, creating room\n"); | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
4230 aim_chatnav_createroom(odata->sess, cur, name, *exchange); |
2086 | 4231 } else { |
4232 /* this gets tricky */ | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
4233 struct create_room *cr = g_new0(struct create_room, 1); |
2086 | 4234 debug_printf("chatnav does not exist, opening chatnav\n"); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
4235 cr->exchange = *exchange; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
4236 cr->name = g_strdup(name); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
4237 odata->create_rooms = g_slist_append(odata->create_rooms, cr); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
4238 aim_reqservice(odata->sess, odata->conn, AIM_CONN_TYPE_CHATNAV); |
2086 | 4239 } |
4240 } | |
4241 | |
3466 | 4242 static void oscar_chat_invite(struct gaim_connection *g, int id, const char *message, const char *name) { |
2086 | 4243 struct oscar_data *odata = (struct oscar_data *)g->proto_data; |
4244 struct chat_connection *ccon = find_oscar_chat(g, id); | |
4245 | |
4246 if (!ccon) | |
4247 return; | |
4248 | |
4249 aim_chat_invite(odata->sess, odata->conn, name, message ? message : "", | |
4250 ccon->exchange, ccon->name, 0x0); | |
4251 } | |
4252 | |
4253 static void oscar_chat_leave(struct gaim_connection *g, int id) { | |
4254 struct oscar_data *odata = g ? (struct oscar_data *)g->proto_data : NULL; | |
4255 GSList *bcs = g->buddy_chats; | |
4256 struct conversation *b = NULL; | |
4257 struct chat_connection *c = NULL; | |
4258 int count = 0; | |
4259 | |
4260 while (bcs) { | |
4261 count++; | |
4262 b = (struct conversation *)bcs->data; | |
4263 if (id == b->id) | |
4264 break; | |
4265 bcs = bcs->next; | |
4266 b = NULL; | |
4267 } | |
4268 | |
4269 if (!b) | |
4270 return; | |
4271 | |
4272 debug_printf("Attempting to leave room %s (currently in %d rooms)\n", b->name, count); | |
4273 | |
4274 c = find_oscar_chat(g, b->id); | |
4275 if (c != NULL) { | |
4276 if (odata) | |
4277 odata->oscar_chats = g_slist_remove(odata->oscar_chats, c); | |
4278 if (c->inpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
4279 gaim_input_remove(c->inpa); |
2086 | 4280 if (g && odata->sess) |
4281 aim_conn_kill(odata->sess, &c->conn); | |
4282 g_free(c->name); | |
4283 g_free(c->show); | |
4284 g_free(c); | |
4285 } | |
4286 /* we do this because with Oscar it doesn't tell us we left */ | |
4287 serv_got_chat_left(g, b->id); | |
4288 } | |
4289 | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4290 static int oscar_chat_send(struct gaim_connection *g, int id, char *message) { |
2086 | 4291 struct oscar_data *odata = (struct oscar_data *)g->proto_data; |
4292 GSList *bcs = g->buddy_chats; | |
4293 struct conversation *b = NULL; | |
4294 struct chat_connection *c = NULL; | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4295 char *buf, *buf2; |
2086 | 4296 int i, j; |
4297 | |
4298 while (bcs) { | |
4299 b = (struct conversation *)bcs->data; | |
4300 if (id == b->id) | |
4301 break; | |
4302 bcs = bcs->next; | |
4303 b = NULL; | |
4304 } | |
4305 if (!b) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4306 return -EINVAL; |
2086 | 4307 |
4308 bcs = odata->oscar_chats; | |
4309 while (bcs) { | |
4310 c = (struct chat_connection *)bcs->data; | |
4311 if (b == c->cnv) | |
4312 break; | |
4313 bcs = bcs->next; | |
4314 c = NULL; | |
4315 } | |
4316 if (!c) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4317 return -EINVAL; |
2086 | 4318 |
4319 buf = g_malloc(strlen(message) * 4 + 1); | |
4320 for (i = 0, j = 0; i < strlen(message); i++) { | |
4321 if (message[i] == '\n') { | |
4322 buf[j++] = '<'; | |
4323 buf[j++] = 'B'; | |
4324 buf[j++] = 'R'; | |
4325 buf[j++] = '>'; | |
4326 } else { | |
4327 buf[j++] = message[i]; | |
4328 } | |
4329 } | |
4330 buf[j] = '\0'; | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4331 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4332 if (strlen(buf) > c->maxlen) |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4333 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4334 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4335 buf2 = strip_html(buf); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4336 if (strlen(buf2) > c->maxvis) { |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4337 g_free(buf2); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4338 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4339 } |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4340 g_free(buf2); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4341 |
2086 | 4342 aim_chat_send_im(odata->sess, c->conn, 0, buf, strlen(buf)); |
4343 g_free(buf); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4344 return 0; |
2086 | 4345 } |
4346 | |
4347 static char **oscar_list_icon(int uc) { | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4348 if (uc == 0) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4349 return (char **)icon_online_xpm; |
3595 | 4350 if (uc & 0xffff0000) { |
4351 uc >>= 16; | |
3101 | 4352 if (uc & AIM_ICQ_STATE_INVISIBLE) |
4353 return icon_offline_xpm; | |
4354 if (uc & AIM_ICQ_STATE_CHAT) | |
4355 return icon_ffc_xpm; | |
3212 | 4356 if (uc & AIM_ICQ_STATE_DND) |
4357 return icon_dnd_xpm; | |
4358 if (uc & AIM_ICQ_STATE_OUT) | |
4359 return icon_na_xpm; | |
3101 | 4360 if (uc & AIM_ICQ_STATE_BUSY) |
4361 return icon_occ_xpm; | |
4362 if (uc & AIM_ICQ_STATE_AWAY) | |
4363 return icon_away_xpm; | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4364 return icon_online_xpm; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4365 } |
3101 | 4366 if (uc & UC_UNAVAILABLE) |
4367 return (char **)away_icon_xpm; | |
3079 | 4368 if (uc & UC_WIRELESS) |
4369 return (char **)wireless_icon_xpm; | |
2689 | 4370 if (uc & UC_AB) |
2679 | 4371 return (char **)ab_xpm; |
2086 | 4372 if (uc & UC_AOL) |
4373 return (char **)aol_icon_xpm; | |
4374 if (uc & UC_ADMIN) | |
4375 return (char **)admin_icon_xpm; | |
4376 if (uc & UC_UNCONFIRMED) | |
4377 return (char **)dt_icon_xpm; | |
2297
a0f6ead876ca
[gaim-migrate @ 2307]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2288
diff
changeset
|
4378 if (uc & UC_NORMAL) |
a0f6ead876ca
[gaim-migrate @ 2307]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2288
diff
changeset
|
4379 return (char **)free_icon_xpm; |
2086 | 4380 return NULL; |
4381 } | |
4382 | |
3952 | 4383 /* |
4384 * This is called after the raw data for a file has been transferred (whether | |
4385 * we are sending or receiving), but there are other files remaining. | |
4386 */ | |
3771 | 4387 void oscar_file_transfer_nextfile(struct gaim_connection *gc, |
3630 | 4388 struct file_transfer *xfer) { |
4389 struct oscar_file_transfer *oft = find_oft_by_xfer(gc, xfer); | |
4390 aim_conn_t *conn = oft->conn; | |
4391 aim_session_t *sess = aim_conn_getsess(conn); | |
4392 | |
4393 oft->filesdone++; | |
4394 oft->watcher = gaim_input_add(conn->fd, GAIM_INPUT_READ, | |
4395 oscar_callback, conn); | |
4396 | |
4397 /* If this is an incoming sendfile transfer, we send an OK | |
4398 * message to the sender; if this is an outgoing sendfile, we | |
4399 * will get an OK from the receiver that will be handled in | |
4400 * oscar_sendfile_out_done(), so we don't need to do anything | |
4401 * yet. | |
4402 */ | |
4403 | |
4404 if (oft->type == OFT_SENDFILE_IN) | |
4405 aim_oft_end(sess, conn); | |
4406 } | |
4407 | |
3952 | 4408 /* |
4409 * This is called after the raw data for a file has been transferred (whether | |
4410 * we are sending or receiving), and it is the last file in the set, so we | |
4411 * can tear down the connection. | |
4412 */ | |
3771 | 4413 void oscar_file_transfer_done(struct gaim_connection *gc, |
3630 | 4414 struct file_transfer *xfer) { |
4415 struct oscar_file_transfer *oft = find_oft_by_xfer(gc, xfer); | |
4416 aim_conn_t *conn = oft->conn; | |
4417 aim_session_t *sess = aim_conn_getsess(conn); | |
4418 | |
4419 oft->filesdone++; | |
4420 if (oft->type == OFT_SENDFILE_IN) { | |
4421 aim_oft_end(sess, conn); | |
4422 oscar_file_transfer_disconnect(sess, conn); | |
4423 } | |
4424 else if (oft->type == OFT_SENDFILE_OUT) { | |
4425 /* Wait for response before closing connection. */ | |
4426 oft->watcher = gaim_input_add(conn->fd, GAIM_INPUT_READ, | |
4427 oscar_callback, conn); | |
4428 } | |
4429 } | |
4430 | |
3952 | 4431 /* |
4432 * This is called when there is raw data ready to be sent or received; all the | |
4433 * protocol details have been taken care of. | |
4434 */ | |
3630 | 4435 static int oscar_file_transfer_do(aim_session_t *sess, aim_frame_t *fr, ...) { |
4436 struct gaim_connection *gc = sess->aux_data; | |
4437 va_list ap; | |
4438 aim_conn_t *conn; | |
4439 struct oscar_file_transfer *oft; | |
3771 | 4440 struct aim_fileheader_t *fh; |
3752 | 4441 int err; |
3630 | 4442 |
4443 va_start(ap, fr); | |
4444 conn = va_arg(ap, aim_conn_t *); | |
3771 | 4445 fh = va_arg(ap, struct aim_fileheader_t *); |
4446 va_end(ap); | |
3630 | 4447 |
4448 oft = find_oft_by_conn(gc, conn); | |
4449 | |
4450 /* Don't use the regular input handler for the raw data. */ | |
4451 gaim_input_remove(oft->watcher); | |
4452 oft->watcher = 0; | |
4453 | |
4454 if (oft->type == OFT_SENDFILE_IN) { | |
3952 | 4455 /* AAA convert fh->name from UCS-2 to UTF-8 if (fh->nencode == 0x0002) */ |
4456 err = transfer_in_do(oft->xfer, conn->fd, fh->name, fh->size); | |
3630 | 4457 } |
4458 else { | |
3771 | 4459 err = transfer_out_do(oft->xfer, conn->fd, fh->nrecvd); |
3630 | 4460 } |
4461 | |
3752 | 4462 if (err) { |
4463 /* There was an error; cancel the transfer. */ | |
4464 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4465 aim_conn_t *bosconn = od->conn; | |
4466 aim_canceltransfer(sess, bosconn, oft->cookie, | |
4467 oft->sn, AIM_CAPS_SENDFILE); | |
4468 oscar_file_transfer_disconnect(sess, oft->conn); | |
4469 } | |
4470 | |
3630 | 4471 return 0; |
4472 } | |
4473 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4474 static int gaim_directim_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 4475 va_list ap; |
4476 struct gaim_connection *gc = sess->aux_data; | |
4477 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4478 aim_conn_t *newconn, *listenerconn; |
2235
5d8b6100a9cc
[gaim-migrate @ 2245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2232
diff
changeset
|
4479 struct conversation *cnv; |
2086 | 4480 struct direct_im *dim; |
4481 char buf[256]; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4482 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4483 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4484 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4485 newconn = va_arg(ap, aim_conn_t *); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4486 listenerconn = va_arg(ap, aim_conn_t *); |
2086 | 4487 va_end(ap); |
4488 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4489 aim_conn_close(listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4490 aim_conn_kill(sess, &listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4491 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4492 sn = g_strdup(aim_directim_getsn(newconn)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4493 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4494 debug_printf("DirectIM: initiate success to %s\n", sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4495 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4496 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4497 if (!(cnv = find_conversation(sn))) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4498 cnv = new_conversation(sn); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
4499 gaim_input_remove(dim->watcher); |
2086 | 4500 dim->conn = newconn; |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
4501 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
2086 | 4502 oscar_callback, dim->conn); |
3008 | 4503 dim->connected = TRUE; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4504 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4505 g_free(sn); |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2833
diff
changeset
|
4506 write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL, time(NULL), -1); |
2086 | 4507 |
4508 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, | |
4509 gaim_directim_incoming, 0); | |
4510 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, | |
4511 gaim_directim_typing, 0); | |
3033 | 4512 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, |
2993 | 4513 gaim_update_ui, 0); |
4514 return 1; | |
4515 } | |
4516 | |
4517 static int gaim_update_ui(aim_session_t *sess, aim_frame_t *fr, ...) { | |
4518 va_list ap; | |
4519 char *sn; | |
4520 double percent; | |
4521 struct gaim_connection *gc = sess->aux_data; | |
4522 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4523 struct conversation *c; | |
4524 struct direct_im *dim; | |
4525 | |
4526 va_start(ap, fr); | |
4527 sn = va_arg(ap, char *); | |
4528 percent = va_arg(ap, double); | |
4529 va_end(ap); | |
4530 | |
2994 | 4531 if (!(dim = find_direct_im(od, sn))) |
4532 return 1; | |
3059 | 4533 if (dim->watcher) { |
4534 gaim_input_remove(dim->watcher); /* Otherwise, the callback will callback */ | |
4535 dim->watcher = 0; | |
4536 } | |
3044 | 4537 while (gtk_events_pending()) |
4538 gtk_main_iteration(); | |
4539 | |
2993 | 4540 if ((c = find_conversation(sn))) |
4541 update_progress(c, percent); | |
4542 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, | |
4543 oscar_callback, dim->conn); | |
2086 | 4544 |
4545 return 1; | |
4546 } | |
4547 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4548 static int gaim_directim_incoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 4549 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4550 char *msg, *sn; |
3952 | 4551 int len, encoding; |
2086 | 4552 struct gaim_connection *gc = sess->aux_data; |
4553 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4554 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4555 sn = va_arg(ap, char *); |
2086 | 4556 msg = va_arg(ap, char *); |
2993 | 4557 len = va_arg(ap, int); |
3952 | 4558 encoding = va_arg(ap, int); |
2086 | 4559 va_end(ap); |
4560 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4561 debug_printf("Got DirectIM message from %s\n", sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4562 |
3952 | 4563 /* AAA - I imagine Paco-Paco will want to do some voodoo with the encoding here */ |
2993 | 4564 serv_got_im(gc, sn, msg, 0, time(NULL), len); |
2086 | 4565 |
4566 return 1; | |
4567 } | |
4568 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4569 static int gaim_directim_typing(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 4570 va_list ap; |
4571 char *sn; | |
2993 | 4572 int typing; |
4573 struct gaim_connection *gc = sess->aux_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4574 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4575 va_start(ap, fr); |
2086 | 4576 sn = va_arg(ap, char *); |
2993 | 4577 typing = va_arg(ap, int); |
2086 | 4578 va_end(ap); |
4579 | |
2993 | 4580 if (typing) { |
4581 /* I had to leave this. It's just too funny. It reminds me of my sister. */ | |
4582 debug_printf("ohmigod! %s has started typing (DirectIM). He's going to send you a message! *squeal*\n", sn); | |
3768 | 4583 serv_got_typing(gc,sn,0, TYPING); |
2993 | 4584 } else |
4585 serv_got_typing_stopped(gc,sn); | |
2086 | 4586 return 1; |
4587 } | |
4588 | |
4589 struct ask_do_dir_im { | |
4590 char *who; | |
4591 struct gaim_connection *gc; | |
4592 }; | |
4593 | |
3730 | 4594 static void oscar_cancel_direct_im(struct ask_do_dir_im *data) { |
2086 | 4595 g_free(data); |
4596 } | |
4597 | |
3730 | 4598 static void oscar_direct_im(struct ask_do_dir_im *data) { |
2086 | 4599 struct gaim_connection *gc = data->gc; |
4600 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4601 struct direct_im *dim; | |
4602 | |
4603 dim = find_direct_im(od, data->who); | |
4604 if (dim) { | |
3008 | 4605 if (!(dim->connected)) { /* We'll free the old, unconnected dim, and start over */ |
4606 od->direct_ims = g_slist_remove(od->direct_ims, dim); | |
4607 gaim_input_remove(dim->watcher); | |
4608 g_free(dim); | |
4609 debug_printf("Gave up on old direct IM, trying again\n"); | |
4610 } else { | |
3427 | 4611 do_error_dialog("DirectIM already open.", NULL, GAIM_ERROR); |
3008 | 4612 return; |
4613 } | |
2086 | 4614 } |
4615 dim = g_new0(struct direct_im, 1); | |
4616 dim->gc = gc; | |
4617 g_snprintf(dim->name, sizeof dim->name, "%s", data->who); | |
4618 | |
2717
03bf072c6238
[gaim-migrate @ 2730]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2713
diff
changeset
|
4619 dim->conn = aim_directim_initiate(od->sess, data->who); |
2086 | 4620 if (dim->conn != NULL) { |
4621 od->direct_ims = g_slist_append(od->direct_ims, dim); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
4622 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
2086 | 4623 oscar_callback, dim->conn); |
4624 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINITIATE, | |
4625 gaim_directim_initiate, 0); | |
4626 } else { | |
3427 | 4627 do_error_dialog(_("Unable to open Direct IM"), NULL, GAIM_ERROR); |
2086 | 4628 g_free(dim); |
4629 } | |
4630 } | |
4631 | |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
4632 static void oscar_ask_direct_im(struct gaim_connection *gc, gchar *who) { |
2086 | 4633 char buf[BUF_LONG]; |
4634 struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1); | |
4635 data->who = who; | |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
4636 data->gc = gc; |
3730 | 4637 g_snprintf(buf, sizeof(buf), _("You have selected to open a Direct IM connection with %s."), who); |
4638 do_ask_dialog(buf, _("Because this reveals your IP address, it may be considered a privacy risk. Do you wish to continue?"), data, _("Connect"), oscar_direct_im, _("Cancel"), oscar_cancel_direct_im); | |
2086 | 4639 } |
4640 | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
4641 static void oscar_get_away_msg(struct gaim_connection *gc, char *who) { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
4642 struct oscar_data *od = gc->proto_data; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
4643 od->evilhack = g_slist_append(od->evilhack, g_strdup(normalize(who))); |
3212 | 4644 if (od->icq) { |
4645 struct buddy *budlight = find_buddy(gc, who); | |
4646 if (budlight) | |
3595 | 4647 if ((budlight->uc >> 16) & (AIM_ICQ_STATE_AWAY || AIM_ICQ_STATE_DND || AIM_ICQ_STATE_OUT || AIM_ICQ_STATE_BUSY || AIM_ICQ_STATE_CHAT)) |
3212 | 4648 if (budlight->caps & AIM_CAPS_ICQSERVERRELAY) |
3595 | 4649 aim_send_im_ch2_geticqmessage(od->sess, who, (budlight->uc & 0xffff0000) >> 16); |
3212 | 4650 else { |
3595 | 4651 char *state_msg = gaim_icq_status((budlight->uc & 0xffff0000) >> 16); |
3952 | 4652 char *dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<BR><HR><I>Remote client does not support sending status messages.</I><BR>"), who, state_msg); |
3212 | 4653 g_show_info_text(gc, who, 2, dialog_msg, NULL); |
4654 free(state_msg); | |
4655 free(dialog_msg); | |
4656 } | |
4657 else { | |
3595 | 4658 char *state_msg = gaim_icq_status((budlight->uc & 0xffff0000) >> 16); |
3952 | 4659 char *dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<BR><HR><I>User has no status message.</I><BR>"), who, state_msg); |
3212 | 4660 g_show_info_text(gc, who, 2, dialog_msg, NULL); |
4661 free(state_msg); | |
4662 free(dialog_msg); | |
4663 } | |
4664 else | |
3427 | 4665 do_error_dialog("Could not find contact in local list, therefore unable to request status message.\n", NULL, GAIM_ERROR); |
3212 | 4666 } else |
4667 oscar_get_info(gc, who); | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
4668 } |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
4669 |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
4670 static GList *oscar_buddy_menu(struct gaim_connection *gc, char *who) { |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
4671 GList *m = NULL; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
4672 struct proto_buddy_menu *pbm; |
2086 | 4673 char *n = g_strdup(normalize(gc->username)); |
2833
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
4674 struct oscar_data *odata = gc->proto_data; |
2086 | 4675 |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
4676 pbm = g_new0(struct proto_buddy_menu, 1); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
4677 pbm->label = _("Get Info"); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
4678 pbm->callback = oscar_get_info; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
4679 pbm->gc = gc; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
4680 m = g_list_append(m, pbm); |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
4681 |
3212 | 4682 if (odata->icq) { |
4683 pbm = g_new0(struct proto_buddy_menu, 1); | |
4684 pbm->label = _("Get Status Msg"); | |
4685 pbm->callback = oscar_get_away_msg; | |
4686 pbm->gc = gc; | |
4687 m = g_list_append(m, pbm); | |
4688 } else { | |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
4689 pbm = g_new0(struct proto_buddy_menu, 1); |
2833
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
4690 pbm->label = _("Get Away Msg"); |
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
4691 pbm->callback = oscar_get_away_msg; |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
4692 pbm->gc = gc; |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
4693 m = g_list_append(m, pbm); |
2833
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
4694 |
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
4695 if (strcmp(n, normalize(who))) { |
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
4696 pbm = g_new0(struct proto_buddy_menu, 1); |
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
4697 pbm->label = _("Direct IM"); |
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
4698 pbm->callback = oscar_ask_direct_im; |
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
4699 pbm->gc = gc; |
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
4700 m = g_list_append(m, pbm); |
3752 | 4701 |
4702 pbm = g_new0(struct proto_buddy_menu, 1); | |
4703 pbm->label = _("Send File"); | |
4704 pbm->callback = oscar_ask_send_file; | |
4705 pbm->gc = gc; | |
4706 m = g_list_append(m, pbm); | |
2833
cdbe6e2f0ff2
[gaim-migrate @ 2846]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2822
diff
changeset
|
4707 } |
2086 | 4708 } |
2920 | 4709 |
4710 pbm = g_new0(struct proto_buddy_menu, 1); | |
4711 pbm->label = _("Get Capabilities"); | |
4712 pbm->callback = oscar_get_caps; | |
4713 pbm->gc = gc; | |
4714 m = g_list_append(m, pbm); | |
4715 | |
2086 | 4716 g_free(n); |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
4717 |
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
4718 return m; |
2086 | 4719 } |
4720 | |
3456 | 4721 static GList *oscar_edit_buddy_menu(struct gaim_connection *gc, char *who) |
4722 { | |
4723 GList *m = NULL; | |
4724 struct proto_buddy_menu *pbm; | |
4725 struct oscar_data *odata = gc->proto_data; | |
4726 | |
4727 if (odata->icq) { | |
4728 pbm = g_new0(struct proto_buddy_menu, 1); | |
4729 pbm->label = _("Get Info"); | |
4730 pbm->callback = oscar_get_info; | |
4731 pbm->gc = gc; | |
4732 m = g_list_append(m, pbm); | |
4733 } | |
4734 | |
4735 return m; | |
4736 } | |
4737 | |
2086 | 4738 static void oscar_set_permit_deny(struct gaim_connection *gc) { |
4739 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
2995 | 4740 if (od->icq) { |
3783 | 4741 GSList *list, *g; |
2995 | 4742 char buf[MAXMSGLEN]; |
4743 int at; | |
4744 | |
4745 switch(gc->permdeny) { | |
4746 case 1: | |
4747 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gc->username); | |
4748 break; | |
4749 case 2: | |
4750 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gc->username); | |
4751 break; | |
4752 case 3: | |
4753 list = gc->permit; | |
4754 at = 0; | |
4755 while (list) { | |
4756 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
4757 list = list->next; | |
4758 } | |
4759 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); | |
4760 break; | |
4761 case 4: | |
4762 list = gc->deny; | |
4763 at = 0; | |
4764 while (list) { | |
4765 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
4766 list = list->next; | |
4767 } | |
4768 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf); | |
4769 break; | |
3782 | 4770 case 5: |
3783 | 4771 g = gc->groups; |
4151 | 4772 at = 0; |
3782 | 4773 while (g) { |
4774 list = ((struct group *)g->data)->members; | |
4775 while (list) { | |
4151 | 4776 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", ((struct buddy *)list->data)->name); |
3782 | 4777 list = list->next; |
4778 } | |
4779 g = g->next; | |
4780 } | |
4781 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); | |
4782 break; | |
4783 default: | |
2995 | 4784 break; |
2086 | 4785 } |
2995 | 4786 signoff_blocked(gc); |
4787 } else { | |
4788 if (od->sess->ssi.received_data) | |
3210 | 4789 aim_ssi_setpermdeny(od->sess, od->conn, gc->permdeny, 0xffffffff); |
2086 | 4790 } |
4791 } | |
4792 | |
4793 static void oscar_add_permit(struct gaim_connection *gc, char *who) { | |
2991 | 4794 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2995 | 4795 if (od->icq) { |
4796 if (gc->permdeny != 3) return; | |
4797 oscar_set_permit_deny(gc); | |
4798 } else { | |
4799 debug_printf("ssi: About to add a permit\n"); | |
4800 if (od->sess->ssi.received_data) | |
3466 | 4801 aim_ssi_addpord(od->sess, od->conn, (const char **) &who, 1, AIM_SSI_TYPE_PERMIT); |
2995 | 4802 } |
2086 | 4803 } |
4804 | |
4805 static void oscar_add_deny(struct gaim_connection *gc, char *who) { | |
2991 | 4806 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2995 | 4807 if (od->icq) { |
4808 if (gc->permdeny != 4) return; | |
4809 oscar_set_permit_deny(gc); | |
4810 } else { | |
4811 debug_printf("ssi: About to add a deny\n"); | |
4812 if (od->sess->ssi.received_data) | |
3466 | 4813 aim_ssi_addpord(od->sess, od->conn, (const char **) &who, 1, AIM_SSI_TYPE_DENY); |
2995 | 4814 } |
2086 | 4815 } |
4816 | |
4817 static void oscar_rem_permit(struct gaim_connection *gc, char *who) { | |
2991 | 4818 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2995 | 4819 if (od->icq) { |
4820 if (gc->permdeny != 3) return; | |
4821 oscar_set_permit_deny(gc); | |
4822 } else { | |
4823 debug_printf("ssi: About to delete a permit\n"); | |
4824 if (od->sess->ssi.received_data) | |
3595 | 4825 aim_ssi_delpord(od->sess, od->conn, (const char **) &who, 1, AIM_SSI_TYPE_PERMIT); |
2995 | 4826 } |
2086 | 4827 } |
4828 | |
4829 static void oscar_rem_deny(struct gaim_connection *gc, char *who) { | |
2991 | 4830 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2995 | 4831 if (od->icq) { |
4832 if (gc->permdeny != 4) return; | |
4833 oscar_set_permit_deny(gc); | |
4834 } else { | |
4835 debug_printf("ssi: About to delete a deny\n"); | |
4836 if (od->sess->ssi.received_data) | |
3595 | 4837 aim_ssi_delpord(od->sess, od->conn, (const char **) &who, 1, AIM_SSI_TYPE_DENY); |
2995 | 4838 } |
2086 | 4839 } |
4840 | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4841 static GList *oscar_away_states(struct gaim_connection *gc) |
2086 | 4842 { |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4843 struct oscar_data *od = gc->proto_data; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4844 GList *m = NULL; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4845 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4846 if (!od->icq) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4847 return g_list_append(m, GAIM_AWAY_CUSTOM); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4848 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4849 m = g_list_append(m, "Online"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4850 m = g_list_append(m, "Away"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4851 m = g_list_append(m, "Do Not Disturb"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4852 m = g_list_append(m, "Not Available"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4853 m = g_list_append(m, "Occupied"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4854 m = g_list_append(m, "Free For Chat"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4855 m = g_list_append(m, "Invisible"); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4856 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4857 return m; |
2086 | 4858 } |
4859 | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4860 static void oscar_change_email(struct gaim_connection *gc, char *email) |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4861 { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4862 struct oscar_data *od = gc->proto_data; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4863 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4864 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4865 if (conn) { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4866 aim_admin_setemail(od->sess, conn, email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4867 } else { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4868 od->setemail = TRUE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4869 od->email = g_strdup(email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4870 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4871 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4872 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4873 |
2979 | 4874 static void oscar_format_screenname(struct gaim_connection *gc, char *nick) { |
4875 struct oscar_data *od = gc->proto_data; | |
3031 | 4876 if (!strcmp(normalize(nick), normalize(gc->username))) { |
2979 | 4877 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { |
4878 od->setnick = TRUE; | |
4879 od->newsn = g_strdup(nick); | |
4880 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
4881 } else { | |
4882 aim_admin_setnick(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH), nick); | |
4883 } | |
4884 } else { | |
3427 | 4885 do_error_dialog("The new formatting is invalid.", |
4886 "Screenname formatting can change only capitalization and whitespace.", GAIM_ERROR); | |
2979 | 4887 } |
4888 } | |
4889 | |
2086 | 4890 static void oscar_do_action(struct gaim_connection *gc, char *act) |
4891 { | |
4892 struct oscar_data *od = gc->proto_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4893 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
2086 | 4894 |
4895 if (!strcmp(act, "Set User Info")) { | |
4896 show_set_info(gc); | |
4897 } else if (!strcmp(act, "Change Password")) { | |
4898 show_change_passwd(gc); | |
2979 | 4899 } else if (!strcmp(act, "Format Screenname")) { |
4900 do_prompt_dialog("New screenname formatting:", | |
4901 gc->displayname, gc, oscar_format_screenname, NULL); | |
2086 | 4902 } else if (!strcmp(act, "Confirm Account")) { |
4903 if (!conn) { | |
4904 od->conf = TRUE; | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
4905 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
2086 | 4906 } else |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
4907 aim_admin_reqconfirm(od->sess, conn); |
2086 | 4908 } else if (!strcmp(act, "Display Current Registered Address")) { |
4909 if (!conn) { | |
4910 od->reqemail = TRUE; | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
4911 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
2086 | 4912 } else |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
4913 aim_admin_getinfo(od->sess, conn, 0x11); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4914 } else if (!strcmp(act, "Change Current Registered Address")) { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4915 do_prompt_dialog("Change Address To: ", NULL, gc, oscar_change_email, NULL); |
2086 | 4916 } else if (!strcmp(act, "Search for Buddy by Email")) { |
4917 show_find_email(gc); | |
4918 } | |
4919 } | |
4920 | |
4921 static GList *oscar_actions() | |
4922 { | |
4923 GList *m = NULL; | |
4924 | |
4925 m = g_list_append(m, "Set User Info"); | |
4926 m = g_list_append(m, NULL); | |
4927 m = g_list_append(m, "Change Password"); | |
2979 | 4928 m = g_list_append(m, "Format Screenname"); |
2086 | 4929 m = g_list_append(m, "Confirm Account"); |
4930 m = g_list_append(m, "Display Current Registered Address"); | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4931 m = g_list_append(m, "Change Current Registered Address"); |
2086 | 4932 m = g_list_append(m, NULL); |
4933 m = g_list_append(m, "Search for Buddy by Email"); | |
4934 | |
4935 return m; | |
4936 } | |
4937 | |
3466 | 4938 static void oscar_change_passwd(struct gaim_connection *gc, const char *old, const char *new) |
2086 | 4939 { |
4940 struct oscar_data *od = gc->proto_data; | |
4941 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { | |
4942 od->chpass = TRUE; | |
4943 od->oldp = g_strdup(old); | |
4944 od->newp = g_strdup(new); | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
4945 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
2086 | 4946 } else { |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
4947 aim_admin_changepasswd(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH), |
2086 | 4948 new, old); |
4949 } | |
4950 } | |
4951 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4952 static void oscar_convo_closed(struct gaim_connection *gc, char *who) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4953 { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4954 struct oscar_data *od = gc->proto_data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4955 struct direct_im *dim = find_direct_im(od, who); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4956 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4957 if (!dim) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4958 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4959 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4960 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4961 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4962 aim_conn_kill(od->sess, &dim->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4963 g_free(dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4964 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4965 |
4151 | 4966 static fu32_t check_encoding(const char *utf8) |
4967 { | |
4968 int i = 0; | |
4969 fu32_t encodingflag = 0; | |
4970 | |
4971 /* Determine how we can send this message. Per the | |
4972 * warnings elsewhere in this file, these little | |
4973 * checks determine the simplest encoding we can use | |
4974 * for a given message send using it. */ | |
4975 while (utf8[i]) { | |
4976 if ((unsigned char)utf8[i] > 0x7f) { | |
4977 /* not ASCII! */ | |
4978 encodingflag = AIM_IMFLAGS_ISO_8859_1; | |
4979 break; | |
4980 } | |
4981 i++; | |
4982 } | |
4983 while (utf8[i]) { | |
4984 /* ISO-8859-1 is 0x00-0xbf in the first byte | |
4985 * followed by 0xc0-0xc3 in the second */ | |
4986 if ((unsigned char)utf8[i] < 0x80) { | |
4987 i++; | |
4988 continue; | |
4989 } else if (((unsigned char)utf8[i] & 0xfc) == 0xc0 && | |
4990 ((unsigned char)utf8[i + 1] & 0xc0) == 0x80) { | |
4991 i += 2; | |
4992 continue; | |
4993 } | |
4994 encodingflag = AIM_IMFLAGS_UNICODE; | |
4995 break; | |
4996 } | |
4997 | |
4998 return encodingflag; | |
4999 } | |
5000 | |
5001 static fu32_t parse_encoding(const char *enc) | |
5002 { | |
5003 char *charset; | |
5004 | |
5005 /* If anything goes wrong, fall back on ASCII and print a message */ | |
5006 charset = strstr(enc, "charset="); | |
5007 if (charset == NULL) { | |
5008 debug_printf("No charset specified for info, assuming ASCII\n"); | |
5009 return 0; | |
5010 } | |
5011 charset += 8; | |
5012 if (!strcmp(charset, "\"us-ascii\"")) { | |
5013 return 0; | |
4166 | 5014 } else if (!strcmp(charset, "\"iso-8859-1\"")) { |
5015 return AIM_IMFLAGS_ISO_8859_1; | |
4151 | 5016 } else if (!strcmp(charset, "\"unicode-2-0\"")) { |
5017 return AIM_IMFLAGS_UNICODE; | |
5018 } else { | |
5019 debug_printf("Unrecognized character set '%s', using ASCII\n", charset); | |
5020 return 0; | |
5021 } | |
5022 } | |
3035 | 5023 |
2086 | 5024 static struct prpl *my_protocol = NULL; |
5025 | |
3630 | 5026 G_MODULE_EXPORT void oscar_init(struct prpl *ret) { |
3572 | 5027 struct proto_user_opt *puo; |
2086 | 5028 ret->protocol = PROTO_OSCAR; |
3694 | 5029 ret->options = OPT_PROTO_MAIL_CHECK | OPT_PROTO_BUDDY_ICON | OPT_PROTO_IM_IMAGE; |
3858 | 5030 ret->name = g_strdup("AIM/ICQ"); |
2086 | 5031 ret->list_icon = oscar_list_icon; |
5032 ret->away_states = oscar_away_states; | |
5033 ret->actions = oscar_actions; | |
5034 ret->do_action = oscar_do_action; | |
5035 ret->buddy_menu = oscar_buddy_menu; | |
3456 | 5036 ret->edit_buddy_menu = oscar_edit_buddy_menu; |
2086 | 5037 ret->login = oscar_login; |
5038 ret->close = oscar_close; | |
5039 ret->send_im = oscar_send_im; | |
2993 | 5040 ret->send_typing = oscar_send_typing; |
2086 | 5041 ret->set_info = oscar_set_info; |
5042 ret->get_info = oscar_get_info; | |
5043 ret->set_away = oscar_set_away; | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
5044 ret->get_away = oscar_get_away; |
2086 | 5045 ret->set_dir = oscar_set_dir; |
5046 ret->get_dir = NULL; /* Oscar really doesn't have this */ | |
5047 ret->dir_search = oscar_dir_search; | |
5048 ret->set_idle = oscar_set_idle; | |
5049 ret->change_passwd = oscar_change_passwd; | |
5050 ret->add_buddy = oscar_add_buddy; | |
5051 ret->add_buddies = oscar_add_buddies; | |
3140 | 5052 ret->group_buddy = oscar_move_buddy; |
3348 | 5053 ret->rename_group = oscar_rename_group; |
3771 | 5054 ret->file_transfer_cancel = oscar_file_transfer_cancel; |
5055 ret->file_transfer_in = oscar_file_transfer_in; | |
5056 ret->file_transfer_out = oscar_file_transfer_out; | |
5057 ret->file_transfer_data_chunk = oscar_file_transfer_data_chunk; | |
5058 ret->file_transfer_nextfile = oscar_file_transfer_nextfile; | |
5059 ret->file_transfer_done = oscar_file_transfer_done; | |
2086 | 5060 ret->remove_buddy = oscar_remove_buddy; |
2991 | 5061 ret->remove_buddies = oscar_remove_buddies; |
2086 | 5062 ret->add_permit = oscar_add_permit; |
5063 ret->add_deny = oscar_add_deny; | |
5064 ret->rem_permit = oscar_rem_permit; | |
5065 ret->rem_deny = oscar_rem_deny; | |
5066 ret->set_permit_deny = oscar_set_permit_deny; | |
5067 ret->warn = oscar_warn; | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5068 ret->chat_info = oscar_chat_info; |
2086 | 5069 ret->join_chat = oscar_join_chat; |
5070 ret->chat_invite = oscar_chat_invite; | |
5071 ret->chat_leave = oscar_chat_leave; | |
5072 ret->chat_whisper = NULL; | |
5073 ret->chat_send = oscar_chat_send; | |
5074 ret->keepalive = oscar_keepalive; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5075 ret->convo_closed = oscar_convo_closed; |
2086 | 5076 |
3572 | 5077 puo = g_new0(struct proto_user_opt, 1); |
5078 puo->label = g_strdup("Auth Host:"); | |
5079 puo->def = g_strdup("login.oscar.aol.com"); | |
5080 puo->pos = USEROPT_AUTH; | |
5081 ret->user_opts = g_list_append(ret->user_opts, puo); | |
5082 | |
5083 puo = g_new0(struct proto_user_opt, 1); | |
5084 puo->label = g_strdup("Auth Port:"); | |
5085 puo->def = g_strdup("5190"); | |
5086 puo->pos = USEROPT_AUTHPORT; | |
5087 ret->user_opts = g_list_append(ret->user_opts, puo); | |
5088 | |
2086 | 5089 my_protocol = ret; |
5090 } | |
5091 | |
5092 #ifndef STATIC | |
5093 | |
3630 | 5094 G_MODULE_EXPORT void gaim_prpl_init(struct prpl *prpl) |
2086 | 5095 { |
3572 | 5096 oscar_init(prpl); |
5097 prpl->plug->desc.api_version = PLUGIN_API_VERSION; | |
2086 | 5098 } |
5099 | |
5100 #endif |