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