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