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