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