Mercurial > pidgin
annotate src/protocols/oscar/oscar.c @ 5136:381da05cb5ed
[gaim-migrate @ 5500]
this started out as simply adding an option to right-click on a jabber buddy
and re-request authorization. Then I ended up chasing the disgusting mess
of const vs non-const parameters all over gaim.
The end result is that you can now right-click on jabber buddies and
re-request auth like you can for ICQ. Also, a lot more things are const
that should be, I fixed a bug or two, and I cleaned up one of my least
favorite functions in gaim (linkify_text). It is now decidedly less evil.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Tue, 15 Apr 2003 04:18:00 +0000 |
parents | 2acc2ee66597 |
children | ac9ca88d4b25 |
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> |
4617 | 28 /* this must happen before sys/socket.h or freebsd won't compile */ |
3664 | 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 | |
4608 | 47 #include "gaim.h" |
2086 | 48 #include "multi.h" |
49 #include "prpl.h" | |
4373
dcc6c130c6d9
[gaim-migrate @ 4639]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4366
diff
changeset
|
50 #include "core.h" |
4889 | 51 #include "proxy.h" |
2086 | 52 #include "aim.h" |
53 | |
3630 | 54 #ifdef _WIN32 |
55 #include "win32dep.h" | |
56 #endif | |
57 | |
2086 | 58 /* constants to identify proto_opts */ |
59 #define USEROPT_AUTH 0 | |
60 #define USEROPT_AUTHPORT 1 | |
61 | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
62 #define UC_AOL 0x02 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
63 #define UC_ADMIN 0x04 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
64 #define UC_UNCONFIRMED 0x08 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
65 #define UC_NORMAL 0x10 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
66 #define UC_AB 0x20 |
3079 | 67 #define UC_WIRELESS 0x40 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
68 |
2086 | 69 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" |
70 | |
4249 | 71 static struct prpl *my_protocol = NULL; |
72 | |
3630 | 73 /* For win32 compatability */ |
74 G_MODULE_IMPORT GSList *connections; | |
75 G_MODULE_IMPORT int report_idle; | |
76 | |
4811 | 77 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_IMIMAGE | AIM_CAPS_SENDFILE | AIM_CAPS_INTEROPERATE; |
78 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_IMIMAGE | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8 | AIM_CAPS_INTEROPERATE; | |
3458 | 79 |
4665 | 80 static fu8_t features_aim[] = {0x01, 0x01, 0x01, 0x02}; |
81 static fu8_t features_icq[] = {0x01, 0x06}; | |
2086 | 82 |
83 struct oscar_data { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
84 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
85 aim_conn_t *conn; |
2086 | 86 |
87 guint cnpa; | |
88 guint paspa; | |
3694 | 89 guint emlpa; |
4804 | 90 guint icopa; |
2086 | 91 |
4823 | 92 gboolean iconconnecting; |
93 | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
94 GSList *create_rooms; |
2086 | 95 |
96 gboolean conf; | |
97 gboolean reqemail; | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
98 gboolean setemail; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
99 char *email; |
2979 | 100 gboolean setnick; |
101 char *newsn; | |
2086 | 102 gboolean chpass; |
103 char *oldp; | |
104 char *newp; | |
105 | |
106 GSList *oscar_chats; | |
107 GSList *direct_ims; | |
3630 | 108 GSList *file_transfers; |
4738 | 109 GHashTable *buddyinfo; |
4804 | 110 GSList *requesticon; |
2086 | 111 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
112 gboolean killme; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
113 gboolean icq; |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
114 GSList *evilhack; |
4804 | 115 guint icontimer; |
2993 | 116 |
117 struct { | |
4230 | 118 guint maxwatchers; /* max users who can watch you */ |
2993 | 119 guint maxbuddies; /* max users you can watch */ |
4230 | 120 guint maxgroups; /* max groups in server list */ |
2993 | 121 guint maxpermits; /* max users on permit list */ |
122 guint maxdenies; /* max users on deny list */ | |
123 guint maxsiglen; /* max size (bytes) of profile */ | |
124 guint maxawaymsglen; /* max size (bytes) of posted away message */ | |
125 } rights; | |
2086 | 126 }; |
127 | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
128 struct create_room { |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
129 char *name; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
130 int exchange; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
131 }; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
132 |
2086 | 133 struct chat_connection { |
134 char *name; | |
135 char *show; /* AOL did something funny to us */ | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
136 fu16_t exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
137 fu16_t instance; |
2086 | 138 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
|
139 aim_conn_t *conn; |
2086 | 140 int inpa; |
141 int id; | |
142 struct gaim_connection *gc; /* i hate this. */ | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
143 struct gaim_conversation *cnv; /* bah. */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
144 int maxlen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
145 int maxvis; |
2086 | 146 }; |
147 | |
148 struct direct_im { | |
149 struct gaim_connection *gc; | |
150 char name[80]; | |
151 int watcher; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
152 aim_conn_t *conn; |
3008 | 153 gboolean connected; |
2086 | 154 }; |
155 | |
156 struct ask_direct { | |
157 struct gaim_connection *gc; | |
158 char *sn; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
159 char ip[64]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
160 fu8_t cookie[8]; |
2086 | 161 }; |
162 | |
4617 | 163 /* BBB */ |
164 struct oscar_xfer_data { | |
165 fu8_t cookie[8]; | |
4898 | 166 gchar *proxyip; |
4656 | 167 gchar *clientip; |
4898 | 168 gchar *verifiedip; |
4646 | 169 fu32_t modtime; |
170 fu32_t checksum; | |
3630 | 171 aim_conn_t *conn; |
4617 | 172 struct gaim_xfer *xfer; |
173 struct gaim_connection *gc; | |
3630 | 174 }; |
175 | |
4738 | 176 /* Various PRPL-specific buddy info that we want to keep track of */ |
177 struct buddyinfo { | |
178 time_t signon; | |
179 int caps; | |
180 gboolean typingnot; | |
181 | |
182 unsigned long ico_len; | |
183 unsigned long ico_csum; | |
184 time_t ico_time; | |
185 gboolean ico_need; | |
186 | |
187 unsigned long ico_me_len; | |
188 unsigned long ico_me_csum; | |
189 time_t ico_me_time; | |
190 gboolean ico_informed; | |
4804 | 191 |
4853 | 192 fu16_t iconcsumlen; |
193 fu8_t iconcsum[30]; | |
2086 | 194 }; |
195 | |
4230 | 196 struct name_data { |
3141 | 197 struct gaim_connection *gc; |
4230 | 198 gchar *name; |
3453 | 199 gchar *nick; |
3141 | 200 }; |
201 | |
5129 | 202 static char *msgerrreason[] = { |
203 N_("Invalid error"), | |
204 N_("Invalid SNAC"), | |
205 N_("Rate to host"), | |
206 N_("Rate to client"), | |
207 N_("Not logged in"), | |
208 N_("Service unavailable"), | |
209 N_("Service not defined"), | |
210 N_("Obsolete SNAC"), | |
211 N_("Not supported by host"), | |
212 N_("Not supported by client"), | |
213 N_("Refused by client"), | |
214 N_("Reply too big"), | |
215 N_("Responses lost"), | |
216 N_("Request denied"), | |
217 N_("Busted SNAC payload"), | |
218 N_("Insufficient rights"), | |
219 N_("In local permit/deny"), | |
220 N_("Too evil (sender)"), | |
221 N_("Too evil (receiver)"), | |
222 N_("User temporarily unavailable"), | |
223 N_("No match"), | |
224 N_("List overflow"), | |
225 N_("Request ambiguous"), | |
226 N_("Queue full"), | |
227 N_("Not while on AOL") | |
228 }; | |
229 static int msgerrreasonlen = 25; | |
230 | |
231 /* All the libfaim->gaim callback functions */ | |
232 static int gaim_parse_auth_resp (aim_session_t *, aim_frame_t *, ...); | |
233 static int gaim_parse_login (aim_session_t *, aim_frame_t *, ...); | |
234 static int gaim_handle_redirect (aim_session_t *, aim_frame_t *, ...); | |
235 static int gaim_info_change (aim_session_t *, aim_frame_t *, ...); | |
236 static int gaim_account_confirm (aim_session_t *, aim_frame_t *, ...); | |
237 static int gaim_parse_oncoming (aim_session_t *, aim_frame_t *, ...); | |
238 static int gaim_parse_offgoing (aim_session_t *, aim_frame_t *, ...); | |
239 static int gaim_parse_incoming_im(aim_session_t *, aim_frame_t *, ...); | |
240 static int gaim_parse_misses (aim_session_t *, aim_frame_t *, ...); | |
241 static int gaim_parse_clientauto (aim_session_t *, aim_frame_t *, ...); | |
242 static int gaim_parse_user_info (aim_session_t *, aim_frame_t *, ...); | |
243 static int gaim_parse_motd (aim_session_t *, aim_frame_t *, ...); | |
244 static int gaim_chatnav_info (aim_session_t *, aim_frame_t *, ...); | |
245 static int gaim_chat_join (aim_session_t *, aim_frame_t *, ...); | |
246 static int gaim_chat_leave (aim_session_t *, aim_frame_t *, ...); | |
247 static int gaim_chat_info_update (aim_session_t *, aim_frame_t *, ...); | |
248 static int gaim_chat_incoming_msg(aim_session_t *, aim_frame_t *, ...); | |
249 static int gaim_email_parseupdate(aim_session_t *, aim_frame_t *, ...); | |
250 static int gaim_icon_error (aim_session_t *, aim_frame_t *, ...); | |
251 static int gaim_icon_parseicon (aim_session_t *, aim_frame_t *, ...); | |
252 static int gaim_parse_msgack (aim_session_t *, aim_frame_t *, ...); | |
253 static int gaim_parse_ratechange (aim_session_t *, aim_frame_t *, ...); | |
254 static int gaim_parse_evilnotify (aim_session_t *, aim_frame_t *, ...); | |
255 static int gaim_parse_searcherror(aim_session_t *, aim_frame_t *, ...); | |
256 static int gaim_parse_searchreply(aim_session_t *, aim_frame_t *, ...); | |
257 static int gaim_bosrights (aim_session_t *, aim_frame_t *, ...); | |
258 static int gaim_connerr (aim_session_t *, aim_frame_t *, ...); | |
259 static int conninitdone_admin (aim_session_t *, aim_frame_t *, ...); | |
260 static int conninitdone_bos (aim_session_t *, aim_frame_t *, ...); | |
261 static int conninitdone_chatnav (aim_session_t *, aim_frame_t *, ...); | |
262 static int conninitdone_chat (aim_session_t *, aim_frame_t *, ...); | |
263 static int conninitdone_email (aim_session_t *, aim_frame_t *, ...); | |
264 static int conninitdone_icon (aim_session_t *, aim_frame_t *, ...); | |
265 static int gaim_parse_msgerr (aim_session_t *, aim_frame_t *, ...); | |
266 static int gaim_parse_mtn (aim_session_t *, aim_frame_t *, ...); | |
267 static int gaim_parse_locaterights(aim_session_t *, aim_frame_t *, ...); | |
268 static int gaim_parse_buddyrights(aim_session_t *, aim_frame_t *, ...); | |
269 static int gaim_parse_locerr (aim_session_t *, aim_frame_t *, ...); | |
270 static int gaim_icbm_param_info (aim_session_t *, aim_frame_t *, ...); | |
271 static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...); | |
272 static int gaim_memrequest (aim_session_t *, aim_frame_t *, ...); | |
273 static int gaim_selfinfo (aim_session_t *, aim_frame_t *, ...); | |
274 static int gaim_offlinemsg (aim_session_t *, aim_frame_t *, ...); | |
275 static int gaim_offlinemsgdone (aim_session_t *, aim_frame_t *, ...); | |
276 static int gaim_icqalias (aim_session_t *, aim_frame_t *, ...); | |
277 static int gaim_icqinfo (aim_session_t *, aim_frame_t *, ...); | |
278 static int gaim_popup (aim_session_t *, aim_frame_t *, ...); | |
279 #ifndef NOSSI | |
280 static int gaim_ssi_parseerr (aim_session_t *, aim_frame_t *, ...); | |
281 static int gaim_ssi_parserights (aim_session_t *, aim_frame_t *, ...); | |
282 static int gaim_ssi_parselist (aim_session_t *, aim_frame_t *, ...); | |
283 static int gaim_ssi_parseack (aim_session_t *, aim_frame_t *, ...); | |
284 static int gaim_ssi_authgiven (aim_session_t *, aim_frame_t *, ...); | |
285 static int gaim_ssi_authrequest (aim_session_t *, aim_frame_t *, ...); | |
286 static int gaim_ssi_authreply (aim_session_t *, aim_frame_t *, ...); | |
287 static int gaim_ssi_gotadded (aim_session_t *, aim_frame_t *, ...); | |
288 #endif | |
289 | |
290 /* for DirectIM/image transfer */ | |
291 static int gaim_odc_initiate (aim_session_t *, aim_frame_t *, ...); | |
292 static int gaim_odc_incoming (aim_session_t *, aim_frame_t *, ...); | |
293 static int gaim_odc_typing (aim_session_t *, aim_frame_t *, ...); | |
294 static int gaim_update_ui (aim_session_t *, aim_frame_t *, ...); | |
295 | |
296 /* for file transfer */ | |
297 static int oscar_sendfile_estblsh(aim_session_t *, aim_frame_t *, ...); | |
298 static int oscar_sendfile_prompt (aim_session_t *, aim_frame_t *, ...); | |
299 static int oscar_sendfile_ack (aim_session_t *, aim_frame_t *, ...); | |
300 static int oscar_sendfile_done (aim_session_t *, aim_frame_t *, ...); | |
301 | |
302 /* for icons */ | |
303 static gboolean gaim_icon_timerfunc(gpointer data); | |
304 | |
4230 | 305 static void gaim_free_name_data(struct name_data *data) { |
306 g_free(data->name); | |
307 g_free(data->nick); | |
308 g_free(data); | |
309 } | |
310 | |
5129 | 311 static fu32_t oscar_encoding_check(const char *utf8) |
312 { | |
313 int i = 0; | |
314 fu32_t encodingflag = 0; | |
315 | |
316 /* Determine how we can send this message. Per the warnings elsewhere | |
317 * in this file, these little checks determine the simplest encoding | |
318 * we can use for a given message send using it. */ | |
319 while (utf8[i]) { | |
320 if ((unsigned char)utf8[i] > 0x7f) { | |
321 /* not ASCII! */ | |
322 encodingflag = AIM_IMFLAGS_ISO_8859_1; | |
323 break; | |
324 } | |
325 i++; | |
326 } | |
327 while (utf8[i]) { | |
328 /* ISO-8859-1 is 0x00-0xbf in the first byte | |
329 * followed by 0xc0-0xc3 in the second */ | |
330 if ((unsigned char)utf8[i] < 0x80) { | |
331 i++; | |
332 continue; | |
333 } else if (((unsigned char)utf8[i] & 0xfc) == 0xc0 && | |
334 ((unsigned char)utf8[i + 1] & 0xc0) == 0x80) { | |
335 i += 2; | |
336 continue; | |
337 } | |
338 encodingflag = AIM_IMFLAGS_UNICODE; | |
339 break; | |
340 } | |
341 | |
342 return encodingflag; | |
343 } | |
344 | |
345 static fu32_t oscar_encoding_parse(const char *enc) | |
346 { | |
347 char *charset; | |
348 | |
349 /* If anything goes wrong, fall back on ASCII and print a message */ | |
350 if (enc == NULL) { | |
351 debug_printf("Encoding was null, that's odd\n"); | |
352 return 0; | |
353 } | |
354 charset = strstr(enc, "charset="); | |
355 if (charset == NULL) { | |
356 debug_printf("No charset specified for info, assuming ASCII\n"); | |
357 return 0; | |
358 } | |
359 charset += 8; | |
360 if (!strcmp(charset, "\"us-ascii\"") || !strcmp(charset, "\"utf-8\"")) { | |
361 /* UTF-8 is our native charset, ASCII is a proper subset */ | |
362 return 0; | |
363 } else if (!strcmp(charset, "\"iso-8859-1\"")) { | |
364 return AIM_IMFLAGS_ISO_8859_1; | |
365 } else if (!strcmp(charset, "\"unicode-2-0\"")) { | |
366 return AIM_IMFLAGS_UNICODE; | |
367 } else { | |
368 debug_printf("Unrecognized character set '%s', using ASCII\n", charset); | |
369 return 0; | |
370 } | |
371 } | |
372 | |
373 gchar *oscar_encoding_to_utf8(const char *encoding, char *text, int textlen) | |
374 { | |
375 gchar *utf8 = NULL; | |
376 int flags = oscar_encoding_parse(encoding); | |
377 | |
378 switch (flags) { | |
379 case 0: | |
380 utf8 = g_strndup(text, textlen); | |
381 break; | |
382 case AIM_IMFLAGS_ISO_8859_1: | |
383 utf8 = g_convert(text, textlen, "UTF-8", "ISO-8859-1", NULL, NULL, NULL); | |
384 break; | |
385 case AIM_IMFLAGS_UNICODE: | |
386 utf8 = g_convert(text, textlen, "UTF-8", "UCS-2BE", NULL, NULL, NULL); | |
387 break; | |
388 } | |
389 | |
390 return utf8; | |
391 } | |
392 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
393 static struct direct_im *find_direct_im(struct oscar_data *od, const char *who) { |
2086 | 394 GSList *d = od->direct_ims; |
395 struct direct_im *m = NULL; | |
396 | |
397 while (d) { | |
398 m = (struct direct_im *)d->data; | |
4355 | 399 if (!aim_sncmp(who, m->name)) |
4269 | 400 return m; |
2086 | 401 d = d->next; |
402 } | |
403 | |
4269 | 404 return NULL; |
2086 | 405 } |
406 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
407 static char *extract_name(const char *name) { |
4121 | 408 char *tmp, *x; |
2086 | 409 int i, j; |
4120 | 410 |
411 if (!name) | |
4121 | 412 return NULL; |
413 | |
4120 | 414 x = strchr(name, '-'); |
4121 | 415 |
2086 | 416 if (!x) return NULL; |
417 x = strchr(++x, '-'); | |
418 if (!x) return NULL; | |
419 tmp = g_strdup(++x); | |
420 | |
421 for (i = 0, j = 0; x[i]; i++) { | |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
422 char hex[3]; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
423 if (x[i] != '%') { |
2086 | 424 tmp[j++] = x[i]; |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
425 continue; |
2086 | 426 } |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
427 strncpy(hex, x + ++i, 2); hex[2] = 0; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
428 i++; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
429 tmp[j++] = strtol(hex, NULL, 16); |
2086 | 430 } |
431 | |
432 tmp[j] = 0; | |
433 return tmp; | |
434 } | |
435 | |
436 static struct chat_connection *find_oscar_chat(struct gaim_connection *gc, int id) { | |
437 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; | |
438 struct chat_connection *c = NULL; | |
439 | |
440 while (g) { | |
441 c = (struct chat_connection *)g->data; | |
442 if (c->id == id) | |
443 break; | |
444 g = g->next; | |
445 c = NULL; | |
446 } | |
447 | |
448 return c; | |
449 } | |
450 | |
451 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
|
452 aim_conn_t *conn) { |
2086 | 453 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; |
454 struct chat_connection *c = NULL; | |
455 | |
456 while (g) { | |
457 c = (struct chat_connection *)g->data; | |
458 if (c->conn == conn) | |
459 break; | |
460 g = g->next; | |
461 c = NULL; | |
462 } | |
463 | |
464 return c; | |
465 } | |
466 | |
4617 | 467 static void gaim_odc_disconnect(aim_session_t *sess, aim_conn_t *conn) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
468 struct gaim_connection *gc = sess->aux_data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
469 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
470 struct gaim_conversation *cnv; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
471 struct direct_im *dim; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
472 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
473 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
474 |
4617 | 475 sn = g_strdup(aim_odc_getsn(conn)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
476 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
477 debug_printf("%s disconnected Direct IM.\n", sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
478 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
479 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
480 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
481 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
482 |
3008 | 483 if (dim->connected) |
484 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn); | |
485 else | |
486 g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), sn); | |
487 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
488 if ((cnv = gaim_find_conversation(sn))) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
489 gaim_conversation_write(cnv, NULL, buf, -1, WFLAG_SYSTEM, time(NULL)); |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
490 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
491 gaim_conversation_update_progress(cnv, 100); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
492 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
493 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
|
494 g_free(sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
495 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
496 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
497 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
498 |
4617 | 499 static void oscar_callback(gpointer data, gint source, GaimInputCondition condition) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
500 aim_conn_t *conn = (aim_conn_t *)data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
501 aim_session_t *sess = aim_conn_getsess(conn); |
2086 | 502 struct gaim_connection *gc = sess ? sess->aux_data : NULL; |
4617 | 503 struct oscar_data *od; |
2086 | 504 |
505 if (!gc) { | |
506 /* gc is null. we return, else we seg SIGSEG on next line. */ | |
507 debug_printf("oscar callback for closed connection (1).\n"); | |
508 return; | |
509 } | |
510 | |
4617 | 511 od = (struct oscar_data *)gc->proto_data; |
2086 | 512 |
513 if (!g_slist_find(connections, gc)) { | |
514 /* oh boy. this is probably bad. i guess the only thing we | |
515 * can really do is return? */ | |
516 debug_printf("oscar callback for closed connection (2).\n"); | |
517 return; | |
518 } | |
519 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
520 if (condition & GAIM_INPUT_READ) { |
4617 | 521 if (conn->type == AIM_CONN_TYPE_LISTENER) { |
522 debug_printf("got information on rendezvous listener\n"); | |
523 if (aim_handlerendconnect(od->sess, conn) < 0) { | |
524 debug_printf("connection error (rendezvous listener)\n"); | |
525 aim_conn_kill(od->sess, &conn); | |
2086 | 526 } |
527 } else { | |
4617 | 528 if (aim_get_command(od->sess, conn) >= 0) { |
529 aim_rxdispatch(od->sess); | |
530 if (od->killme) | |
2086 | 531 signoff(gc); |
532 } else { | |
533 if ((conn->type == AIM_CONN_TYPE_BOS) || | |
4617 | 534 !(aim_getconn_type(od->sess, AIM_CONN_TYPE_BOS))) { |
4236 | 535 debug_printf("major connection error\n"); |
3074 | 536 hide_login_progress_error(gc, _("Disconnected.")); |
2086 | 537 signoff(gc); |
538 } else if (conn->type == AIM_CONN_TYPE_CHAT) { | |
539 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); | |
540 char buf[BUF_LONG]; | |
541 debug_printf("disconnected from chat room %s\n", c->name); | |
542 c->conn = NULL; | |
543 if (c->inpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
544 gaim_input_remove(c->inpa); |
2086 | 545 c->inpa = 0; |
546 c->fd = -1; | |
4617 | 547 aim_conn_kill(od->sess, &conn); |
3574 | 548 snprintf(buf, sizeof(buf), _("You have been disconnected from chat room %s."), c->name); |
3427 | 549 do_error_dialog(buf, NULL, GAIM_ERROR); |
2086 | 550 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { |
4617 | 551 if (od->cnpa > 0) |
552 gaim_input_remove(od->cnpa); | |
553 od->cnpa = 0; | |
2086 | 554 debug_printf("removing chatnav input watcher\n"); |
4617 | 555 while (od->create_rooms) { |
556 struct create_room *cr = od->create_rooms->data; | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
557 g_free(cr->name); |
4617 | 558 od->create_rooms = |
559 g_slist_remove(od->create_rooms, cr); | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
560 g_free(cr); |
3427 | 561 do_error_dialog(_("Chat is currently unavailable"), NULL, GAIM_ERROR); |
2086 | 562 } |
4617 | 563 aim_conn_kill(od->sess, &conn); |
2086 | 564 } else if (conn->type == AIM_CONN_TYPE_AUTH) { |
4617 | 565 if (od->paspa > 0) |
566 gaim_input_remove(od->paspa); | |
567 od->paspa = 0; | |
2086 | 568 debug_printf("removing authconn input watcher\n"); |
4617 | 569 aim_conn_kill(od->sess, &conn); |
3694 | 570 } else if (conn->type == AIM_CONN_TYPE_EMAIL) { |
4617 | 571 if (od->emlpa > 0) |
572 gaim_input_remove(od->emlpa); | |
573 od->emlpa = 0; | |
3694 | 574 debug_printf("removing email input watcher\n"); |
4617 | 575 aim_conn_kill(od->sess, &conn); |
4804 | 576 } else if (conn->type == AIM_CONN_TYPE_ICON) { |
577 if (od->icopa > 0) | |
578 gaim_input_remove(od->icopa); | |
579 od->icopa = 0; | |
580 debug_printf("removing icon input watcher\n"); | |
581 aim_conn_kill(od->sess, &conn); | |
2086 | 582 } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
583 if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) |
4617 | 584 gaim_odc_disconnect(od->sess, conn); |
585 aim_conn_kill(od->sess, &conn); | |
2086 | 586 } else { |
4194 | 587 debug_printf("holy crap! generic connection error! %hu\n", |
2086 | 588 conn->type); |
4617 | 589 aim_conn_kill(od->sess, &conn); |
2086 | 590 } |
591 } | |
592 } | |
593 } | |
594 } | |
595 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
596 static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) { |
2086 | 597 char *s = g_strdup_vprintf(format, va); |
598 char buf[256]; | |
599 char *t; | |
600 struct gaim_connection *gc = sess->aux_data; | |
601 | |
602 g_snprintf(buf, sizeof(buf), "%s %d: ", gc->username, level); | |
603 t = g_strconcat(buf, s, NULL); | |
604 debug_printf(t); | |
605 if (t[strlen(t)-1] != '\n') | |
606 debug_printf("\n"); | |
607 g_free(t); | |
608 g_free(s); | |
609 } | |
610 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
611 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 612 { |
613 struct gaim_connection *gc = data; | |
4617 | 614 struct oscar_data *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
615 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
616 aim_conn_t *conn; |
2086 | 617 |
618 if (!g_slist_find(connections, gc)) { | |
619 close(source); | |
620 return; | |
621 } | |
622 | |
4617 | 623 od = gc->proto_data; |
624 sess = od->sess; | |
2086 | 625 conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); |
4366 | 626 |
627 conn->fd = source; | |
2086 | 628 |
629 if (source < 0) { | |
630 hide_login_progress(gc, _("Couldn't connect to host")); | |
631 signoff(gc); | |
632 return; | |
633 } | |
634 | |
635 aim_conn_completeconnect(sess, conn); | |
4617 | 636 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); |
4236 | 637 debug_printf("Password sent, waiting for response\n"); |
2086 | 638 } |
639 | |
4491 | 640 static void oscar_login(struct gaim_account *account) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
641 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
642 aim_conn_t *conn; |
2086 | 643 char buf[256]; |
4491 | 644 struct gaim_connection *gc = new_gaim_conn(account); |
4617 | 645 struct oscar_data *od = gc->proto_data = g_new0(struct oscar_data, 1); |
2086 | 646 |
4491 | 647 if (isdigit(*account->username)) { |
4617 | 648 od->icq = TRUE; |
3064 | 649 gc->password[8] = 0; |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
650 } else { |
2918
4df759d607f3
[gaim-migrate @ 2931]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2916
diff
changeset
|
651 gc->flags |= OPT_CONN_HTML; |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
652 gc->flags |= OPT_CONN_AUTO_RESP; |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
653 } |
4738 | 654 od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
2086 | 655 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
656 sess = g_new0(aim_session_t, 1); |
2086 | 657 |
658 aim_session_init(sess, AIM_SESS_FLAGS_NONBLOCKCONNECT, 0); | |
659 aim_setdebuggingcb(sess, oscar_debug); | |
660 | |
661 /* we need an immediate queue because we don't use a while-loop to | |
662 * see if things need to be sent. */ | |
663 aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL); | |
4617 | 664 od->sess = sess; |
2086 | 665 sess->aux_data = gc; |
666 | |
667 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); | |
668 if (conn == NULL) { | |
4236 | 669 debug_printf("internal connection error\n"); |
2086 | 670 hide_login_progress(gc, _("Unable to login to AIM")); |
671 signoff(gc); | |
672 return; | |
673 } | |
674 | |
675 g_snprintf(buf, sizeof(buf), _("Signon: %s"), gc->username); | |
676 set_login_progress(gc, 2, buf); | |
677 | |
4649 | 678 aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2086 | 679 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); |
680 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); | |
681 | |
682 conn->status |= AIM_CONN_STATUS_INPROGRESS; | |
4634 | 683 if (proxy_connect(account, account->proto_opt[USEROPT_AUTH][0] ? |
4491 | 684 account->proto_opt[USEROPT_AUTH] : FAIM_LOGIN_SERVER, |
685 account->proto_opt[USEROPT_AUTHPORT][0] ? | |
686 atoi(account->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, | |
687 oscar_login_connect, gc) < 0) { | |
2086 | 688 hide_login_progress(gc, _("Couldn't connect to host")); |
689 signoff(gc); | |
690 return; | |
691 } | |
692 aim_request_login(sess, conn, gc->username); | |
693 } | |
694 | |
695 static void oscar_close(struct gaim_connection *gc) { | |
4617 | 696 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
697 | |
698 while (od->oscar_chats) { | |
699 struct chat_connection *n = od->oscar_chats->data; | |
2086 | 700 if (n->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
701 gaim_input_remove(n->inpa); |
2086 | 702 g_free(n->name); |
703 g_free(n->show); | |
4617 | 704 od->oscar_chats = g_slist_remove(od->oscar_chats, n); |
2086 | 705 g_free(n); |
706 } | |
4617 | 707 while (od->direct_ims) { |
708 struct direct_im *n = od->direct_ims->data; | |
2086 | 709 if (n->watcher > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
710 gaim_input_remove(n->watcher); |
4617 | 711 od->direct_ims = g_slist_remove(od->direct_ims, n); |
2086 | 712 g_free(n); |
713 } | |
4617 | 714 /* BBB */ |
715 while (od->file_transfers) { | |
716 struct gaim_xfer *xfer; | |
717 xfer = (struct gaim_xfer *)od->file_transfers->data; | |
718 gaim_xfer_destroy(xfer); | |
3630 | 719 } |
4804 | 720 while (od->requesticon) { |
721 char *sn = od->requesticon->data; | |
722 od->requesticon = g_slist_remove(od->requesticon, sn); | |
723 free(sn); | |
724 } | |
4738 | 725 g_hash_table_destroy(od->buddyinfo); |
4617 | 726 while (od->evilhack) { |
727 g_free(od->evilhack->data); | |
728 od->evilhack = g_slist_remove(od->evilhack, od->evilhack->data); | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
729 } |
4617 | 730 while (od->create_rooms) { |
731 struct create_room *cr = od->create_rooms->data; | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
732 g_free(cr->name); |
4617 | 733 od->create_rooms = g_slist_remove(od->create_rooms, cr); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
734 g_free(cr); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
735 } |
4617 | 736 if (od->email) |
737 g_free(od->email); | |
738 if (od->newp) | |
739 g_free(od->newp); | |
740 if (od->oldp) | |
741 g_free(od->oldp); | |
2086 | 742 if (gc->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
743 gaim_input_remove(gc->inpa); |
4617 | 744 if (od->cnpa > 0) |
745 gaim_input_remove(od->cnpa); | |
746 if (od->paspa > 0) | |
747 gaim_input_remove(od->paspa); | |
748 if (od->emlpa > 0) | |
749 gaim_input_remove(od->emlpa); | |
4804 | 750 if (od->icopa > 0) |
751 gaim_input_remove(od->icopa); | |
4832 | 752 if (od->icopa > 0) |
753 gaim_input_remove(od->icopa); | |
754 if (od->icontimer) | |
755 g_source_remove(od->icontimer); | |
4617 | 756 aim_session_kill(od->sess); |
757 g_free(od->sess); | |
758 od->sess = NULL; | |
2086 | 759 g_free(gc->proto_data); |
760 gc->proto_data = NULL; | |
4236 | 761 debug_printf("Signed off.\n"); |
2086 | 762 } |
763 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
764 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { |
2086 | 765 struct gaim_connection *gc = data; |
4617 | 766 struct oscar_data *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
767 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
768 aim_conn_t *bosconn; |
2086 | 769 |
770 if (!g_slist_find(connections, gc)) { | |
771 close(source); | |
772 return; | |
773 } | |
774 | |
4617 | 775 od = gc->proto_data; |
776 sess = od->sess; | |
777 bosconn = od->conn; | |
4366 | 778 bosconn->fd = source; |
2086 | 779 |
780 if (source < 0) { | |
781 hide_login_progress(gc, _("Could Not Connect")); | |
782 signoff(gc); | |
783 return; | |
784 } | |
785 | |
786 aim_conn_completeconnect(sess, bosconn); | |
4617 | 787 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); |
2086 | 788 set_login_progress(gc, 4, _("Connection established, cookie sent")); |
789 } | |
790 | |
4617 | 791 /* BBB */ |
4656 | 792 /* |
793 * This little area in oscar.c is the nexus of file transfer code, | |
794 * so I wrote a little explanation of what happens. I am such a | |
795 * ninja. | |
796 * | |
797 * The series of events for a file send is: | |
798 * -Create xfer and call gaim_xfer_request (this happens in oscar_ask_sendfile) | |
799 * -User chooses a file and oscar_xfer_init is called. It establishs a | |
800 * listening socket, then asks the remote user to connect to us (and | |
801 * gives them the file name, port, IP, etc.) | |
802 * -They connect to us and we send them an AIM_CB_OFT_PROMPT (this happens | |
803 * in oscar_sendfile_estblsh) | |
804 * -They send us an AIM_CB_OFT_ACK and then we start sending data | |
805 * -When we finish, they send us an AIM_CB_OFT_DONE and they close the | |
806 * connection. | |
807 * -We get drunk because file transfer kicks ass. | |
808 * | |
809 * The series of events for a file receive is: | |
810 * -Create xfer and call gaim_xfer request (this happens in incomingim_chan2) | |
811 * -Gaim user selects file to name and location to save file to and | |
812 * oscar_xfer_init is called | |
813 * -It connects to the remote user using the IP they gave us earlier | |
814 * -After connecting, they send us an AIM_CB_OFT_PROMPT. In reply, we send | |
815 * them an AIM_CB_OFT_ACK. | |
816 * -They begin to send us lots of raw data. | |
817 * -When they finish sending data we send an AIM_CB_OFT_DONE and then close | |
818 * the connectionn. | |
819 */ | |
820 static void oscar_sendfile_connected(gpointer data, gint source, GaimInputCondition condition); | |
821 | |
822 /* XXX - This function is pretty ugly */ | |
823 static void | |
824 oscar_xfer_init(struct gaim_xfer *xfer) | |
825 { | |
826 struct gaim_connection *gc; | |
827 struct oscar_data *od; | |
828 struct oscar_xfer_data *xfer_data; | |
829 | |
830 debug_printf("in oscar_xfer_init\n"); | |
831 if (!(xfer_data = xfer->data)) | |
832 return; | |
833 if (!(gc = xfer_data->gc)) | |
834 return; | |
835 if (!(od = gc->proto_data)) | |
836 return; | |
837 | |
838 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { | |
839 int i; | |
840 char ip[4]; | |
841 gchar **ipsplit; | |
842 | |
843 if (xfer->local_ip) { | |
844 ipsplit = g_strsplit(xfer->local_ip, ".", 4); | |
845 for (i=0; ipsplit[i]; i++) | |
846 ip[i] = atoi(ipsplit[i]); | |
847 g_strfreev(ipsplit); | |
848 } else { | |
849 memset(ip, 0x00, 4); | |
850 } | |
851 | |
852 xfer->filename = g_path_get_basename(xfer->local_filename); | |
853 xfer_data->checksum = aim_oft_checksum_file(xfer->local_filename); | |
854 | |
855 /* | |
856 * First try the port specified earlier (5190). If that fails, try a | |
857 * few random ports. Maybe we need a way to tell libfaim to listen | |
858 * for multiple connections on one listener socket. | |
859 */ | |
860 xfer_data->conn = aim_sendfile_listen(od->sess, xfer_data->cookie, ip, xfer->local_port); | |
861 for (i=0; (i<5 && !xfer_data->conn); i++) { | |
862 xfer->local_port = (rand() % (65535-1024)) + 1024; | |
863 xfer_data->conn = aim_sendfile_listen(od->sess, xfer_data->cookie, ip, xfer->local_port); | |
864 } | |
865 debug_printf("port is %d, ip is %hhd.%hhd.%hhd.%hhd\n", xfer->local_port, ip[0], ip[1], ip[2], ip[3]); | |
866 if (xfer_data->conn) { | |
867 xfer->watcher = gaim_input_add(xfer_data->conn->fd, GAIM_INPUT_READ, oscar_callback, xfer_data->conn); | |
868 aim_im_sendch2_sendfile_ask(od->sess, xfer_data->cookie, xfer->who, ip, xfer->local_port, xfer->filename, 1, xfer->size); | |
869 aim_conn_addhandler(od->sess, xfer_data->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ESTABLISHED, oscar_sendfile_estblsh, 0); | |
870 } else { | |
871 do_error_dialog(_("File Transfer Aborted"), _("Unable to establish listener socket."), GAIM_ERROR); | |
872 /* XXX - The below line causes a crash because the transfer is canceled before the "Ok" callback on the file selection thing exists, I think */ | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
873 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 874 } |
875 } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
876 xfer_data->conn = aim_newconn(od->sess, AIM_CONN_TYPE_RENDEZVOUS, NULL); | |
877 if (xfer_data->conn) { | |
878 xfer_data->conn->subtype = AIM_CONN_SUBTYPE_OFT_SENDFILE; | |
879 aim_conn_addhandler(od->sess, xfer_data->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_PROMPT, oscar_sendfile_prompt, 0); | |
880 xfer_data->conn->fd = xfer->fd = proxy_connect(gc->account, xfer->remote_ip, xfer->remote_port, oscar_sendfile_connected, xfer); | |
881 if (xfer->fd == -1) { | |
882 do_error_dialog(_("File Transfer Aborted"), _("Unable to establish file descriptor."), GAIM_ERROR); | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
883 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 884 } |
885 } else { | |
886 do_error_dialog(_("File Transfer Aborted"), _("Unable to create new connection."), GAIM_ERROR); | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
887 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 888 /* Try a different port? Ask them to connect to us? */ |
889 } | |
890 | |
891 } | |
892 } | |
893 | |
894 static void | |
895 oscar_xfer_start(struct gaim_xfer *xfer) | |
896 { | |
897 /* struct gaim_connection *gc; | |
898 struct oscar_data *od; | |
899 struct oscar_xfer_data *xfer_data; | |
900 | |
901 if (!(xfer_data = xfer->data)) | |
902 return; | |
903 if (!(gc = xfer_data->gc)) | |
904 return; | |
905 if (!(od = gc->proto_data)) | |
906 return; | |
907 | |
908 od = xfer_data->od; | |
909 */ | |
910 debug_printf("AAA - in oscar_xfer_start\n"); | |
911 | |
912 /* I'm pretty sure we don't need to do jack here. Nor Jill. */ | |
913 } | |
914 | |
915 static void | |
916 oscar_xfer_end(struct gaim_xfer *xfer) | |
917 { | |
918 struct gaim_connection *gc; | |
919 struct oscar_data *od; | |
920 struct oscar_xfer_data *xfer_data; | |
921 | |
922 debug_printf("AAA - in oscar_xfer_end\n"); | |
923 if (!(xfer_data = xfer->data)) | |
924 return; | |
925 | |
926 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) | |
927 aim_oft_sendheader(xfer_data->conn->sessv, xfer_data->conn, AIM_CB_OFT_DONE, xfer_data->cookie, xfer->filename, 1, 1, xfer->size, xfer->size, xfer_data->modtime, xfer_data->checksum, 0x02, xfer->size, xfer_data->checksum); | |
928 | |
4898 | 929 g_free(xfer_data->proxyip); |
4656 | 930 g_free(xfer_data->clientip); |
4898 | 931 g_free(xfer_data->verifiedip); |
4656 | 932 |
933 if ((gc = xfer_data->gc)) { | |
934 if ((od = gc->proto_data)) | |
935 od->file_transfers = g_slist_remove(od->file_transfers, xfer); | |
936 } | |
937 | |
938 g_free(xfer_data); | |
939 xfer->data = NULL; | |
940 } | |
941 | |
942 static void | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
943 oscar_xfer_cancel_send(struct gaim_xfer *xfer) |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
944 { |
4763 | 945 struct gaim_connection *gc; |
946 struct oscar_data *od; | |
947 struct oscar_xfer_data *xfer_data; | |
948 aim_conn_t *conn; | |
949 | |
950 debug_printf("AAA - in oscar_xfer_cancel_send\n"); | |
951 if (!(xfer_data = xfer->data)) | |
952 return; | |
953 | |
954 if ((conn = xfer_data->conn)) { | |
955 aim_session_t *sess; | |
956 if ((sess = conn->sessv)) | |
957 if (xfer_data->cookie && xfer->who) | |
958 aim_im_sendch2_sendfile_cancel(sess, xfer_data->cookie, xfer->who, AIM_CAPS_SENDFILE); | |
959 } | |
960 | |
4898 | 961 g_free(xfer_data->proxyip); |
4763 | 962 g_free(xfer_data->clientip); |
4898 | 963 g_free(xfer_data->verifiedip); |
4763 | 964 |
965 if ((gc = xfer_data->gc)) | |
966 if ((od = gc->proto_data)) | |
967 od->file_transfers = g_slist_remove(od->file_transfers, xfer); | |
968 | |
969 g_free(xfer_data); | |
970 xfer->data = NULL; | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
971 } |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
972 |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
973 static void |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
974 oscar_xfer_cancel_recv(struct gaim_xfer *xfer) |
4656 | 975 { |
976 struct gaim_connection *gc; | |
977 struct oscar_data *od; | |
978 struct oscar_xfer_data *xfer_data; | |
979 aim_conn_t *conn; | |
980 | |
4763 | 981 debug_printf("AAA - in oscar_xfer_cancel_recv\n"); |
4656 | 982 if (!(xfer_data = xfer->data)) |
983 return; | |
984 | |
985 if ((conn = xfer_data->conn)) { | |
986 aim_session_t *sess; | |
987 if ((sess = conn->sessv)) | |
988 if (xfer_data->cookie && xfer->who) | |
989 aim_im_sendch2_sendfile_cancel(sess, xfer_data->cookie, xfer->who, AIM_CAPS_SENDFILE); | |
990 } | |
991 | |
4898 | 992 g_free(xfer_data->proxyip); |
4656 | 993 g_free(xfer_data->clientip); |
4898 | 994 g_free(xfer_data->verifiedip); |
4656 | 995 |
996 if ((gc = xfer_data->gc)) | |
997 if ((od = gc->proto_data)) | |
998 od->file_transfers = g_slist_remove(od->file_transfers, xfer); | |
999 | |
1000 g_free(xfer_data); | |
1001 xfer->data = NULL; | |
1002 } | |
1003 | |
1004 static void | |
1005 oscar_xfer_ack(struct gaim_xfer *xfer, const char *buffer, size_t size) | |
1006 { | |
1007 struct oscar_xfer_data *xfer_data; | |
1008 | |
1009 if (!(xfer_data = xfer->data)) | |
1010 return; | |
1011 | |
1012 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { | |
1013 /* | |
1014 * If we're done sending, intercept the socket from the core ft code | |
1015 * and wait for the other guy to send the "done" OFT packet. | |
1016 */ | |
1017 if (gaim_xfer_get_bytes_remaining(xfer) <= 0) { | |
1018 gaim_input_remove(xfer->watcher); | |
1019 xfer->watcher = gaim_input_add(xfer->fd, GAIM_INPUT_READ, oscar_callback, xfer_data->conn); | |
1020 xfer->fd = 0; | |
1021 gaim_xfer_set_completed(xfer, TRUE); | |
1022 } | |
1023 } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
1024 /* Update our rolling checksum */ | |
1025 /* xfer_data->checksum = aim_oft_checksum_chunk(buffer, size, xfer_data->checksum); */ | |
1026 } | |
1027 } | |
1028 | |
1029 static struct gaim_xfer * | |
1030 oscar_find_xfer_by_cookie(GSList *fts, const char *ck) | |
1031 { | |
1032 struct gaim_xfer *xfer; | |
1033 struct oscar_xfer_data *data; | |
1034 | |
1035 while (fts) { | |
1036 xfer = fts->data; | |
1037 data = xfer->data; | |
1038 | |
1039 if (data && !strcmp(data->cookie, ck)) | |
1040 return xfer; | |
1041 | |
1042 fts = g_slist_next(fts); | |
1043 } | |
1044 | |
1045 return NULL; | |
1046 } | |
1047 | |
1048 static struct gaim_xfer * | |
1049 oscar_find_xfer_by_conn(GSList *fts, aim_conn_t *conn) | |
1050 { | |
1051 struct gaim_xfer *xfer; | |
1052 struct oscar_xfer_data *data; | |
1053 | |
1054 while (fts) { | |
1055 xfer = fts->data; | |
1056 data = xfer->data; | |
1057 | |
1058 if (data && (conn == data->conn)) | |
1059 return xfer; | |
1060 | |
1061 fts = g_slist_next(fts); | |
1062 } | |
1063 | |
1064 return NULL; | |
1065 } | |
1066 | |
5136 | 1067 static void oscar_ask_sendfile(struct gaim_connection *gc, const char *destsn) { |
3630 | 1068 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
3752 | 1069 |
4617 | 1070 /* You want to send a file to someone else, you're so generous */ |
1071 struct gaim_xfer *xfer; | |
1072 struct oscar_xfer_data *xfer_data; | |
1073 | |
1074 /* Create the oscar-specific data */ | |
1075 xfer_data = g_malloc0(sizeof(struct oscar_xfer_data)); | |
1076 xfer_data->gc = gc; | |
1077 | |
1078 /* Build the file transfer handle */ | |
1079 xfer = gaim_xfer_new(gc->account, GAIM_XFER_SEND, destsn); | |
1080 xfer_data->xfer = xfer; | |
1081 xfer->data = xfer_data; | |
1082 | |
1083 /* Set the info about the incoming file */ | |
4650 | 1084 if (od && od->sess) { |
4617 | 1085 aim_conn_t *conn; |
4650 | 1086 if ((conn = aim_conn_findbygroup(od->sess, 0x0004))) |
1087 xfer->local_ip = gaim_getip_from_fd(conn->fd); | |
4617 | 1088 } |
1089 xfer->local_port = 5190; | |
1090 | |
1091 /* Setup our I/O op functions */ | |
1092 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init); | |
1093 gaim_xfer_set_start_fnc(xfer, oscar_xfer_start); | |
1094 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
1095 gaim_xfer_set_cancel_send_fnc(xfer, oscar_xfer_cancel_send); |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
1096 gaim_xfer_set_cancel_recv_fnc(xfer, oscar_xfer_cancel_recv); |
4656 | 1097 gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack); |
4617 | 1098 |
1099 /* Keep track of this transfer for later */ | |
1100 od->file_transfers = g_slist_append(od->file_transfers, xfer); | |
1101 | |
1102 /* Now perform the request */ | |
1103 gaim_xfer_request(xfer); | |
3630 | 1104 } |
1105 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1106 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1107 va_list ap; |
2704 | 1108 struct aim_authresp_info *info; |
4452 | 1109 int i, rc; |
1110 char *host; int port; | |
4491 | 1111 struct gaim_account *account; |
2704 | 1112 aim_conn_t *bosconn; |
2086 | 1113 |
1114 struct gaim_connection *gc = sess->aux_data; | |
1115 struct oscar_data *od = gc->proto_data; | |
4491 | 1116 account = gc->account; |
1117 port = account->proto_opt[USEROPT_AUTHPORT][0] ? | |
1118 atoi(account->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, | |
2086 | 1119 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1120 va_start(ap, fr); |
2704 | 1121 info = va_arg(ap, struct aim_authresp_info *); |
2086 | 1122 va_end(ap); |
1123 | |
2704 | 1124 debug_printf("inside auth_resp (Screen name: %s)\n", info->sn); |
1125 | |
4293 | 1126 if (info->errorcode || !info->bosip || !info->cookielen || !info->cookie) { |
4056 | 1127 char buf[256]; |
2704 | 1128 switch (info->errorcode) { |
2086 | 1129 case 0x05: |
1130 /* Incorrect nick/password */ | |
1131 hide_login_progress(gc, _("Incorrect nickname or password.")); | |
1132 break; | |
1133 case 0x11: | |
1134 /* Suspended account */ | |
1135 hide_login_progress(gc, _("Your account is currently suspended.")); | |
1136 break; | |
3498 | 1137 case 0x14: |
1138 /* service temporarily unavailable */ | |
1139 hide_login_progress(gc, _("The AOL Instant Messenger service is temporarily unavailable.")); | |
1140 break; | |
2086 | 1141 case 0x18: |
1142 /* connecting too frequently */ | |
1143 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.")); | |
1144 break; | |
1145 case 0x1c: | |
1146 /* client too old */ | |
4056 | 1147 g_snprintf(buf, sizeof(buf), _("The client version you are using is too old. Please upgrade at %s"), WEBSITE); |
1148 hide_login_progress(gc, buf); | |
2086 | 1149 break; |
1150 default: | |
1151 hide_login_progress(gc, _("Authentication Failed")); | |
1152 break; | |
1153 } | |
4194 | 1154 debug_printf("Login Error Code 0x%04hx\n", info->errorcode); |
2704 | 1155 debug_printf("Error URL: %s\n", info->errorurl); |
2086 | 1156 od->killme = TRUE; |
1157 return 1; | |
1158 } | |
1159 | |
1160 | |
4194 | 1161 debug_printf("Reg status: %hu\n", info->regstatus); |
2704 | 1162 if (info->email) { |
1163 debug_printf("Email: %s\n", info->email); | |
2086 | 1164 } else { |
1165 debug_printf("Email is NULL\n"); | |
1166 } | |
2704 | 1167 debug_printf("BOSIP: %s\n", info->bosip); |
2086 | 1168 debug_printf("Closing auth connection...\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1169 aim_conn_kill(sess, &fr->conn); |
2086 | 1170 |
1171 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL); | |
1172 if (bosconn == NULL) { | |
1173 hide_login_progress(gc, _("Internal Error")); | |
1174 od->killme = TRUE; | |
1175 return 0; | |
1176 } | |
1177 | |
4649 | 1178 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1179 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_bos, 0); |
2086 | 1180 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, gaim_bosrights, 0); |
1181 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0); | |
1182 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, gaim_handle_redirect, 0); | |
2993 | 1183 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_RIGHTSINFO, gaim_parse_locaterights, 0); |
2086 | 1184 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_RIGHTSINFO, gaim_parse_buddyrights, 0); |
1185 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, gaim_parse_oncoming, 0); | |
1186 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, gaim_parse_offgoing, 0); | |
1187 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, gaim_parse_incoming_im, 0); | |
1188 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, gaim_parse_locerr, 0); | |
1189 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, gaim_parse_misses, 0); | |
3212 | 1190 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_CLIENTAUTORESP, gaim_parse_clientauto, 0); |
2086 | 1191 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, gaim_parse_ratechange, 0); |
1192 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL, gaim_parse_evilnotify, 0); | |
1193 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, AIM_CB_LOK_ERROR, gaim_parse_searcherror, 0); | |
1194 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, 0x0003, gaim_parse_searchreply, 0); | |
1195 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, gaim_parse_msgerr, 0); | |
3595 | 1196 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parse_mtn, 0); |
2086 | 1197 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parse_user_info, 0); |
1198 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK, gaim_parse_msgack, 0); | |
1199 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
|
1200 aim_conn_addhandler(sess, bosconn, 0x0004, 0x0005, gaim_icbm_param_info, 0); |
2086 | 1201 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, gaim_parse_genericerr, 0); |
1202 aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, gaim_parse_genericerr, 0); | |
1203 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, gaim_parse_genericerr, 0); | |
1204 aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, gaim_memrequest, 0); | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1205 aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0); |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
1206 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
|
1207 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
|
1208 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_POP, 0x0002, gaim_popup, 0); |
4759 | 1209 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_ALIAS, gaim_icqalias, 0); |
4624 | 1210 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_INFO, gaim_icqinfo, 0); |
4230 | 1211 #ifndef NOSSI |
4642 | 1212 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ERROR, gaim_ssi_parseerr, 0); |
2991 | 1213 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RIGHTSINFO, gaim_ssi_parserights, 0); |
1214 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_LIST, gaim_ssi_parselist, 0); | |
1215 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_NOLIST, gaim_ssi_parselist, 0); | |
4230 | 1216 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_SRVACK, gaim_ssi_parseack, 0); |
1217 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTH, gaim_ssi_authgiven, 0); | |
1218 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREQ, gaim_ssi_authrequest, 0); | |
1219 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREP, gaim_ssi_authreply, 0); | |
1220 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ADDED, gaim_ssi_gotadded, 0); | |
1221 #endif | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
1222 |
2086 | 1223 ((struct oscar_data *)gc->proto_data)->conn = bosconn; |
2704 | 1224 for (i = 0; i < (int)strlen(info->bosip); i++) { |
1225 if (info->bosip[i] == ':') { | |
1226 port = atoi(&(info->bosip[i+1])); | |
2086 | 1227 break; |
1228 } | |
1229 } | |
2704 | 1230 host = g_strndup(info->bosip, i); |
2086 | 1231 bosconn->status |= AIM_CONN_STATUS_INPROGRESS; |
4634 | 1232 rc = proxy_connect(gc->account, host, port, oscar_bos_connect, gc); |
2086 | 1233 g_free(host); |
4366 | 1234 if (rc < 0) { |
2086 | 1235 hide_login_progress(gc, _("Could Not Connect")); |
1236 od->killme = TRUE; | |
1237 return 0; | |
1238 } | |
4293 | 1239 aim_sendcookie(sess, bosconn, info->cookielen, info->cookie); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1240 gaim_input_remove(gc->inpa); |
2704 | 1241 |
2086 | 1242 return 1; |
1243 } | |
1244 | |
1245 struct pieceofcrap { | |
1246 struct gaim_connection *gc; | |
1247 unsigned long offset; | |
1248 unsigned long len; | |
1249 char *modname; | |
1250 int fd; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1251 aim_conn_t *conn; |
2086 | 1252 unsigned int inpa; |
1253 }; | |
1254 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1255 static void damn_you(gpointer data, gint source, GaimInputCondition c) |
2086 | 1256 { |
1257 struct pieceofcrap *pos = data; | |
1258 struct oscar_data *od = pos->gc->proto_data; | |
1259 char in = '\0'; | |
1260 int x = 0; | |
1261 unsigned char m[17]; | |
1262 | |
1263 while (read(pos->fd, &in, 1) == 1) { | |
1264 if (in == '\n') | |
1265 x++; | |
1266 else if (in != '\r') | |
1267 x = 0; | |
1268 if (x == 2) | |
1269 break; | |
1270 in = '\0'; | |
1271 } | |
1272 if (in != '\n') { | |
4056 | 1273 char buf[256]; |
1274 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until " | |
1275 "this is fixed. Check %s for updates."), WEBSITE); | |
3427 | 1276 do_error_dialog(_("Gaim was Unable to get a valid AIM login hash."), |
4056 | 1277 buf, GAIM_WARNING); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1278 gaim_input_remove(pos->inpa); |
2086 | 1279 close(pos->fd); |
1280 g_free(pos); | |
1281 return; | |
1282 } | |
1283 read(pos->fd, m, 16); | |
1284 m[16] = '\0'; | |
1285 debug_printf("Sending hash: "); | |
1286 for (x = 0; x < 16; x++) | |
4194 | 1287 debug_printf("%02hhx ", (unsigned char)m[x]); |
2086 | 1288 debug_printf("\n"); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1289 gaim_input_remove(pos->inpa); |
2086 | 1290 close(pos->fd); |
1291 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); | |
1292 g_free(pos); | |
1293 } | |
1294 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1295 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) { |
2086 | 1296 struct pieceofcrap *pos = data; |
1297 char buf[BUF_LONG]; | |
1298 | |
4366 | 1299 pos->fd = source; |
1300 | |
2086 | 1301 if (source < 0) { |
4056 | 1302 char buf[256]; |
1303 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until " | |
1304 "this is fixed. Check %s for updates."), WEBSITE); | |
3427 | 1305 do_error_dialog(_("Gaim was Unable to get a valid AIM login hash."), |
4056 | 1306 buf, GAIM_WARNING); |
2086 | 1307 if (pos->modname) |
1308 g_free(pos->modname); | |
1309 g_free(pos); | |
1310 return; | |
1311 } | |
1312 | |
1313 g_snprintf(buf, sizeof(buf), "GET " AIMHASHDATA | |
1314 "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n", | |
1315 pos->offset, pos->len, pos->modname ? pos->modname : ""); | |
1316 write(pos->fd, buf, strlen(buf)); | |
1317 if (pos->modname) | |
1318 g_free(pos->modname); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1319 pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); |
2086 | 1320 return; |
1321 } | |
1322 | |
1323 /* size of icbmui.ocm, the largest module in AIM 3.5 */ | |
1324 #define AIM_MAX_FILE_SIZE 98304 | |
1325 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1326 int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1327 va_list ap; |
1328 struct pieceofcrap *pos; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1329 fu32_t offset, len; |
2086 | 1330 char *modname; |
1331 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1332 va_start(ap, fr); |
4200 | 1333 offset = va_arg(ap, fu32_t); |
1334 len = va_arg(ap, fu32_t); | |
2086 | 1335 modname = va_arg(ap, char *); |
1336 va_end(ap); | |
1337 | |
4194 | 1338 debug_printf("offset: %lu, len: %lu, file: %s\n", offset, len, (modname ? modname : "aim.exe")); |
2086 | 1339 if (len == 0) { |
1340 debug_printf("len is 0, hashing NULL\n"); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1341 aim_sendmemblock(sess, fr->conn, offset, len, NULL, |
2086 | 1342 AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
1343 return 1; | |
1344 } | |
1345 /* uncomment this when you're convinced it's right. remember, it's been wrong before. | |
1346 if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) { | |
1347 char *buf; | |
1348 int i = 8; | |
1349 if (modname) | |
1350 i += strlen(modname); | |
1351 buf = g_malloc(i); | |
1352 i = 0; | |
1353 if (modname) { | |
1354 memcpy(buf, modname, strlen(modname)); | |
1355 i += strlen(modname); | |
1356 } | |
1357 buf[i++] = offset & 0xff; | |
1358 buf[i++] = (offset >> 8) & 0xff; | |
1359 buf[i++] = (offset >> 16) & 0xff; | |
1360 buf[i++] = (offset >> 24) & 0xff; | |
1361 buf[i++] = len & 0xff; | |
1362 buf[i++] = (len >> 8) & 0xff; | |
1363 buf[i++] = (len >> 16) & 0xff; | |
1364 buf[i++] = (len >> 24) & 0xff; | |
1365 debug_printf("len + offset is invalid, hashing request\n"); | |
1366 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); | |
1367 g_free(buf); | |
1368 return 1; | |
1369 } | |
1370 */ | |
1371 | |
1372 pos = g_new0(struct pieceofcrap, 1); | |
1373 pos->gc = sess->aux_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1374 pos->conn = fr->conn; |
2086 | 1375 |
1376 pos->offset = offset; | |
1377 pos->len = len; | |
1378 pos->modname = modname ? g_strdup(modname) : NULL; | |
1379 | |
4634 | 1380 if (proxy_connect(pos->gc->account, "gaim.sourceforge.net", 80, straight_to_hell, pos) != 0) { |
4056 | 1381 char buf[256]; |
2086 | 1382 if (pos->modname) |
1383 g_free(pos->modname); | |
1384 g_free(pos); | |
4056 | 1385 g_snprintf(buf, sizeof(buf), _("You may be disconnected shortly. You may want to use TOC until " |
1386 "this is fixed. Check %s for updates."), WEBSITE); | |
4452 | 1387 do_error_dialog(_("Gaim was Unable to get a valid login hash."), |
4056 | 1388 buf, GAIM_WARNING); |
2086 | 1389 } |
1390 | |
1391 return 1; | |
1392 } | |
1393 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1394 static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1395 char *key; |
1396 va_list ap; | |
1397 struct gaim_connection *gc = sess->aux_data; | |
4617 | 1398 struct oscar_data *od = gc->proto_data; |
2086 | 1399 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1400 va_start(ap, fr); |
2086 | 1401 key = va_arg(ap, char *); |
1402 va_end(ap); | |
1403 | |
4617 | 1404 if (od->icq) { |
3458 | 1405 struct client_info_s info = CLIENTINFO_ICQ_KNOWNGOOD; |
1406 aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key); | |
1407 } else { | |
1408 #if 0 | |
1409 struct client_info_s info = {"gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b}; | |
1410 #endif | |
1411 struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD; | |
1412 aim_send_login(sess, fr->conn, gc->username, gc->password, &info, key); | |
1413 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1414 |
2086 | 1415 return 1; |
1416 } | |
1417 | |
2675 | 1418 static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { |
2647 | 1419 struct gaim_connection *gc = sess->aux_data; |
1420 struct chat_connection *chatcon; | |
1421 static int id = 1; | |
1422 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1423 aim_conn_addhandler(sess, fr->conn, 0x000e, 0x0001, gaim_parse_genericerr, 0); |
2675 | 1424 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN, gaim_chat_join, 0); |
1425 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERLEAVE, gaim_chat_leave, 0); | |
1426 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE, gaim_chat_info_update, 0); | |
1427 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_chat_incoming_msg, 0); | |
1428 | |
2672 | 1429 aim_clientready(sess, fr->conn); |
2675 | 1430 |
2647 | 1431 chatcon = find_oscar_chat_by_conn(gc, fr->conn); |
1432 chatcon->id = id; | |
1433 chatcon->cnv = serv_got_joined_chat(gc, id++, chatcon->show); | |
1434 | |
1435 return 1; | |
1436 } | |
1437 | |
2675 | 1438 static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...) { |
1439 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1440 aim_conn_addhandler(sess, fr->conn, 0x000d, 0x0001, gaim_parse_genericerr, 0); |
2647 | 1441 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_INFO, gaim_chatnav_info, 0); |
2675 | 1442 |
1443 aim_clientready(sess, fr->conn); | |
1444 | |
1445 aim_chatnav_reqrights(sess, fr->conn); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1446 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1447 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1448 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1449 |
3694 | 1450 static int conninitdone_email(aim_session_t *sess, aim_frame_t *fr, ...) { |
1451 | |
1452 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); | |
1453 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_EML, AIM_CB_EML_MAILSTATUS, gaim_email_parseupdate, 0); | |
1454 | |
1455 aim_email_sendcookies(sess, fr->conn); | |
1456 aim_email_activate(sess, fr->conn); | |
1457 aim_clientready(sess, fr->conn); | |
1458 | |
1459 return 1; | |
1460 } | |
1461 | |
4804 | 1462 static int conninitdone_icon(aim_session_t *sess, aim_frame_t *fr, ...) { |
1463 struct gaim_connection *gc = sess->aux_data; | |
1464 struct oscar_data *od = gc->proto_data; | |
1465 | |
1466 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); | |
1467 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_ERROR, gaim_icon_error, 0); | |
1468 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_RESPONSE, gaim_icon_parseicon, 0); | |
1469 | |
1470 aim_clientready(sess, fr->conn); | |
1471 | |
4823 | 1472 od->iconconnecting = FALSE; |
1473 | |
4804 | 1474 if (od->icontimer) |
1475 g_source_remove(od->icontimer); | |
1476 od->icontimer = g_timeout_add(100, gaim_icon_timerfunc, gc); | |
1477 | |
1478 return 1; | |
1479 } | |
1480 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1481 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { |
2086 | 1482 struct gaim_connection *gc = data; |
4617 | 1483 struct oscar_data *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1484 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1485 aim_conn_t *tstconn; |
2086 | 1486 |
1487 if (!g_slist_find(connections, gc)) { | |
1488 close(source); | |
1489 return; | |
1490 } | |
1491 | |
4617 | 1492 od = gc->proto_data; |
1493 sess = od->sess; | |
2086 | 1494 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV); |
4366 | 1495 tstconn->fd = source; |
2086 | 1496 |
1497 if (source < 0) { | |
1498 aim_conn_kill(sess, &tstconn); | |
1499 debug_printf("unable to connect to chatnav server\n"); | |
1500 return; | |
1501 } | |
1502 | |
1503 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1504 od->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
2086 | 1505 debug_printf("chatnav: connected\n"); |
1506 } | |
1507 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1508 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 1509 { |
1510 struct gaim_connection *gc = data; | |
4617 | 1511 struct oscar_data *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1512 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1513 aim_conn_t *tstconn; |
2086 | 1514 |
1515 if (!g_slist_find(connections, gc)) { | |
1516 close(source); | |
1517 return; | |
1518 } | |
1519 | |
4617 | 1520 od = gc->proto_data; |
1521 sess = od->sess; | |
2086 | 1522 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); |
4366 | 1523 tstconn->fd = source; |
2086 | 1524 |
1525 if (source < 0) { | |
1526 aim_conn_kill(sess, &tstconn); | |
1527 debug_printf("unable to connect to authorizer\n"); | |
1528 return; | |
1529 } | |
1530 | |
1531 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1532 od->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
2086 | 1533 debug_printf("chatnav: connected\n"); |
1534 } | |
1535 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1536 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 1537 { |
1538 struct chat_connection *ccon = data; | |
1539 struct gaim_connection *gc = ccon->gc; | |
4617 | 1540 struct oscar_data *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1541 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1542 aim_conn_t *tstconn; |
2086 | 1543 |
1544 if (!g_slist_find(connections, gc)) { | |
1545 close(source); | |
1546 g_free(ccon->show); | |
1547 g_free(ccon->name); | |
1548 g_free(ccon); | |
1549 return; | |
1550 } | |
1551 | |
4617 | 1552 od = gc->proto_data; |
1553 sess = od->sess; | |
2086 | 1554 tstconn = ccon->conn; |
4366 | 1555 tstconn->fd = source; |
2086 | 1556 |
1557 if (source < 0) { | |
1558 aim_conn_kill(sess, &tstconn); | |
1559 g_free(ccon->show); | |
1560 g_free(ccon->name); | |
1561 g_free(ccon); | |
1562 return; | |
1563 } | |
1564 | |
1565 aim_conn_completeconnect(sess, ccon->conn); | |
4617 | 1566 ccon->inpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
1567 od->oscar_chats = g_slist_append(od->oscar_chats, ccon); | |
2086 | 1568 } |
1569 | |
3694 | 1570 static void oscar_email_connect(gpointer data, gint source, GaimInputCondition cond) { |
1571 struct gaim_connection *gc = data; | |
4617 | 1572 struct oscar_data *od; |
3694 | 1573 aim_session_t *sess; |
1574 aim_conn_t *tstconn; | |
1575 | |
1576 if (!g_slist_find(connections, gc)) { | |
1577 close(source); | |
1578 return; | |
1579 } | |
1580 | |
4617 | 1581 od = gc->proto_data; |
1582 sess = od->sess; | |
3694 | 1583 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_EMAIL); |
4366 | 1584 tstconn->fd = source; |
3694 | 1585 |
1586 if (source < 0) { | |
1587 aim_conn_kill(sess, &tstconn); | |
1588 debug_printf("unable to connect to email server\n"); | |
1589 return; | |
1590 } | |
1591 | |
1592 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1593 od->emlpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
3694 | 1594 debug_printf("email: connected\n"); |
1595 } | |
1596 | |
4804 | 1597 static void oscar_icon_connect(gpointer data, gint source, GaimInputCondition cond) { |
1598 struct gaim_connection *gc = data; | |
1599 struct oscar_data *od; | |
1600 aim_session_t *sess; | |
1601 aim_conn_t *tstconn; | |
1602 | |
1603 if (!g_slist_find(connections, gc)) { | |
1604 close(source); | |
1605 return; | |
1606 } | |
1607 | |
1608 od = gc->proto_data; | |
1609 sess = od->sess; | |
1610 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_ICON); | |
1611 tstconn->fd = source; | |
1612 | |
1613 if (source < 0) { | |
1614 aim_conn_kill(sess, &tstconn); | |
1615 debug_printf("unable to connect to icon server\n"); | |
1616 return; | |
1617 } | |
1618 | |
1619 aim_conn_completeconnect(sess, tstconn); | |
1620 od->icopa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); | |
1621 debug_printf("icon: connected\n"); | |
1622 } | |
1623 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1624 /* 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
|
1625 static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1626 struct gaim_connection *gc = sess->aux_data; |
4491 | 1627 struct gaim_account *account = gc->account; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1628 aim_conn_t *tstconn; |
4452 | 1629 int i; |
2086 | 1630 char *host; |
1631 int port; | |
4821 | 1632 va_list ap; |
1633 struct aim_redirect_data *redir; | |
2086 | 1634 |
4491 | 1635 port = account->proto_opt[USEROPT_AUTHPORT][0] ? |
1636 atoi(account->proto_opt[USEROPT_AUTHPORT]) : FAIM_LOGIN_PORT, | |
2086 | 1637 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1638 va_start(ap, fr); |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1639 redir = va_arg(ap, struct aim_redirect_data *); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1640 va_end(ap); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1641 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1642 for (i = 0; i < (int)strlen(redir->ip); i++) { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1643 if (redir->ip[i] == ':') { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1644 port = atoi(&(redir->ip[i+1])); |
2086 | 1645 break; |
1646 } | |
1647 } | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1648 host = g_strndup(redir->ip, i); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1649 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1650 switch(redir->group) { |
2086 | 1651 case 0x7: /* Authorizer */ |
1652 debug_printf("Reconnecting with authorizor...\n"); | |
1653 tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); | |
1654 if (tstconn == NULL) { | |
1655 debug_printf("unable to reconnect with authorizer\n"); | |
1656 g_free(host); | |
1657 return 1; | |
1658 } | |
4649 | 1659 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1660 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_admin, 0); |
2086 | 1661 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0003, gaim_info_change, 0); |
1662 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0005, gaim_info_change, 0); | |
1663 aim_conn_addhandler(sess, tstconn, 0x0007, 0x0007, gaim_account_confirm, 0); | |
1664 | |
1665 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
4634 | 1666 if (proxy_connect(account, host, port, oscar_auth_connect, gc) != 0) { |
2086 | 1667 aim_conn_kill(sess, &tstconn); |
1668 debug_printf("unable to reconnect with authorizer\n"); | |
1669 g_free(host); | |
1670 return 1; | |
1671 } | |
4293 | 1672 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
4194 | 1673 break; |
1674 | |
2086 | 1675 case 0xd: /* ChatNav */ |
1676 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, NULL); | |
1677 if (tstconn == NULL) { | |
1678 debug_printf("unable to connect to chatnav server\n"); | |
1679 g_free(host); | |
1680 return 1; | |
1681 } | |
4649 | 1682 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1683 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chatnav, 0); |
2086 | 1684 |
1685 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
4634 | 1686 if (proxy_connect(account, host, port, oscar_chatnav_connect, gc) != 0) { |
2086 | 1687 aim_conn_kill(sess, &tstconn); |
1688 debug_printf("unable to connect to chatnav server\n"); | |
1689 g_free(host); | |
1690 return 1; | |
1691 } | |
4293 | 1692 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
4194 | 1693 break; |
1694 | |
1695 case 0xe: { /* Chat */ | |
2086 | 1696 struct chat_connection *ccon; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1697 |
2086 | 1698 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, NULL); |
1699 if (tstconn == NULL) { | |
1700 debug_printf("unable to connect to chat server\n"); | |
1701 g_free(host); | |
1702 return 1; | |
1703 } | |
1704 | |
4649 | 1705 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1706 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chat, 0); |
1707 | |
2086 | 1708 ccon = g_new0(struct chat_connection, 1); |
1709 ccon->conn = tstconn; | |
1710 ccon->gc = gc; | |
1711 ccon->fd = -1; | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1712 ccon->name = g_strdup(redir->chat.room); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1713 ccon->exchange = redir->chat.exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1714 ccon->instance = redir->chat.instance; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1715 ccon->show = extract_name(redir->chat.room); |
4634 | 1716 |
2086 | 1717 ccon->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
4634 | 1718 if (proxy_connect(account, host, port, oscar_chat_connect, ccon) != 0) { |
2086 | 1719 aim_conn_kill(sess, &tstconn); |
1720 debug_printf("unable to connect to chat server\n"); | |
1721 g_free(host); | |
1722 g_free(ccon->show); | |
1723 g_free(ccon->name); | |
1724 g_free(ccon); | |
1725 return 1; | |
1726 } | |
4293 | 1727 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
4194 | 1728 debug_printf("Connected to chat room %s exchange %hu\n", ccon->name, ccon->exchange); |
1729 } break; | |
3694 | 1730 |
4804 | 1731 case 0x0010: { /* icon */ |
1732 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_ICON, NULL))) { | |
1733 debug_printf("unable to connect to icon server\n"); | |
1734 g_free(host); | |
1735 return 1; | |
1736 } | |
1737 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); | |
1738 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_icon, 0); | |
1739 | |
1740 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
1741 if (proxy_connect(account, host, port, oscar_icon_connect, gc) != 0) { | |
1742 aim_conn_kill(sess, &tstconn); | |
1743 debug_printf("unable to connect to icon server\n"); | |
1744 g_free(host); | |
1745 return 1; | |
1746 } | |
1747 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); | |
1748 } break; | |
1749 | |
3694 | 1750 case 0x0018: { /* email */ |
1751 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_EMAIL, NULL))) { | |
1752 debug_printf("unable to connect to email server\n"); | |
1753 g_free(host); | |
1754 return 1; | |
1755 } | |
4649 | 1756 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
3694 | 1757 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_email, 0); |
1758 | |
1759 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
4634 | 1760 if (proxy_connect(account, host, port, oscar_email_connect, gc) != 0) { |
3694 | 1761 aim_conn_kill(sess, &tstconn); |
1762 debug_printf("unable to connect to email server\n"); | |
1763 g_free(host); | |
1764 return 1; | |
1765 } | |
4293 | 1766 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
3694 | 1767 } break; |
1768 | |
2086 | 1769 default: /* huh? */ |
4194 | 1770 debug_printf("got redirect for unknown service 0x%04hx\n", redir->group); |
2086 | 1771 break; |
1772 } | |
1773 | |
1774 g_free(host); | |
1775 return 1; | |
1776 } | |
1777 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1778 static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1779 struct gaim_connection *gc = sess->aux_data; |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1780 struct oscar_data *od = gc->proto_data; |
4738 | 1781 struct buddyinfo *bi; |
2993 | 1782 time_t time_idle = 0, signon = 0; |
1783 int type = 0; | |
1784 int caps = 0; | |
2086 | 1785 va_list ap; |
4738 | 1786 aim_userinfo_t *info; |
4194 | 1787 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1788 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1789 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1790 va_end(ap); |
1791 | |
2993 | 1792 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) |
1793 caps = info->capabilities; | |
3267 | 1794 if (info->flags & AIM_FLAG_ACTIVEBUDDY) |
1795 type |= UC_AB; | |
1796 | |
4766 | 1797 if (info->present & AIM_USERINFO_PRESENT_FLAGS) { |
1798 if (info->flags & AIM_FLAG_UNCONFIRMED) | |
1799 type |= UC_UNCONFIRMED; | |
1800 if (info->flags & AIM_FLAG_ADMINISTRATOR) | |
1801 type |= UC_ADMIN; | |
1802 if (info->flags & AIM_FLAG_AOL) | |
1803 type |= UC_AOL; | |
1804 if (info->flags & AIM_FLAG_FREE) | |
1805 type |= UC_NORMAL; | |
1806 if (info->flags & AIM_FLAG_AWAY) | |
1807 type |= UC_UNAVAILABLE; | |
1808 if (info->flags & AIM_FLAG_WIRELESS) | |
1809 type |= UC_WIRELESS; | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1810 } |
2993 | 1811 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) { |
3595 | 1812 type = (info->icqinfo.status << 16); |
3013 | 1813 if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) && |
1814 (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) { | |
2993 | 1815 type |= UC_UNAVAILABLE; |
3013 | 1816 } |
2993 | 1817 } |
1818 | |
1819 if (caps & AIM_CAPS_ICQ) | |
1820 caps ^= AIM_CAPS_ICQ; | |
1821 | |
1822 if (info->present & AIM_USERINFO_PRESENT_IDLE) { | |
2086 | 1823 time(&time_idle); |
1824 time_idle -= info->idletime*60; | |
2993 | 1825 } |
1826 | |
1827 if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) | |
1828 signon = time(NULL) - info->sessionlen; | |
2086 | 1829 |
4269 | 1830 if (!aim_sncmp(gc->username, info->sn)) |
2305
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1831 g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", info->sn); |
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1832 |
4738 | 1833 bi = g_hash_table_lookup(od->buddyinfo, normalize(info->sn)); |
1834 if (!bi) { | |
1835 bi = g_new0(struct buddyinfo, 1); | |
1836 g_hash_table_insert(od->buddyinfo, g_strdup(normalize(info->sn)), bi); | |
1837 } | |
1838 bi->signon = info->onlinesince ? info->onlinesince : (info->sessionlen + time(NULL)); | |
4829 | 1839 if (caps) |
1840 bi->caps = caps; | |
4739 | 1841 bi->typingnot = FALSE; |
1842 bi->ico_informed = FALSE; | |
4732 | 1843 |
4804 | 1844 /* Server stored icon stuff */ |
4853 | 1845 if (info->iconcsumlen) { |
1846 char *b16, *saved_b16; | |
1847 struct buddy *b; | |
1848 | |
1849 memcpy(bi->iconcsum, info->iconcsum, info->iconcsumlen); | |
1850 bi->iconcsumlen = info->iconcsumlen; | |
1851 b16 = tobase16(bi->iconcsum, bi->iconcsumlen); | |
1852 b = gaim_find_buddy(gc->account, info->sn); | |
1853 saved_b16 = gaim_buddy_get_setting(b, "icon_checksum"); | |
1854 if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) { | |
1855 GSList *cur = od->requesticon; | |
1856 while (cur && aim_sncmp((char *)cur->data, info->sn)) | |
1857 cur = cur->next; | |
1858 if (!cur) { | |
1859 od->requesticon = g_slist_append(od->requesticon, strdup(normalize(info->sn))); | |
1860 if (od->icontimer) | |
1861 g_source_remove(od->icontimer); | |
1862 od->icontimer = g_timeout_add(500, gaim_icon_timerfunc, gc); | |
1863 } | |
1864 } | |
1865 free(saved_b16); | |
1866 free(b16); | |
1867 } | |
1868 | |
1869 serv_got_update(gc, info->sn, 1, info->warnlevel/10, signon, time_idle, type); | |
2086 | 1870 |
1871 return 1; | |
1872 } | |
1873 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1874 static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { |
4739 | 1875 struct gaim_connection *gc = sess->aux_data; |
2086 | 1876 va_list ap; |
4739 | 1877 aim_userinfo_t *info; |
2086 | 1878 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1879 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1880 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1881 va_end(ap); |
1882 | |
4732 | 1883 serv_got_update(gc, info->sn, 0, 0, 0, 0, 0); |
2086 | 1884 |
1885 return 1; | |
1886 } | |
1887 | |
3730 | 1888 static void cancel_direct_im(struct ask_direct *d) { |
2086 | 1889 debug_printf("Freeing DirectIM prompts.\n"); |
1890 | |
1891 g_free(d->sn); | |
1892 g_free(d); | |
1893 } | |
1894 | |
4617 | 1895 static void oscar_odc_callback(gpointer data, gint source, GaimInputCondition condition) { |
2086 | 1896 struct direct_im *dim = data; |
1897 struct gaim_connection *gc = dim->gc; | |
1898 struct oscar_data *od = gc->proto_data; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
1899 struct gaim_conversation *cnv; |
2086 | 1900 char buf[256]; |
3008 | 1901 struct sockaddr name; |
1902 socklen_t name_len = 1; | |
1903 | |
2086 | 1904 if (!g_slist_find(connections, gc)) { |
1905 g_free(dim); | |
1906 return; | |
1907 } | |
1908 | |
1909 if (source < 0) { | |
1910 g_free(dim); | |
1911 return; | |
1912 } | |
1913 | |
4366 | 1914 dim->conn->fd = source; |
2086 | 1915 aim_conn_completeconnect(od->sess, dim->conn); |
4491 | 1916 if (!(cnv = gaim_find_conversation(dim->name))) |
1917 cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, dim->name); | |
3008 | 1918 |
1919 /* This is the best way to see if we're connected or not */ | |
1920 if (getpeername(source, &name, &name_len) == 0) { | |
1921 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name); | |
1922 dim->connected = TRUE; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
1923 gaim_conversation_write(cnv, NULL, buf, -1, WFLAG_SYSTEM, time(NULL)); |
3008 | 1924 } |
2086 | 1925 od->direct_ims = g_slist_append(od->direct_ims, dim); |
3008 | 1926 |
4617 | 1927 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); |
2086 | 1928 } |
1929 | |
4617 | 1930 /* BBB */ |
3952 | 1931 /* |
4617 | 1932 * This is called after a remote AIM user has connected to us. We |
1933 * want to do some voodoo with the socket file descriptors, add a | |
1934 * callback or two, and then send the AIM_CB_OFT_PROMPT. | |
3952 | 1935 */ |
4656 | 1936 static int oscar_sendfile_estblsh(aim_session_t *sess, aim_frame_t *fr, ...) { |
3630 | 1937 struct gaim_connection *gc = sess->aux_data; |
1938 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4617 | 1939 struct gaim_xfer *xfer; |
1940 struct oscar_xfer_data *xfer_data; | |
3630 | 1941 va_list ap; |
1942 aim_conn_t *conn, *listenerconn; | |
4656 | 1943 |
1944 debug_printf("AAA - in oscar_sendfile_estblsh\n"); | |
3630 | 1945 va_start(ap, fr); |
1946 conn = va_arg(ap, aim_conn_t *); | |
1947 listenerconn = va_arg(ap, aim_conn_t *); | |
1948 va_end(ap); | |
1949 | |
4617 | 1950 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, listenerconn))) |
1951 return 1; | |
1952 | |
1953 if (!(xfer_data = xfer->data)) | |
1954 return 1; | |
1955 | |
3630 | 1956 /* Stop watching listener conn; watch transfer conn instead */ |
4617 | 1957 gaim_input_remove(xfer->watcher); |
3630 | 1958 aim_conn_kill(sess, &listenerconn); |
1959 | |
4617 | 1960 xfer_data->conn = conn; |
1961 xfer->fd = xfer_data->conn->fd; | |
1962 | |
1963 aim_conn_addhandler(sess, xfer_data->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ACK, oscar_sendfile_ack, 0); | |
1964 aim_conn_addhandler(sess, xfer_data->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DONE, oscar_sendfile_done, 0); | |
1965 xfer->watcher = gaim_input_add(xfer_data->conn->fd, GAIM_INPUT_READ, oscar_callback, xfer_data->conn); | |
1966 | |
1967 /* Inform the other user that we are connected and ready to transfer */ | |
4646 | 1968 aim_oft_sendheader(sess, xfer_data->conn, AIM_CB_OFT_PROMPT, NULL, xfer->filename, 0, 1, xfer->size, xfer->size, time(NULL), xfer_data->checksum, 0x02, 0, 0); |
3630 | 1969 |
1970 return 0; | |
1971 } | |
1972 | |
3952 | 1973 /* |
4617 | 1974 * This is the gaim callback passed to proxy_connect when connecting to another AIM |
1975 * user in order to transfer a file. | |
3952 | 1976 */ |
4617 | 1977 static void oscar_sendfile_connected(gpointer data, gint source, GaimInputCondition condition) { |
1978 struct gaim_connection *gc; | |
1979 struct gaim_xfer *xfer; | |
1980 struct oscar_xfer_data *xfer_data; | |
4656 | 1981 |
1982 debug_printf("AAA - in oscar_sendfile_connected\n"); | |
4617 | 1983 if (!(xfer = data)) |
1984 return; | |
1985 if (!(xfer_data = xfer->data)) | |
1986 return; | |
1987 if (!(gc = xfer_data->gc)) | |
3630 | 1988 return; |
4617 | 1989 if (source < 0) |
1990 return; | |
1991 | |
1992 xfer->fd = source; | |
1993 xfer_data->conn->fd = source; | |
1994 | |
1995 aim_conn_completeconnect(xfer_data->conn->sessv, xfer_data->conn); | |
1996 xfer->watcher = gaim_input_add(xfer->fd, GAIM_INPUT_READ, oscar_callback, xfer_data->conn); | |
1997 | |
1998 /* Inform the other user that we are connected and ready to transfer */ | |
1999 aim_im_sendch2_sendfile_accept(xfer_data->conn->sessv, xfer_data->cookie, xfer->who, AIM_CAPS_SENDFILE); | |
2000 | |
2001 return; | |
3630 | 2002 } |
2003 | |
3952 | 2004 /* |
4617 | 2005 * This is called when a buddy sends us some file info. This happens when they |
2006 * are sending a file to you, and you have just established a connection to them. | |
4650 | 2007 * You should send them the exact same info except use the real cookie. We also |
4617 | 2008 * get like totally ready to like, receive the file, kay? |
3952 | 2009 */ |
4617 | 2010 static int oscar_sendfile_prompt(aim_session_t *sess, aim_frame_t *fr, ...) { |
2011 struct gaim_connection *gc = sess->aux_data; | |
2012 struct oscar_data *od = gc->proto_data; | |
2013 struct gaim_xfer *xfer; | |
2014 struct oscar_xfer_data *xfer_data; | |
2015 va_list ap; | |
2016 aim_conn_t *conn; | |
2017 fu8_t *cookie; | |
2018 struct aim_fileheader_t *fh; | |
4656 | 2019 |
2020 debug_printf("AAA - in oscar_sendfile_prompt\n"); | |
4617 | 2021 va_start(ap, fr); |
2022 conn = va_arg(ap, aim_conn_t *); | |
2023 cookie = va_arg(ap, fu8_t *); | |
2024 fh = va_arg(ap, struct aim_fileheader_t *); | |
2025 va_end(ap); | |
2026 | |
2027 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, conn))) | |
2028 return 1; | |
2029 | |
2030 if (!(xfer_data = xfer->data)) | |
2031 return 1; | |
2032 | |
2033 /* Jot down some data we'll need later */ | |
2034 xfer_data->modtime = fh->modtime; | |
2035 xfer_data->checksum = fh->checksum; | |
2036 | |
2037 /* We want to stop listening with a normal thingy */ | |
2038 gaim_input_remove(xfer->watcher); | |
2039 xfer->watcher = 0; | |
2040 | |
2041 /* XXX - convert the name from UTF-8 to UCS-2 if necessary, and pass the encoding to the call below */ | |
4646 | 2042 aim_oft_sendheader(xfer_data->conn->sessv, xfer_data->conn, AIM_CB_OFT_ACK, xfer_data->cookie, xfer->filename, 0, 1, xfer->size, xfer->size, fh->modtime, fh->checksum, 0x02, 0, 0); |
4617 | 2043 gaim_xfer_start(xfer, xfer->fd, NULL, 0); |
2044 | |
2045 return 0; | |
3630 | 2046 } |
2047 | |
3952 | 2048 /* |
4657 | 2049 * We are sending a file to someone else. They have just acknowledged our |
4617 | 2050 * prompt, so we want to start sending data like there's no tomorrow. |
3952 | 2051 */ |
4617 | 2052 static int oscar_sendfile_ack(aim_session_t *sess, aim_frame_t *fr, ...) { |
2053 struct gaim_connection *gc = sess->aux_data; | |
2054 struct oscar_data *od = gc->proto_data; | |
2055 struct gaim_xfer *xfer; | |
2056 va_list ap; | |
2057 aim_conn_t *conn; | |
2058 fu8_t *cookie; | |
2059 struct aim_fileheader_t *fh; | |
4656 | 2060 |
2061 debug_printf("AAA - in oscar_sendfile_ack\n"); | |
4617 | 2062 va_start(ap, fr); |
2063 conn = va_arg(ap, aim_conn_t *); | |
2064 cookie = va_arg(ap, fu8_t *); | |
2065 fh = va_arg(ap, struct aim_fileheader_t *); | |
2066 va_end(ap); | |
2067 | |
2068 if (!(xfer = oscar_find_xfer_by_cookie(od->file_transfers, cookie))) | |
2069 return 1; | |
2070 | |
4656 | 2071 /* We want to stop listening with a normal thingy */ |
2072 gaim_input_remove(xfer->watcher); | |
2073 xfer->watcher = 0; | |
2074 | |
4617 | 2075 gaim_xfer_start(xfer, xfer->fd, NULL, 0); |
2076 | |
2077 return 0; | |
3630 | 2078 } |
4617 | 2079 |
2080 /* | |
2081 * We just sent a file to someone. They said they got it and everything, | |
2082 * so we can close our direct connection and what not. | |
2083 */ | |
2084 static int oscar_sendfile_done(aim_session_t *sess, aim_frame_t *fr, ...) { | |
2085 struct gaim_connection *gc = sess->aux_data; | |
2086 struct oscar_data *od = gc->proto_data; | |
2087 struct gaim_xfer *xfer; | |
2088 va_list ap; | |
2089 aim_conn_t *conn; | |
2090 fu8_t *cookie; | |
2091 struct aim_fileheader_t *fh; | |
4656 | 2092 |
2093 debug_printf("AAA - in oscar_sendfile_done\n"); | |
4617 | 2094 va_start(ap, fr); |
2095 conn = va_arg(ap, aim_conn_t *); | |
2096 cookie = va_arg(ap, fu8_t *); | |
2097 fh = va_arg(ap, struct aim_fileheader_t *); | |
2098 va_end(ap); | |
2099 | |
2100 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, conn))) | |
2101 return 1; | |
2102 | |
4656 | 2103 xfer->fd = conn->fd; |
4617 | 2104 gaim_xfer_end(xfer); |
2105 | |
2106 return 0; | |
2107 } | |
3630 | 2108 |
4244 | 2109 static void accept_direct_im(struct ask_direct *d) { |
2086 | 2110 struct gaim_connection *gc = d->gc; |
4244 | 2111 struct oscar_data *od; |
2086 | 2112 struct direct_im *dim; |
2945 | 2113 char *host; int port = 4443; |
4366 | 2114 int i, rc; |
2086 | 2115 |
4244 | 2116 if (!g_slist_find(connections, gc)) { |
2117 cancel_direct_im(d); | |
2118 return; | |
2119 } | |
2120 | |
2121 od = (struct oscar_data *)gc->proto_data; | |
2086 | 2122 debug_printf("Accepted DirectIM.\n"); |
2123 | |
2124 dim = find_direct_im(od, d->sn); | |
2125 if (dim) { | |
3730 | 2126 cancel_direct_im(d); /* 40 */ |
4244 | 2127 return; |
2086 | 2128 } |
2129 dim = g_new0(struct direct_im, 1); | |
2130 dim->gc = d->gc; | |
2131 g_snprintf(dim->name, sizeof dim->name, "%s", d->sn); | |
2132 | |
4617 | 2133 dim->conn = aim_odc_connect(od->sess, d->sn, NULL, d->cookie); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2134 if (!dim->conn) { |
2086 | 2135 g_free(dim); |
3730 | 2136 cancel_direct_im(d); |
4244 | 2137 return; |
2086 | 2138 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2139 |
2086 | 2140 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, |
4617 | 2141 gaim_odc_incoming, 0); |
2086 | 2142 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, |
4617 | 2143 gaim_odc_typing, 0); |
3033 | 2144 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, |
2993 | 2145 gaim_update_ui, 0); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2146 for (i = 0; i < (int)strlen(d->ip); i++) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2147 if (d->ip[i] == ':') { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2148 port = atoi(&(d->ip[i+1])); |
2086 | 2149 break; |
2150 } | |
2151 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2152 host = g_strndup(d->ip, i); |
2086 | 2153 dim->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
4634 | 2154 rc = proxy_connect(gc->account, host, port, oscar_odc_callback, dim); |
2086 | 2155 g_free(host); |
4366 | 2156 if (rc < 0) { |
2086 | 2157 aim_conn_kill(od->sess, &dim->conn); |
2158 g_free(dim); | |
3730 | 2159 cancel_direct_im(d); |
4244 | 2160 return; |
2086 | 2161 } |
2162 | |
3730 | 2163 cancel_direct_im(d); |
2086 | 2164 |
4244 | 2165 return; |
2086 | 2166 } |
2167 | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2168 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2169 struct gaim_connection *gc = sess->aux_data; |
3600 | 2170 struct oscar_data *od = gc->proto_data; |
4738 | 2171 char *tmp; |
2273
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2172 int flags = 0; |
3659 | 2173 int convlen; |
2174 GError *err = NULL; | |
4738 | 2175 struct buddyinfo *bi; |
2176 | |
2177 bi = g_hash_table_lookup(od->buddyinfo, normalize(userinfo->sn)); | |
2178 if (!bi) { | |
2179 bi = g_new0(struct buddyinfo, 1); | |
2180 g_hash_table_insert(od->buddyinfo, g_strdup(normalize(userinfo->sn)), bi); | |
2181 } | |
2273
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2182 |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2183 if (args->icbmflags & AIM_IMFLAGS_AWAY) |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2184 flags |= IM_FLAG_AWAY; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2185 |
4738 | 2186 if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT) |
2187 bi->typingnot = TRUE; | |
2188 else | |
2189 bi->typingnot = FALSE; | |
2190 | |
4380 | 2191 if ((args->icbmflags & AIM_IMFLAGS_HASICON) && (args->iconlen) && (args->iconsum) && (args->iconstamp)) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2192 debug_printf("%s has an icon\n", userinfo->sn); |
4738 | 2193 if ((args->iconlen != bi->ico_len) || (args->iconsum != bi->ico_csum) || (args->iconstamp != bi->ico_time)) { |
2194 bi->ico_need = TRUE; | |
2195 bi->ico_len = args->iconlen; | |
2196 bi->ico_csum = args->iconsum; | |
2197 bi->ico_time = args->iconstamp; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2198 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2199 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2200 |
4491 | 2201 if (gc->account->iconfile[0] && (args->icbmflags & AIM_IMFLAGS_BUDDYREQ)) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2202 FILE *file; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2203 struct stat st; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2204 |
4491 | 2205 if (!stat(gc->account->iconfile, &st)) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2206 char *buf = g_malloc(st.st_size); |
4491 | 2207 file = fopen(gc->account->iconfile, "rb"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2208 if (file) { |
2603
24664768a739
[gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
2209 int len = fread(buf, 1, st.st_size, file); |
4194 | 2210 debug_printf("Sending buddy icon to %s (%d bytes, %lu reported)\n", |
4617 | 2211 userinfo->sn, len, st.st_size); |
2212 aim_im_sendch2_icon(sess, userinfo->sn, buf, st.st_size, | |
2213 st.st_mtime, aimutil_iconsum(buf, st.st_size)); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2214 fclose(file); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
2215 } else |
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
2216 debug_printf("Can't open buddy icon file!\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2217 g_free(buf); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
2218 } else |
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
2219 debug_printf("Can't stat buddy icon file!\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2220 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2221 |
4662 | 2222 debug_printf("Character set is %hu %hu\n", args->charset, args->charsubset); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2223 if (args->icbmflags & AIM_IMFLAGS_UNICODE) { |
3722 | 2224 /* This message is marked as UNICODE, so we have to |
2225 * convert it to utf-8 before handing it to the gaim core. | |
2226 * This conversion should *never* fail, if it does it | |
2227 * means that either the incoming ICBM is corrupted or | |
4662 | 2228 * there is something we don't understand about it. |
2229 * For the record, AIM Unicode is big-endian UCS-2 */ | |
2230 | |
2231 debug_printf("Received UNICODE IM\n"); | |
4121 | 2232 |
2233 if (!args->msg || !args->msglen) | |
2234 return 1; | |
4641 | 2235 |
3659 | 2236 tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err); |
2237 if (err) { | |
2238 debug_printf("Unicode IM conversion: %s\n", err->message); | |
2239 tmp = strdup(_("(There was an error receiving this message)")); | |
4800 | 2240 g_error_free(err); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2241 } |
3722 | 2242 } else { |
3850 | 2243 /* This will get executed for both AIM_IMFLAGS_ISO_8859_1 and |
3722 | 2244 * unflagged messages, which are ASCII. That's OK because |
2245 * ASCII is a strict subset of ISO-8859-1; this should | |
2246 * help with compatibility with old, broken versions of | |
2247 * gaim (everything before 0.60) and other broken clients | |
2248 * that will happily send ISO-8859-1 without marking it as | |
2249 * such */ | |
4662 | 2250 if (args->icbmflags & AIM_IMFLAGS_ISO_8859_1) |
4194 | 2251 debug_printf("Received ISO-8859-1 IM\n"); |
4121 | 2252 |
2253 if (!args->msg || !args->msglen) | |
2254 return 1; | |
2255 | |
3659 | 2256 tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &convlen, &err); |
2257 if (err) { | |
2258 debug_printf("ISO-8859-1 IM conversion: %s\n", err->message); | |
2259 tmp = strdup(_("(There was an error receiving this message)")); | |
4800 | 2260 g_error_free(err); |
3659 | 2261 } |
3642 | 2262 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2263 |
4333 | 2264 /* strip_linefeed(tmp); */ |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2833
diff
changeset
|
2265 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
|
2266 g_free(tmp); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2267 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2268 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2269 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2270 |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2271 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
|
2272 struct gaim_connection *gc = sess->aux_data; |
4617 | 2273 struct oscar_data *od = gc->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2274 |
4121 | 2275 if (!args) |
2276 return 0; | |
4194 | 2277 |
4617 | 2278 debug_printf("rendezvous with %s, status is %hu\n", userinfo->sn, args->status); |
2869 | 2279 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2280 if (args->reqclass & AIM_CAPS_CHAT) { |
4121 | 2281 char *name; |
4120 | 2282 int *exch; |
4121 | 2283 GList *m = NULL; |
4120 | 2284 |
4121 | 2285 if (!args->info.chat.roominfo.name || !args->info.chat.roominfo.exchange || !args->msg) |
2286 return 1; | |
2287 name = extract_name(args->info.chat.roominfo.name); | |
4120 | 2288 exch = g_new0(int, 1); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2289 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
|
2290 *exch = args->info.chat.roominfo.exchange; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2291 m = g_list_append(m, exch); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2292 serv_got_chat_invite(gc, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2293 name ? name : args->info.chat.roominfo.name, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2294 userinfo->sn, |
2869 | 2295 (char *)args->msg, |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2296 m); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2297 if (name) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2298 g_free(name); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2299 } else if (args->reqclass & AIM_CAPS_SENDFILE) { |
4617 | 2300 /* BBB */ |
2301 if (args->status == AIM_RENDEZVOUS_PROPOSE) { | |
2302 /* Someone wants to send a file (or files) to us */ | |
2303 struct gaim_xfer *xfer; | |
2304 struct oscar_xfer_data *xfer_data; | |
2305 | |
2306 if (!args->cookie || !args->verifiedip || !args->port || | |
2307 !args->info.sendfile.filename || !args->info.sendfile.totsize || | |
4656 | 2308 !args->info.sendfile.totfiles || !args->reqclass) { |
2309 debug_printf("%s tried to send you a file with incomplete information.\n", userinfo->sn); | |
4617 | 2310 return 1; |
4656 | 2311 } |
4617 | 2312 |
2313 if (args->info.sendfile.subtype == AIM_OFT_SUBTYPE_SEND_DIR) { | |
2314 /* last char of the ft req is a star, they are sending us a | |
2315 * directory -- remove the star and trailing slash so we dont save | |
2316 * directories that look like 'dirname\*' -- arl */ | |
2317 char *tmp = strrchr(args->info.sendfile.filename, '\\'); | |
2318 if (tmp && (tmp[1] == '*')) { | |
2319 tmp[0] = '\0'; | |
2320 } | |
2321 } | |
2322 | |
2323 /* Setup the oscar-specific transfer xfer_data */ | |
2324 xfer_data = g_malloc0(sizeof(struct oscar_xfer_data)); | |
2325 xfer_data->gc = gc; | |
2326 memcpy(xfer_data->cookie, args->cookie, 8); | |
2327 | |
2328 /* Build the file transfer handle */ | |
2329 xfer = gaim_xfer_new(gc->account, GAIM_XFER_RECEIVE, userinfo->sn); | |
2330 xfer_data->xfer = xfer; | |
2331 xfer->data = xfer_data; | |
2332 | |
2333 /* Set the info about the incoming file */ | |
2334 gaim_xfer_set_filename(xfer, args->info.sendfile.filename); | |
2335 gaim_xfer_set_size(xfer, args->info.sendfile.totsize); | |
2336 xfer->remote_port = args->port; | |
4650 | 2337 xfer->remote_ip = g_strdup(args->verifiedip); |
4898 | 2338 if (args->proxyip) |
2339 xfer_data->proxyip = g_strdup(args->proxyip); | |
4650 | 2340 if (args->clientip) |
2341 xfer_data->clientip = g_strdup(args->clientip); | |
4898 | 2342 if (args->verifiedip) |
2343 xfer_data->verifiedip = g_strdup(args->verifiedip); | |
4617 | 2344 |
2345 /* Setup our I/O op functions */ | |
2346 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init); | |
2347 gaim_xfer_set_start_fnc(xfer, oscar_xfer_start); | |
2348 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2349 gaim_xfer_set_cancel_send_fnc(xfer, oscar_xfer_cancel_send); |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2350 gaim_xfer_set_cancel_recv_fnc(xfer, oscar_xfer_cancel_recv); |
4617 | 2351 gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack); |
2352 | |
2353 /* | |
2354 * XXX - Should do something with args->msg, args->encoding, and args->language | |
2355 * probably make it apply to all ch2 messages. | |
3752 | 2356 */ |
4617 | 2357 |
2358 /* Keep track of this transfer for later */ | |
2359 od->file_transfers = g_slist_append(od->file_transfers, xfer); | |
2360 | |
2361 /* Now perform the request */ | |
2362 gaim_xfer_request(xfer); | |
2363 } else if (args->status == AIM_RENDEZVOUS_CANCEL) { | |
2364 /* The other user wants to cancel a file transfer */ | |
2365 struct gaim_xfer *xfer; | |
2366 debug_printf("AAA - File transfer canceled by remote user\n"); | |
2367 if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, args->cookie))) | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2368 gaim_xfer_cancel_remote(xfer); |
4617 | 2369 } else if (args->status == AIM_RENDEZVOUS_ACCEPT) { |
2370 /* | |
2371 * This gets sent by the receiver of a file | |
2372 * as they connect directly to us. If we don't | |
2373 * get this, then maybe a third party connected | |
2374 * to us, and we shouldn't send them anything. | |
2375 */ | |
2376 } else { | |
2377 debug_printf("unknown rendezvous status!\n"); | |
3630 | 2378 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2379 } else if (args->reqclass & AIM_CAPS_GETFILE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2380 } else if (args->reqclass & AIM_CAPS_VOICE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2381 } else if (args->reqclass & AIM_CAPS_BUDDYICON) { |
4799 | 2382 set_icon_data(gc, userinfo->sn, args->info.icon.icon, |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2383 args->info.icon.length); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2384 } else if (args->reqclass & AIM_CAPS_IMIMAGE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2385 struct ask_direct *d = g_new0(struct ask_direct, 1); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2386 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2387 |
4212 | 2388 if (!args->verifiedip) { |
4650 | 2389 debug_printf("directim kill blocked (%s)\n", userinfo->sn); |
2390 return 1; | |
4212 | 2391 } |
2392 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2393 debug_printf("%s received direct im request from %s (%s)\n", |
2869 | 2394 gc->username, userinfo->sn, args->verifiedip); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2395 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2396 d->gc = gc; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2397 d->sn = g_strdup(userinfo->sn); |
2869 | 2398 strncpy(d->ip, args->verifiedip, sizeof(d->ip)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2399 memcpy(d->cookie, args->cookie, 8); |
4650 | 2400 g_snprintf(buf, sizeof buf, _("%s has just asked to directly connect to %s"), userinfo->sn, gc->username); |
4249 | 2401 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, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2402 } else { |
4194 | 2403 debug_printf("Unknown reqclass %hu\n", args->reqclass); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2404 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2405 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2406 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2407 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2408 |
3453 | 2409 /* |
4230 | 2410 * Authorization Functions |
2411 * Most of these are callbacks from dialogs. They're used by both | |
2412 * methods of authorization (SSI and old-school channel 4 ICBM) | |
3453 | 2413 */ |
4269 | 2414 /* When you ask other people for authorization */ |
4337 | 2415 static void gaim_auth_request(struct name_data *data, char *msg) { |
4230 | 2416 struct gaim_connection *gc = data->gc; |
4244 | 2417 |
2418 if (g_slist_find(connections, gc)) { | |
2419 struct oscar_data *od = gc->proto_data; | |
4687 | 2420 struct buddy *buddy = gaim_find_buddy(gc->account, data->name); |
2421 struct group *group = gaim_find_buddys_group(buddy); | |
4244 | 2422 if (buddy && group) { |
2423 debug_printf("ssi: adding buddy %s to group %s\n", buddy->name, group->name); | |
4889 | 2424 aim_ssi_sendauthrequest(od->sess, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list.")); |
4269 | 2425 if (!aim_ssi_itemlist_finditem(od->sess->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY)) |
4889 | 2426 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 1); |
4244 | 2427 } |
4230 | 2428 } |
4337 | 2429 } |
2430 | |
2431 static void gaim_auth_request_msgprompt(struct name_data *data) { | |
2432 do_prompt_dialog(_("Authorization Request Message:"), _("Please authorize me!"), data, gaim_auth_request, gaim_free_name_data); | |
4230 | 2433 } |
2434 | |
2435 static void gaim_auth_dontrequest(struct name_data *data) { | |
4244 | 2436 struct gaim_connection *gc = data->gc; |
2437 | |
2438 if (g_slist_find(connections, gc)) { | |
2439 /* struct oscar_data *od = gc->proto_data; */ | |
2440 /* XXX - Take the buddy out of our buddy list */ | |
2441 } | |
2442 | |
4230 | 2443 gaim_free_name_data(data); |
2444 } | |
2445 | |
5136 | 2446 static void gaim_auth_sendrequest(struct gaim_connection *gc, const char *name) { |
4269 | 2447 struct name_data *data = g_new(struct name_data, 1); |
2448 struct buddy *buddy; | |
2449 gchar *dialog_msg, *nombre; | |
2450 | |
4687 | 2451 buddy = gaim_find_buddy(gc->account, name); |
2452 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
2453 nombre = g_strdup_printf("%s (%s)", name, gaim_get_buddy_alias_only(buddy)); | |
4269 | 2454 else |
4830 | 2455 nombre = NULL; |
2456 | |
2457 dialog_msg = g_strdup_printf(_("The user %s requires authorization before being added to a buddy list. Do you want to send an authorization request?"), (nombre ? nombre : name)); | |
4269 | 2458 data->gc = gc; |
2459 data->name = g_strdup(name); | |
2460 data->nick = NULL; | |
4337 | 2461 do_ask_dialog(_("Request Authorization"), dialog_msg, data, _("Request Authorization"), gaim_auth_request_msgprompt, _("Cancel"), gaim_auth_dontrequest, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE); |
4269 | 2462 |
2463 g_free(dialog_msg); | |
2464 g_free(nombre); | |
2465 } | |
2466 | |
4230 | 2467 /* When other people ask you for authorization */ |
2468 static void gaim_auth_grant(struct name_data *data) { | |
2469 struct gaim_connection *gc = data->gc; | |
4244 | 2470 |
2471 if (g_slist_find(connections, gc)) { | |
2472 struct oscar_data *od = gc->proto_data; | |
4236 | 2473 #ifdef NOSSI |
4244 | 2474 struct buddy *buddy; |
2475 gchar message; | |
2476 message = 0; | |
4687 | 2477 buddy = gaim_find_buddy(gc->account, data->name); |
4617 | 2478 aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHGRANTED, &message); |
4687 | 2479 show_got_added(gc, NULL, data->name, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); |
4230 | 2480 #else |
4889 | 2481 aim_ssi_sendauthreply(od->sess, data->name, 0x01, NULL); |
4230 | 2482 #endif |
4244 | 2483 } |
2484 | |
4230 | 2485 gaim_free_name_data(data); |
3141 | 2486 } |
2487 | |
4230 | 2488 /* When other people ask you for authorization */ |
4337 | 2489 static void gaim_auth_dontgrant(struct name_data *data, char *msg) { |
4230 | 2490 struct gaim_connection *gc = data->gc; |
4244 | 2491 |
2492 if (g_slist_find(connections, gc)) { | |
2493 struct oscar_data *od = gc->proto_data; | |
4230 | 2494 #ifdef NOSSI |
4617 | 2495 aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHDENIED, msg ? msg : _("No reason given.")); |
4230 | 2496 #else |
4889 | 2497 aim_ssi_sendauthreply(od->sess, data->name, 0x00, msg ? msg : _("No reason given.")); |
4230 | 2498 #endif |
4244 | 2499 } |
4337 | 2500 } |
2501 | |
2502 static void gaim_auth_dontgrant_msgprompt(struct name_data *data) { | |
2503 do_prompt_dialog(_("Authorization Denied Message:"), _("No reason given."), data, gaim_auth_dontgrant, gaim_free_name_data); | |
3141 | 2504 } |
2505 | |
4230 | 2506 /* When someone sends you contacts */ |
2507 static void gaim_icq_contactadd(struct name_data *data) { | |
2508 struct gaim_connection *gc = data->gc; | |
4244 | 2509 |
2510 if (g_slist_find(connections, gc)) { | |
2511 show_add_buddy(gc, data->name, NULL, data->nick); | |
2512 } | |
2513 | |
4230 | 2514 gaim_free_name_data(data); |
3453 | 2515 } |
2516 | |
4075 | 2517 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 | 2518 struct gaim_connection *gc = sess->aux_data; |
4076 | 2519 gchar **msg1, **msg2; |
2520 GError *err = NULL; | |
2521 int i; | |
2522 | |
4121 | 2523 if (!args->type || !args->msg || !args->uin) |
2524 return 1; | |
4194 | 2525 |
2526 debug_printf("Received a channel 4 message of type 0x%02hhx.\n", args->type); | |
4076 | 2527 |
2528 /* Split up the message at the delimeter character, then convert each string to UTF-8 */ | |
4173 | 2529 msg1 = g_strsplit(args->msg, "\376", 0); |
4194 | 2530 msg2 = (gchar **)g_malloc(10*sizeof(gchar *)); /* XXX - 10 is a guess */ |
4076 | 2531 for (i=0; msg1[i]; i++) { |
2532 strip_linefeed(msg1[i]); | |
2533 msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err); | |
4800 | 2534 if (err) { |
4076 | 2535 debug_printf("Error converting a string from ISO-8859-1 to UTF-8 in oscar ICBM channel 4 parsing\n"); |
4800 | 2536 g_error_free(err); |
2537 } | |
4076 | 2538 } |
2539 msg2[i] = NULL; | |
2540 | |
3952 | 2541 switch (args->type) { |
4173 | 2542 case 0x01: { /* MacICQ message or basic offline message */ |
4076 | 2543 if (i >= 1) { |
2544 gchar *uin = g_strdup_printf("%lu", args->uin); | |
2545 if (t) { /* This is an offline message */ | |
2546 /* I think this timestamp is in UTC, or something */ | |
2547 serv_got_im(gc, uin, msg2[0], 0, t, -1); | |
2548 } else { /* This is a message from MacICQ/Miranda */ | |
2549 serv_got_im(gc, uin, msg2[0], 0, time(NULL), -1); | |
2550 } | |
2551 g_free(uin); | |
4075 | 2552 } |
3316 | 2553 } break; |
2554 | |
4173 | 2555 case 0x04: { /* Someone sent you a URL */ |
4076 | 2556 if (i >= 2) { |
2557 gchar *uin = g_strdup_printf("%lu", args->uin); | |
2558 gchar *message = g_strdup_printf("<A HREF=\"%s\">%s</A>", msg2[1], msg2[0]); | |
3453 | 2559 serv_got_im(gc, uin, message, 0, time(NULL), -1); |
2560 g_free(uin); | |
2561 g_free(message); | |
2562 } | |
2563 } break; | |
2564 | |
4173 | 2565 case 0x06: { /* Someone requested authorization */ |
4076 | 2566 if (i >= 6) { |
4230 | 2567 struct name_data *data = g_new(struct name_data, 1); |
4337 | 2568 gchar *dialog_msg = g_strdup_printf(_("The user %lu wants to add you to their buddy list for the following reason:\n%s"), args->uin, msg2[5] ? msg2[5] : _("No reason given.")); |
4076 | 2569 debug_printf("Received an authorization request from UIN %lu\n", args->uin); |
2570 data->gc = gc; | |
4230 | 2571 data->name = g_strdup_printf("%lu", args->uin); |
2572 data->nick = NULL; | |
4337 | 2573 do_ask_dialog(_("Authorization Request"), dialog_msg, data, _("Authorize"), gaim_auth_grant, _("Deny"), gaim_auth_dontgrant_msgprompt, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE); |
4076 | 2574 g_free(dialog_msg); |
2575 } | |
3141 | 2576 } break; |
2577 | |
4173 | 2578 case 0x07: { /* Someone has denied you authorization */ |
4076 | 2579 if (i >= 1) { |
4194 | 2580 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.")); |
4230 | 2581 do_error_dialog(_("ICQ authorization denied."), dialog_msg, GAIM_INFO); |
4076 | 2582 g_free(dialog_msg); |
2583 } | |
3141 | 2584 } break; |
2585 | |
4173 | 2586 case 0x08: { /* Someone has granted you authorization */ |
4194 | 2587 gchar *dialog_msg = g_strdup_printf(_("The user %lu has granted your request to add them to your contact list."), args->uin); |
3427 | 2588 do_error_dialog("ICQ authorization accepted.", dialog_msg, GAIM_INFO); |
3141 | 2589 g_free(dialog_msg); |
2590 } break; | |
2591 | |
4333 | 2592 case 0x09: { /* Message from the Godly ICQ server itself, I think */ |
2593 if (i >= 5) { | |
2594 gchar *dialog_msg = g_strdup_printf(_("You have received a special message\n\nFrom: %s [%s]\n%s"), msg2[0], msg2[3], msg2[5]); | |
2595 do_error_dialog("ICQ Server Message", dialog_msg, GAIM_INFO); | |
2596 g_free(dialog_msg); | |
2597 } | |
2598 } break; | |
2599 | |
4173 | 2600 case 0x0d: { /* Someone has sent you a pager message from http://www.icq.com/your_uin */ |
4076 | 2601 if (i >= 6) { |
4194 | 2602 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 | 2603 do_error_dialog("ICQ Page", dialog_msg, GAIM_INFO); |
2604 g_free(dialog_msg); | |
2605 } | |
4075 | 2606 } break; |
2607 | |
4173 | 2608 case 0x0e: { /* Someone has emailed you at your_uin@pager.icq.com */ |
4076 | 2609 if (i >= 6) { |
4308 | 2610 gchar *dialog_msg = g_strdup_printf(_("You have received an ICQ email from %s [%s]\n\nMessage is:\n%s"), msg2[0], msg2[3], msg2[5]); |
4076 | 2611 do_error_dialog("ICQ Email", dialog_msg, GAIM_INFO); |
2612 g_free(dialog_msg); | |
2613 } | |
4075 | 2614 } break; |
2615 | |
4173 | 2616 case 0x12: { |
3141 | 2617 /* Ack for authorizing/denying someone. Or possibly an ack for sending any system notice */ |
4173 | 2618 /* Someone added you to their contact list? */ |
3141 | 2619 } break; |
2620 | |
4173 | 2621 case 0x13: { /* Someone has sent you some ICQ contacts */ |
3453 | 2622 int i, num; |
2623 gchar **text; | |
4173 | 2624 text = g_strsplit(args->msg, "\376", 0); |
3453 | 2625 if (text) { |
2626 num = 0; | |
2627 for (i=0; i<strlen(text[0]); i++) | |
2628 num = num*10 + text[0][i]-48; | |
2629 for (i=0; i<num; i++) { | |
4230 | 2630 struct name_data *data = g_new(struct name_data, 1); |
3730 | 2631 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 | 2632 data->gc = gc; |
4790 | 2633 data->name = g_strdup(text[i*2+1]); |
2634 data->nick = g_strdup(text[i*2+2]); | |
4249 | 2635 do_ask_dialog(message, _("Do you want to add this contact to your Buddy List?"), data, _("Add"), gaim_icq_contactadd, _("Decline"), gaim_free_name_data, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE); |
3453 | 2636 g_free(message); |
2637 } | |
2638 g_strfreev(text); | |
2639 } | |
2640 } break; | |
2641 | |
4173 | 2642 case 0x1a: { /* Someone has sent you a greeting card or requested contacts? */ |
3453 | 2643 /* This is boring and silly. */ |
2644 } break; | |
2645 | |
3141 | 2646 default: { |
4194 | 2647 debug_printf("Received a channel 4 message of unknown type (type 0x%02hhx).\n", args->type); |
3141 | 2648 } break; |
2649 } | |
2650 | |
4076 | 2651 g_strfreev(msg1); |
2652 g_strfreev(msg2); | |
2653 | |
3141 | 2654 return 1; |
2655 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2656 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2657 static int gaim_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...) { |
4200 | 2658 fu16_t channel; |
2659 int ret = 0; | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2660 aim_userinfo_t *userinfo; |
2086 | 2661 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2662 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2663 va_start(ap, fr); |
4200 | 2664 channel = (fu16_t)va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2665 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 2666 |
3141 | 2667 switch (channel) { |
2668 case 1: { /* standard message */ | |
2669 struct aim_incomingim_ch1_args *args; | |
2670 args = va_arg(ap, struct aim_incomingim_ch1_args *); | |
2671 ret = incomingim_chan1(sess, fr->conn, userinfo, args); | |
2672 } break; | |
2673 | |
2674 case 2: { /* rendevous */ | |
2675 struct aim_incomingim_ch2_args *args; | |
2676 args = va_arg(ap, struct aim_incomingim_ch2_args *); | |
2677 ret = incomingim_chan2(sess, fr->conn, userinfo, args); | |
2678 } break; | |
2679 | |
2680 case 4: { /* ICQ */ | |
2681 struct aim_incomingim_ch4_args *args; | |
2682 args = va_arg(ap, struct aim_incomingim_ch4_args *); | |
4075 | 2683 ret = incomingim_chan4(sess, fr->conn, userinfo, args, 0); |
3141 | 2684 } break; |
2685 | |
2686 default: { | |
4194 | 2687 debug_printf("ICBM received on unsupported channel (channel 0x%04hx).", channel); |
3141 | 2688 } break; |
2086 | 2689 } |
2690 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2691 va_end(ap); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2692 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2693 return ret; |
2086 | 2694 } |
2695 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2696 static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2697 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2698 fu16_t chan, nummissed, reason; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2699 aim_userinfo_t *userinfo; |
2086 | 2700 char buf[1024]; |
2701 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2702 va_start(ap, fr); |
4200 | 2703 chan = (fu16_t)va_arg(ap, unsigned int); |
2704 userinfo = va_arg(ap, aim_userinfo_t *); | |
2705 nummissed = (fu16_t)va_arg(ap, unsigned int); | |
2706 reason = (fu16_t)va_arg(ap, unsigned int); | |
2086 | 2707 va_end(ap); |
2708 | |
2709 switch(reason) { | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2710 case 0: |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2711 /* Invalid (0) */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2712 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2713 sizeof(buf), |
4276 | 2714 ngettext( |
2715 "You missed %hu message from %s because it was invalid.", | |
2716 "You missed %hu messages from %s because they were invalid.", | |
2717 nummissed), | |
4282 | 2718 nummissed, |
2719 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2720 break; |
2086 | 2721 case 1: |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2722 /* Message too large */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2723 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2724 sizeof(buf), |
4276 | 2725 ngettext( |
2726 "You missed %hu message from %s because it was too large.", | |
2727 "You missed %hu messages from %s because they were too large.", | |
2728 nummissed), | |
4282 | 2729 nummissed, |
2730 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2731 break; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2732 case 2: |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2733 /* Rate exceeded */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2734 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2735 sizeof(buf), |
4276 | 2736 ngettext( |
2737 "You missed %hu message from %s because the rate limit has been exceeded.", | |
2738 "You missed %hu messages from %s because the rate limit has been exceeded.", | |
2739 nummissed), | |
4282 | 2740 nummissed, |
2741 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2742 break; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2743 case 3: |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2744 /* Evil Sender */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2745 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2746 sizeof(buf), |
4276 | 2747 ngettext( |
2748 "You missed %hu message from %s because he/she was too evil.", | |
2749 "You missed %hu messages from %s because he/she was too evil.", | |
2750 nummissed), | |
4282 | 2751 nummissed, |
2752 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2753 break; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2754 case 4: |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2755 /* Evil Receiver */ |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2756 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2757 sizeof(buf), |
4276 | 2758 ngettext( |
2759 "You missed %hu message from %s because you are too evil.", | |
2760 "You missed %hu messages from %s because you are too evil.", | |
2761 nummissed), | |
4282 | 2762 nummissed, |
2763 userinfo->sn); | |
2086 | 2764 break; |
2765 default: | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2766 g_snprintf(buf, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2767 sizeof(buf), |
4276 | 2768 ngettext( |
2769 "You missed %hu message from %s for an unknown reason.", | |
2770 "You missed %hu messages from %s for an unknown reason.", | |
2771 nummissed), | |
4282 | 2772 nummissed, |
2773 userinfo->sn); | |
2086 | 2774 break; |
2775 } | |
3427 | 2776 do_error_dialog(buf, NULL, GAIM_ERROR); |
2086 | 2777 |
2778 return 1; | |
2779 } | |
2780 | |
3212 | 2781 static char *gaim_icq_status(int state) { |
2782 /* Make a cute little string that shows the status of the dude or dudet */ | |
2783 if (state & AIM_ICQ_STATE_CHAT) | |
4342 | 2784 return g_strdup_printf(_("Free For Chat")); |
3212 | 2785 else if (state & AIM_ICQ_STATE_DND) |
4342 | 2786 return g_strdup_printf(_("Do Not Disturb")); |
3212 | 2787 else if (state & AIM_ICQ_STATE_OUT) |
4342 | 2788 return g_strdup_printf(_("Not Available")); |
3212 | 2789 else if (state & AIM_ICQ_STATE_BUSY) |
4342 | 2790 return g_strdup_printf(_("Occupied")); |
3212 | 2791 else if (state & AIM_ICQ_STATE_AWAY) |
4342 | 2792 return g_strdup_printf(_("Away")); |
3212 | 2793 else if (state & AIM_ICQ_STATE_WEBAWARE) |
4342 | 2794 return g_strdup_printf(_("Web Aware")); |
3212 | 2795 else if (state & AIM_ICQ_STATE_INVISIBLE) |
4342 | 2796 return g_strdup_printf(_("Invisible")); |
3212 | 2797 else |
4342 | 2798 return g_strdup_printf(_("Online")); |
3212 | 2799 } |
2800 | |
4194 | 2801 static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const char *cookie) { |
3630 | 2802 struct gaim_connection *gc = sess->aux_data; |
4617 | 2803 struct oscar_data *od = gc->proto_data; |
2804 | |
2805 /* BBB */ | |
3630 | 2806 switch (reason) { |
4151 | 2807 case 3: { /* Decline sendfile. */ |
4617 | 2808 struct gaim_xfer *xfer; |
2809 debug_printf("AAA - Other user declined file transfer\n"); | |
2810 if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, cookie))) | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2811 gaim_xfer_cancel_remote(xfer); |
4151 | 2812 } break; |
2813 | |
2814 default: { | |
4194 | 2815 debug_printf("Received an unknown rendezvous client auto-response from %s. Type 0x%04hx\n", who, reason); |
4151 | 2816 } |
3630 | 2817 |
2818 } | |
2819 | |
2820 return 0; | |
2821 } | |
2822 | |
4194 | 2823 static int gaim_parse_clientauto_ch4(aim_session_t *sess, char *who, fu16_t reason, fu32_t state, char *msg) { |
4151 | 2824 struct gaim_connection *gc = sess->aux_data; |
2825 | |
2826 switch(reason) { | |
2827 case 0x0003: { /* Reply from an ICQ status message request */ | |
2828 char *status_msg = gaim_icq_status(state); | |
2829 char *dialog_msg, **splitmsg; | |
2830 struct oscar_data *od = gc->proto_data; | |
2831 GSList *l = od->evilhack; | |
2832 gboolean evilhack = FALSE; | |
2833 | |
2834 /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ | |
2835 splitmsg = g_strsplit(msg, "\r\n", 0); | |
2836 | |
2837 /* If who is in od->evilhack, then we're just getting the away message, otherwise this | |
2838 * will just get appended to the info box (which is already showing). */ | |
2839 while (l) { | |
2840 char *x = l->data; | |
2841 if (!strcmp(x, normalize(who))) { | |
2842 evilhack = TRUE; | |
2843 g_free(x); | |
2844 od->evilhack = g_slist_remove(od->evilhack, x); | |
2845 break; | |
2846 } | |
2847 l = l->next; | |
2848 } | |
2849 | |
2850 if (evilhack) | |
4344 | 2851 dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<HR>%s"), who, status_msg, g_strjoinv("<BR>", splitmsg)); |
4151 | 2852 else |
4344 | 2853 dialog_msg = g_strdup_printf(_("<B>Status:</B> %s<HR>%s"), status_msg, g_strjoinv("<BR>", splitmsg)); |
4151 | 2854 g_show_info_text(gc, who, 2, dialog_msg, NULL); |
2855 | |
2856 g_free(status_msg); | |
2857 g_free(dialog_msg); | |
2858 g_strfreev(splitmsg); | |
2859 } break; | |
2860 | |
2861 default: { | |
4194 | 2862 debug_printf("Received an unknown client auto-response from %s. Type 0x%04hx\n", who, reason); |
4151 | 2863 } break; |
2864 } /* end of switch */ | |
2865 | |
2866 return 0; | |
2867 } | |
2868 | |
3212 | 2869 static int gaim_parse_clientauto(aim_session_t *sess, aim_frame_t *fr, ...) { |
2870 va_list ap; | |
2871 fu16_t chan, reason; | |
2872 char *who; | |
2873 | |
2874 va_start(ap, fr); | |
4200 | 2875 chan = (fu16_t)va_arg(ap, unsigned int); |
3212 | 2876 who = va_arg(ap, char *); |
4200 | 2877 reason = (fu16_t)va_arg(ap, unsigned int); |
3212 | 2878 |
3952 | 2879 if (chan == 0x0002) { /* File transfer declined */ |
3630 | 2880 char *cookie = va_arg(ap, char *); |
4151 | 2881 return gaim_parse_clientauto_ch2(sess, who, reason, cookie); |
3952 | 2882 } else if (chan == 0x0004) { /* ICQ message */ |
4200 | 2883 fu32_t state = 0; |
4151 | 2884 char *msg = NULL; |
2885 if (reason == 0x0003) { | |
4200 | 2886 state = va_arg(ap, fu32_t); |
4151 | 2887 msg = va_arg(ap, char *); |
2888 } | |
2889 return gaim_parse_clientauto_ch4(sess, who, reason, state, msg); | |
2890 } | |
3952 | 2891 |
3212 | 2892 va_end(ap); |
2893 | |
2894 return 1; | |
2895 } | |
2896 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2897 static int gaim_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2898 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2899 fu16_t reason; |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2900 char *m; |
2246
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); |
4199 | 2903 reason = (fu16_t) va_arg(ap, unsigned int); |
2086 | 2904 va_end(ap); |
2905 | |
4194 | 2906 debug_printf("snac threw error (reason 0x%04hx: %s)\n", reason, |
2086 | 2907 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown"); |
2908 | |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2909 m = g_strdup_printf(_("SNAC threw error: %s\n"), |
4056 | 2910 reason < msgerrreasonlen ? gettext(msgerrreason[reason]) : _("Unknown error")); |
3427 | 2911 do_error_dialog(m, NULL, GAIM_ERROR); |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2912 g_free(m); |
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2913 |
2086 | 2914 return 1; |
2915 } | |
2916 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2917 static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
4617 | 2918 #if 0 |
3752 | 2919 struct gaim_connection *gc = sess->aux_data; |
4617 | 2920 struct oscar_data *od = gc->proto_data; |
2921 struct gaim_xfer *xfer; | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2922 #endif |
4617 | 2923 va_list ap; |
2924 fu16_t reason; | |
2925 char *data, *buf; | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2926 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2927 va_start(ap, fr); |
4617 | 2928 reason = (fu16_t)va_arg(ap, unsigned int); |
3752 | 2929 data = va_arg(ap, char *); |
2086 | 2930 va_end(ap); |
2931 | |
4617 | 2932 debug_printf("Message error with data %s and reason %hu\n", data, reason); |
2933 | |
2934 /* BBB */ | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2935 #if 0 |
4617 | 2936 /* If this was a file transfer request, data is a cookie */ |
2937 if ((xfer = oscar_find_xfer_by_cookie(od->file_transfers, data))) { | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2938 gaim_xfer_cancel_remote(xfer); |
3630 | 2939 return 1; |
2940 } | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2941 #endif |
3630 | 2942 |
4617 | 2943 /* Data is assumed to be the destination sn */ |
2944 buf = g_strdup_printf(_("Your message to %s did not get sent:"), data); | |
4342 | 2945 do_error_dialog(buf, (reason < msgerrreasonlen) ? gettext(msgerrreason[reason]) : _("No reason given."), GAIM_ERROR); |
4617 | 2946 g_free(buf); |
2086 | 2947 |
2948 return 1; | |
2949 } | |
2950 | |
3595 | 2951 static int gaim_parse_mtn(aim_session_t *sess, aim_frame_t *fr, ...) { |
2952 struct gaim_connection *gc = sess->aux_data; | |
2953 va_list ap; | |
2954 fu16_t type1, type2; | |
2955 char *sn; | |
2956 | |
2957 va_start(ap, fr); | |
4199 | 2958 type1 = (fu16_t) va_arg(ap, unsigned int); |
3595 | 2959 sn = va_arg(ap, char *); |
4199 | 2960 type2 = (fu16_t) va_arg(ap, unsigned int); |
3595 | 2961 va_end(ap); |
2962 | |
2963 switch (type2) { | |
2964 case 0x0000: { /* Text has been cleared */ | |
2965 serv_got_typing_stopped(gc, sn); | |
2966 } break; | |
2967 | |
2968 case 0x0001: { /* Paused typing */ | |
3768 | 2969 serv_got_typing(gc, sn, 0, TYPED); |
3595 | 2970 } break; |
2971 | |
2972 case 0x0002: { /* Typing */ | |
3768 | 2973 serv_got_typing(gc, sn, 0, TYPING); |
3595 | 2974 } break; |
2975 | |
2976 default: { | |
4624 | 2977 printf("Received unknown typing notification message from %s. Type1 is 0x%04x and type2 is 0x%04hx.\n", sn, type1, type2); |
3595 | 2978 } break; |
2979 } | |
2980 | |
2981 return 1; | |
2982 } | |
2983 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2984 static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2985 va_list ap; |
2986 char *destn; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2987 fu16_t reason; |
2086 | 2988 char buf[1024]; |
2989 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2990 va_start(ap, fr); |
4199 | 2991 reason = (fu16_t) va_arg(ap, unsigned int); |
2086 | 2992 destn = va_arg(ap, char *); |
2993 va_end(ap); | |
2994 | |
3574 | 2995 snprintf(buf, sizeof(buf), _("User information for %s unavailable:"), destn); |
4342 | 2996 do_error_dialog(buf, (reason < msgerrreasonlen) ? gettext(msgerrreason[reason]) : _("No reason given."), GAIM_ERROR); |
2086 | 2997 |
2998 return 1; | |
2999 } | |
3000 | |
4853 | 3001 /* CCC */ |
2086 | 3002 static char *images(int flags) { |
3003 static char buf[1024]; | |
3101 | 3004 g_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s", |
2679 | 3005 (flags & AIM_FLAG_ACTIVEBUDDY) ? "<IMG SRC=\"ab_icon.gif\">" : "", |
2086 | 3006 (flags & AIM_FLAG_UNCONFIRMED) ? "<IMG SRC=\"dt_icon.gif\">" : "", |
3007 (flags & AIM_FLAG_AOL) ? "<IMG SRC=\"aol_icon.gif\">" : "", | |
3101 | 3008 (flags & AIM_FLAG_ICQ) ? "<IMG SRC=\"icq_icon.gif\">" : "", |
2086 | 3009 (flags & AIM_FLAG_ADMINISTRATOR) ? "<IMG SRC=\"admin_icon.gif\">" : "", |
3079 | 3010 (flags & AIM_FLAG_FREE) ? "<IMG SRC=\"free_icon.gif\">" : "", |
3011 (flags & AIM_FLAG_WIRELESS) ? "<IMG SRC=\"wireless_icon.gif\">" : ""); | |
2086 | 3012 return buf; |
3013 } | |
3014 | |
3101 | 3015 |
2920 | 3016 static char *caps_string(guint caps) |
3017 { | |
3018 static char buf[512], *tmp; | |
3019 int count = 0, i = 0; | |
3020 guint bit = 1; | |
4742 | 3021 |
3022 if (!caps) { | |
4744 | 3023 return NULL; |
4743 | 3024 } else while (bit <= 0x20000) { |
2920 | 3025 if (bit & caps) { |
3026 switch (bit) { | |
3027 case 0x1: | |
3028 tmp = _("Buddy Icon"); | |
3029 break; | |
3030 case 0x2: | |
3031 tmp = _("Voice"); | |
3032 break; | |
3033 case 0x4: | |
4898 | 3034 tmp = _("Direct IM"); |
2920 | 3035 break; |
3036 case 0x8: | |
3037 tmp = _("Chat"); | |
3038 break; | |
3039 case 0x10: | |
3040 tmp = _("Get File"); | |
3041 break; | |
3042 case 0x20: | |
3043 tmp = _("Send File"); | |
3044 break; | |
3045 case 0x40: | |
3046 case 0x200: | |
3047 tmp = _("Games"); | |
3048 break; | |
3049 case 0x80: | |
4898 | 3050 tmp = _("Add-Ins"); |
2920 | 3051 break; |
3052 case 0x100: | |
3053 tmp = _("Send Buddy List"); | |
3054 break; | |
3055 case 0x400: | |
3056 tmp = _("EveryBuddy Bug"); | |
3057 break; | |
3058 case 0x800: | |
3059 tmp = _("AP User"); | |
3060 break; | |
3061 case 0x1000: | |
3062 tmp = _("ICQ RTF"); | |
3063 break; | |
3064 case 0x2000: | |
3065 tmp = _("Nihilist"); | |
3066 break; | |
3067 case 0x4000: | |
3068 tmp = _("ICQ Server Relay"); | |
3069 break; | |
3070 case 0x8000: | |
3071 tmp = _("ICQ Unknown"); | |
3072 break; | |
3073 case 0x10000: | |
3074 tmp = _("Trillian Encryption"); | |
3075 break; | |
4742 | 3076 case 0x20000: |
3077 tmp = _("ICQ UTF8"); | |
3078 break; | |
2920 | 3079 default: |
3080 tmp = NULL; | |
3081 break; | |
3082 } | |
3083 if (tmp) | |
3084 i += g_snprintf(buf + i, sizeof(buf) - i, "%s%s", (count ? ", " : ""), | |
3085 tmp); | |
3086 count++; | |
3087 } | |
3088 bit <<= 1; | |
3089 } | |
4744 | 3090 return buf; |
2920 | 3091 } |
3092 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3093 static int gaim_parse_user_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
4791 | 3094 struct gaim_connection *gc = sess->aux_data; |
3095 struct oscar_data *od = gc->proto_data; | |
3096 char header[BUF_LONG]; | |
3097 GSList *l = od->evilhack; | |
3098 gboolean evilhack = FALSE; | |
3099 gchar *membersince = NULL, *onlinesince = NULL, *idle = NULL; | |
3100 va_list ap; | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3101 aim_userinfo_t *info; |
4791 | 3102 fu16_t infotype; |
4151 | 3103 char *text_enc = NULL, *text = NULL, *utf8 = NULL; |
3104 int text_len; | |
2086 | 3105 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3106 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3107 info = va_arg(ap, aim_userinfo_t *); |
4199 | 3108 infotype = (fu16_t) va_arg(ap, unsigned int); |
4151 | 3109 text_enc = va_arg(ap, char *); |
3110 text = va_arg(ap, char *); | |
3111 text_len = va_arg(ap, int); | |
2086 | 3112 va_end(ap); |
3113 | |
4151 | 3114 if (text_len > 0) { |
5129 | 3115 if (!(utf8 = oscar_encoding_to_utf8(text_enc, text, text_len))) { |
4791 | 3116 utf8 = g_strdup(_("<i>Unable to display information because it was sent in an unknown encoding.</i>")); |
4194 | 3117 debug_printf("Encountered an unknown encoding while parsing userinfo\n"); |
4151 | 3118 } |
3119 } | |
3120 | |
2993 | 3121 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) { |
4834 | 3122 onlinesince = g_strdup_printf(_("Online Since : <b>%s</b><br>\n"), |
2993 | 3123 asctime(localtime(&info->onlinesince))); |
3124 } | |
3125 | |
3126 if (info->present & AIM_USERINFO_PRESENT_MEMBERSINCE) { | |
4834 | 3127 membersince = g_strdup_printf(_("Member Since : <b>%s</b><br>\n"), |
2993 | 3128 asctime(localtime(&info->membersince))); |
3129 } | |
3130 | |
3131 if (info->present & AIM_USERINFO_PRESENT_IDLE) { | |
4426 | 3132 gchar *itime = sec_to_text(info->idletime*60); |
4834 | 3133 idle = g_strdup_printf(_("Idle : <b>%s</b>"), itime); |
4426 | 3134 g_free(itime); |
2993 | 3135 } else |
4834 | 3136 idle = g_strdup(_("Idle: <b>Active</b>")); |
2993 | 3137 |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3138 g_snprintf(header, sizeof header, |
4791 | 3139 _("Username : <b>%s</b> %s <br>\n" |
3140 "Warning Level : <b>%d %%</b><br>\n" | |
2086 | 3141 "%s" |
2993 | 3142 "%s" |
4344 | 3143 "%s\n" |
4791 | 3144 "<hr>\n"), |
2086 | 3145 info->sn, images(info->flags), |
3146 info->warnlevel/10, | |
2993 | 3147 onlinesince ? onlinesince : "", |
3148 membersince ? membersince : "", | |
3149 idle ? idle : ""); | |
3150 | |
3151 g_free(onlinesince); | |
3152 g_free(membersince); | |
3153 g_free(idle); | |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
3154 |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3155 while (l) { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3156 char *x = l->data; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3157 if (!strcmp(x, normalize(info->sn))) { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3158 evilhack = TRUE; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3159 g_free(x); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3160 od->evilhack = g_slist_remove(od->evilhack, x); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3161 break; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3162 } |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3163 l = l->next; |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3164 } |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3165 |
2920 | 3166 if (infotype == AIM_GETINFO_AWAYMESSAGE) { |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3167 if (evilhack) { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3168 g_show_info_text(gc, info->sn, 2, |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3169 header, |
4151 | 3170 (utf8 && *utf8) ? away_subs(utf8, gc->username) : |
4207 | 3171 _("<i>User has no away message</i>"), NULL); |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3172 } else { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3173 g_show_info_text(gc, info->sn, 0, |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3174 header, |
5129 | 3175 (utf8 && *utf8) ? _("<b>Away Message:</b><br>") : NULL, |
4151 | 3176 (utf8 && *utf8) ? away_subs(utf8, gc->username) : NULL, |
4791 | 3177 (utf8 && *utf8) ? "<hr>" : NULL, |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3178 NULL); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3179 } |
2920 | 3180 } else if (infotype == AIM_GETINFO_CAPABILITIES) { |
3181 g_show_info_text(gc, info->sn, 2, | |
3182 header, | |
3183 "<i>", _("Client Capabilities: "), | |
3184 caps_string(info->capabilities), | |
3185 "</i>", | |
3186 NULL); | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3187 } else { |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3188 g_show_info_text(gc, info->sn, 1, |
5129 | 3189 (utf8 && *utf8) ? _("<b>Profile:</b><br>") : _("<i>No Information Provided</i>"), |
3190 (utf8 && *utf8) ? away_subs(utf8, gc->username) : NULL, | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3191 NULL); |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3192 } |
2086 | 3193 |
4151 | 3194 g_free(utf8); |
3195 | |
2086 | 3196 return 1; |
3197 } | |
3198 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3199 static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3200 char *msg; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3201 fu16_t id; |
2086 | 3202 va_list ap; |
3203 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3204 va_start(ap, fr); |
4199 | 3205 id = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3206 msg = va_arg(ap, char *); |
3207 va_end(ap); | |
3208 | |
4194 | 3209 debug_printf("MOTD: %s (%hu)\n", msg ? msg : "Unknown", id); |
2092
59b0377d18aa
[gaim-migrate @ 2102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
3210 if (id < 4) |
3427 | 3211 do_error_dialog(_("Your AIM connection may be lost."), NULL, GAIM_WARNING); |
2086 | 3212 |
3213 return 1; | |
3214 } | |
3215 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3216 static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3217 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3218 fu16_t type; |
2086 | 3219 struct gaim_connection *gc = sess->aux_data; |
4617 | 3220 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2086 | 3221 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3222 va_start(ap, fr); |
4199 | 3223 type = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3224 |
3225 switch(type) { | |
3226 case 0x0002: { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3227 fu8_t maxrooms; |
2086 | 3228 struct aim_chat_exchangeinfo *exchanges; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3229 int exchangecount, i; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3230 |
4199 | 3231 maxrooms = (fu8_t) va_arg(ap, unsigned int); |
2086 | 3232 exchangecount = va_arg(ap, int); |
3233 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *); | |
3234 | |
3235 debug_printf("chat info: Chat Rights:\n"); | |
4194 | 3236 debug_printf("chat info: \tMax Concurrent Rooms: %hhd\n", maxrooms); |
2086 | 3237 debug_printf("chat info: \tExchange List: (%d total)\n", exchangecount); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3238 for (i = 0; i < exchangecount; i++) |
4194 | 3239 debug_printf("chat info: \t\t%hu %s\n", exchanges[i].number, exchanges[i].name ? exchanges[i].name : ""); |
4617 | 3240 while (od->create_rooms) { |
3241 struct create_room *cr = od->create_rooms->data; | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3242 debug_printf("creating room %s\n", cr->name); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3243 aim_chatnav_createroom(sess, fr->conn, cr->name, cr->exchange); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3244 g_free(cr->name); |
4617 | 3245 od->create_rooms = g_slist_remove(od->create_rooms, cr); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3246 g_free(cr); |
2086 | 3247 } |
3248 } | |
3249 break; | |
3250 case 0x0008: { | |
3251 char *fqcn, *name, *ck; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3252 fu16_t instance, flags, maxmsglen, maxoccupancy, unknown, exchange; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3253 fu8_t createperms; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3254 fu32_t createtime; |
2086 | 3255 |
3256 fqcn = va_arg(ap, char *); | |
4200 | 3257 instance = (fu16_t)va_arg(ap, unsigned int); |
3258 exchange = (fu16_t)va_arg(ap, unsigned int); | |
3259 flags = (fu16_t)va_arg(ap, unsigned int); | |
3260 createtime = va_arg(ap, fu32_t); | |
3261 maxmsglen = (fu16_t)va_arg(ap, unsigned int); | |
3262 maxoccupancy = (fu16_t)va_arg(ap, unsigned int); | |
3263 createperms = (fu8_t)va_arg(ap, unsigned int); | |
3264 unknown = (fu16_t)va_arg(ap, unsigned int); | |
3265 name = va_arg(ap, char *); | |
3266 ck = va_arg(ap, char *); | |
4194 | 3267 |
3268 debug_printf("created room: %s %hu %hu %hu %lu %hu %hu %hhu %hu %s %s\n", | |
2086 | 3269 fqcn, |
3270 exchange, instance, flags, | |
3271 createtime, | |
3272 maxmsglen, maxoccupancy, createperms, unknown, | |
3273 name, ck); | |
4617 | 3274 aim_chat_join(od->sess, od->conn, exchange, ck, instance); |
2086 | 3275 } |
3276 break; | |
3277 default: | |
4194 | 3278 debug_printf("chatnav info: unknown type (%04hx)\n", type); |
2086 | 3279 break; |
3280 } | |
4194 | 3281 |
3282 va_end(ap); | |
3283 | |
2086 | 3284 return 1; |
3285 } | |
3286 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3287 static int gaim_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3288 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3289 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3290 aim_userinfo_t *info; |
2086 | 3291 struct gaim_connection *g = sess->aux_data; |
3292 | |
3293 struct chat_connection *c = NULL; | |
3294 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3295 va_start(ap, fr); |
2086 | 3296 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3297 info = va_arg(ap, aim_userinfo_t *); |
2086 | 3298 va_end(ap); |
3299 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3300 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 3301 if (!c) |
3302 return 1; | |
3303 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3304 for (i = 0; i < count; i++) |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
3305 gaim_chat_add_user(GAIM_CHAT(c->cnv), info[i].sn, NULL); |
2086 | 3306 |
3307 return 1; | |
3308 } | |
3309 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3310 static int gaim_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3311 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3312 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3313 aim_userinfo_t *info; |
2086 | 3314 struct gaim_connection *g = sess->aux_data; |
3315 | |
3316 struct chat_connection *c = NULL; | |
3317 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3318 va_start(ap, fr); |
2086 | 3319 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3320 info = va_arg(ap, aim_userinfo_t *); |
2086 | 3321 va_end(ap); |
3322 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3323 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 3324 if (!c) |
3325 return 1; | |
3326 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3327 for (i = 0; i < count; i++) |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
3328 gaim_chat_remove_user(GAIM_CHAT(c->cnv), info[i].sn, NULL); |
2086 | 3329 |
3330 return 1; | |
3331 } | |
3332 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3333 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
|
3334 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3335 aim_userinfo_t *userinfo; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3336 struct aim_chat_roominfo *roominfo; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3337 char *roomname; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3338 int usercount; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3339 char *roomdesc; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3340 fu16_t unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3341 fu32_t creationtime; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3342 struct gaim_connection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3343 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
|
3344 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3345 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3346 roominfo = va_arg(ap, struct aim_chat_roominfo *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3347 roomname = va_arg(ap, char *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3348 usercount= va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3349 userinfo = va_arg(ap, aim_userinfo_t *); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3350 roomdesc = va_arg(ap, char *); |
4200 | 3351 unknown_c9 = (fu16_t)va_arg(ap, unsigned int); |
3352 creationtime = va_arg(ap, fu32_t); | |
3353 maxmsglen = (fu16_t)va_arg(ap, unsigned int); | |
3354 unknown_d2 = (fu16_t)va_arg(ap, unsigned int); | |
3355 unknown_d5 = (fu16_t)va_arg(ap, unsigned int); | |
3356 maxvisiblemsglen = (fu16_t)va_arg(ap, unsigned int); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3357 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3358 |
4194 | 3359 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
|
3360 maxmsglen, maxvisiblemsglen); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3361 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3362 ccon->maxlen = maxmsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3363 ccon->maxvis = maxvisiblemsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3364 |
2086 | 3365 return 1; |
3366 } | |
3367 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3368 static int gaim_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) { |
4269 | 3369 struct gaim_connection *gc = sess->aux_data; |
2086 | 3370 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3371 aim_userinfo_t *info; |
2086 | 3372 char *msg; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3373 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); |
2086 | 3374 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3375 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3376 info = va_arg(ap, aim_userinfo_t *); |
4194 | 3377 msg = va_arg(ap, char *); |
3378 va_end(ap); | |
2086 | 3379 |
4269 | 3380 serv_got_chat_in(gc, ccon->id, info->sn, 0, msg, time((time_t)NULL)); |
2086 | 3381 |
3382 return 1; | |
3383 } | |
3384 | |
3694 | 3385 static int gaim_email_parseupdate(aim_session_t *sess, aim_frame_t *fr, ...) { |
3386 va_list ap; | |
3387 struct gaim_connection *gc = sess->aux_data; | |
3388 struct aim_emailinfo *emailinfo; | |
3725 | 3389 int havenewmail; |
3694 | 3390 |
3391 va_start(ap, fr); | |
3392 emailinfo = va_arg(ap, struct aim_emailinfo *); | |
3725 | 3393 havenewmail = va_arg(ap, int); |
3694 | 3394 va_end(ap); |
3395 | |
3725 | 3396 if (emailinfo) { |
3397 if (emailinfo->unread) { | |
3398 if (havenewmail) | |
3399 connection_has_mail(gc, emailinfo->nummsgs ? emailinfo->nummsgs : -1, NULL, NULL, emailinfo->url); | |
3400 } else | |
3694 | 3401 connection_has_mail(gc, 0, NULL, NULL, emailinfo->url); |
3402 } | |
3403 | |
3404 return 1; | |
3405 } | |
3406 | |
4804 | 3407 static int gaim_icon_error(aim_session_t *sess, aim_frame_t *fr, ...) { |
3408 struct gaim_connection *gc = sess->aux_data; | |
3409 struct oscar_data *od = gc->proto_data; | |
3410 char *sn; | |
3411 | |
3412 sn = od->requesticon->data; | |
3413 debug_printf("removing %s from hash table\n", sn); | |
3414 od->requesticon = g_slist_remove(od->requesticon, sn); | |
3415 free(sn); | |
3416 | |
3417 if (od->icontimer) | |
3418 g_source_remove(od->icontimer); | |
3419 od->icontimer = g_timeout_add(500, gaim_icon_timerfunc, gc); | |
3420 | |
3421 return 1; | |
3422 } | |
3423 | |
3424 static int gaim_icon_parseicon(aim_session_t *sess, aim_frame_t *fr, ...) { | |
3425 struct gaim_connection *gc = sess->aux_data; | |
3426 struct oscar_data *od = gc->proto_data; | |
3427 GSList *cur; | |
3428 va_list ap; | |
3429 char *sn; | |
4853 | 3430 fu8_t *iconcsum, *icon; |
3431 fu16_t iconcsumlen, iconlen; | |
4804 | 3432 |
3433 va_start(ap, fr); | |
3434 sn = va_arg(ap, char *); | |
4853 | 3435 iconcsum = va_arg(ap, fu8_t *); |
3436 iconcsumlen = va_arg(ap, int); | |
4804 | 3437 icon = va_arg(ap, fu8_t *); |
3438 iconlen = va_arg(ap, int); | |
3439 va_end(ap); | |
3440 | |
4853 | 3441 if (iconlen > 0) { |
3442 char *b16; | |
5129 | 3443 struct buddy *b = gaim_find_buddy(gc->account, sn); |
4804 | 3444 set_icon_data(gc, sn, icon, iconlen); |
4853 | 3445 b16 = tobase16(iconcsum, iconcsumlen); |
5129 | 3446 if (b16) { |
3447 gaim_buddy_set_setting(b, "icon_checksum", b16); | |
3448 gaim_blist_save(); | |
5125 | 3449 free(b16); |
5129 | 3450 } |
4853 | 3451 } |
4804 | 3452 |
3453 cur = od->requesticon; | |
3454 while (cur) { | |
3455 char *cursn = cur->data; | |
3456 if (!aim_sncmp(cursn, sn)) { | |
3457 od->requesticon = g_slist_remove(od->requesticon, cursn); | |
3458 free(cursn); | |
3459 cur = od->requesticon; | |
3460 } else | |
3461 cur = cur->next; | |
3462 } | |
3463 | |
3464 if (od->icontimer) | |
3465 g_source_remove(od->icontimer); | |
3466 od->icontimer = g_timeout_add(250, gaim_icon_timerfunc, gc); | |
3467 | |
3468 return 1; | |
3469 } | |
3470 | |
3471 static gboolean gaim_icon_timerfunc(gpointer data) { | |
3472 struct gaim_connection *gc = data; | |
3473 struct oscar_data *od = gc->proto_data; | |
3474 struct buddyinfo *bi; | |
3475 aim_conn_t *conn; | |
3476 | |
3477 if (!od->requesticon) { | |
3478 debug_printf("no more icons to request\n"); | |
3479 return FALSE; | |
3480 } | |
3481 | |
3482 conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON); | |
4823 | 3483 if (!conn && !od->iconconnecting) { |
4804 | 3484 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); |
4823 | 3485 od->iconconnecting = TRUE; |
4804 | 3486 return FALSE; |
3487 } | |
3488 | |
3489 bi = g_hash_table_lookup(od->buddyinfo, (char *)od->requesticon->data); | |
4853 | 3490 if (bi && (bi->iconcsumlen > 0)) { |
4889 | 3491 aim_icon_request(od->sess, od->requesticon->data, bi->iconcsum, bi->iconcsumlen); |
4804 | 3492 return FALSE; |
3493 } else { | |
3494 char *sn = od->requesticon->data; | |
3495 od->requesticon = g_slist_remove(od->requesticon, sn); | |
3496 free(sn); | |
3497 } | |
3498 | |
3499 return TRUE; | |
3500 } | |
3501 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3502 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3503 * 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
|
3504 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3505 static int gaim_parse_msgack(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3506 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3507 fu16_t type; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3508 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3509 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3510 va_start(ap, fr); |
4199 | 3511 type = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3512 sn = va_arg(ap, char *); |
3513 va_end(ap); | |
3514 | |
3515 debug_printf("Sent message to %s.\n", sn); | |
3516 | |
3517 return 1; | |
3518 } | |
3519 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3520 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
|
3521 static const char *codes[5] = { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3522 "invalid", |
4194 | 3523 "change", |
3524 "warning", | |
3525 "limit", | |
3526 "limit cleared", | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3527 }; |
2086 | 3528 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3529 fu16_t code, rateclass; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3530 fu32_t windowsize, clear, alert, limit, disconnect, currentavg, maxavg; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3531 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3532 va_start(ap, fr); |
4200 | 3533 code = (fu16_t)va_arg(ap, unsigned int); |
3534 rateclass= (fu16_t)va_arg(ap, unsigned int); | |
3535 windowsize = va_arg(ap, fu32_t); | |
3536 clear = va_arg(ap, fu32_t); | |
3537 alert = va_arg(ap, fu32_t); | |
3538 limit = va_arg(ap, fu32_t); | |
3539 disconnect = va_arg(ap, fu32_t); | |
3540 currentavg = va_arg(ap, fu32_t); | |
3541 maxavg = va_arg(ap, fu32_t); | |
2086 | 3542 va_end(ap); |
3543 | |
4194 | 3544 debug_printf("rate %s (param ID 0x%04hx): curavg = %lu, maxavg = %lu, alert at %lu, " |
3545 "clear warning at %lu, limit at %lu, disconnect at %lu (window size = %lu)\n", | |
2086 | 3546 (code < 5) ? codes[code] : codes[0], |
3547 rateclass, | |
3548 currentavg, maxavg, | |
3549 alert, clear, | |
3550 limit, disconnect, | |
3551 windowsize); | |
3552 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3553 /* XXX fix these values */ |
2086 | 3554 if (code == AIM_RATE_CODE_CHANGE) { |
3555 if (currentavg >= clear) | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3556 aim_conn_setlatency(fr->conn, 0); |
2086 | 3557 } else if (code == AIM_RATE_CODE_WARNING) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3558 aim_conn_setlatency(fr->conn, windowsize/4); |
2909
48ec70928d7f
[gaim-migrate @ 2922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2906
diff
changeset
|
3559 } else if (code == AIM_RATE_CODE_LIMIT) { |
3427 | 3560 do_error_dialog(_("Rate limiting error."), |
3561 _("The last message was not sent because you are over the rate limit. " | |
3562 "Please wait 10 seconds and try again."), GAIM_ERROR); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3563 aim_conn_setlatency(fr->conn, windowsize/2); |
2086 | 3564 } else if (code == AIM_RATE_CODE_CLEARLIMIT) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3565 aim_conn_setlatency(fr->conn, 0); |
2086 | 3566 } |
3567 | |
3568 return 1; | |
3569 } | |
3570 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3571 static int gaim_parse_evilnotify(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3572 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3573 fu16_t newevil; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3574 aim_userinfo_t *userinfo; |
2086 | 3575 struct gaim_connection *gc = sess->aux_data; |
3576 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3577 va_start(ap, fr); |
4199 | 3578 newevil = (fu16_t) va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3579 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 3580 va_end(ap); |
3581 | |
3582 serv_got_eviled(gc, (userinfo && userinfo->sn[0]) ? userinfo->sn : NULL, newevil / 10); | |
3583 | |
3584 return 1; | |
3585 } | |
3586 | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3587 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
|
3588 va_list ap; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3589 aim_userinfo_t *info; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3590 struct gaim_connection *gc = sess->aux_data; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3591 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3592 va_start(ap, fr); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3593 info = va_arg(ap, aim_userinfo_t *); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3594 va_end(ap); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3595 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3596 gc->evil = info->warnlevel/10; |
4841 | 3597 |
3598 if (info->onlinesince) | |
3599 gc->login_time_official = info->onlinesince; | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3600 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3601 return 1; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3602 } |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3603 |
4649 | 3604 static int gaim_connerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
3605 struct gaim_connection *gc = sess->aux_data; | |
4666 | 3606 struct oscar_data *od = gc->proto_data; |
4649 | 3607 va_list ap; |
3608 fu16_t code; | |
3609 char *msg; | |
3610 | |
3611 va_start(ap, fr); | |
3612 code = (fu16_t)va_arg(ap, int); | |
3613 msg = va_arg(ap, char *); | |
3614 va_end(ap); | |
3615 | |
3616 debug_printf("Disconnected. Code is 0x%04x and msg is %s\n", code, msg); | |
3617 if ((fr) && (fr->conn) && (fr->conn->type == AIM_CONN_TYPE_BOS)) { | |
4651 | 3618 if (code == 0x0001) { |
4652 | 3619 hide_login_progress_error(gc, _("You have been disconnected because you have signed on with this screen name at another location.")); |
4651 | 3620 } else { |
4652 | 3621 hide_login_progress_error(gc, _("You have been signed off for an unknown reason.")); |
4651 | 3622 } |
4666 | 3623 od->killme = TRUE; |
4649 | 3624 } |
3625 | |
3626 return 1; | |
3627 } | |
3628 | |
2675 | 3629 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3630 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3631 aim_reqpersonalinfo(sess, fr->conn); |
4230 | 3632 |
3633 #ifndef NOSSI | |
3634 debug_printf("ssi: requesting ssi list\n"); | |
4889 | 3635 aim_ssi_reqrights(sess); |
3636 aim_ssi_reqdata(sess, sess->ssi.timestamp, sess->ssi.numitems); | |
4230 | 3637 #endif |
3638 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3639 aim_bos_reqlocaterights(sess, fr->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3640 aim_bos_reqbuddyrights(sess, fr->conn); |
4617 | 3641 aim_im_reqparams(sess); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3642 aim_bos_reqrights(sess, fr->conn); |
4230 | 3643 |
3644 #ifdef NOSSI | |
3645 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS); | |
3646 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE | AIM_PRIVFLAGS_ALLOWMEMBERSINCE); | |
3647 #endif | |
2086 | 3648 |
3649 return 1; | |
3650 } | |
3651 | |
2675 | 3652 static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) { |
2647 | 3653 struct gaim_connection *gc = sess->aux_data; |
3654 struct oscar_data *od = gc->proto_data; | |
3655 | |
2672 | 3656 aim_clientready(sess, fr->conn); |
2675 | 3657 debug_printf("connected to admin\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3658 |
2647 | 3659 if (od->chpass) { |
3660 debug_printf("changing password\n"); | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3661 aim_admin_changepasswd(sess, fr->conn, od->newp, od->oldp); |
2647 | 3662 g_free(od->oldp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3663 od->oldp = NULL; |
2647 | 3664 g_free(od->newp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3665 od->newp = NULL; |
2647 | 3666 od->chpass = FALSE; |
3667 } | |
2979 | 3668 if (od->setnick) { |
3669 debug_printf("formatting screenname\n"); | |
3670 aim_admin_setnick(sess, fr->conn, od->newsn); | |
3671 g_free(od->newsn); | |
3672 od->newsn = NULL; | |
3673 od->setnick = FALSE; | |
3674 } | |
2647 | 3675 if (od->conf) { |
3676 debug_printf("confirming account\n"); | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3677 aim_admin_reqconfirm(sess, fr->conn); |
2647 | 3678 od->conf = FALSE; |
3679 } | |
3680 if (od->reqemail) { | |
3681 debug_printf("requesting email\n"); | |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3682 aim_admin_getinfo(sess, fr->conn, 0x0011); |
2647 | 3683 od->reqemail = FALSE; |
3684 } | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3685 if (od->setemail) { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3686 debug_printf("setting email\n"); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3687 aim_admin_setemail(sess, fr->conn, od->email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3688 g_free(od->email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3689 od->setemail = FALSE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3690 } |
2647 | 3691 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3692 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3693 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3694 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3695 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
|
3696 struct aim_icbmparameters *params; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3697 va_list ap; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3698 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3699 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3700 params = va_arg(ap, struct aim_icbmparameters *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3701 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3702 |
4194 | 3703 /* XXX - evidently this crashes on solaris. i have no clue why |
3704 debug_printf("ICBM Parameters: maxchannel = %hu, default flags = 0x%08lx, max msg len = %hu, " | |
3705 "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
|
3706 params->maxchan, params->flags, params->maxmsglen, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3707 ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3708 params->minmsginterval); |
2427
5bc3b39fc0a5
[gaim-migrate @ 2440]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2421
diff
changeset
|
3709 */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3710 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3711 /* Maybe senderwarn and recverwarn should be user preferences... */ |
3595 | 3712 params->flags = 0x0000000b; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3713 params->maxmsglen = 8000; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3714 params->minmsginterval = 0; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3715 |
4617 | 3716 aim_im_setparams(sess, params); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3717 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3718 return 1; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3719 } |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3720 |
2993 | 3721 static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) |
3722 { | |
3723 va_list ap; | |
3724 fu16_t maxsiglen; | |
3725 struct gaim_connection *gc = sess->aux_data; | |
4617 | 3726 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4151 | 3727 char *unicode; |
3728 int unicode_len; | |
3729 fu32_t flags; | |
2993 | 3730 |
3731 va_start(ap, fr); | |
4199 | 3732 maxsiglen = (fu16_t) va_arg(ap, int); |
2993 | 3733 va_end(ap); |
3734 | |
3735 debug_printf("locate rights: max sig len = %d\n", maxsiglen); | |
3736 | |
4617 | 3737 od->rights.maxsiglen = od->rights.maxawaymsglen = (guint)maxsiglen; |
3738 | |
3739 if (od->icq) | |
4151 | 3740 aim_bos_setprofile(sess, fr->conn, NULL, NULL, 0, NULL, NULL, 0, caps_icq); |
3741 else { | |
5129 | 3742 flags = oscar_encoding_check (gc->account->user_info); |
4151 | 3743 |
3744 if (flags == 0) { | |
4600 | 3745 aim_bos_setprofile(sess, fr->conn, "us-ascii", gc->account->user_info, |
4491 | 3746 strlen(gc->account->user_info), NULL, NULL, 0, caps_aim); |
4151 | 3747 } else { |
4491 | 3748 unicode = g_convert (gc->account->user_info, strlen(gc->account->user_info), |
4151 | 3749 "UCS-2BE", "UTF-8", NULL, &unicode_len, NULL); |
3750 aim_bos_setprofile(sess, fr->conn, "unicode-2-0", unicode, unicode_len, | |
3751 NULL, NULL, 0, caps_aim); | |
3752 g_free(unicode); | |
3753 } | |
3754 } | |
2993 | 3755 |
3756 return 1; | |
3757 } | |
3758 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3759 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
|
3760 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3761 fu16_t maxbuddies, maxwatchers; |
2993 | 3762 struct gaim_connection *gc = sess->aux_data; |
4617 | 3763 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3764 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3765 va_start(ap, fr); |
4199 | 3766 maxbuddies = (fu16_t) va_arg(ap, unsigned int); |
3767 maxwatchers = (fu16_t) va_arg(ap, unsigned int); | |
2086 | 3768 va_end(ap); |
3769 | |
4194 | 3770 debug_printf("buddy list rights: Max buddies = %hu / Max watchers = %hu\n", maxbuddies, maxwatchers); |
2086 | 3771 |
4617 | 3772 od->rights.maxbuddies = (guint)maxbuddies; |
3773 od->rights.maxwatchers = (guint)maxwatchers; | |
2993 | 3774 |
2086 | 3775 return 1; |
3776 } | |
3777 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3778 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
|
3779 fu16_t maxpermits, maxdenies; |
2086 | 3780 va_list ap; |
2993 | 3781 struct gaim_connection *gc = sess->aux_data; |
4617 | 3782 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2086 | 3783 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3784 va_start(ap, fr); |
4199 | 3785 maxpermits = (fu16_t) va_arg(ap, unsigned int); |
3786 maxdenies = (fu16_t) va_arg(ap, unsigned int); | |
2086 | 3787 va_end(ap); |
3788 | |
4194 | 3789 debug_printf("BOS rights: Max permit = %hu / Max deny = %hu\n", maxpermits, maxdenies); |
2086 | 3790 |
4617 | 3791 od->rights.maxpermits = (guint)maxpermits; |
3792 od->rights.maxdenies = (guint)maxdenies; | |
2993 | 3793 |
3794 account_online(gc); | |
3795 serv_finish_login(gc); | |
3796 | |
3797 debug_printf("buddy list loaded\n"); | |
3798 | |
2672 | 3799 aim_clientready(sess, fr->conn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3800 |
4617 | 3801 /* XXX - Should call aim_bos_setidle with 0x0000 */ |
3802 | |
4664 | 3803 if (od->icq) { |
3804 aim_icq_reqofflinemsgs(sess); | |
3805 aim_icq_hideip(sess); | |
3806 } | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3807 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3808 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV); |
4102 | 3809 if (sess->authinfo->email) |
3810 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_EMAIL); | |
2086 | 3811 |
3812 return 1; | |
3813 } | |
3814 | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3815 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
|
3816 va_list ap; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3817 struct aim_icq_offlinemsg *msg; |
4075 | 3818 struct aim_incomingim_ch4_args args; |
3819 time_t t; | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3820 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3821 va_start(ap, fr); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3822 msg = va_arg(ap, struct aim_icq_offlinemsg *); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3823 va_end(ap); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3824 |
4075 | 3825 debug_printf("Received offline message. Converting to channel 4 ICBM...\n"); |
3826 args.uin = msg->sender; | |
3827 args.type = msg->type; | |
4173 | 3828 args.flags = msg->flags; |
4076 | 3829 args.msglen = msg->msglen; |
4075 | 3830 args.msg = msg->msg; |
3831 t = get_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0); | |
3832 incomingim_chan4(sess, fr->conn, NULL, &args, t); | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3833 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3834 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3835 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3836 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3837 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
|
3838 { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3839 aim_icq_ackofflinemsgs(sess); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3840 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3841 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3842 |
4624 | 3843 static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...) |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3844 { |
2773
a0fd8f91e294
[gaim-migrate @ 2786]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2768
diff
changeset
|
3845 struct gaim_connection *gc = sess->aux_data; |
4819 | 3846 gchar *buf, *tmp, *utf8; |
4624 | 3847 gchar who[16]; |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3848 va_list ap; |
4151 | 3849 struct aim_icq_info *info; |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3850 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3851 va_start(ap, fr); |
4151 | 3852 info = va_arg(ap, struct aim_icq_info *); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3853 va_end(ap); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3854 |
4664 | 3855 if (!info->uin) |
3856 return 0; | |
3857 | |
4151 | 3858 g_snprintf(who, sizeof(who), "%lu", info->uin); |
4820 | 3859 buf = g_strdup_printf("<b>%s</b> %s", _("UIN:"), who); |
4819 | 3860 if (info->nick && info->nick[0] && (utf8 = gaim_try_conv_to_utf8(info->nick))) { |
3861 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Nick:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
3862 } | |
3863 if (info->first && info->first[0] && (utf8 = gaim_try_conv_to_utf8(info->first))) { | |
3864 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("First Name:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
3865 } | |
3866 if (info->last && info->last[0] && (utf8 = gaim_try_conv_to_utf8(info->last))) { | |
3867 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Last Name:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
3868 } | |
3869 if (info->email && info->email[0] && (utf8 = gaim_try_conv_to_utf8(info->email))) { | |
3870 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Email Address:"), "</b> <a href=\"mailto:", utf8, "\">", utf8, "</a>", NULL); g_free(tmp); g_free(utf8); | |
4625 | 3871 } |
3872 if (info->numaddresses && info->email2) { | |
3873 int i; | |
3874 for (i = 0; i < info->numaddresses; i++) { | |
4819 | 3875 if (info->email2[i] && info->email2[i][0] && (utf8 = gaim_try_conv_to_utf8(info->email2[i]))) { |
3876 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Email Address:"), "</b> <a href=\"mailto:", utf8, "\">", utf8, "</a>", NULL); g_free(tmp); g_free(utf8); | |
4643 | 3877 } |
4625 | 3878 } |
4624 | 3879 } |
4819 | 3880 if (info->mobile && info->mobile[0] && (utf8 = gaim_try_conv_to_utf8(info->mobile))) { |
3881 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Mobile Phone:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4625 | 3882 } |
3883 if (info->gender) { | |
4819 | 3884 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Gender:"), "</b> ", info->gender==1 ? _("Female") : _("Male"), NULL); g_free(tmp); |
4151 | 3885 } |
4624 | 3886 if (info->birthyear || info->birthmonth || info->birthday) { |
4627 | 3887 char date[30]; |
3888 struct tm tm; | |
3889 tm.tm_mday = (int)info->birthday; | |
3890 tm.tm_mon = (int)info->birthmonth-1; | |
3891 tm.tm_year = (int)info->birthyear-1900; | |
4628 | 3892 strftime(date, sizeof(date), "%x", &tm); |
4819 | 3893 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Birthday:"), "</b> ", date, NULL); g_free(tmp); |
4151 | 3894 } |
4624 | 3895 if (info->age) { |
3896 char age[5]; | |
3897 snprintf(age, sizeof(age), "%hhd", info->age); | |
4819 | 3898 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Age:"), "</b> ", age, NULL); g_free(tmp); |
3899 } | |
3900 if (info->personalwebpage && info->personalwebpage[0] && (utf8 = gaim_try_conv_to_utf8(info->personalwebpage))) { | |
3901 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Personal Web Page:"), "</b> <a href=\"", utf8, "\">", utf8, "</a>", NULL); g_free(tmp); g_free(utf8); | |
3902 } | |
3903 if (info->info && info->info[0] && (utf8 = gaim_try_conv_to_utf8(info->info))) { | |
3904 tmp = buf; buf = g_strconcat(tmp, "<hr><b>", _("Additional Information:"), "</b><br>", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3905 } |
3906 tmp = buf; buf = g_strconcat(tmp, "<hr>\n", NULL); g_free(tmp); | |
4641 | 3907 if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) { |
4819 | 3908 tmp = buf; buf = g_strconcat(tmp, "<b>", _("Home Address:"), "</b>", NULL); g_free(tmp); |
3909 if (info->homeaddr && info->homeaddr[0] && (utf8 = gaim_try_conv_to_utf8(info->homeaddr))) { | |
3910 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Address:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3911 } |
4819 | 3912 if (info->homecity && info->homecity[0] && (utf8 = gaim_try_conv_to_utf8(info->homecity))) { |
3913 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("City:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3914 } |
4819 | 3915 if (info->homestate && info->homestate[0] && (utf8 = gaim_try_conv_to_utf8(info->homestate))) { |
3916 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("State:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3917 } |
4819 | 3918 if (info->homezip && info->homezip[0] && (utf8 = gaim_try_conv_to_utf8(info->homezip))) { |
3919 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Zip Code:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3920 } |
3921 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); | |
4151 | 3922 } |
4641 | 3923 if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) { |
4819 | 3924 tmp = buf; buf = g_strconcat(tmp, "<b>", _("Work Address:"), "</b>", NULL); g_free(tmp); |
3925 if (info->workaddr && info->workaddr[0] && (utf8 = gaim_try_conv_to_utf8(info->workaddr))) { | |
3926 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Address:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3927 } |
4819 | 3928 if (info->workcity && info->workcity[0] && (utf8 = gaim_try_conv_to_utf8(info->workcity))) { |
3929 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("City:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3930 } |
4819 | 3931 if (info->workstate && info->workstate[0] && (utf8 = gaim_try_conv_to_utf8(info->workstate))) { |
3932 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("State:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3933 } |
4819 | 3934 if (info->workzip && info->workzip[0] && (utf8 = gaim_try_conv_to_utf8(info->workzip))) { |
3935 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Zip Code:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3936 } |
3937 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); | |
3938 } | |
4641 | 3939 if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) { |
4819 | 3940 tmp = buf; buf = g_strconcat(tmp, "<b>", _("Work Information:"), "</b>", NULL); g_free(tmp); |
3941 if (info->workcompany && info->workcompany[0] && (utf8 = gaim_try_conv_to_utf8(info->workcompany))) { | |
3942 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Company:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3943 } |
4819 | 3944 if (info->workdivision && info->workdivision[0] && (utf8 = gaim_try_conv_to_utf8(info->workdivision))) { |
3945 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Division:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3946 } |
4819 | 3947 if (info->workposition && info->workposition[0] && (utf8 = gaim_try_conv_to_utf8(info->workposition))) { |
3948 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Position:"), "</b> ", utf8, NULL); g_free(tmp); g_free(utf8); | |
4624 | 3949 } |
4819 | 3950 if (info->workwebpage && info->workwebpage[0] && (utf8 = gaim_try_conv_to_utf8(info->workwebpage))) { |
3951 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Web Page:"), "</b> <a href=\"", utf8, "\">", utf8, "</a>", NULL); g_free(tmp); g_free(utf8); | |
4624 | 3952 } |
3953 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); | |
4151 | 3954 } |
3955 | |
3956 g_show_info_text(gc, who, 2, buf, NULL); | |
3957 g_free(buf); | |
3958 | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3959 return 1; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3960 } |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3961 |
4759 | 3962 static int gaim_icqalias(aim_session_t *sess, aim_frame_t *fr, ...) |
3963 { | |
3964 struct gaim_connection *gc = sess->aux_data; | |
4820 | 3965 gchar who[16], *utf8; |
4759 | 3966 struct buddy *b; |
3967 va_list ap; | |
3968 struct aim_icq_info *info; | |
3969 | |
3970 va_start(ap, fr); | |
3971 info = va_arg(ap, struct aim_icq_info *); | |
3972 va_end(ap); | |
3973 | |
4822 | 3974 if (info->uin && info->nick && info->nick[0] && (utf8 = gaim_try_conv_to_utf8(info->nick))) { |
4759 | 3975 g_snprintf(who, sizeof(who), "%lu", info->uin); |
4820 | 3976 serv_got_alias(gc, who, utf8); |
4759 | 3977 if ((b = gaim_find_buddy(gc->account, who))) { |
4820 | 3978 gaim_buddy_set_setting(b, "servernick", utf8); |
4759 | 3979 gaim_blist_save(); |
3980 } | |
4820 | 3981 g_free(utf8); |
4759 | 3982 } |
3983 | |
3984 return 1; | |
3985 } | |
3986 | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3987 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
|
3988 { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3989 char *msg, *url; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3990 fu16_t wid, hei, delay; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3991 va_list ap; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3992 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3993 va_start(ap, fr); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3994 msg = va_arg(ap, char *); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3995 url = va_arg(ap, char *); |
4199 | 3996 wid = (fu16_t) va_arg(ap, int); |
3997 hei = (fu16_t) va_arg(ap, int); | |
3998 delay = (fu16_t) va_arg(ap, int); | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3999 va_end(ap); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4000 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4001 serv_got_popup(msg, url, wid, hei); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4002 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4003 return 1; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4004 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4005 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4006 static int gaim_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 4007 va_list ap; |
4008 char *address, *SNs; | |
4009 int i, num; | |
4010 char *buf; | |
4011 int at = 0, len; | |
4012 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4013 va_start(ap, fr); |
2086 | 4014 address = va_arg(ap, char *); |
4015 num = va_arg(ap, int); | |
4016 SNs = va_arg(ap, char *); | |
4017 va_end(ap); | |
4018 | |
4019 len = num * (MAXSNLEN + 1) + 1024; | |
4020 buf = g_malloc(len); | |
4021 at += g_snprintf(buf + at, len - at, "<B>%s has the following screen names:</B><BR>", address); | |
4022 for (i = 0; i < num; i++) | |
4023 at += g_snprintf(buf + at, len - at, "%s<BR>", &SNs[i * (MAXSNLEN + 1)]); | |
3212 | 4024 g_show_info_text(NULL, NULL, 2, buf, NULL); |
2086 | 4025 g_free(buf); |
4026 | |
4027 return 1; | |
4028 } | |
4029 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4030 static int gaim_parse_searcherror(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 4031 va_list ap; |
4032 char *address; | |
4033 char buf[BUF_LONG]; | |
4034 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4035 va_start(ap, fr); |
2086 | 4036 address = va_arg(ap, char *); |
4037 va_end(ap); | |
4038 | |
4039 g_snprintf(buf, sizeof(buf), "No results found for email address %s", address); | |
3427 | 4040 do_error_dialog(buf, NULL, GAIM_ERROR); |
2086 | 4041 |
4042 return 1; | |
4043 } | |
4044 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4045 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
|
4046 fu16_t status; |
2086 | 4047 va_list ap; |
4048 char msg[256]; | |
4049 struct gaim_connection *gc = sess->aux_data; | |
4050 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4051 va_start(ap, fr); |
4199 | 4052 status = (fu16_t) va_arg(ap, unsigned int); /* status code of confirmation request */ |
2086 | 4053 va_end(ap); |
4054 | |
4055 debug_printf("account confirmation returned status 0x%04x (%s)\n", status, | |
3912 | 4056 status ? "unknown" : "email sent"); |
4057 if (!status) { | |
2086 | 4058 g_snprintf(msg, sizeof(msg), "You should receive an email asking to confirm %s.", |
4059 gc->username); | |
4056 | 4060 do_error_dialog(_("Account Confirmation Requested"), msg, GAIM_INFO); |
2086 | 4061 } |
4062 | |
4063 return 1; | |
4064 } | |
4065 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4066 static int gaim_info_change(aim_session_t *sess, aim_frame_t *fr, ...) { |
3912 | 4067 struct gaim_connection *gc = sess->aux_data; |
2086 | 4068 va_list ap; |
3912 | 4069 fu16_t perms, err; |
4070 char *url, *sn, *email; | |
4071 int change; | |
2086 | 4072 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4073 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4074 change = va_arg(ap, int); |
4199 | 4075 perms = (fu16_t) va_arg(ap, unsigned int); |
4076 err = (fu16_t) va_arg(ap, unsigned int); | |
3912 | 4077 url = va_arg(ap, char *); |
4078 sn = va_arg(ap, char *); | |
4079 email = va_arg(ap, char *); | |
2086 | 4080 va_end(ap); |
4081 | |
3912 | 4082 debug_printf("account info: because of %s, perms=0x%04x, err=0x%04x, url=%s, sn=%s, email=%s\n", |
4083 change ? "change" : "request", perms, err, url, sn, email); | |
4084 | |
4085 if (err && url) { | |
4086 char *dialog_msg; | |
4087 char *dialog_top = g_strdup_printf(_("Error Changing Account Info")); | |
4088 switch (err) { | |
4089 case 0x0001: { | |
4090 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name differs from the original."), err); | |
4091 } break; | |
4092 case 0x0006: { | |
4093 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name ends in a space."), err); | |
4094 } break; | |
4095 case 0x000b: { | |
4096 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name is too long."), err); | |
4097 } break; | |
4098 case 0x001d: { | |
4099 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); | |
4100 } break; | |
4101 case 0x0021: { | |
4102 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); | |
4103 } break; | |
4104 case 0x0023: { | |
4105 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because the given address is invalid."), err); | |
4106 } break; | |
4107 default: { | |
4108 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unknown error."), err); | |
4109 } break; | |
4110 } | |
4111 do_error_dialog(dialog_top, dialog_msg, GAIM_ERROR); | |
4112 g_free(dialog_top); | |
4113 g_free(dialog_msg); | |
4114 return 1; | |
4115 } | |
4116 | |
4117 if (sn) { | |
4585 | 4118 char *dialog_msg = g_strdup_printf(_("Your screen name is currently formatted as follows:\n%s"), sn); |
4056 | 4119 do_error_dialog(_("Account Info"), dialog_msg, GAIM_INFO); |
3912 | 4120 g_free(dialog_msg); |
4121 } | |
4122 | |
4123 if (email) { | |
4124 char *dialog_msg = g_strdup_printf(_("The email address for %s is %s"), gc->username, email); | |
4056 | 4125 do_error_dialog(_("Account Info"), dialog_msg, GAIM_INFO); |
3912 | 4126 g_free(dialog_msg); |
2086 | 4127 } |
4128 | |
4129 return 1; | |
4130 } | |
4131 | |
4132 static void oscar_keepalive(struct gaim_connection *gc) { | |
4617 | 4133 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4134 aim_flap_nop(od->sess, od->conn); | |
2086 | 4135 } |
4136 | |
3001 | 4137 static int oscar_send_typing(struct gaim_connection *gc, char *name, int typing) { |
4617 | 4138 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4139 struct direct_im *dim = find_direct_im(od, name); | |
3595 | 4140 if (dim) |
4870 | 4141 if (typing == TYPING) |
4142 aim_odc_send_typing(od->sess, dim->conn, 0x0002); | |
4143 else if (typing == TYPED) | |
4144 aim_odc_send_typing(od->sess, dim->conn, 0x0001); | |
4145 else | |
4146 aim_odc_send_typing(od->sess, dim->conn, 0x0000); | |
3595 | 4147 else { |
4738 | 4148 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(name)); |
4149 if (bi && bi->typingnot) { | |
3596 | 4150 if (typing == TYPING) |
4617 | 4151 aim_im_sendmtn(od->sess, 0x0001, name, 0x0002); |
3596 | 4152 else if (typing == TYPED) |
4617 | 4153 aim_im_sendmtn(od->sess, 0x0001, name, 0x0001); |
3595 | 4154 else |
4617 | 4155 aim_im_sendmtn(od->sess, 0x0001, name, 0x0000); |
3595 | 4156 } |
4157 } | |
2993 | 4158 return 0; |
4159 } | |
5136 | 4160 static void oscar_ask_direct_im(struct gaim_connection *gc, const char *name); |
4161 | |
4162 static int oscar_send_im(struct gaim_connection *gc, const char *name, const char *message, int len, int imflags) { | |
4617 | 4163 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4164 struct direct_im *dim = find_direct_im(od, name); | |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4165 int ret = 0; |
3659 | 4166 GError *err = NULL; |
3458 | 4167 |
4838 | 4168 if (dim && dim->connected) { |
4169 /* If we're directly connected, send a direct IM */ | |
4170 /* XXX - The last parameter below is the encoding. Let Paco-Paco do something with it. */ | |
4870 | 4171 if (imflags & IM_FLAG_AWAY) |
4172 ret = aim_odc_send_im(od->sess, dim->conn, message, len == -1 ? strlen(message) : len, 0, 1); | |
4173 else | |
4174 ret = aim_odc_send_im(od->sess, dim->conn, message, len == -1 ? strlen(message) : len, 0, 0); | |
3044 | 4175 } else if (len != -1) { |
4176 /* Trying to send an IM image outside of a direct connection. */ | |
4177 oscar_ask_direct_im(gc, name); | |
4838 | 4178 ret = -ENOTCONN; |
2086 | 4179 } else { |
4738 | 4180 struct buddyinfo *bi; |
3008 | 4181 struct aim_sendimext_args args; |
4182 struct stat st; | |
4151 | 4183 int len; |
4269 | 4184 |
4738 | 4185 bi = g_hash_table_lookup(od->buddyinfo, normalize(name)); |
4186 if (!bi) { | |
4187 bi = g_new0(struct buddyinfo, 1); | |
4188 g_hash_table_insert(od->buddyinfo, g_strdup(normalize(name)), bi); | |
4189 } | |
4190 | |
3008 | 4191 args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES; |
4665 | 4192 if (od->icq) { |
4193 args.features = features_icq; | |
4194 args.featureslen = sizeof(features_icq); | |
3008 | 4195 args.flags |= AIM_IMFLAGS_OFFLINE; |
4665 | 4196 } else { |
4197 args.features = features_aim; | |
4198 args.featureslen = sizeof(features_aim); | |
4972 | 4199 |
4200 if (imflags & IM_FLAG_AWAY) | |
4201 args.flags |= AIM_IMFLAGS_AWAY; | |
4665 | 4202 } |
4269 | 4203 |
4738 | 4204 if (bi->ico_need) { |
4205 debug_printf("Sending buddy icon request with message\n"); | |
3008 | 4206 args.flags |= AIM_IMFLAGS_BUDDYREQ; |
4738 | 4207 bi->ico_need = FALSE; |
3008 | 4208 } |
4269 | 4209 |
4491 | 4210 if (gc->account->iconfile[0] && !stat(gc->account->iconfile, &st)) { |
4211 FILE *file = fopen(gc->account->iconfile, "r"); | |
3008 | 4212 if (file) { |
4213 char *buf = g_malloc(st.st_size); | |
4214 fread(buf, 1, st.st_size, file); | |
4269 | 4215 |
3008 | 4216 args.iconlen = st.st_size; |
4617 | 4217 args.iconsum = aimutil_iconsum(buf, st.st_size); |
3008 | 4218 args.iconstamp = st.st_mtime; |
4219 | |
4738 | 4220 if ((args.iconlen != bi->ico_me_len) || (args.iconsum != bi->ico_me_csum) || (args.iconstamp != bi->ico_me_time)) |
4221 bi->ico_informed = FALSE; | |
4222 | |
4223 if (!bi->ico_informed) { | |
4224 debug_printf("Claiming to have a buddy icon\n"); | |
4225 args.flags |= AIM_IMFLAGS_HASICON; | |
4226 bi->ico_me_len = args.iconlen; | |
4227 bi->ico_me_csum = args.iconsum; | |
4228 bi->ico_me_time = args.iconstamp; | |
4229 bi->ico_informed = TRUE; | |
4230 } | |
4231 | |
3008 | 4232 fclose(file); |
4233 g_free(buf); | |
2086 | 4234 } |
4235 } | |
4269 | 4236 |
3008 | 4237 args.destsn = name; |
4269 | 4238 |
3642 | 4239 len = strlen(message); |
5129 | 4240 args.flags |= oscar_encoding_check(message); |
3642 | 4241 if (args.flags & AIM_IMFLAGS_UNICODE) { |
4194 | 4242 debug_printf("Sending Unicode IM\n"); |
4662 | 4243 args.charset = 0x0002; |
4665 | 4244 args.charsubset = 0x0000; |
3659 | 4245 args.msg = g_convert(message, len, "UCS-2BE", "UTF-8", NULL, &len, &err); |
4246 if (err) { | |
4247 debug_printf("Error converting a unicode message: %s\n", err->message); | |
4248 debug_printf("This really shouldn't happen!\n"); | |
4249 /* We really shouldn't try to send the | |
4250 * IM now, but I'm not sure what to do */ | |
4800 | 4251 g_error_free(err); |
3659 | 4252 } |
3850 | 4253 } else if (args.flags & AIM_IMFLAGS_ISO_8859_1) { |
4194 | 4254 debug_printf("Sending ISO-8859-1 IM\n"); |
4662 | 4255 args.charset = 0x0003; |
4665 | 4256 args.charsubset = 0x0000; |
3659 | 4257 args.msg = g_convert(message, len, "ISO-8859-1", "UTF-8", NULL, &len, &err); |
4258 if (err) { | |
4259 debug_printf("conversion error: %s\n", err->message); | |
3642 | 4260 debug_printf("Someone tell Ethan his 8859-1 detection is wrong\n"); |
4261 args.flags ^= AIM_IMFLAGS_ISO_8859_1 | AIM_IMFLAGS_UNICODE; | |
4262 len = strlen(message); | |
4800 | 4263 g_error_free(err); |
3659 | 4264 args.msg = g_convert(message, len, "UCS-2BE", "UTF8", NULL, &len, &err); |
4265 if (err) { | |
4194 | 4266 debug_printf("Error in unicode fallback: %s\n", err->message); |
4800 | 4267 g_error_free(err); |
3659 | 4268 } |
3642 | 4269 } |
4270 } else { | |
4662 | 4271 args.charset = 0x0000; |
4272 args.charsubset = 0x0000; | |
3642 | 4273 args.msg = message; |
4274 } | |
4275 args.msglen = len; | |
4269 | 4276 |
4617 | 4277 ret = aim_im_sendch1_ext(od->sess, &args); |
2086 | 4278 } |
4838 | 4279 |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4280 if (ret >= 0) |
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4281 return 1; |
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4282 return ret; |
2086 | 4283 } |
4284 | |
5136 | 4285 static void oscar_get_info(struct gaim_connection *g, const char *name) { |
4617 | 4286 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
4287 if (od->icq) | |
4624 | 4288 aim_icq_getallinfo(od->sess, name); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4289 else |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
4290 /* 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
|
4291 * 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
|
4292 * insert in the middle. i hate people. */ |
4617 | 4293 aim_getinfo(od->sess, od->conn, name, AIM_GETINFO_AWAYMESSAGE); |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
4294 } |
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
4295 |
5136 | 4296 static void oscar_get_away(struct gaim_connection *g, const char *who) { |
4617 | 4297 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
4298 if (od->icq) { | |
4687 | 4299 struct buddy *budlight = gaim_find_buddy(g->account, who); |
3212 | 4300 if (budlight) |
3595 | 4301 if ((budlight->uc & 0xffff0000) >> 16) |
4687 | 4302 aim_im_sendch2_geticqaway(od->sess, who, (budlight->uc & 0xffff0000) >> 16); |
3212 | 4303 else |
4304 debug_printf("Error: The user %s has no status message, therefore not requesting.\n", who); | |
4305 else | |
4306 debug_printf("Error: Could not find %s in local contact list, therefore unable to request status message.\n", who); | |
4307 } else | |
4617 | 4308 aim_getinfo(od->sess, od->conn, who, AIM_GETINFO_GENERALINFO); |
2086 | 4309 } |
4310 | |
3466 | 4311 static void oscar_set_dir(struct gaim_connection *g, const char *first, const char *middle, const char *last, |
4312 const char *maiden, const char *city, const char *state, const char *country, int web) { | |
4617 | 4313 /* XXX - some of these things are wrong, but i'm lazy */ |
4314 struct oscar_data *od = (struct oscar_data *)g->proto_data; | |
4315 aim_setdirectoryinfo(od->sess, od->conn, first, middle, last, | |
2086 | 4316 maiden, NULL, NULL, city, state, NULL, 0, web); |
4317 } | |
4318 | |
4319 | |
5129 | 4320 static void oscar_set_idle(struct gaim_connection *gc, int time) { |
4321 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4617 | 4322 aim_bos_setidle(od->sess, od->conn, time); |
2086 | 4323 } |
4324 | |
5129 | 4325 static void oscar_set_info(struct gaim_connection *gc, char *text) { |
4326 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4327 fu32_t flags = 0; | |
4328 char *msg = NULL; | |
4329 int msglen = 0; | |
2993 | 4330 |
4617 | 4331 if (od->rights.maxsiglen == 0) |
3427 | 4332 do_error_dialog(_("Unable to set AIM profile."), |
4333 _("You have probably requested to set your profile before the login procedure completed. " | |
5129 | 4334 "Your profile remains unset; try setting it again when you are fully connected."), GAIM_WARNING); |
4617 | 4335 |
4336 if (od->icq) | |
4337 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, NULL, NULL, 0, caps_icq); | |
4151 | 4338 else { |
5129 | 4339 if (!text) { |
4340 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, NULL, NULL, 0, caps_aim); | |
4341 return; | |
4342 } | |
4343 | |
4344 flags = oscar_encoding_check(text); | |
4345 if (flags & AIM_IMFLAGS_UNICODE) { | |
4346 msg = g_convert(text, strlen(text), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); | |
4347 aim_bos_setprofile(od->sess, od->conn, "unicode-2-0", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim); | |
4348 g_free(msg); | |
4349 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { | |
4350 msg = g_convert(text, strlen(text), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); | |
4351 aim_bos_setprofile(od->sess, od->conn, "iso-8859-1", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim); | |
4352 g_free(msg); | |
4151 | 4353 } else { |
5129 | 4354 msglen = strlen(text); |
4355 aim_bos_setprofile(od->sess, od->conn, "us-ascii", text, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim); | |
4151 | 4356 } |
5129 | 4357 |
4358 if (msglen > od->rights.maxsiglen) { | |
4359 gchar *errstr; | |
4360 errstr = g_strdup_printf(_("The maximum profile length of %d bytes has been exceeded. " | |
4361 "Gaim has truncated it for you."), od->rights.maxsiglen); | |
4362 do_error_dialog(_("Profile too long."), errstr, GAIM_WARNING); | |
4363 g_free(errstr); | |
4364 } | |
4365 | |
4366 } | |
2993 | 4367 |
4368 return; | |
2086 | 4369 } |
4370 | |
5129 | 4371 static void oscar_set_away_aim(struct gaim_connection *gc, struct oscar_data *od, const char *text) |
2993 | 4372 { |
5129 | 4373 fu32_t flags = 0; |
4374 char *msg = NULL; | |
4375 int msglen = 0; | |
2993 | 4376 |
4377 if (od->rights.maxawaymsglen == 0) | |
3427 | 4378 do_error_dialog(_("Unable to set AIM away message."), |
4379 _("You have probably requested to set your away message before the login procedure completed. " | |
5129 | 4380 "You remain in a \"present\" state; try setting it again when you are fully connected."), GAIM_WARNING); |
4381 | |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4382 if (gc->away) { |
2993 | 4383 g_free(gc->away); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4384 gc->away = NULL; |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4385 } |
2993 | 4386 |
5129 | 4387 if (!text) { |
4151 | 4388 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
|
4389 return; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4390 } |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4391 |
5129 | 4392 flags = oscar_encoding_check(text); |
4393 if (flags & AIM_IMFLAGS_UNICODE) { | |
4394 msg = g_convert(text, strlen(text), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); | |
4395 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "unicode-2-0", msg, | |
4396 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim); | |
4397 g_free(msg); | |
4398 gc->away = g_strndup(text, od->rights.maxawaymsglen/2); | |
4399 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { | |
4400 msg = g_convert(text, strlen(text), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); | |
4401 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "iso-8859-1", msg, | |
4402 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim); | |
4403 g_free(msg); | |
4404 gc->away = g_strndup(text, od->rights.maxawaymsglen); | |
4405 } else { | |
4406 msglen = strlen(text); | |
4407 aim_bos_setprofile(od->sess, od->conn, NULL, NULL, 0, "us-ascii", text, | |
4408 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim); | |
4409 gc->away = g_strndup(text, od->rights.maxawaymsglen); | |
4410 } | |
4411 | |
4412 if (msglen > od->rights.maxawaymsglen) { | |
2993 | 4413 gchar *errstr; |
4414 | |
5129 | 4415 errstr = g_strdup_printf(_("The maximum away message length of %d bytes has been exceeded. " |
3427 | 4416 "Gaim has truncated it and set you away."), od->rights.maxawaymsglen); |
5129 | 4417 do_error_dialog(_("Away message too long."), errstr, GAIM_WARNING); |
2993 | 4418 g_free(errstr); |
4419 } | |
4420 | |
4421 return; | |
4422 } | |
4423 | |
4424 static void oscar_set_away_icq(struct gaim_connection *gc, struct oscar_data *od, const char *state, const char *message) | |
4425 { | |
4426 | |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4427 if (gc->away) { |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4428 g_free(gc->away); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4429 gc->away = NULL; |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4430 } |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4431 |
4342 | 4432 if (strcmp(state, _("Invisible"))) { |
4491 | 4433 if (aim_ssi_getpermdeny(od->sess->ssi.local) != gc->account->permdeny) |
4889 | 4434 aim_ssi_setpermdeny(od->sess, gc->account->permdeny, 0xffffffff); |
4491 | 4435 gc->account->permdeny = 4; |
4342 | 4436 } else { |
4437 if (aim_ssi_getpermdeny(od->sess->ssi.local) != 0x03) | |
4889 | 4438 aim_ssi_setpermdeny(od->sess, 0x03, 0xffffffff); |
4491 | 4439 gc->account->permdeny = 3; |
4342 | 4440 } |
4441 | |
4442 if (!strcmp(state, _("Online"))) | |
4901 | 4443 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
4342 | 4444 else if (!strcmp(state, _("Away"))) { |
4901 | 4445 aim_setextstatus(od->sess, AIM_ICQ_STATE_AWAY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4446 gc->away = g_strdup(""); |
4342 | 4447 } else if (!strcmp(state, _("Do Not Disturb"))) { |
4901 | 4448 aim_setextstatus(od->sess, 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
|
4449 gc->away = g_strdup(""); |
4342 | 4450 } else if (!strcmp(state, _("Not Available"))) { |
4901 | 4451 aim_setextstatus(od->sess, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4452 gc->away = g_strdup(""); |
4342 | 4453 } else if (!strcmp(state, _("Occupied"))) { |
4901 | 4454 aim_setextstatus(od->sess, AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4455 gc->away = g_strdup(""); |
4342 | 4456 } else if (!strcmp(state, _("Free For Chat"))) { |
4901 | 4457 aim_setextstatus(od->sess, AIM_ICQ_STATE_CHAT); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4458 gc->away = g_strdup(""); |
4342 | 4459 } else if (!strcmp(state, _("Invisible"))) { |
4901 | 4460 aim_setextstatus(od->sess, AIM_ICQ_STATE_INVISIBLE); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4461 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4462 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { |
2998 | 4463 if (message) { |
4901 | 4464 aim_setextstatus(od->sess, AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4465 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4466 } else { |
4901 | 4467 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4468 } |
2086 | 4469 } |
2993 | 4470 |
4471 return; | |
4472 } | |
4473 | |
4474 static void oscar_set_away(struct gaim_connection *gc, char *state, char *message) | |
4475 { | |
4476 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4477 | |
4478 if (od->icq) | |
4479 oscar_set_away_icq(gc, od, state, message); | |
4480 else | |
4481 oscar_set_away_aim(gc, od, message); | |
4482 | |
4483 return; | |
2086 | 4484 } |
4485 | |
4230 | 4486 static void oscar_warn(struct gaim_connection *gc, char *name, int anon) { |
4617 | 4487 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4488 aim_im_warn(od->sess, od->conn, name, anon ? AIM_WARN_ANON : 0); | |
2086 | 4489 } |
4490 | |
4230 | 4491 static void oscar_dir_search(struct gaim_connection *gc, const char *first, const char *middle, const char *last, |
3466 | 4492 const char *maiden, const char *city, const char *state, const char *country, const char *email) { |
4617 | 4493 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2086 | 4494 if (strlen(email)) |
4617 | 4495 aim_usersearch_address(od->sess, od->conn, email); |
2086 | 4496 } |
4497 | |
4230 | 4498 static void oscar_add_buddy(struct gaim_connection *gc, const char *name) { |
4499 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4500 #ifdef NOSSI | |
4501 aim_add_buddy(od->sess, od->conn, name); | |
4502 #else | |
4503 if ((od->sess->ssi.received_data) && !(aim_ssi_itemlist_exists(od->sess->ssi.local, name))) { | |
4687 | 4504 struct buddy *buddy = gaim_find_buddy(gc->account, name); |
4505 struct group *group = gaim_find_buddys_group(buddy); | |
4230 | 4506 if (buddy && group) { |
4507 debug_printf("ssi: adding buddy %s to group %s\n", name, group->name); | |
4889 | 4508 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 0); |
4230 | 4509 } |
4510 } | |
4511 #endif | |
4759 | 4512 if (od->icq) |
4513 aim_icq_getalias(od->sess, name); | |
4230 | 4514 } |
4515 | |
4516 static void oscar_add_buddies(struct gaim_connection *gc, GList *buddies) { | |
4517 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4518 #ifdef NOSSI | |
4519 char buf[MSG_LEN]; | |
4520 int n=0; | |
4521 while (buddies) { | |
4522 if (n > MSG_LEN - 18) { | |
4523 aim_bos_setbuddylist(od->sess, od->conn, buf); | |
4524 n = 0; | |
3092 | 4525 } |
4230 | 4526 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", (char *)buddies->data); |
4527 buddies = buddies->next; | |
4528 } | |
4529 aim_bos_setbuddylist(od->sess, od->conn, buf); | |
4530 #else | |
4531 if (od->sess->ssi.received_data) { | |
4532 while (buddies) { | |
4687 | 4533 struct buddy *buddy = gaim_find_buddy(gc->account, (const char *)buddies->data); |
4534 struct group *group = gaim_find_buddys_group(buddy); | |
4230 | 4535 if (buddy && group) { |
4536 debug_printf("ssi: adding buddy %s to group %s\n", (const char *)buddies->data, group->name); | |
4889 | 4537 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 0); |
4230 | 4538 } |
4539 buddies = buddies->next; | |
4540 } | |
4541 } | |
4542 #endif | |
4543 } | |
4544 | |
4545 static void oscar_remove_buddy(struct gaim_connection *gc, char *name, char *group) { | |
4546 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4547 #ifdef NOSSI | |
4548 aim_remove_buddy(od->sess, od->conn, name); | |
4549 #else | |
4550 if (od->sess->ssi.received_data) { | |
4551 debug_printf("ssi: deleting buddy %s from group %s\n", name, group); | |
4889 | 4552 aim_ssi_delbuddy(od->sess, name, group); |
4230 | 4553 } |
4554 #endif | |
4555 } | |
4556 | |
4557 static void oscar_remove_buddies(struct gaim_connection *gc, GList *buddies, const char *group) { | |
4558 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4559 #ifdef NOSSI | |
4560 GList *cur; | |
4561 for (cur=buddies; cur; cur=cur->next) | |
4562 aim_remove_buddy(od->sess, od->conn, cur->data); | |
4563 #else | |
4564 if (od->sess->ssi.received_data) { | |
3092 | 4565 while (buddies) { |
4230 | 4566 debug_printf("ssi: deleting buddy %s from group %s\n", (char *)buddies->data, group); |
4889 | 4567 aim_ssi_delbuddy(od->sess, buddies->data, group); |
3092 | 4568 buddies = buddies->next; |
4569 } | |
4230 | 4570 } |
4571 #endif | |
4572 } | |
4573 | |
4574 #ifndef NOSSI | |
4269 | 4575 static void oscar_move_buddy(struct gaim_connection *gc, const char *name, const char *old_group, const char *new_group) { |
4576 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4303 | 4577 if (od->sess->ssi.received_data && strcmp(old_group, new_group)) { |
4269 | 4578 debug_printf("ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group); |
4889 | 4579 aim_ssi_movebuddy(od->sess, old_group, new_group, name); |
4269 | 4580 } |
4581 } | |
4582 | |
4583 static void oscar_alias_buddy(struct gaim_connection *gc, const char *name, const char *alias) { | |
4584 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4585 if (od->sess->ssi.received_data) { | |
4586 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, name); | |
4587 if (gname) { | |
4588 debug_printf("ssi: changing the alias for buddy %s to %s\n", name, alias); | |
4889 | 4589 aim_ssi_aliasbuddy(od->sess, gname, name, alias); |
4269 | 4590 } |
4591 } | |
4592 } | |
4593 | |
4230 | 4594 static void oscar_rename_group(struct gaim_connection *g, const char *old_group, const char *new_group, GList *members) { |
4595 struct oscar_data *od = (struct oscar_data *)g->proto_data; | |
4596 | |
4597 if (od->sess->ssi.received_data) { | |
4598 if (aim_ssi_itemlist_finditem(od->sess->ssi.local, new_group, NULL, AIM_SSI_TYPE_GROUP)) { | |
4599 oscar_remove_buddies(g, members, old_group); | |
4600 oscar_add_buddies(g, members); | |
4601 debug_printf("ssi: moved all buddies from group %s to %s\n", old_group, new_group); | |
4602 } else { | |
4889 | 4603 aim_ssi_rename_group(od->sess, old_group, new_group); |
4230 | 4604 debug_printf("ssi: renamed group %s to %s\n", old_group, new_group); |
2995 | 4605 } |
4606 } | |
4607 } | |
4608 | |
4642 | 4609 static int gaim_ssi_parseerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
4610 struct gaim_connection *gc = sess->aux_data; | |
4611 struct oscar_data *od = gc->proto_data; | |
4612 va_list ap; | |
4613 fu16_t reason; | |
4614 | |
4615 va_start(ap, fr); | |
4616 reason = (fu16_t)va_arg(ap, unsigned int); | |
4617 va_end(ap); | |
4618 | |
4619 debug_printf("ssi: SNAC error %hu\n", reason); | |
4620 | |
4621 if (reason == 0x0005) { | |
4622 do_error_dialog(_("Unable To Retrive Buddy List"), _("Gaim was temporarily unable to retrive your buddy list from the AIM servers. Your buddy list is not lost, and will probably become available in a few hours."), GAIM_ERROR); | |
4623 } | |
4624 | |
4625 /* Activate SSI */ | |
4626 /* Sending the enable causes other people to be able to see you, and you to see them */ | |
4627 /* Make sure your privacy setting/invisibility is set how you want it before this! */ | |
4628 debug_printf("ssi: activating server-stored buddy list\n"); | |
4629 aim_ssi_enable(od->sess); | |
4630 | |
4631 return 1; | |
4632 } | |
4633 | |
2991 | 4634 static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) { |
4230 | 4635 struct gaim_connection *gc = sess->aux_data; |
4636 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4637 int numtypes, i; | |
4638 fu16_t *maxitems; | |
2991 | 4639 va_list ap; |
4640 | |
4641 va_start(ap, fr); | |
4230 | 4642 numtypes = va_arg(ap, int); |
4643 maxitems = va_arg(ap, fu16_t *); | |
2991 | 4644 va_end(ap); |
4645 | |
4230 | 4646 debug_printf("ssi rights:"); |
4647 for (i=0; i<numtypes; i++) | |
4617 | 4648 debug_printf(" max type 0x%04x=%hd,", i, maxitems[i]); |
4317 | 4649 debug_printf("\n"); |
4230 | 4650 |
4651 if (numtypes >= 0) | |
4652 od->rights.maxbuddies = maxitems[0]; | |
4653 if (numtypes >= 1) | |
4654 od->rights.maxgroups = maxitems[1]; | |
4655 if (numtypes >= 2) | |
4656 od->rights.maxpermits = maxitems[2]; | |
4657 if (numtypes >= 3) | |
4658 od->rights.maxdenies = maxitems[3]; | |
2991 | 4659 |
4660 return 1; | |
4661 } | |
4662 | |
4663 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { | |
4664 struct gaim_connection *gc = sess->aux_data; | |
4230 | 4665 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2995 | 4666 struct aim_ssi_item *curitem; |
2991 | 4667 int tmp; |
4778 | 4668 gboolean export = FALSE; |
4617 | 4669 /* XXX - use these? |
4230 | 4670 va_list ap; |
4671 | |
4672 va_start(ap, fr); | |
4673 fmtver = (fu16_t)va_arg(ap, int); | |
4674 numitems = (fu16_t)va_arg(ap, int); | |
4675 items = va_arg(ap, struct aim_ssi_item); | |
4676 timestamp = va_arg(ap, fu32_t); | |
4677 va_end(ap); */ | |
2991 | 4678 |
4679 debug_printf("ssi: syncing local list and server list\n"); | |
4680 | |
4681 /* Clean the buddy list */ | |
4889 | 4682 aim_ssi_cleanlist(sess); |
2991 | 4683 |
4684 /* Add from server list to local list */ | |
4230 | 4685 for (curitem=sess->ssi.local; curitem; curitem=curitem->next) { |
2991 | 4686 switch (curitem->type) { |
4230 | 4687 case 0x0000: { /* Buddy */ |
4251 | 4688 if (curitem->name) { |
4292 | 4689 char *gname = aim_ssi_itemlist_findparentname(sess->ssi.local, curitem->name); |
4458 | 4690 char *gname_utf8 = gaim_try_conv_to_utf8(gname); |
4282 | 4691 char *alias = aim_ssi_getalias(sess->ssi.local, gname, curitem->name); |
4458 | 4692 char *alias_utf8 = gaim_try_conv_to_utf8(alias); |
4687 | 4693 struct buddy *buddy = gaim_find_buddy(gc->account, curitem->name); |
4458 | 4694 /* Should gname be freed here? -- elb */ |
4754 | 4695 /* Not with the current code, but that might be cleaner -- med */ |
4458 | 4696 free(alias); |
4282 | 4697 if (buddy) { |
4292 | 4698 /* Get server stored alias */ |
4705 | 4699 if (alias_utf8) { |
4700 g_free(buddy->alias); | |
4701 buddy->alias = g_strdup(alias_utf8); | |
4702 } | |
4282 | 4703 } else { |
4687 | 4704 struct group *g; |
4705 buddy = gaim_buddy_new(gc->account, curitem->name, alias_utf8); | |
4706 | |
4754 | 4707 if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { |
4687 | 4708 g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); |
4754 | 4709 gaim_blist_add_group(g, NULL); |
4710 } | |
4687 | 4711 |
5131 | 4712 debug_printf("ssi: adding buddy %s to group %s to local list\n", curitem->name, gname_utf8 ? gname_utf8 : _("Orphans")); |
4687 | 4713 gaim_blist_add_buddy(buddy, g, NULL); |
4778 | 4714 export = TRUE; |
4251 | 4715 } |
4458 | 4716 free(gname_utf8); |
4717 free(alias_utf8); | |
2991 | 4718 } |
4230 | 4719 } break; |
4720 | |
4721 case 0x0001: { /* Group */ | |
4282 | 4722 /* Shouldn't add empty groups */ |
4230 | 4723 } break; |
4724 | |
4725 case 0x0002: { /* Permit buddy */ | |
2991 | 4726 if (curitem->name) { |
4230 | 4727 /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */ |
2991 | 4728 GSList *list; |
4491 | 4729 for (list=gc->account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
2991 | 4730 if (!list) { |
2995 | 4731 debug_printf("ssi: adding permit buddy %s to local list\n", curitem->name); |
4491 | 4732 gaim_privacy_permit_add(gc->account, curitem->name); |
2991 | 4733 build_allow_list(); |
4778 | 4734 export = TRUE; |
2991 | 4735 } |
4736 } | |
4230 | 4737 } break; |
4738 | |
4739 case 0x0003: { /* Deny buddy */ | |
2991 | 4740 if (curitem->name) { |
4741 GSList *list; | |
4491 | 4742 for (list=gc->account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
2991 | 4743 if (!list) { |
2995 | 4744 debug_printf("ssi: adding deny buddy %s to local list\n", curitem->name); |
4491 | 4745 gaim_privacy_deny_add(gc->account, curitem->name); |
2991 | 4746 build_block_list(); |
4778 | 4747 export = TRUE; |
2991 | 4748 } |
4749 } | |
4230 | 4750 } break; |
4751 | |
4752 case 0x0004: { /* Permit/deny setting */ | |
2991 | 4753 if (curitem->data) { |
4754 fu8_t permdeny; | |
4491 | 4755 if ((permdeny = aim_ssi_getpermdeny(sess->ssi.local)) && (permdeny != gc->account->permdeny)) { |
4756 debug_printf("ssi: changing permdeny from %d to %hhu\n", gc->account->permdeny, permdeny); | |
4757 gc->account->permdeny = permdeny; | |
4758 if (od->icq && gc->account->permdeny == 0x03) { | |
4342 | 4759 serv_set_away(gc, "Invisible", ""); |
4760 } | |
4778 | 4761 export = TRUE; |
2991 | 4762 } |
4763 } | |
4230 | 4764 } break; |
4765 | |
4766 case 0x0005: { /* Presence setting */ | |
3109 | 4767 /* We don't want to change Gaim's setting because it applies to all accounts */ |
4230 | 4768 } break; |
2991 | 4769 } /* End of switch on curitem->type */ |
4770 } /* End of for loop */ | |
4230 | 4771 |
4772 /* If changes were made, then flush buddy list to file */ | |
4778 | 4773 if (export) |
4349 | 4774 gaim_blist_save(); |
2991 | 4775 |
4759 | 4776 { /* Add from local list to server list */ |
4777 GaimBlistNode *gnode, *bnode; | |
4778 struct group *group; | |
4779 struct buddy *buddy; | |
4780 struct gaim_buddy_list *blist; | |
3017 | 4781 GSList *cur; |
4782 | |
2991 | 4783 /* Buddies */ |
4759 | 4784 if ((blist = gaim_get_blist())) |
4785 for (gnode = blist->root; gnode; gnode = gnode->next) { | |
4786 group = (struct group *)gnode; | |
4787 for (bnode = gnode->child; bnode; bnode = bnode->next) { | |
4788 buddy = (struct buddy *)bnode; | |
4789 if (buddy->account == gc->account) { | |
4790 gchar *servernick = gaim_buddy_get_setting(buddy, "servernick"); | |
4791 if (servernick) { | |
4792 serv_got_alias(gc, buddy->name, servernick); | |
4793 g_free(servernick); | |
4794 } | |
4795 if (aim_ssi_itemlist_exists(sess->ssi.local, buddy->name)) { | |
4796 /* Store local alias on server */ | |
4797 char *alias = aim_ssi_getalias(sess->ssi.local, group->name, buddy->name); | |
4783 | 4798 if (!alias && buddy->alias && strlen(buddy->alias)) |
4889 | 4799 aim_ssi_aliasbuddy(sess, group->name, buddy->name, buddy->alias); |
4759 | 4800 free(alias); |
4801 } else { | |
4802 debug_printf("ssi: adding buddy %s from local list to server list\n", buddy->name); | |
4889 | 4803 aim_ssi_addbuddy(sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 0); |
4759 | 4804 } |
4349 | 4805 } |
4230 | 4806 } |
4292 | 4807 } |
2991 | 4808 /* Permit list */ |
4491 | 4809 if (gc->account->permit) { |
4810 for (cur=gc->account->permit; cur; cur=cur->next) | |
4230 | 4811 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) { |
4812 debug_printf("ssi: adding permit %s from local list to server list\n", (char *)cur->data); | |
4889 | 4813 aim_ssi_addpermit(sess, cur->data); |
4230 | 4814 } |
2991 | 4815 } |
4816 | |
4817 /* Deny list */ | |
4491 | 4818 if (gc->account->deny) { |
4819 for (cur=gc->account->deny; cur; cur=cur->next) | |
4230 | 4820 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_DENY)) { |
4821 debug_printf("ssi: adding deny %s from local list to server list\n", (char *)cur->data); | |
4889 | 4822 aim_ssi_adddeny(sess, cur->data); |
4230 | 4823 } |
2991 | 4824 } |
3109 | 4825 /* Presence settings (idle time visibility) */ |
4230 | 4826 if ((tmp = aim_ssi_getpresence(sess->ssi.local)) != 0xFFFFFFFF) |
3109 | 4827 if (report_idle && !(tmp & 0x400)) |
4889 | 4828 aim_ssi_setpresence(sess, tmp | 0x400); |
4778 | 4829 } /* end adding buddies from local list to server list */ |
4830 | |
4831 { /* Check for maximum number of buddies */ | |
4785 | 4832 GaimBlistNode *gnode,*bnode; |
4833 tmp = 0; | |
4834 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { | |
4835 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
4836 continue; | |
4837 for(bnode = gnode->child; bnode; bnode = bnode->next) { | |
4838 struct buddy *b = (struct buddy *)bnode; | |
4839 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
4840 continue; | |
4491 | 4841 if(b->account == gc->account) |
4349 | 4842 tmp++; |
4843 } | |
3214 | 4844 } |
4770 | 4845 |
4230 | 4846 if (tmp > od->rights.maxbuddies) { |
3210 | 4847 char *dialog_msg = g_strdup_printf(_("The maximum number of buddies allowed in your buddy list is %d, and you have %d." |
4848 " Until you are below the limit, some buddies will not show up as online."), | |
4230 | 4849 od->rights.maxbuddies, tmp); |
4642 | 4850 do_error_dialog(_("Maximum buddy list length exceeded."), dialog_msg, GAIM_WARNING); |
3210 | 4851 g_free(dialog_msg); |
4852 } | |
4778 | 4853 } |
4785 | 4854 |
4901 | 4855 /* Set our ICQ status */ |
4856 if (od->icq && !gc->away) { | |
4857 aim_setextstatus(sess, AIM_ICQ_STATE_NORMAL); | |
4858 } | |
4859 | |
4342 | 4860 /* Activate SSI */ |
4861 /* Sending the enable causes other people to be able to see you, and you to see them */ | |
4862 /* Make sure your privacy setting/invisibility is set how you want it before this! */ | |
4863 debug_printf("ssi: activating server-stored buddy list\n"); | |
4642 | 4864 aim_ssi_enable(sess); |
4342 | 4865 |
2991 | 4866 return 1; |
2086 | 4867 } |
4230 | 4868 |
4869 static int gaim_ssi_parseack(aim_session_t *sess, aim_frame_t *fr, ...) { | |
4870 struct gaim_connection *gc = sess->aux_data; | |
4871 va_list ap; | |
4872 struct aim_ssi_tmp *retval; | |
4873 | |
4874 va_start(ap, fr); | |
4875 retval = va_arg(ap, struct aim_ssi_tmp *); | |
4876 va_end(ap); | |
4877 | |
4878 while (retval) { | |
4848 | 4879 debug_printf("ssi: status is 0x%04hx for a 0x%04hx action with name %s\n", retval->ack, retval->action, retval->item ? (retval->item->name ? retval->item->name : "no name") : "no item"); |
4230 | 4880 |
4881 if (retval->ack != 0xffff) | |
4882 switch (retval->ack) { | |
4883 case 0x0000: { /* added successfully */ | |
4884 } break; | |
4885 | |
4829 | 4886 case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */ |
4887 gchar *buf; | |
4888 buf = g_strdup_printf(_("Could not add the buddy %s because you have too many buddies in your buddy list. Please remove one and try again."), (retval->name ? retval->name : _("(no name)"))); | |
4889 /* do_error_dialog(_("Unable To Add"), buf, GAIM_ERROR); */ | |
4890 g_free(buf); | |
4891 } | |
4892 | |
4230 | 4893 case 0x000e: { /* contact requires authorization */ |
4828 | 4894 if ((retval->action == AIM_CB_SSI_ADD) && (retval->name)) |
4269 | 4895 gaim_auth_sendrequest(gc, retval->name); |
4230 | 4896 } break; |
4897 | |
4898 default: { /* La la la */ | |
4899 debug_printf("ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack); | |
4900 /* Should remove buddy from local list and give an error message? */ | |
4901 } break; | |
4902 } | |
4903 | |
4904 retval = retval->next; | |
4905 } | |
4906 | |
4907 return 1; | |
4908 } | |
4909 | |
4910 static int gaim_ssi_authgiven(aim_session_t *sess, aim_frame_t *fr, ...) { | |
4911 struct gaim_connection *gc = sess->aux_data; | |
4912 va_list ap; | |
4913 char *sn, *msg; | |
4236 | 4914 gchar *dialog_msg, *nombre; |
4230 | 4915 struct name_data *data; |
4236 | 4916 struct buddy *buddy; |
4230 | 4917 |
4918 va_start(ap, fr); | |
4919 sn = va_arg(ap, char *); | |
4920 msg = va_arg(ap, char *); | |
4921 va_end(ap); | |
4922 | |
4923 debug_printf("ssi: %s has given you permission to add him to your buddy list\n", sn); | |
4924 | |
4687 | 4925 buddy = gaim_find_buddy(gc->account, sn); |
4926 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
4927 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 4928 else |
4929 nombre = g_strdup(sn); | |
4930 | |
4931 dialog_msg = g_strdup_printf(_("The user %s has given you permission to add you to their buddy list. Do you want to add them?"), nombre); | |
4230 | 4932 data = g_new(struct name_data, 1); |
4933 data->gc = gc; | |
4934 data->name = g_strdup(sn); | |
4935 data->nick = NULL; | |
4249 | 4936 do_ask_dialog(_("Authorization Given"), dialog_msg, data, _("Yes"), gaim_icq_contactadd, _("No"), gaim_free_name_data, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE); |
4236 | 4937 |
4230 | 4938 g_free(dialog_msg); |
4236 | 4939 g_free(nombre); |
4230 | 4940 |
4941 return 1; | |
4942 } | |
4943 | |
4944 static int gaim_ssi_authrequest(aim_session_t *sess, aim_frame_t *fr, ...) { | |
4945 struct gaim_connection *gc = sess->aux_data; | |
4946 va_list ap; | |
4947 char *sn, *msg; | |
4236 | 4948 gchar *dialog_msg, *nombre; |
4230 | 4949 struct name_data *data; |
4236 | 4950 struct buddy *buddy; |
4230 | 4951 |
4952 va_start(ap, fr); | |
4953 sn = va_arg(ap, char *); | |
4954 msg = va_arg(ap, char *); | |
4955 va_end(ap); | |
4956 | |
4957 debug_printf("ssi: received authorization request from %s\n", sn); | |
4958 | |
4687 | 4959 buddy = gaim_find_buddy(gc->account, sn); |
4960 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
4961 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 4962 else |
4963 nombre = g_strdup(sn); | |
4964 | |
4337 | 4965 dialog_msg = g_strdup_printf(_("The user %s wants to add you to their buddy list for the following reason:\n%s"), nombre, msg ? msg : _("No reason given.")); |
4230 | 4966 data = g_new(struct name_data, 1); |
4967 data->gc = gc; | |
4968 data->name = g_strdup(sn); | |
4969 data->nick = NULL; | |
4337 | 4970 do_ask_dialog(_("Authorization Request"), dialog_msg, data, _("Authorize"), gaim_auth_grant, _("Deny"), gaim_auth_dontgrant_msgprompt, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE); |
4236 | 4971 |
4230 | 4972 g_free(dialog_msg); |
4236 | 4973 g_free(nombre); |
4230 | 4974 |
4975 return 1; | |
4976 } | |
4977 | |
4978 static int gaim_ssi_authreply(aim_session_t *sess, aim_frame_t *fr, ...) { | |
4236 | 4979 struct gaim_connection *gc = sess->aux_data; |
4230 | 4980 va_list ap; |
4981 char *sn, *msg; | |
4236 | 4982 gchar *dialog_msg, *nombre; |
4230 | 4983 fu8_t reply; |
4236 | 4984 struct buddy *buddy; |
4230 | 4985 |
4986 va_start(ap, fr); | |
4987 sn = va_arg(ap, char *); | |
4988 reply = (fu8_t)va_arg(ap, int); | |
4989 msg = va_arg(ap, char *); | |
4990 va_end(ap); | |
4991 | |
4236 | 4992 debug_printf("ssi: received authorization reply from %s. Reply is 0x%04hhx\n", sn, reply); |
4993 | |
4687 | 4994 buddy = gaim_find_buddy(gc->account, sn); |
4995 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
4996 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 4997 else |
4998 nombre = g_strdup(sn); | |
4999 | |
4230 | 5000 if (reply) { |
5001 /* Granted */ | |
4236 | 5002 dialog_msg = g_strdup_printf(_("The user %s has granted your request to add them to your contact list."), nombre); |
4230 | 5003 do_error_dialog(_("Authorization Granted"), dialog_msg, GAIM_INFO); |
5004 } else { | |
5005 /* Denied */ | |
4236 | 5006 dialog_msg = g_strdup_printf(_("The user %s has denied your request to add them to your contact list for the following reason:\n%s"), nombre, msg ? msg : _("No reason given.")); |
4230 | 5007 do_error_dialog(_("Authorization Denied"), dialog_msg, GAIM_INFO); |
5008 } | |
5009 g_free(dialog_msg); | |
4236 | 5010 g_free(nombre); |
4230 | 5011 |
5012 return 1; | |
5013 } | |
5014 | |
5015 static int gaim_ssi_gotadded(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5016 struct gaim_connection *gc = sess->aux_data; | |
5017 va_list ap; | |
5018 char *sn; | |
4236 | 5019 struct buddy *buddy; |
4230 | 5020 |
5021 va_start(ap, fr); | |
5022 sn = va_arg(ap, char *); | |
5023 va_end(ap); | |
5024 | |
4687 | 5025 buddy = gaim_find_buddy(gc->account, sn); |
4230 | 5026 debug_printf("ssi: %s added you to their buddy list\n", sn); |
4687 | 5027 show_got_added(gc, NULL, sn, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); |
4230 | 5028 |
5029 return 1; | |
5030 } | |
4269 | 5031 #endif |
2086 | 5032 |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5033 static GList *oscar_chat_info(struct gaim_connection *gc) { |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5034 GList *m = NULL; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5035 struct proto_chat_entry *pce; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5036 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5037 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5038 pce->label = _("Join what group:"); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5039 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5040 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5041 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5042 pce->label = _("Exchange:"); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5043 pce->is_int = TRUE; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5044 pce->min = 4; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5045 pce->max = 20; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5046 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5047 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5048 return m; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5049 } |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5050 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5051 static void oscar_join_chat(struct gaim_connection *g, GList *data) { |
4617 | 5052 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5053 aim_conn_t *cur; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5054 char *name; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5055 int *exchange; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5056 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5057 if (!data || !data->next) |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5058 return; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5059 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5060 name = data->data; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5061 exchange = data->next->data; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5062 |
2086 | 5063 debug_printf("Attempting to join chat room %s.\n", name); |
4617 | 5064 if ((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) { |
2086 | 5065 debug_printf("chatnav exists, creating room\n"); |
4617 | 5066 aim_chatnav_createroom(od->sess, cur, name, *exchange); |
2086 | 5067 } else { |
5068 /* this gets tricky */ | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
5069 struct create_room *cr = g_new0(struct create_room, 1); |
2086 | 5070 debug_printf("chatnav does not exist, opening chatnav\n"); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
5071 cr->exchange = *exchange; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
5072 cr->name = g_strdup(name); |
4617 | 5073 od->create_rooms = g_slist_append(od->create_rooms, cr); |
5074 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV); | |
2086 | 5075 } |
5076 } | |
5077 | |
3466 | 5078 static void oscar_chat_invite(struct gaim_connection *g, int id, const char *message, const char *name) { |
4617 | 5079 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
2086 | 5080 struct chat_connection *ccon = find_oscar_chat(g, id); |
5081 | |
5082 if (!ccon) | |
5083 return; | |
5084 | |
4617 | 5085 aim_chat_invite(od->sess, od->conn, name, message ? message : "", |
2086 | 5086 ccon->exchange, ccon->name, 0x0); |
5087 } | |
5088 | |
5089 static void oscar_chat_leave(struct gaim_connection *g, int id) { | |
4617 | 5090 struct oscar_data *od = g ? (struct oscar_data *)g->proto_data : NULL; |
2086 | 5091 GSList *bcs = g->buddy_chats; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5092 struct gaim_conversation *b = NULL; |
2086 | 5093 struct chat_connection *c = NULL; |
5094 int count = 0; | |
5095 | |
5096 while (bcs) { | |
5097 count++; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5098 b = (struct gaim_conversation *)bcs->data; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5099 if (id == gaim_chat_get_id(GAIM_CHAT(b))) |
2086 | 5100 break; |
5101 bcs = bcs->next; | |
5102 b = NULL; | |
5103 } | |
5104 | |
5105 if (!b) | |
5106 return; | |
5107 | |
5108 debug_printf("Attempting to leave room %s (currently in %d rooms)\n", b->name, count); | |
5109 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5110 c = find_oscar_chat(g, gaim_chat_get_id(GAIM_CHAT(b))); |
2086 | 5111 if (c != NULL) { |
4617 | 5112 if (od) |
5113 od->oscar_chats = g_slist_remove(od->oscar_chats, c); | |
2086 | 5114 if (c->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
5115 gaim_input_remove(c->inpa); |
4617 | 5116 if (g && od->sess) |
5117 aim_conn_kill(od->sess, &c->conn); | |
2086 | 5118 g_free(c->name); |
5119 g_free(c->show); | |
5120 g_free(c); | |
5121 } | |
5122 /* we do this because with Oscar it doesn't tell us we left */ | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5123 serv_got_chat_left(g, gaim_chat_get_id(GAIM_CHAT(b))); |
2086 | 5124 } |
5125 | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5126 static int oscar_chat_send(struct gaim_connection *g, int id, char *message) { |
4617 | 5127 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
2086 | 5128 GSList *bcs = g->buddy_chats; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5129 struct gaim_conversation *b = NULL; |
2086 | 5130 struct chat_connection *c = NULL; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5131 char *buf, *buf2; |
2086 | 5132 int i, j; |
5133 | |
5134 while (bcs) { | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5135 b = (struct gaim_conversation *)bcs->data; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5136 if (id == gaim_chat_get_id(GAIM_CHAT(b))) |
2086 | 5137 break; |
5138 bcs = bcs->next; | |
5139 b = NULL; | |
5140 } | |
5141 if (!b) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5142 return -EINVAL; |
2086 | 5143 |
4617 | 5144 bcs = od->oscar_chats; |
2086 | 5145 while (bcs) { |
5146 c = (struct chat_connection *)bcs->data; | |
5147 if (b == c->cnv) | |
5148 break; | |
5149 bcs = bcs->next; | |
5150 c = NULL; | |
5151 } | |
5152 if (!c) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5153 return -EINVAL; |
2086 | 5154 |
5155 buf = g_malloc(strlen(message) * 4 + 1); | |
5156 for (i = 0, j = 0; i < strlen(message); i++) { | |
5157 if (message[i] == '\n') { | |
5158 buf[j++] = '<'; | |
5159 buf[j++] = 'B'; | |
5160 buf[j++] = 'R'; | |
5161 buf[j++] = '>'; | |
5162 } else { | |
5163 buf[j++] = message[i]; | |
5164 } | |
5165 } | |
5166 buf[j] = '\0'; | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5167 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5168 if (strlen(buf) > c->maxlen) |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5169 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5170 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5171 buf2 = strip_html(buf); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5172 if (strlen(buf2) > c->maxvis) { |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5173 g_free(buf2); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5174 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5175 } |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5176 g_free(buf2); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5177 |
4617 | 5178 aim_chat_send_im(od->sess, c->conn, 0, buf, strlen(buf)); |
2086 | 5179 g_free(buf); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5180 return 0; |
2086 | 5181 } |
5182 | |
4687 | 5183 static const char *oscar_list_icon(struct gaim_account *a, struct buddy *b) { |
4766 | 5184 if (!b || (b && b->name && b->name[0] == '+')) { |
4687 | 5185 if (isdigit(a->username[0])) |
5186 return "icq"; | |
5187 else | |
5188 return "aim"; | |
5189 } | |
5190 | |
5191 if (isdigit(b->name[0])) | |
5192 return "icq"; | |
5193 return "aim"; | |
5194 } | |
5195 | |
4690 | 5196 static void oscar_list_emblems(struct buddy *b, char **se, char **sw, char **nw, char **ne) |
4687 | 5197 { |
5198 char *emblems[4] = {NULL,NULL,NULL,NULL}; | |
5199 int i = 0; | |
5200 | |
5131 | 5201 if (!GAIM_BUDDY_IS_ONLINE(b)) { |
5202 struct gaim_account *account; | |
5203 struct gaim_connection *gc; | |
5204 struct oscar_data *od; | |
5205 char *gname; | |
5206 if ((b->name) && (account = b->account) && (gc = account->gc) && | |
5207 (od = gc->proto_data) && (od->sess->ssi.received_data) && | |
5208 (gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name)) && | |
5209 (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name))) { | |
5210 emblems[i++] = "notauthorized"; | |
5211 } else { | |
5212 emblems[i++] = "offline"; | |
5213 } | |
5214 } | |
4916 | 5215 |
4766 | 5216 if (b->name && (b->uc & 0xffff0000) && isdigit(b->name[0])) { |
4960 | 5217 int uc = b->uc >> 16; |
4766 | 5218 if (uc & AIM_ICQ_STATE_INVISIBLE) |
4960 | 5219 emblems[i++] = "invisible"; |
4766 | 5220 else if (uc & AIM_ICQ_STATE_CHAT) |
4960 | 5221 emblems[i++] = "freeforchat"; |
4766 | 5222 else if (uc & AIM_ICQ_STATE_DND) |
4960 | 5223 emblems[i++] = "dnd"; |
4766 | 5224 else if (uc & AIM_ICQ_STATE_OUT) |
4960 | 5225 emblems[i++] = "na"; |
4766 | 5226 else if (uc & AIM_ICQ_STATE_BUSY) |
4960 | 5227 emblems[i++] = "occupied"; |
4766 | 5228 else if (uc & AIM_ICQ_STATE_AWAY) |
5229 emblems[i++] = "away"; | |
5230 } else { | |
5231 if (b->uc & UC_UNAVAILABLE) | |
5232 emblems[i++] = "away"; | |
5233 } | |
4687 | 5234 if (b->uc & UC_WIRELESS) |
5235 emblems[i++] = "wireless"; | |
5236 if (b->uc & UC_AOL) | |
5237 emblems[i++] = "aol"; | |
5238 if (b->uc & UC_ADMIN) | |
5239 emblems[i++] = "admin"; | |
5240 if (b->uc & UC_AB && i < 4) | |
5241 emblems[i++] = "activebuddy"; | |
4766 | 5242 /* if (b->uc & UC_UNCONFIRMED && i < 4) |
5243 emblems[i++] = "unconfirmed"; */ | |
4687 | 5244 *se = emblems[0]; |
5245 *sw = emblems[1]; | |
5246 *nw = emblems[2]; | |
5247 *ne = emblems[3]; | |
5248 } | |
5249 | |
5131 | 5250 static char *oscar_tooltip_text(struct buddy *b) { |
5251 struct gaim_connection *gc = b->account->gc; | |
5252 struct oscar_data *od = gc->proto_data; | |
5253 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name)); | |
5254 gchar *tmp, *yay = g_strdup(""); | |
5255 | |
5256 if (GAIM_BUDDY_IS_ONLINE(b)) { | |
5257 if (isdigit(b->name[0])) { | |
5258 char *tmp, *status; | |
5259 status = gaim_icq_status((b->uc & 0xffff0000) >> 16); | |
5260 tmp = yay; | |
5261 yay = g_strconcat(tmp, _("<b>Status:</b> "), status, "\n", NULL); | |
5262 g_free(tmp); | |
5263 g_free(status); | |
5264 } | |
5265 | |
5266 if (bi) { | |
5267 char *tstr = sec_to_text(time(NULL) - bi->signon + | |
5268 (gc->login_time_official ? gc->login_time_official - gc->login_time : 0)); | |
5269 tmp = yay; | |
5270 yay = g_strconcat(tmp, _("<b>Logged In:</b> "), tstr, "\n", NULL); | |
5271 free(tmp); | |
5272 free(tstr); | |
5273 | |
5274 if (bi->caps) { | |
5275 char *caps = caps_string(bi->caps); | |
5276 tmp = yay; | |
5277 yay = g_strconcat(tmp, _("<b>Capabilities:</b> "), caps, "\n", NULL); | |
5278 free(tmp); | |
5279 } | |
5280 } | |
5281 } else { | |
5282 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); | |
5283 if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) { | |
5284 tmp = yay; | |
5285 yay = g_strconcat(tmp, _("<b>Status:</b> Not Authorized"), "\n", NULL); | |
5286 g_free(tmp); | |
5287 } else { | |
5288 tmp = yay; | |
5289 yay = g_strconcat(tmp, _("<b>Status:</b> Offline"), "\n", NULL); | |
5290 g_free(tmp); | |
5291 } | |
5292 } | |
5293 | |
5294 /* remove the trailing newline character */ | |
5295 if (yay) | |
5296 yay[strlen(yay)-1] = '\0'; | |
5297 return yay; | |
5298 } | |
5299 | |
3952 | 5300 /* |
4617 | 5301 * We have just established a socket with the other dude, so set up some handlers. |
3952 | 5302 */ |
4617 | 5303 static int gaim_odc_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 5304 struct gaim_connection *gc = sess->aux_data; |
5305 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5306 struct gaim_conversation *cnv; |
2086 | 5307 struct direct_im *dim; |
5308 char buf[256]; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5309 char *sn; |
4617 | 5310 va_list ap; |
5311 aim_conn_t *newconn, *listenerconn; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5312 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5313 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5314 newconn = va_arg(ap, aim_conn_t *); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5315 listenerconn = va_arg(ap, aim_conn_t *); |
2086 | 5316 va_end(ap); |
5317 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5318 aim_conn_close(listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5319 aim_conn_kill(sess, &listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5320 |
4617 | 5321 sn = g_strdup(aim_odc_getsn(newconn)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5322 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5323 debug_printf("DirectIM: initiate success to %s\n", sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5324 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5325 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5326 if (!(cnv = gaim_find_conversation(sn))) |
4491 | 5327 cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, sn); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
5328 gaim_input_remove(dim->watcher); |
2086 | 5329 dim->conn = newconn; |
4617 | 5330 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); |
3008 | 5331 dim->connected = TRUE; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5332 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5333 g_free(sn); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5334 gaim_conversation_write(cnv, NULL, buf, -1, WFLAG_SYSTEM, time(NULL)); |
2086 | 5335 |
4617 | 5336 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, gaim_odc_incoming, 0); |
5337 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, gaim_odc_typing, 0); | |
5338 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, gaim_update_ui, 0); | |
5339 | |
2993 | 5340 return 1; |
5341 } | |
5342 | |
5343 static int gaim_update_ui(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5344 va_list ap; | |
5345 char *sn; | |
5346 double percent; | |
5347 struct gaim_connection *gc = sess->aux_data; | |
5348 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5349 struct gaim_conversation *c; |
2993 | 5350 struct direct_im *dim; |
5351 | |
5352 va_start(ap, fr); | |
5353 sn = va_arg(ap, char *); | |
5354 percent = va_arg(ap, double); | |
5355 va_end(ap); | |
5356 | |
2994 | 5357 if (!(dim = find_direct_im(od, sn))) |
5358 return 1; | |
3059 | 5359 if (dim->watcher) { |
5360 gaim_input_remove(dim->watcher); /* Otherwise, the callback will callback */ | |
5361 dim->watcher = 0; | |
5362 } | |
3044 | 5363 while (gtk_events_pending()) |
5364 gtk_main_iteration(); | |
5365 | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5366 if ((c = gaim_find_conversation(sn))) |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5367 gaim_conversation_update_progress(c, percent); |
2993 | 5368 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
5369 oscar_callback, dim->conn); | |
2086 | 5370 |
5371 return 1; | |
5372 } | |
5373 | |
4617 | 5374 static int gaim_odc_incoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
4870 | 5375 struct gaim_connection *gc = sess->aux_data; |
5376 int imflags = 0; | |
2086 | 5377 va_list ap; |
4870 | 5378 char *sn, *msg; |
5379 int len, encoding, isawaymsg; | |
2086 | 5380 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5381 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5382 sn = va_arg(ap, char *); |
2086 | 5383 msg = va_arg(ap, char *); |
2993 | 5384 len = va_arg(ap, int); |
3952 | 5385 encoding = va_arg(ap, int); |
4870 | 5386 isawaymsg = va_arg(ap, int); |
2086 | 5387 va_end(ap); |
5388 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5389 debug_printf("Got DirectIM message from %s\n", sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5390 |
4870 | 5391 if (isawaymsg) |
5392 imflags |= IM_FLAG_AWAY; | |
5393 | |
4617 | 5394 /* XXX - I imagine Paco-Paco will want to do some voodoo with the encoding here */ |
4870 | 5395 serv_got_im(gc, sn, msg, imflags, time(NULL), len); |
2086 | 5396 |
5397 return 1; | |
5398 } | |
5399 | |
4617 | 5400 static int gaim_odc_typing(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 5401 va_list ap; |
5402 char *sn; | |
2993 | 5403 int typing; |
5404 struct gaim_connection *gc = sess->aux_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5405 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5406 va_start(ap, fr); |
2086 | 5407 sn = va_arg(ap, char *); |
2993 | 5408 typing = va_arg(ap, int); |
2086 | 5409 va_end(ap); |
5410 | |
4870 | 5411 if (typing == 0x0002) { |
2993 | 5412 /* I had to leave this. It's just too funny. It reminds me of my sister. */ |
5413 debug_printf("ohmigod! %s has started typing (DirectIM). He's going to send you a message! *squeal*\n", sn); | |
4342 | 5414 serv_got_typing(gc, sn, 0, TYPING); |
4870 | 5415 } else if (typing == 0x0001) |
5416 serv_got_typing(gc, sn, 0, TYPED); | |
5417 else | |
4342 | 5418 serv_got_typing_stopped(gc, sn); |
2086 | 5419 return 1; |
5420 } | |
5421 | |
5422 struct ask_do_dir_im { | |
5423 char *who; | |
5424 struct gaim_connection *gc; | |
5425 }; | |
5426 | |
3730 | 5427 static void oscar_cancel_direct_im(struct ask_do_dir_im *data) { |
5136 | 5428 g_free(data->who); |
2086 | 5429 g_free(data); |
5430 } | |
5431 | |
3730 | 5432 static void oscar_direct_im(struct ask_do_dir_im *data) { |
2086 | 5433 struct gaim_connection *gc = data->gc; |
4244 | 5434 struct oscar_data *od; |
2086 | 5435 struct direct_im *dim; |
5436 | |
4244 | 5437 if (!g_slist_find(connections, gc)) { |
5136 | 5438 g_free(data->who); |
4244 | 5439 g_free(data); |
5440 return; | |
5441 } | |
5442 | |
5443 od = (struct oscar_data *)gc->proto_data; | |
5444 | |
2086 | 5445 dim = find_direct_im(od, data->who); |
5446 if (dim) { | |
3008 | 5447 if (!(dim->connected)) { /* We'll free the old, unconnected dim, and start over */ |
5448 od->direct_ims = g_slist_remove(od->direct_ims, dim); | |
5449 gaim_input_remove(dim->watcher); | |
5450 g_free(dim); | |
5451 debug_printf("Gave up on old direct IM, trying again\n"); | |
5452 } else { | |
3427 | 5453 do_error_dialog("DirectIM already open.", NULL, GAIM_ERROR); |
5136 | 5454 g_free(data->who); |
4244 | 5455 g_free(data); |
3008 | 5456 return; |
5457 } | |
2086 | 5458 } |
5459 dim = g_new0(struct direct_im, 1); | |
5460 dim->gc = gc; | |
5461 g_snprintf(dim->name, sizeof dim->name, "%s", data->who); | |
5462 | |
4617 | 5463 dim->conn = aim_odc_initiate(od->sess, data->who); |
2086 | 5464 if (dim->conn != NULL) { |
5465 od->direct_ims = g_slist_append(od->direct_ims, dim); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
5466 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
2086 | 5467 oscar_callback, dim->conn); |
4617 | 5468 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIM_ESTABLISHED, |
5469 gaim_odc_initiate, 0); | |
2086 | 5470 } else { |
3427 | 5471 do_error_dialog(_("Unable to open Direct IM"), NULL, GAIM_ERROR); |
2086 | 5472 g_free(dim); |
5473 } | |
4244 | 5474 |
5136 | 5475 g_free(data->who); |
4244 | 5476 g_free(data); |
2086 | 5477 } |
5478 | |
5136 | 5479 static void oscar_ask_direct_im(struct gaim_connection *gc, const char *who) { |
2086 | 5480 char buf[BUF_LONG]; |
5481 struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1); | |
5136 | 5482 data->who = g_strdup(who); |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
5483 data->gc = gc; |
3730 | 5484 g_snprintf(buf, sizeof(buf), _("You have selected to open a Direct IM connection with %s."), who); |
4249 | 5485 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, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE); |
2086 | 5486 } |
5487 | |
5488 static void oscar_set_permit_deny(struct gaim_connection *gc) { | |
5489 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4230 | 5490 #ifdef NOSSI |
4770 | 5491 GSList *list, *g = gaim_blist_groups(), *g1; |
4230 | 5492 char buf[MAXMSGLEN]; |
5493 int at; | |
5494 | |
4491 | 5495 switch(gc->account->permdeny) { |
4687 | 5496 case 1: |
4230 | 5497 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gc->username); |
5498 break; | |
5499 case 2: | |
5500 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gc->username); | |
5501 break; | |
5502 case 3: | |
4642 | 5503 list = gc->account->permit; |
4230 | 5504 at = 0; |
5505 while (list) { | |
5506 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
5507 list = list->next; | |
5508 } | |
5509 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); | |
5510 break; | |
5511 case 4: | |
4642 | 5512 list = gc->account->deny; |
4230 | 5513 at = 0; |
5514 while (list) { | |
5515 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
5516 list = list->next; | |
5517 } | |
5518 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf); | |
5519 break; | |
5520 case 5: | |
4770 | 5521 g1 = g; |
4230 | 5522 at = 0; |
4770 | 5523 while (g1) { |
5524 list = gaim_blist_members((struct group *)g->data); | |
5525 GSList list1 = list; | |
5526 while (list1) { | |
5527 struct buddy *b = list1->data; | |
4491 | 5528 if(b->account == gc->account) |
4349 | 5529 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", b->name); |
4770 | 5530 list1 = list1->next; |
2995 | 5531 } |
4770 | 5532 g_slist_free(list); |
5533 g1 = g1->next; | |
4349 | 5534 } |
4770 | 5535 g_slist_free(g); |
4230 | 5536 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); |
5537 break; | |
5538 default: | |
5539 break; | |
2086 | 5540 } |
4230 | 5541 signoff_blocked(gc); |
5542 #else | |
5543 if (od->sess->ssi.received_data) | |
4889 | 5544 aim_ssi_setpermdeny(od->sess, gc->account->permdeny, 0xffffffff); |
4230 | 5545 #endif |
2086 | 5546 } |
5547 | |
4349 | 5548 static void oscar_add_permit(struct gaim_connection *gc, const char *who) { |
4269 | 5549 #ifdef NOSSI |
4491 | 5550 if (gc->account->permdeny == 3) |
4269 | 5551 oscar_set_permit_deny(gc); |
5552 #else | |
2991 | 5553 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4230 | 5554 debug_printf("ssi: About to add a permit\n"); |
5555 if (od->sess->ssi.received_data) | |
4889 | 5556 aim_ssi_addpermit(od->sess, who); |
4230 | 5557 #endif |
2086 | 5558 } |
5559 | |
4349 | 5560 static void oscar_add_deny(struct gaim_connection *gc, const char *who) { |
4269 | 5561 #ifdef NOSSI |
4491 | 5562 if (gc->account->permdeny == 4) |
4269 | 5563 oscar_set_permit_deny(gc); |
5564 #else | |
2991 | 5565 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4230 | 5566 debug_printf("ssi: About to add a deny\n"); |
5567 if (od->sess->ssi.received_data) | |
4889 | 5568 aim_ssi_adddeny(od->sess, who); |
4230 | 5569 #endif |
2086 | 5570 } |
5571 | |
4349 | 5572 static void oscar_rem_permit(struct gaim_connection *gc, const char *who) { |
4269 | 5573 #ifdef NOSSI |
4491 | 5574 if (gc->account->permdeny == 3) |
4269 | 5575 oscar_set_permit_deny(gc); |
5576 #else | |
2991 | 5577 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4230 | 5578 debug_printf("ssi: About to delete a permit\n"); |
5579 if (od->sess->ssi.received_data) | |
4889 | 5580 aim_ssi_delpermit(od->sess, who); |
4230 | 5581 #endif |
2086 | 5582 } |
5583 | |
4349 | 5584 static void oscar_rem_deny(struct gaim_connection *gc, const char *who) { |
4269 | 5585 #ifdef NOSSI |
4491 | 5586 if (gc->account->permdeny == 4) |
4269 | 5587 oscar_set_permit_deny(gc); |
5588 #else | |
2991 | 5589 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4230 | 5590 debug_printf("ssi: About to delete a deny\n"); |
5591 if (od->sess->ssi.received_data) | |
4889 | 5592 aim_ssi_deldeny(od->sess, who); |
4230 | 5593 #endif |
2086 | 5594 } |
5595 | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5596 static GList *oscar_away_states(struct gaim_connection *gc) |
2086 | 5597 { |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5598 struct oscar_data *od = gc->proto_data; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5599 GList *m = NULL; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5600 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5601 if (!od->icq) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5602 return g_list_append(m, GAIM_AWAY_CUSTOM); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5603 |
4333 | 5604 m = g_list_append(m, _("Online")); |
5605 m = g_list_append(m, _("Away")); | |
5606 m = g_list_append(m, _("Do Not Disturb")); | |
5607 m = g_list_append(m, _("Not Available")); | |
5608 m = g_list_append(m, _("Occupied")); | |
5609 m = g_list_append(m, _("Free For Chat")); | |
5610 m = g_list_append(m, _("Invisible")); | |
5611 | |
5612 return m; | |
5613 } | |
5614 | |
5136 | 5615 static GList *oscar_buddy_menu(struct gaim_connection *gc, const char *who) { |
4333 | 5616 struct oscar_data *od = gc->proto_data; |
5617 GList *m = NULL; | |
5618 struct proto_buddy_menu *pbm; | |
5619 | |
5620 if (od->icq) { | |
4624 | 5621 #if 0 |
4333 | 5622 pbm = g_new0(struct proto_buddy_menu, 1); |
5623 pbm->label = _("Get Status Msg"); | |
4969 | 5624 pbm->callback = oscar_get_icqstatusmsg; |
4333 | 5625 pbm->gc = gc; |
5626 m = g_list_append(m, pbm); | |
4624 | 5627 #endif |
4333 | 5628 } else { |
4687 | 5629 struct buddy *b = gaim_find_buddy(gc->account, who); |
4356 | 5630 |
5068 | 5631 if ((aim_sncmp(gc->username, who)) && GAIM_BUDDY_IS_ONLINE(b)) { |
4333 | 5632 pbm = g_new0(struct proto_buddy_menu, 1); |
5633 pbm->label = _("Direct IM"); | |
5634 pbm->callback = oscar_ask_direct_im; | |
5635 pbm->gc = gc; | |
5636 m = g_list_append(m, pbm); | |
4650 | 5637 |
4333 | 5638 pbm = g_new0(struct proto_buddy_menu, 1); |
5639 pbm->label = _("Send File"); | |
4617 | 5640 pbm->callback = oscar_ask_sendfile; |
4333 | 5641 pbm->gc = gc; |
5642 m = g_list_append(m, pbm); | |
4826 | 5643 #if 0 |
5644 pbm = g_new0(struct proto_buddy_menu, 1); | |
5645 pbm->label = _("Get File"); | |
5646 pbm->callback = oscar_ask_getfile; | |
5647 pbm->gc = gc; | |
5648 m = g_list_append(m, pbm); | |
5649 #endif | |
4333 | 5650 } |
5131 | 5651 } |
4916 | 5652 |
5131 | 5653 if (od->sess->ssi.received_data) { |
5654 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, who); | |
5655 if (gname && aim_ssi_waitingforauth(od->sess->ssi.local, gname, who)) { | |
5656 pbm = g_new0(struct proto_buddy_menu, 1); | |
5657 pbm->label = _("Re-request Authorization"); | |
5658 pbm->callback = gaim_auth_sendrequest; | |
5659 pbm->gc = gc; | |
5660 m = g_list_append(m, pbm); | |
4333 | 5661 } |
4916 | 5662 } |
5663 | |
4333 | 5664 return m; |
5665 } | |
5666 | |
5667 static void oscar_format_screenname(struct gaim_connection *gc, char *nick) { | |
5668 struct oscar_data *od = gc->proto_data; | |
5669 if (!aim_sncmp(gc->username, nick)) { | |
5670 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { | |
5671 od->setnick = TRUE; | |
5672 od->newsn = g_strdup(nick); | |
5673 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
5674 } else { | |
5675 aim_admin_setnick(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH), nick); | |
5676 } | |
5677 } else { | |
5678 do_error_dialog(_("The new formatting is invalid."), | |
5679 _("Screenname formatting can change only capitalization and whitespace."), GAIM_ERROR); | |
5680 } | |
5681 } | |
5682 | |
5683 static void oscar_show_format_screenname(struct gaim_connection *gc) | |
5684 { | |
5685 do_prompt_dialog(_("New screenname formatting:"), gc->displayname, gc, oscar_format_screenname, NULL); | |
5686 } | |
5687 | |
5688 static void oscar_confirm_account(struct gaim_connection *gc) | |
5689 { | |
5690 struct oscar_data *od = gc->proto_data; | |
5691 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); | |
5692 | |
5693 if (conn) { | |
5694 aim_admin_reqconfirm(od->sess, conn); | |
5695 } else { | |
5696 od->conf = TRUE; | |
5697 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
5698 } | |
5699 } | |
5700 | |
5701 static void oscar_show_email(struct gaim_connection *gc) | |
5702 { | |
5703 struct oscar_data *od = gc->proto_data; | |
5704 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); | |
5705 | |
5706 if (conn) { | |
5707 aim_admin_getinfo(od->sess, conn, 0x11); | |
5708 } else { | |
5709 od->reqemail = TRUE; | |
5710 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
5711 } | |
5712 } | |
5713 | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5714 static void oscar_change_email(struct gaim_connection *gc, char *email) |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5715 { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5716 struct oscar_data *od = gc->proto_data; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5717 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
|
5718 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5719 if (conn) { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5720 aim_admin_setemail(od->sess, conn, email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5721 } else { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5722 od->setemail = TRUE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5723 od->email = g_strdup(email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5724 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5725 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5726 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
5727 |
4333 | 5728 static void oscar_show_change_email(struct gaim_connection *gc) |
5729 { | |
5730 do_prompt_dialog(_("Change Address To: "), NULL, gc, oscar_change_email, NULL); | |
5731 } | |
5732 | |
5733 static void oscar_show_awaitingauth(struct gaim_connection *gc) | |
5734 { | |
2979 | 5735 struct oscar_data *od = gc->proto_data; |
4333 | 5736 gchar *nombre, *text, *tmp; |
4785 | 5737 GaimBlistNode *gnode,*bnode; |
4333 | 5738 int num=0; |
5739 | |
5740 text = g_strdup(_("You are awaiting authorization from the following buddies:<BR>")); | |
5741 | |
4785 | 5742 for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
5743 struct group *group = (struct group *)gnode; | |
5744 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
5745 continue; | |
5746 for (bnode = gnode->child; bnode; bnode = bnode->next) { | |
5747 struct buddy *buddy = (struct buddy *)bnode; | |
5748 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
5749 continue; | |
4491 | 5750 if (buddy->account == gc->account && aim_ssi_waitingforauth(od->sess->ssi.local, group->name, buddy->name)) { |
4687 | 5751 if (gaim_get_buddy_alias_only(buddy)) |
5752 nombre = g_strdup_printf(" %s (%s)", buddy->name, gaim_get_buddy_alias_only(buddy)); | |
4333 | 5753 else |
4337 | 5754 nombre = g_strdup_printf(" %s", buddy->name); |
4333 | 5755 tmp = g_strdup_printf("%s<BR>%s", text, nombre); |
5756 g_free(text); | |
5757 text = tmp; | |
5758 g_free(nombre); | |
5759 num++; | |
5760 } | |
2979 | 5761 } |
4333 | 5762 } |
5763 | |
5764 if (!num) { | |
5765 tmp = g_strdup_printf("%s<BR>%s", text, _("<i>you are not waiting for authorization</i>")); | |
5766 g_free(text); | |
5767 text = tmp; | |
2979 | 5768 } |
4333 | 5769 |
4959 | 5770 tmp = g_strdup_printf(_("%s<BR><BR>You can re-request authorization from these buddies by right-clicking on them and clicking \"Re-request authorization.\""), text); |
4333 | 5771 g_free(text); |
5772 text = tmp; | |
5773 g_show_info_text(gc, gc->username, 2, text, NULL); | |
5774 g_free(text); | |
2979 | 5775 } |
5776 | |
4333 | 5777 static void oscar_show_chpassurl(struct gaim_connection *gc) |
5778 { | |
5779 struct oscar_data *od = gc->proto_data; | |
5780 open_url(NULL, od->sess->authinfo->chpassurl); | |
5781 } | |
5782 | |
5783 static GList *oscar_actions(struct gaim_connection *gc) | |
2086 | 5784 { |
5785 struct oscar_data *od = gc->proto_data; | |
4333 | 5786 struct proto_actions_menu *pam; |
5787 GList *m = NULL; | |
5788 | |
5789 pam = g_new0(struct proto_actions_menu, 1); | |
5790 pam->label = _("Set User Info"); | |
5791 pam->callback = show_set_info; | |
5792 pam->gc = gc; | |
5793 m = g_list_append(m, pam); | |
5794 | |
4617 | 5795 if ((od->sess->authinfo->regstatus == 0x0003) || (od->icq)) { |
4333 | 5796 pam = g_new0(struct proto_actions_menu, 1); |
5797 pam->label = _("Change Password"); | |
5798 pam->callback = show_change_passwd; | |
5799 pam->gc = gc; | |
5800 m = g_list_append(m, pam); | |
4617 | 5801 } |
5802 | |
5803 if (od->sess->authinfo->chpassurl) { | |
5804 pam = g_new0(struct proto_actions_menu, 1); | |
5805 pam->label = _("Change Password (URL)"); | |
5806 pam->callback = oscar_show_chpassurl; | |
5807 pam->gc = gc; | |
5808 m = g_list_append(m, pam); | |
5809 } | |
5810 | |
5811 if (od->sess->authinfo->regstatus == 0x0003) { | |
5812 /* AIM actions */ | |
5813 m = g_list_append(m, NULL); | |
4333 | 5814 |
5815 pam = g_new0(struct proto_actions_menu, 1); | |
5816 pam->label = _("Format Screenname"); | |
5817 pam->callback = oscar_show_format_screenname; | |
5818 pam->gc = gc; | |
5819 m = g_list_append(m, pam); | |
5820 | |
5821 pam = g_new0(struct proto_actions_menu, 1); | |
5822 pam->label = _("Confirm Account"); | |
5823 pam->callback = oscar_confirm_account; | |
5824 pam->gc = gc; | |
5825 m = g_list_append(m, pam); | |
5826 | |
5827 pam = g_new0(struct proto_actions_menu, 1); | |
5828 pam->label = _("Display Current Registered Address"); | |
5829 pam->callback = oscar_show_email; | |
5830 pam->gc = gc; | |
5831 m = g_list_append(m, pam); | |
5832 | |
5833 pam = g_new0(struct proto_actions_menu, 1); | |
5834 pam->label = _("Change Current Registered Address"); | |
5835 pam->callback = oscar_show_change_email; | |
5836 pam->gc = gc; | |
5837 m = g_list_append(m, pam); | |
2086 | 5838 } |
4333 | 5839 |
5840 m = g_list_append(m, NULL); | |
5841 | |
5842 pam = g_new0(struct proto_actions_menu, 1); | |
5843 pam->label = _("Show Buddies Awaiting Authorization"); | |
5844 pam->callback = oscar_show_awaitingauth; | |
5845 pam->gc = gc; | |
5846 m = g_list_append(m, pam); | |
5847 | |
2086 | 5848 m = g_list_append(m, NULL); |
4333 | 5849 |
5850 pam = g_new0(struct proto_actions_menu, 1); | |
5851 pam->label = _("Search for Buddy by Email"); | |
5852 pam->callback = show_find_email; | |
5853 pam->gc = gc; | |
5854 m = g_list_append(m, pam); | |
5855 | |
4336 | 5856 /* pam = g_new0(struct proto_actions_menu, 1); |
4333 | 5857 pam->label = _("Search for Buddy by Information"); |
5858 pam->callback = show_find_info; | |
5859 pam->gc = gc; | |
4336 | 5860 m = g_list_append(m, pam); */ |
2086 | 5861 |
5862 return m; | |
5863 } | |
5864 | |
3466 | 5865 static void oscar_change_passwd(struct gaim_connection *gc, const char *old, const char *new) |
2086 | 5866 { |
5867 struct oscar_data *od = gc->proto_data; | |
4617 | 5868 |
5869 if (od->icq) { | |
5870 aim_icq_changepasswd(od->sess, new); | |
2086 | 5871 } else { |
4617 | 5872 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
5873 if (conn) { | |
5874 aim_admin_changepasswd(od->sess, conn, new, old); | |
5875 } else { | |
5876 od->chpass = TRUE; | |
5877 od->oldp = g_strdup(old); | |
5878 od->newp = g_strdup(new); | |
5879 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
5880 } | |
2086 | 5881 } |
5882 } | |
5883 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5884 static void oscar_convo_closed(struct gaim_connection *gc, char *who) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5885 { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5886 struct oscar_data *od = gc->proto_data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5887 struct direct_im *dim = find_direct_im(od, who); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5888 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5889 if (!dim) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5890 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5891 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5892 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5893 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5894 aim_conn_kill(od->sess, &dim->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5895 g_free(dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5896 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5897 |
3630 | 5898 G_MODULE_EXPORT void oscar_init(struct prpl *ret) { |
3572 | 5899 struct proto_user_opt *puo; |
2086 | 5900 ret->protocol = PROTO_OSCAR; |
3694 | 5901 ret->options = OPT_PROTO_MAIL_CHECK | OPT_PROTO_BUDDY_ICON | OPT_PROTO_IM_IMAGE; |
3858 | 5902 ret->name = g_strdup("AIM/ICQ"); |
2086 | 5903 ret->list_icon = oscar_list_icon; |
4687 | 5904 ret->list_emblems = oscar_list_emblems; |
5131 | 5905 ret->tooltip_text = oscar_tooltip_text; |
2086 | 5906 ret->away_states = oscar_away_states; |
5907 ret->actions = oscar_actions; | |
5908 ret->buddy_menu = oscar_buddy_menu; | |
5909 ret->login = oscar_login; | |
5910 ret->close = oscar_close; | |
5911 ret->send_im = oscar_send_im; | |
2993 | 5912 ret->send_typing = oscar_send_typing; |
2086 | 5913 ret->set_info = oscar_set_info; |
5914 ret->get_info = oscar_get_info; | |
5915 ret->set_away = oscar_set_away; | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
5916 ret->get_away = oscar_get_away; |
2086 | 5917 ret->set_dir = oscar_set_dir; |
5918 ret->get_dir = NULL; /* Oscar really doesn't have this */ | |
5919 ret->dir_search = oscar_dir_search; | |
5920 ret->set_idle = oscar_set_idle; | |
5921 ret->change_passwd = oscar_change_passwd; | |
5922 ret->add_buddy = oscar_add_buddy; | |
5923 ret->add_buddies = oscar_add_buddies; | |
4269 | 5924 ret->remove_buddy = oscar_remove_buddy; |
5925 ret->remove_buddies = oscar_remove_buddies; | |
4230 | 5926 #ifndef NOSSI |
3140 | 5927 ret->group_buddy = oscar_move_buddy; |
4269 | 5928 ret->alias_buddy = oscar_alias_buddy; |
3348 | 5929 ret->rename_group = oscar_rename_group; |
4230 | 5930 #endif |
4269 | 5931 ret->add_permit = oscar_add_permit; |
5932 ret->add_deny = oscar_add_deny; | |
5933 ret->rem_permit = oscar_rem_permit; | |
5934 ret->rem_deny = oscar_rem_deny; | |
5935 ret->set_permit_deny = oscar_set_permit_deny; | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
5936 |
2086 | 5937 ret->warn = oscar_warn; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5938 ret->chat_info = oscar_chat_info; |
2086 | 5939 ret->join_chat = oscar_join_chat; |
5940 ret->chat_invite = oscar_chat_invite; | |
5941 ret->chat_leave = oscar_chat_leave; | |
5942 ret->chat_whisper = NULL; | |
5943 ret->chat_send = oscar_chat_send; | |
5944 ret->keepalive = oscar_keepalive; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5945 ret->convo_closed = oscar_convo_closed; |
2086 | 5946 |
3572 | 5947 puo = g_new0(struct proto_user_opt, 1); |
5948 puo->label = g_strdup("Auth Host:"); | |
5949 puo->def = g_strdup("login.oscar.aol.com"); | |
5950 puo->pos = USEROPT_AUTH; | |
5951 ret->user_opts = g_list_append(ret->user_opts, puo); | |
5952 | |
5953 puo = g_new0(struct proto_user_opt, 1); | |
5954 puo->label = g_strdup("Auth Port:"); | |
5955 puo->def = g_strdup("5190"); | |
5956 puo->pos = USEROPT_AUTHPORT; | |
5957 ret->user_opts = g_list_append(ret->user_opts, puo); | |
5958 | |
2086 | 5959 my_protocol = ret; |
5960 } | |
5961 | |
5962 #ifndef STATIC | |
5963 | |
3630 | 5964 G_MODULE_EXPORT void gaim_prpl_init(struct prpl *prpl) |
2086 | 5965 { |
3572 | 5966 oscar_init(prpl); |
5967 prpl->plug->desc.api_version = PLUGIN_API_VERSION; | |
2086 | 5968 } |
5969 | |
5970 #endif |