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