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