Mercurial > pidgin.yaz
annotate src/protocols/oscar/oscar.c @ 8219:862dc2839646
[gaim-migrate @ 8942]
Alright, this should make aim support non-ascii chars in chats.
I guess I should actually test that...
Anyway, it doesn't seem to break anything.
It's a patch from Uli Luckas. Yay.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 09 Feb 2004 06:02:28 +0000 |
parents | 3418a6d51464 |
children | 9790cda80d52 |
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 | |
8151 | 7 * Some code copyright (C) 2001-2004, Mark Doliner <thekingant@users.sourceforge.net> |
6302 | 8 * |
9 * Most libfaim code copyright (C) 1998-2001 Adam Fritzler <afritz@auk.cx> | |
8151 | 10 * Some libfaim code copyright (C) 2001-2004 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" |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
31 #include "buddyicon.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
32 #include "conversation.h" |
7083
3100a6e03644
[gaim-migrate @ 7648]
Christian Hammond <chipx86@chipx86.com>
parents:
7082
diff
changeset
|
33 #include "core.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
34 #include "debug.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
35 #include "ft.h" |
6982 | 36 #include "imgstore.h" |
2086 | 37 #include "multi.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
38 #include "notify.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
39 #include "privacy.h" |
2086 | 40 #include "prpl.h" |
4889 | 41 #include "proxy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
42 #include "request.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
43 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
44 |
2086 | 45 #include "aim.h" |
5842 | 46 #include "md5.h" |
2086 | 47 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
48 #define UC_AOL 0x02 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
49 #define UC_ADMIN 0x04 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
50 #define UC_UNCONFIRMED 0x08 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
51 #define UC_NORMAL 0x10 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
52 #define UC_AB 0x20 |
3079 | 53 #define UC_WIRELESS 0x40 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
54 |
2086 | 55 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" |
56 | |
7283 | 57 #define OSCAR_CONNECT_STEPS 6 |
58 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
59 static GaimPlugin *my_protocol = NULL; |
4249 | 60 |
7376 | 61 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_INTEROPERATE | AIM_CAPS_ICHAT; |
62 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8 | AIM_CAPS_INTEROPERATE | AIM_CAPS_ICHAT; | |
3458 | 63 |
4665 | 64 static fu8_t features_aim[] = {0x01, 0x01, 0x01, 0x02}; |
65 static fu8_t features_icq[] = {0x01, 0x06}; | |
2086 | 66 |
7283 | 67 typedef struct _OscarData OscarData; |
68 struct _OscarData { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
69 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
70 aim_conn_t *conn; |
2086 | 71 |
72 guint cnpa; | |
73 guint paspa; | |
3694 | 74 guint emlpa; |
4804 | 75 guint icopa; |
2086 | 76 |
4823 | 77 gboolean iconconnecting; |
5842 | 78 gboolean set_icon; |
4823 | 79 |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
80 GSList *create_rooms; |
2086 | 81 |
82 gboolean conf; | |
83 gboolean reqemail; | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
84 gboolean setemail; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
85 char *email; |
2979 | 86 gboolean setnick; |
87 char *newsn; | |
2086 | 88 gboolean chpass; |
89 char *oldp; | |
90 char *newp; | |
5842 | 91 |
2086 | 92 GSList *oscar_chats; |
93 GSList *direct_ims; | |
3630 | 94 GSList *file_transfers; |
4738 | 95 GHashTable *buddyinfo; |
4804 | 96 GSList *requesticon; |
2086 | 97 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
98 gboolean killme; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
99 gboolean icq; |
4804 | 100 guint icontimer; |
5968 | 101 guint getblisttimer; |
2993 | 102 |
103 struct { | |
4230 | 104 guint maxwatchers; /* max users who can watch you */ |
2993 | 105 guint maxbuddies; /* max users you can watch */ |
4230 | 106 guint maxgroups; /* max groups in server list */ |
2993 | 107 guint maxpermits; /* max users on permit list */ |
108 guint maxdenies; /* max users on deny list */ | |
109 guint maxsiglen; /* max size (bytes) of profile */ | |
110 guint maxawaymsglen; /* max size (bytes) of posted away message */ | |
111 } rights; | |
2086 | 112 }; |
113 | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
114 struct create_room { |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
115 char *name; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
116 int exchange; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
117 }; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
118 |
2086 | 119 struct chat_connection { |
120 char *name; | |
121 char *show; /* AOL did something funny to us */ | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
122 fu16_t exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
123 fu16_t instance; |
2086 | 124 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
|
125 aim_conn_t *conn; |
2086 | 126 int inpa; |
127 int id; | |
5575 | 128 GaimConnection *gc; /* i hate this. */ |
5679 | 129 GaimConversation *cnv; /* bah. */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
130 int maxlen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
131 int maxvis; |
2086 | 132 }; |
133 | |
134 struct direct_im { | |
5575 | 135 GaimConnection *gc; |
2086 | 136 char name[80]; |
137 int watcher; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
138 aim_conn_t *conn; |
3008 | 139 gboolean connected; |
2086 | 140 }; |
141 | |
142 struct ask_direct { | |
5575 | 143 GaimConnection *gc; |
2086 | 144 char *sn; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
145 char ip[64]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
146 fu8_t cookie[8]; |
2086 | 147 }; |
148 | |
7011 | 149 /* |
150 * Various PRPL-specific buddy info that we want to keep track of | |
151 * Some other info is maintained by locate.c, and I'd like to move | |
152 * the rest of this to libfaim, mostly im.c | |
153 */ | |
4738 | 154 struct buddyinfo { |
155 gboolean typingnot; | |
6292 | 156 gchar *availmsg; |
6857 | 157 fu32_t ipaddr; |
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; | |
7406 | 168 gboolean ico_sent; |
2086 | 169 }; |
170 | |
4230 | 171 struct name_data { |
5575 | 172 GaimConnection *gc; |
4230 | 173 gchar *name; |
3453 | 174 gchar *nick; |
3141 | 175 }; |
176 | |
5129 | 177 static char *msgerrreason[] = { |
178 N_("Invalid error"), | |
179 N_("Invalid SNAC"), | |
180 N_("Rate to host"), | |
181 N_("Rate to client"), | |
182 N_("Not logged in"), | |
183 N_("Service unavailable"), | |
184 N_("Service not defined"), | |
185 N_("Obsolete SNAC"), | |
186 N_("Not supported by host"), | |
187 N_("Not supported by client"), | |
188 N_("Refused by client"), | |
189 N_("Reply too big"), | |
190 N_("Responses lost"), | |
191 N_("Request denied"), | |
192 N_("Busted SNAC payload"), | |
193 N_("Insufficient rights"), | |
194 N_("In local permit/deny"), | |
195 N_("Too evil (sender)"), | |
196 N_("Too evil (receiver)"), | |
197 N_("User temporarily unavailable"), | |
198 N_("No match"), | |
199 N_("List overflow"), | |
200 N_("Request ambiguous"), | |
201 N_("Queue full"), | |
202 N_("Not while on AOL") | |
203 }; | |
204 static int msgerrreasonlen = 25; | |
205 | |
206 /* All the libfaim->gaim callback functions */ | |
207 static int gaim_parse_auth_resp (aim_session_t *, aim_frame_t *, ...); | |
208 static int gaim_parse_login (aim_session_t *, aim_frame_t *, ...); | |
209 static int gaim_handle_redirect (aim_session_t *, aim_frame_t *, ...); | |
210 static int gaim_info_change (aim_session_t *, aim_frame_t *, ...); | |
211 static int gaim_account_confirm (aim_session_t *, aim_frame_t *, ...); | |
212 static int gaim_parse_oncoming (aim_session_t *, aim_frame_t *, ...); | |
213 static int gaim_parse_offgoing (aim_session_t *, aim_frame_t *, ...); | |
214 static int gaim_parse_incoming_im(aim_session_t *, aim_frame_t *, ...); | |
215 static int gaim_parse_misses (aim_session_t *, aim_frame_t *, ...); | |
216 static int gaim_parse_clientauto (aim_session_t *, aim_frame_t *, ...); | |
7011 | 217 static int gaim_parse_userinfo (aim_session_t *, aim_frame_t *, ...); |
5129 | 218 static int gaim_parse_motd (aim_session_t *, aim_frame_t *, ...); |
219 static int gaim_chatnav_info (aim_session_t *, aim_frame_t *, ...); | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
220 static int gaim_conv_chat_join (aim_session_t *, aim_frame_t *, ...); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
221 static int gaim_conv_chat_leave (aim_session_t *, aim_frame_t *, ...); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
222 static int gaim_conv_chat_info_update (aim_session_t *, aim_frame_t *, ...); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
223 static int gaim_conv_chat_incoming_msg(aim_session_t *, aim_frame_t *, ...); |
5129 | 224 static int gaim_email_parseupdate(aim_session_t *, aim_frame_t *, ...); |
225 static int gaim_icon_error (aim_session_t *, aim_frame_t *, ...); | |
226 static int gaim_icon_parseicon (aim_session_t *, aim_frame_t *, ...); | |
5844 | 227 static int oscar_icon_req (aim_session_t *, aim_frame_t *, ...); |
5129 | 228 static int gaim_parse_msgack (aim_session_t *, aim_frame_t *, ...); |
229 static int gaim_parse_ratechange (aim_session_t *, aim_frame_t *, ...); | |
230 static int gaim_parse_evilnotify (aim_session_t *, aim_frame_t *, ...); | |
231 static int gaim_parse_searcherror(aim_session_t *, aim_frame_t *, ...); | |
232 static int gaim_parse_searchreply(aim_session_t *, aim_frame_t *, ...); | |
233 static int gaim_bosrights (aim_session_t *, aim_frame_t *, ...); | |
234 static int gaim_connerr (aim_session_t *, aim_frame_t *, ...); | |
235 static int conninitdone_admin (aim_session_t *, aim_frame_t *, ...); | |
236 static int conninitdone_bos (aim_session_t *, aim_frame_t *, ...); | |
237 static int conninitdone_chatnav (aim_session_t *, aim_frame_t *, ...); | |
238 static int conninitdone_chat (aim_session_t *, aim_frame_t *, ...); | |
239 static int conninitdone_email (aim_session_t *, aim_frame_t *, ...); | |
240 static int conninitdone_icon (aim_session_t *, aim_frame_t *, ...); | |
241 static int gaim_parse_msgerr (aim_session_t *, aim_frame_t *, ...); | |
242 static int gaim_parse_mtn (aim_session_t *, aim_frame_t *, ...); | |
243 static int gaim_parse_locaterights(aim_session_t *, aim_frame_t *, ...); | |
244 static int gaim_parse_buddyrights(aim_session_t *, aim_frame_t *, ...); | |
245 static int gaim_parse_locerr (aim_session_t *, aim_frame_t *, ...); | |
246 static int gaim_icbm_param_info (aim_session_t *, aim_frame_t *, ...); | |
247 static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...); | |
248 static int gaim_memrequest (aim_session_t *, aim_frame_t *, ...); | |
249 static int gaim_selfinfo (aim_session_t *, aim_frame_t *, ...); | |
250 static int gaim_offlinemsg (aim_session_t *, aim_frame_t *, ...); | |
251 static int gaim_offlinemsgdone (aim_session_t *, aim_frame_t *, ...); | |
252 static int gaim_icqalias (aim_session_t *, aim_frame_t *, ...); | |
253 static int gaim_icqinfo (aim_session_t *, aim_frame_t *, ...); | |
254 static int gaim_popup (aim_session_t *, aim_frame_t *, ...); | |
255 #ifndef NOSSI | |
256 static int gaim_ssi_parseerr (aim_session_t *, aim_frame_t *, ...); | |
257 static int gaim_ssi_parserights (aim_session_t *, aim_frame_t *, ...); | |
258 static int gaim_ssi_parselist (aim_session_t *, aim_frame_t *, ...); | |
259 static int gaim_ssi_parseack (aim_session_t *, aim_frame_t *, ...); | |
260 static int gaim_ssi_authgiven (aim_session_t *, aim_frame_t *, ...); | |
261 static int gaim_ssi_authrequest (aim_session_t *, aim_frame_t *, ...); | |
262 static int gaim_ssi_authreply (aim_session_t *, aim_frame_t *, ...); | |
263 static int gaim_ssi_gotadded (aim_session_t *, aim_frame_t *, ...); | |
264 #endif | |
265 | |
266 /* for DirectIM/image transfer */ | |
267 static int gaim_odc_initiate (aim_session_t *, aim_frame_t *, ...); | |
268 static int gaim_odc_incoming (aim_session_t *, aim_frame_t *, ...); | |
269 static int gaim_odc_typing (aim_session_t *, aim_frame_t *, ...); | |
6982 | 270 static int gaim_odc_update_ui (aim_session_t *, aim_frame_t *, ...); |
5129 | 271 |
272 /* for file transfer */ | |
273 static int oscar_sendfile_estblsh(aim_session_t *, aim_frame_t *, ...); | |
274 static int oscar_sendfile_prompt (aim_session_t *, aim_frame_t *, ...); | |
275 static int oscar_sendfile_ack (aim_session_t *, aim_frame_t *, ...); | |
276 static int oscar_sendfile_done (aim_session_t *, aim_frame_t *, ...); | |
277 | |
278 /* for icons */ | |
279 static gboolean gaim_icon_timerfunc(gpointer data); | |
280 | |
8076 | 281 /* remove these at some point? */ |
7282 | 282 /* Because I don't like forward declarations? I think that was why... */ |
5954 | 283 static void oscar_set_info(GaimConnection *gc, const char *text); |
8076 | 284 static void oscar_set_away(GaimConnection *gc, const char *state, const char *message); |
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); |
296 } | |
297 | |
5129 | 298 static fu32_t oscar_encoding_check(const char *utf8) |
299 { | |
300 int i = 0; | |
301 fu32_t encodingflag = 0; | |
302 | |
303 /* Determine how we can send this message. Per the warnings elsewhere | |
304 * in this file, these little checks determine the simplest encoding | |
305 * we can use for a given message send using it. */ | |
306 while (utf8[i]) { | |
307 if ((unsigned char)utf8[i] > 0x7f) { | |
308 /* not ASCII! */ | |
309 encodingflag = AIM_IMFLAGS_ISO_8859_1; | |
310 break; | |
311 } | |
312 i++; | |
313 } | |
314 while (utf8[i]) { | |
315 /* ISO-8859-1 is 0x00-0xbf in the first byte | |
316 * followed by 0xc0-0xc3 in the second */ | |
317 if ((unsigned char)utf8[i] < 0x80) { | |
318 i++; | |
319 continue; | |
320 } else if (((unsigned char)utf8[i] & 0xfc) == 0xc0 && | |
321 ((unsigned char)utf8[i + 1] & 0xc0) == 0x80) { | |
322 i += 2; | |
323 continue; | |
324 } | |
325 encodingflag = AIM_IMFLAGS_UNICODE; | |
326 break; | |
327 } | |
328 | |
329 return encodingflag; | |
330 } | |
331 | |
332 static fu32_t oscar_encoding_parse(const char *enc) | |
333 { | |
334 char *charset; | |
335 | |
336 /* If anything goes wrong, fall back on ASCII and print a message */ | |
337 if (enc == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
338 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
339 "Encoding was null, that's odd\n"); |
5129 | 340 return 0; |
341 } | |
342 charset = strstr(enc, "charset="); | |
343 if (charset == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
344 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
345 "No charset specified for info, assuming ASCII\n"); |
5129 | 346 return 0; |
347 } | |
348 charset += 8; | |
349 if (!strcmp(charset, "\"us-ascii\"") || !strcmp(charset, "\"utf-8\"")) { | |
350 /* UTF-8 is our native charset, ASCII is a proper subset */ | |
351 return 0; | |
352 } else if (!strcmp(charset, "\"iso-8859-1\"")) { | |
353 return AIM_IMFLAGS_ISO_8859_1; | |
354 } else if (!strcmp(charset, "\"unicode-2-0\"")) { | |
355 return AIM_IMFLAGS_UNICODE; | |
356 } else { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
357 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
358 "Unrecognized character set '%s', using ASCII\n", charset); |
5129 | 359 return 0; |
360 } | |
361 } | |
362 | |
363 gchar *oscar_encoding_to_utf8(const char *encoding, char *text, int textlen) | |
364 { | |
365 gchar *utf8 = NULL; | |
366 int flags = oscar_encoding_parse(encoding); | |
367 | |
368 switch (flags) { | |
369 case 0: | |
370 utf8 = g_strndup(text, textlen); | |
371 break; | |
372 case AIM_IMFLAGS_ISO_8859_1: | |
373 utf8 = g_convert(text, textlen, "UTF-8", "ISO-8859-1", NULL, NULL, NULL); | |
374 break; | |
375 case AIM_IMFLAGS_UNICODE: | |
376 utf8 = g_convert(text, textlen, "UTF-8", "UCS-2BE", NULL, NULL, NULL); | |
377 break; | |
378 } | |
379 | |
380 return utf8; | |
381 } | |
382 | |
7283 | 383 static struct direct_im *find_direct_im(OscarData *od, const char *who) { |
2086 | 384 GSList *d = od->direct_ims; |
385 struct direct_im *m = NULL; | |
386 | |
387 while (d) { | |
388 m = (struct direct_im *)d->data; | |
4355 | 389 if (!aim_sncmp(who, m->name)) |
4269 | 390 return m; |
2086 | 391 d = d->next; |
392 } | |
393 | |
4269 | 394 return NULL; |
2086 | 395 } |
396 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
397 static char *extract_name(const char *name) { |
4121 | 398 char *tmp, *x; |
2086 | 399 int i, j; |
4120 | 400 |
401 if (!name) | |
4121 | 402 return NULL; |
403 | |
4120 | 404 x = strchr(name, '-'); |
4121 | 405 |
2086 | 406 if (!x) return NULL; |
407 x = strchr(++x, '-'); | |
408 if (!x) return NULL; | |
409 tmp = g_strdup(++x); | |
410 | |
411 for (i = 0, j = 0; x[i]; i++) { | |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
412 char hex[3]; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
413 if (x[i] != '%') { |
2086 | 414 tmp[j++] = x[i]; |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
415 continue; |
2086 | 416 } |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
417 strncpy(hex, x + ++i, 2); hex[2] = 0; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
418 i++; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
419 tmp[j++] = strtol(hex, NULL, 16); |
2086 | 420 } |
421 | |
422 tmp[j] = 0; | |
423 return tmp; | |
424 } | |
425 | |
5575 | 426 static struct chat_connection *find_oscar_chat(GaimConnection *gc, int id) { |
7283 | 427 GSList *g = ((OscarData *)gc->proto_data)->oscar_chats; |
2086 | 428 struct chat_connection *c = NULL; |
429 | |
430 while (g) { | |
431 c = (struct chat_connection *)g->data; | |
432 if (c->id == id) | |
433 break; | |
434 g = g->next; | |
435 c = NULL; | |
436 } | |
437 | |
438 return c; | |
439 } | |
440 | |
5575 | 441 static struct chat_connection *find_oscar_chat_by_conn(GaimConnection *gc, |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
442 aim_conn_t *conn) { |
7283 | 443 GSList *g = ((OscarData *)gc->proto_data)->oscar_chats; |
2086 | 444 struct chat_connection *c = NULL; |
445 | |
446 while (g) { | |
447 c = (struct chat_connection *)g->data; | |
448 if (c->conn == conn) | |
449 break; | |
450 g = g->next; | |
451 c = NULL; | |
452 } | |
453 | |
454 return c; | |
455 } | |
456 | |
8219 | 457 static struct chat_connection *find_oscar_chat_by_conv(GaimConnection *gc, |
458 GaimConversation *conv) { | |
459 GSList *g = ((OscarData *)gc->proto_data)->oscar_chats; | |
460 struct chat_connection *c = NULL; | |
461 | |
462 while (g) { | |
463 c = (struct chat_connection *)g->data; | |
464 if (c->cnv == conv) | |
465 break; | |
466 g = g->next; | |
467 c = NULL; | |
468 } | |
469 | |
470 return c; | |
471 } | |
472 | |
4617 | 473 static void gaim_odc_disconnect(aim_session_t *sess, aim_conn_t *conn) { |
5575 | 474 GaimConnection *gc = sess->aux_data; |
7283 | 475 OscarData *od = (OscarData *)gc->proto_data; |
5679 | 476 GaimConversation *cnv; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
477 struct direct_im *dim; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
478 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
479 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
480 |
4617 | 481 sn = g_strdup(aim_odc_getsn(conn)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
482 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
483 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
484 "%s disconnected Direct IM.\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
485 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
486 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
487 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
488 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
489 |
3008 | 490 if (dim->connected) |
491 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn); | |
492 else | |
493 g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), sn); | |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
494 |
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
495 cnv = gaim_find_conversation_with_account(sn, gaim_connection_get_account(gc)); |
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
496 if (cnv) |
6982 | 497 gaim_conversation_write(cnv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
498 |
5579 | 499 gaim_conversation_update_progress(cnv, 0); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
500 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
501 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
|
502 g_free(sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
503 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
504 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
505 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
506 |
4617 | 507 static void oscar_callback(gpointer data, gint source, GaimInputCondition condition) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
508 aim_conn_t *conn = (aim_conn_t *)data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
509 aim_session_t *sess = aim_conn_getsess(conn); |
5575 | 510 GaimConnection *gc = sess ? sess->aux_data : NULL; |
7283 | 511 OscarData *od; |
2086 | 512 |
513 if (!gc) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
514 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
515 "oscar callback for closed connection (1).\n"); |
2086 | 516 return; |
517 } | |
518 | |
7283 | 519 od = (OscarData *)gc->proto_data; |
2086 | 520 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
521 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 522 /* oh boy. this is probably bad. i guess the only thing we |
523 * can really do is return? */ | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
524 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
525 "oscar callback for closed connection (2).\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
526 gaim_debug(GAIM_DEBUG_MISC, "oscar", "gc = %p\n", gc); |
2086 | 527 return; |
528 } | |
529 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
530 if (condition & GAIM_INPUT_READ) { |
4617 | 531 if (conn->type == AIM_CONN_TYPE_LISTENER) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
532 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
533 "got information on rendezvous listener\n"); |
4617 | 534 if (aim_handlerendconnect(od->sess, conn) < 0) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
535 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
536 "connection error (rendezvous listener)\n"); |
4617 | 537 aim_conn_kill(od->sess, &conn); |
2086 | 538 } |
539 } else { | |
4617 | 540 if (aim_get_command(od->sess, conn) >= 0) { |
541 aim_rxdispatch(od->sess); | |
6029 | 542 if (od->killme) { |
543 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "Waiting to be destroyed\n"); | |
544 return; | |
545 } | |
2086 | 546 } else { |
547 if ((conn->type == AIM_CONN_TYPE_BOS) || | |
4617 | 548 !(aim_getconn_type(od->sess, AIM_CONN_TYPE_BOS))) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
549 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
550 "major connection error\n"); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
551 gaim_connection_error(gc, _("Disconnected.")); |
2086 | 552 } else if (conn->type == AIM_CONN_TYPE_CHAT) { |
553 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); | |
5420 | 554 char *buf; |
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 "disconnected from chat room %s\n", c->name); |
2086 | 557 c->conn = NULL; |
558 if (c->inpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
559 gaim_input_remove(c->inpa); |
2086 | 560 c->inpa = 0; |
561 c->fd = -1; | |
4617 | 562 aim_conn_kill(od->sess, &conn); |
5420 | 563 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
|
564 gaim_notify_error(gc, NULL, buf, NULL); |
5420 | 565 g_free(buf); |
2086 | 566 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { |
4617 | 567 if (od->cnpa > 0) |
568 gaim_input_remove(od->cnpa); | |
569 od->cnpa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
570 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
571 "removing chatnav input watcher\n"); |
4617 | 572 while (od->create_rooms) { |
573 struct create_room *cr = od->create_rooms->data; | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
574 g_free(cr->name); |
4617 | 575 od->create_rooms = |
576 g_slist_remove(od->create_rooms, cr); | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
577 g_free(cr); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
578 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
579 _("Chat is currently unavailable"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
580 NULL); |
2086 | 581 } |
4617 | 582 aim_conn_kill(od->sess, &conn); |
2086 | 583 } else if (conn->type == AIM_CONN_TYPE_AUTH) { |
4617 | 584 if (od->paspa > 0) |
585 gaim_input_remove(od->paspa); | |
586 od->paspa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
587 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
588 "removing authconn input watcher\n"); |
4617 | 589 aim_conn_kill(od->sess, &conn); |
3694 | 590 } else if (conn->type == AIM_CONN_TYPE_EMAIL) { |
4617 | 591 if (od->emlpa > 0) |
592 gaim_input_remove(od->emlpa); | |
593 od->emlpa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
594 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
595 "removing email input watcher\n"); |
4617 | 596 aim_conn_kill(od->sess, &conn); |
4804 | 597 } else if (conn->type == AIM_CONN_TYPE_ICON) { |
598 if (od->icopa > 0) | |
599 gaim_input_remove(od->icopa); | |
600 od->icopa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
601 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
602 "removing icon input watcher\n"); |
4804 | 603 aim_conn_kill(od->sess, &conn); |
2086 | 604 } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
605 if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) |
4617 | 606 gaim_odc_disconnect(od->sess, conn); |
607 aim_conn_kill(od->sess, &conn); | |
2086 | 608 } else { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
609 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
610 "holy crap! generic connection error! %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
611 conn->type); |
4617 | 612 aim_conn_kill(od->sess, &conn); |
2086 | 613 } |
614 } | |
615 } | |
616 } | |
617 } | |
618 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
619 static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) { |
5575 | 620 GaimConnection *gc = sess->aux_data; |
7285 | 621 gchar *s = g_strdup_vprintf(format, va); |
622 gchar *buf; | |
623 | |
624 buf = g_strdup_printf("%s %d: %s", gaim_account_get_username(gaim_connection_get_account(gc)), level, s); | |
625 gaim_debug(GAIM_DEBUG_INFO, "oscar", buf); | |
626 if (buf[strlen(buf)-1] != '\n') | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
627 gaim_debug(GAIM_DEBUG_INFO, NULL, "\n"); |
7285 | 628 g_free(buf); |
2086 | 629 g_free(s); |
630 } | |
631 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
632 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 633 { |
5575 | 634 GaimConnection *gc = data; |
7283 | 635 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
636 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
637 aim_conn_t *conn; |
2086 | 638 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
639 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 640 close(source); |
641 return; | |
642 } | |
643 | |
4617 | 644 od = gc->proto_data; |
645 sess = od->sess; | |
2086 | 646 conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); |
4366 | 647 conn->fd = source; |
2086 | 648 |
649 if (source < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
650 gaim_connection_error(gc, _("Couldn't connect to host")); |
2086 | 651 return; |
652 } | |
653 | |
654 aim_conn_completeconnect(sess, conn); | |
4617 | 655 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); |
7282 | 656 aim_request_login(sess, conn, gaim_account_get_username(gaim_connection_get_account(gc))); |
657 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
658 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
7282 | 659 "Screen name sent, waiting for response\n"); |
7283 | 660 gaim_connection_update_progress(gc, _("Screen name sent"), 1, OSCAR_CONNECT_STEPS); |
2086 | 661 } |
662 | |
5575 | 663 static void oscar_login(GaimAccount *account) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
664 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
665 aim_conn_t *conn; |
5575 | 666 GaimConnection *gc = gaim_account_get_connection(account); |
7283 | 667 OscarData *od = gc->proto_data = g_new0(OscarData, 1); |
2086 | 668 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
669 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
|
670 |
5575 | 671 if (isdigit(*(gaim_account_get_username(account)))) { |
4617 | 672 od->icq = TRUE; |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
673 } else { |
6622 | 674 gc->flags |= GAIM_CONNECTION_HTML; |
675 gc->flags |= GAIM_CONNECTION_AUTO_RESP; | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
676 } |
5836 | 677 od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, oscar_free_buddyinfo); |
2086 | 678 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
679 sess = g_new0(aim_session_t, 1); |
7285 | 680 aim_session_init(sess, TRUE, 0); |
2086 | 681 aim_setdebuggingcb(sess, oscar_debug); |
7282 | 682 /* |
683 * We need an immediate queue because we don't use a while-loop | |
684 * to see if things need to be sent. | |
685 */ | |
2086 | 686 aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL); |
4617 | 687 od->sess = sess; |
2086 | 688 sess->aux_data = gc; |
689 | |
690 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); | |
691 if (conn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
692 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
693 "internal connection error\n"); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
694 gaim_connection_error(gc, _("Unable to login to AIM")); |
2086 | 695 return; |
696 } | |
697 | |
4649 | 698 aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2086 | 699 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); |
700 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); | |
701 | |
702 conn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
703 if (gaim_proxy_connect(account, gaim_account_get_string(account, "server", FAIM_LOGIN_SERVER), |
5575 | 704 gaim_account_get_int(account, "port", FAIM_LOGIN_PORT), |
705 oscar_login_connect, gc) < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
706 gaim_connection_error(gc, _("Couldn't connect to host")); |
2086 | 707 return; |
708 } | |
7282 | 709 |
7283 | 710 gaim_connection_update_progress(gc, _("Connecting"), 0, OSCAR_CONNECT_STEPS); |
5575 | 711 } |
712 | |
713 static void oscar_close(GaimConnection *gc) { | |
7283 | 714 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 715 |
716 while (od->oscar_chats) { | |
717 struct chat_connection *n = od->oscar_chats->data; | |
2086 | 718 if (n->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
719 gaim_input_remove(n->inpa); |
2086 | 720 g_free(n->name); |
721 g_free(n->show); | |
4617 | 722 od->oscar_chats = g_slist_remove(od->oscar_chats, n); |
2086 | 723 g_free(n); |
724 } | |
4617 | 725 while (od->direct_ims) { |
726 struct direct_im *n = od->direct_ims->data; | |
2086 | 727 if (n->watcher > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
728 gaim_input_remove(n->watcher); |
4617 | 729 od->direct_ims = g_slist_remove(od->direct_ims, n); |
2086 | 730 g_free(n); |
731 } | |
4617 | 732 /* BBB */ |
733 while (od->file_transfers) { | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
734 GaimXfer *xfer; |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
735 xfer = (GaimXfer *)od->file_transfers->data; |
7805 | 736 gaim_xfer_cancel_local(xfer); |
3630 | 737 } |
4804 | 738 while (od->requesticon) { |
739 char *sn = od->requesticon->data; | |
740 od->requesticon = g_slist_remove(od->requesticon, sn); | |
741 free(sn); | |
742 } | |
4738 | 743 g_hash_table_destroy(od->buddyinfo); |
4617 | 744 while (od->create_rooms) { |
745 struct create_room *cr = od->create_rooms->data; | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
746 g_free(cr->name); |
4617 | 747 od->create_rooms = g_slist_remove(od->create_rooms, cr); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
748 g_free(cr); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
749 } |
4617 | 750 if (od->email) |
751 g_free(od->email); | |
752 if (od->newp) | |
753 g_free(od->newp); | |
754 if (od->oldp) | |
755 g_free(od->oldp); | |
2086 | 756 if (gc->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
757 gaim_input_remove(gc->inpa); |
4617 | 758 if (od->cnpa > 0) |
759 gaim_input_remove(od->cnpa); | |
760 if (od->paspa > 0) | |
761 gaim_input_remove(od->paspa); | |
762 if (od->emlpa > 0) | |
763 gaim_input_remove(od->emlpa); | |
4804 | 764 if (od->icopa > 0) |
765 gaim_input_remove(od->icopa); | |
6907 | 766 if (od->icontimer > 0) |
4832 | 767 g_source_remove(od->icontimer); |
5968 | 768 if (od->getblisttimer) |
769 g_source_remove(od->getblisttimer); | |
4617 | 770 aim_session_kill(od->sess); |
771 g_free(od->sess); | |
772 od->sess = NULL; | |
2086 | 773 g_free(gc->proto_data); |
774 gc->proto_data = NULL; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
775 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Signed off.\n"); |
2086 | 776 } |
777 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
778 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 779 GaimConnection *gc = data; |
7283 | 780 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
781 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
782 aim_conn_t *bosconn; |
2086 | 783 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
784 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 785 close(source); |
786 return; | |
787 } | |
788 | |
4617 | 789 od = gc->proto_data; |
790 sess = od->sess; | |
791 bosconn = od->conn; | |
4366 | 792 bosconn->fd = source; |
2086 | 793 |
794 if (source < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
795 gaim_connection_error(gc, _("Could Not Connect")); |
2086 | 796 return; |
797 } | |
798 | |
799 aim_conn_completeconnect(sess, bosconn); | |
4617 | 800 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); |
7283 | 801 |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
802 gaim_connection_update_progress(gc, |
7283 | 803 _("Connection established, cookie sent"), 4, OSCAR_CONNECT_STEPS); |
2086 | 804 } |
805 | |
4617 | 806 /* BBB */ |
4656 | 807 /* |
808 * This little area in oscar.c is the nexus of file transfer code, | |
809 * so I wrote a little explanation of what happens. I am such a | |
810 * ninja. | |
811 * | |
812 * The series of events for a file send is: | |
813 * -Create xfer and call gaim_xfer_request (this happens in oscar_ask_sendfile) | |
814 * -User chooses a file and oscar_xfer_init is called. It establishs a | |
815 * listening socket, then asks the remote user to connect to us (and | |
816 * gives them the file name, port, IP, etc.) | |
817 * -They connect to us and we send them an AIM_CB_OFT_PROMPT (this happens | |
818 * in oscar_sendfile_estblsh) | |
819 * -They send us an AIM_CB_OFT_ACK and then we start sending data | |
820 * -When we finish, they send us an AIM_CB_OFT_DONE and they close the | |
821 * connection. | |
822 * -We get drunk because file transfer kicks ass. | |
823 * | |
824 * The series of events for a file receive is: | |
825 * -Create xfer and call gaim_xfer request (this happens in incomingim_chan2) | |
826 * -Gaim user selects file to name and location to save file to and | |
827 * oscar_xfer_init is called | |
828 * -It connects to the remote user using the IP they gave us earlier | |
829 * -After connecting, they send us an AIM_CB_OFT_PROMPT. In reply, we send | |
830 * them an AIM_CB_OFT_ACK. | |
831 * -They begin to send us lots of raw data. | |
832 * -When they finish sending data we send an AIM_CB_OFT_DONE and then close | |
833 * the connectionn. | |
834 */ | |
835 static void oscar_sendfile_connected(gpointer data, gint source, GaimInputCondition condition); | |
836 | |
837 /* XXX - This function is pretty ugly */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
838 static void oscar_xfer_init(GaimXfer *xfer) |
4656 | 839 { |
5146 | 840 struct aim_oft_info *oft_info = xfer->data; |
5575 | 841 GaimConnection *gc = oft_info->sess->aux_data; |
7283 | 842 OscarData *od = gc->proto_data; |
4656 | 843 |
844 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { | |
845 int i; | |
846 | |
847 xfer->filename = g_path_get_basename(xfer->local_filename); | |
5146 | 848 strncpy(oft_info->fh.name, xfer->filename, 64); |
849 oft_info->fh.totsize = gaim_xfer_get_size(xfer); | |
850 oft_info->fh.size = gaim_xfer_get_size(xfer); | |
851 oft_info->fh.checksum = aim_oft_checksum_file(xfer->local_filename); | |
4656 | 852 |
853 /* | |
5146 | 854 * First try the port specified earlier (5190). If that fails, |
855 * increment by 1 and try again. | |
4656 | 856 */ |
5146 | 857 aim_sendfile_listen(od->sess, oft_info); |
858 for (i=0; (i<5 && !oft_info->conn); i++) { | |
859 xfer->local_port = oft_info->port = oft_info->port + 1; | |
860 aim_sendfile_listen(od->sess, oft_info); | |
4656 | 861 } |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
862 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
863 "port is %d, ip is %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
864 xfer->local_port, oft_info->clientip); |
5146 | 865 if (oft_info->conn) { |
866 xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
867 aim_im_sendch2_sendfile_ask(od->sess, oft_info); | |
868 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ESTABLISHED, oscar_sendfile_estblsh, 0); | |
4656 | 869 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
870 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
871 _("Unable to establish listener socket.")); |
4656 | 872 /* 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
|
873 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 874 } |
875 } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
5146 | 876 oft_info->conn = aim_newconn(od->sess, AIM_CONN_TYPE_RENDEZVOUS, NULL); |
877 if (oft_info->conn) { | |
878 oft_info->conn->subtype = AIM_CONN_SUBTYPE_OFT_SENDFILE; | |
879 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
|
880 oft_info->conn->fd = xfer->fd = gaim_proxy_connect(gaim_connection_get_account(gc), xfer->remote_ip, xfer->remote_port, |
5575 | 881 oscar_sendfile_connected, xfer); |
4656 | 882 if (xfer->fd == -1) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
883 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
884 _("Unable to establish file descriptor.")); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
885 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 886 } |
887 } else { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
888 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
889 _("Unable to create new connection.")); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
890 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 891 /* Try a different port? Ask them to connect to us? */ |
892 } | |
893 | |
894 } | |
895 } | |
896 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
897 static void oscar_xfer_start(GaimXfer *xfer) |
4656 | 898 { |
5146 | 899 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
900 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_start\n"); |
4656 | 901 /* I'm pretty sure we don't need to do jack here. Nor Jill. */ |
902 } | |
903 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
904 static void oscar_xfer_end(GaimXfer *xfer) |
4656 | 905 { |
5146 | 906 struct aim_oft_info *oft_info = xfer->data; |
5575 | 907 GaimConnection *gc = oft_info->sess->aux_data; |
7283 | 908 OscarData *od = gc->proto_data; |
4656 | 909 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
910 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_end\n"); |
5146 | 911 |
912 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
913 oft_info->fh.nrecvd = gaim_xfer_get_bytes_sent(xfer); | |
914 aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_DONE, oft_info); | |
915 } | |
916 | |
917 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
918 aim_oft_destroyinfo(oft_info); | |
4656 | 919 xfer->data = NULL; |
5146 | 920 od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
4656 | 921 } |
922 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
923 static void oscar_xfer_cancel_send(GaimXfer *xfer) |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
924 { |
5146 | 925 struct aim_oft_info *oft_info = xfer->data; |
5575 | 926 GaimConnection *gc = oft_info->sess->aux_data; |
7283 | 927 OscarData *od = gc->proto_data; |
4763 | 928 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
929 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
930 "AAA - in oscar_xfer_cancel_send\n"); |
5146 | 931 |
932 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); | |
933 | |
934 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
935 aim_oft_destroyinfo(oft_info); | |
4763 | 936 xfer->data = NULL; |
5146 | 937 od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
938 } |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
939 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
940 static void oscar_xfer_cancel_recv(GaimXfer *xfer) |
4656 | 941 { |
5146 | 942 struct aim_oft_info *oft_info = xfer->data; |
5575 | 943 GaimConnection *gc = oft_info->sess->aux_data; |
7283 | 944 OscarData *od = gc->proto_data; |
4656 | 945 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
946 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
947 "AAA - in oscar_xfer_cancel_recv\n"); |
5146 | 948 |
949 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); | |
950 | |
951 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
952 aim_oft_destroyinfo(oft_info); | |
4656 | 953 xfer->data = NULL; |
5146 | 954 od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
4656 | 955 } |
956 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
957 static void oscar_xfer_ack(GaimXfer *xfer, const char *buffer, size_t size) |
4656 | 958 { |
5146 | 959 struct aim_oft_info *oft_info = xfer->data; |
4656 | 960 |
961 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { | |
962 /* | |
963 * If we're done sending, intercept the socket from the core ft code | |
964 * and wait for the other guy to send the "done" OFT packet. | |
965 */ | |
966 if (gaim_xfer_get_bytes_remaining(xfer) <= 0) { | |
967 gaim_input_remove(xfer->watcher); | |
5146 | 968 xfer->watcher = gaim_input_add(xfer->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); |
4656 | 969 xfer->fd = 0; |
970 gaim_xfer_set_completed(xfer, TRUE); | |
971 } | |
972 } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
5146 | 973 /* Update our rolling checksum. Like Walmart, yo. */ |
974 oft_info->fh.recvcsum = aim_oft_checksum_chunk(buffer, size, oft_info->fh.recvcsum); | |
4656 | 975 } |
976 } | |
977 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
978 static GaimXfer *oscar_find_xfer_by_cookie(GSList *fts, const char *ck) |
4656 | 979 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
980 GaimXfer *xfer; |
5146 | 981 struct aim_oft_info *oft_info; |
4656 | 982 |
983 while (fts) { | |
984 xfer = fts->data; | |
5146 | 985 oft_info = xfer->data; |
986 | |
987 if (oft_info && !strcmp(ck, oft_info->cookie)) | |
4656 | 988 return xfer; |
989 | |
990 fts = g_slist_next(fts); | |
991 } | |
992 | |
993 return NULL; | |
994 } | |
995 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
996 static GaimXfer *oscar_find_xfer_by_conn(GSList *fts, aim_conn_t *conn) |
4656 | 997 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
998 GaimXfer *xfer; |
5146 | 999 struct aim_oft_info *oft_info; |
4656 | 1000 |
1001 while (fts) { | |
1002 xfer = fts->data; | |
5146 | 1003 oft_info = xfer->data; |
1004 | |
1005 if (oft_info && (conn == oft_info->conn)) | |
4656 | 1006 return xfer; |
1007 | |
1008 fts = g_slist_next(fts); | |
1009 } | |
1010 | |
1011 return NULL; | |
1012 } | |
1013 | |
5575 | 1014 static void oscar_ask_sendfile(GaimConnection *gc, const char *destsn) { |
7283 | 1015 OscarData *od = (OscarData *)gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1016 GaimXfer *xfer; |
5146 | 1017 struct aim_oft_info *oft_info; |
3752 | 1018 |
4617 | 1019 /* You want to send a file to someone else, you're so generous */ |
1020 | |
1021 /* Build the file transfer handle */ | |
5575 | 1022 xfer = gaim_xfer_new(gaim_connection_get_account(gc), GAIM_XFER_SEND, destsn); |
4617 | 1023 xfer->local_port = 5190; |
1024 | |
5146 | 1025 /* Create the oscar-specific data */ |
1026 oft_info = aim_oft_createinfo(od->sess, NULL, destsn, xfer->local_ip, xfer->local_port, 0, 0, NULL); | |
1027 xfer->data = oft_info; | |
1028 | |
4617 | 1029 /* Setup our I/O op functions */ |
1030 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init); | |
1031 gaim_xfer_set_start_fnc(xfer, oscar_xfer_start); | |
1032 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
1033 gaim_xfer_set_cancel_send_fnc(xfer, oscar_xfer_cancel_send); |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
1034 gaim_xfer_set_cancel_recv_fnc(xfer, oscar_xfer_cancel_recv); |
4656 | 1035 gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack); |
4617 | 1036 |
1037 /* Keep track of this transfer for later */ | |
1038 od->file_transfers = g_slist_append(od->file_transfers, xfer); | |
1039 | |
1040 /* Now perform the request */ | |
1041 gaim_xfer_request(xfer); | |
3630 | 1042 } |
1043 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1044 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { |
6029 | 1045 GaimConnection *gc = sess->aux_data; |
7283 | 1046 OscarData *od = gc->proto_data; |
6029 | 1047 GaimAccount *account = gc->account; |
1048 aim_conn_t *bosconn; | |
1049 char *host; int port; | |
1050 int i, rc; | |
2086 | 1051 va_list ap; |
2704 | 1052 struct aim_authresp_info *info; |
6029 | 1053 |
5575 | 1054 port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); |
2086 | 1055 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1056 va_start(ap, fr); |
2704 | 1057 info = va_arg(ap, struct aim_authresp_info *); |
2086 | 1058 va_end(ap); |
1059 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1060 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1061 "inside auth_resp (Screen name: %s)\n", info->sn); |
2704 | 1062 |
4293 | 1063 if (info->errorcode || !info->bosip || !info->cookielen || !info->cookie) { |
4056 | 1064 char buf[256]; |
2704 | 1065 switch (info->errorcode) { |
2086 | 1066 case 0x05: |
1067 /* Incorrect nick/password */ | |
6498 | 1068 gc->wants_to_die = TRUE; |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1069 gaim_connection_error(gc, _("Incorrect nickname or password.")); |
2086 | 1070 break; |
1071 case 0x11: | |
1072 /* Suspended account */ | |
6498 | 1073 gc->wants_to_die = TRUE; |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1074 gaim_connection_error(gc, _("Your account is currently suspended.")); |
2086 | 1075 break; |
3498 | 1076 case 0x14: |
1077 /* service temporarily unavailable */ | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1078 gaim_connection_error(gc, _("The AOL Instant Messenger service is temporarily unavailable.")); |
3498 | 1079 break; |
2086 | 1080 case 0x18: |
1081 /* connecting too frequently */ | |
6498 | 1082 gc->wants_to_die = TRUE; |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1083 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 | 1084 break; |
1085 case 0x1c: | |
1086 /* client too old */ | |
6498 | 1087 gc->wants_to_die = TRUE; |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6350
diff
changeset
|
1088 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
|
1089 gaim_connection_error(gc, buf); |
2086 | 1090 break; |
1091 default: | |
6623 | 1092 gaim_connection_error(gc, _("Authentication failed")); |
2086 | 1093 break; |
1094 } | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1095 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1096 "Login Error Code 0x%04hx\n", info->errorcode); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1097 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1098 "Error URL: %s\n", info->errorurl); |
2086 | 1099 od->killme = TRUE; |
1100 return 1; | |
1101 } | |
1102 | |
1103 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1104 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1105 "Reg status: %hu\n", info->regstatus); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1106 |
2704 | 1107 if (info->email) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1108 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Email: %s\n", info->email); |
2086 | 1109 } else { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1110 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Email is NULL\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1111 } |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1112 |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1113 gaim_debug(GAIM_DEBUG_MISC, "oscar", "BOSIP: %s\n", info->bosip); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1114 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1115 "Closing auth connection...\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1116 aim_conn_kill(sess, &fr->conn); |
2086 | 1117 |
1118 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL); | |
1119 if (bosconn == NULL) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1120 gaim_connection_error(gc, _("Internal Error")); |
2086 | 1121 od->killme = TRUE; |
1122 return 0; | |
1123 } | |
1124 | |
4649 | 1125 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1126 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_bos, 0); |
2086 | 1127 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, gaim_bosrights, 0); |
1128 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0); | |
1129 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, gaim_handle_redirect, 0); | |
2993 | 1130 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_RIGHTSINFO, gaim_parse_locaterights, 0); |
2086 | 1131 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_RIGHTSINFO, gaim_parse_buddyrights, 0); |
1132 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, gaim_parse_oncoming, 0); | |
1133 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, gaim_parse_offgoing, 0); | |
1134 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, gaim_parse_incoming_im, 0); | |
1135 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, gaim_parse_locerr, 0); | |
1136 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, gaim_parse_misses, 0); | |
3212 | 1137 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_CLIENTAUTORESP, gaim_parse_clientauto, 0); |
2086 | 1138 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, gaim_parse_ratechange, 0); |
1139 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL, gaim_parse_evilnotify, 0); | |
1140 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, AIM_CB_LOK_ERROR, gaim_parse_searcherror, 0); | |
1141 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, 0x0003, gaim_parse_searchreply, 0); | |
1142 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, gaim_parse_msgerr, 0); | |
3595 | 1143 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parse_mtn, 0); |
7011 | 1144 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parse_userinfo, 0); |
2086 | 1145 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK, gaim_parse_msgack, 0); |
1146 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
|
1147 aim_conn_addhandler(sess, bosconn, 0x0004, 0x0005, gaim_icbm_param_info, 0); |
2086 | 1148 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, gaim_parse_genericerr, 0); |
1149 aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, gaim_parse_genericerr, 0); | |
1150 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, gaim_parse_genericerr, 0); | |
1151 aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, gaim_memrequest, 0); | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1152 aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0); |
5844 | 1153 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
|
1154 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
|
1155 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
|
1156 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_POP, 0x0002, gaim_popup, 0); |
4759 | 1157 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_ALIAS, gaim_icqalias, 0); |
4624 | 1158 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_INFO, gaim_icqinfo, 0); |
4230 | 1159 #ifndef NOSSI |
4642 | 1160 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ERROR, gaim_ssi_parseerr, 0); |
2991 | 1161 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RIGHTSINFO, gaim_ssi_parserights, 0); |
1162 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_LIST, gaim_ssi_parselist, 0); | |
1163 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_NOLIST, gaim_ssi_parselist, 0); | |
4230 | 1164 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_SRVACK, gaim_ssi_parseack, 0); |
1165 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTH, gaim_ssi_authgiven, 0); | |
1166 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREQ, gaim_ssi_authrequest, 0); | |
1167 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREP, gaim_ssi_authreply, 0); | |
1168 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ADDED, gaim_ssi_gotadded, 0); | |
1169 #endif | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
1170 |
7283 | 1171 od->conn = bosconn; |
2704 | 1172 for (i = 0; i < (int)strlen(info->bosip); i++) { |
1173 if (info->bosip[i] == ':') { | |
1174 port = atoi(&(info->bosip[i+1])); | |
2086 | 1175 break; |
1176 } | |
1177 } | |
2704 | 1178 host = g_strndup(info->bosip, i); |
2086 | 1179 bosconn->status |= AIM_CONN_STATUS_INPROGRESS; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1180 rc = gaim_proxy_connect(gc->account, host, port, oscar_bos_connect, gc); |
2086 | 1181 g_free(host); |
4366 | 1182 if (rc < 0) { |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1183 gaim_connection_error(gc, _("Could Not Connect")); |
2086 | 1184 od->killme = TRUE; |
1185 return 0; | |
1186 } | |
4293 | 1187 aim_sendcookie(sess, bosconn, info->cookielen, info->cookie); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1188 gaim_input_remove(gc->inpa); |
2704 | 1189 |
7283 | 1190 gaim_connection_update_progress(gc, _("Received authorization"), 3, OSCAR_CONNECT_STEPS); |
7282 | 1191 |
2086 | 1192 return 1; |
1193 } | |
1194 | |
7285 | 1195 /* XXX - Should use gaim_url_fetch for the below stuff */ |
2086 | 1196 struct pieceofcrap { |
5575 | 1197 GaimConnection *gc; |
2086 | 1198 unsigned long offset; |
1199 unsigned long len; | |
1200 char *modname; | |
1201 int fd; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1202 aim_conn_t *conn; |
2086 | 1203 unsigned int inpa; |
1204 }; | |
1205 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1206 static void damn_you(gpointer data, gint source, GaimInputCondition c) |
2086 | 1207 { |
1208 struct pieceofcrap *pos = data; | |
7283 | 1209 OscarData *od = pos->gc->proto_data; |
2086 | 1210 char in = '\0'; |
1211 int x = 0; | |
1212 unsigned char m[17]; | |
1213 | |
1214 while (read(pos->fd, &in, 1) == 1) { | |
1215 if (in == '\n') | |
1216 x++; | |
1217 else if (in != '\r') | |
1218 x = 0; | |
1219 if (x == 2) | |
1220 break; | |
1221 in = '\0'; | |
1222 } | |
1223 if (in != '\n') { | |
4056 | 1224 char buf[256]; |
1225 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
|
1226 "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1227 gaim_notify_warning(pos->gc, NULL, |
7422 | 1228 _("Gaim was unable to get a valid AIM login hash."), |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1229 buf); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1230 gaim_input_remove(pos->inpa); |
2086 | 1231 close(pos->fd); |
1232 g_free(pos); | |
1233 return; | |
1234 } | |
1235 read(pos->fd, m, 16); | |
1236 m[16] = '\0'; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1237 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Sending hash: "); |
2086 | 1238 for (x = 0; x < 16; x++) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1239 gaim_debug(GAIM_DEBUG_MISC, NULL, "%02hhx ", (unsigned char)m[x]); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1240 |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1241 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n"); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1242 gaim_input_remove(pos->inpa); |
2086 | 1243 close(pos->fd); |
1244 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); | |
1245 g_free(pos); | |
1246 } | |
1247 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1248 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) { |
2086 | 1249 struct pieceofcrap *pos = data; |
5420 | 1250 gchar *buf; |
2086 | 1251 |
4366 | 1252 pos->fd = source; |
1253 | |
2086 | 1254 if (source < 0) { |
5420 | 1255 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
|
1256 "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1257 gaim_notify_warning(pos->gc, NULL, |
7422 | 1258 _("Gaim was unable to get a valid AIM login hash."), |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1259 buf); |
5420 | 1260 g_free(buf); |
2086 | 1261 if (pos->modname) |
1262 g_free(pos->modname); | |
1263 g_free(pos); | |
1264 return; | |
1265 } | |
1266 | |
5420 | 1267 buf = g_strdup_printf("GET " AIMHASHDATA "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n", |
2086 | 1268 pos->offset, pos->len, pos->modname ? pos->modname : ""); |
1269 write(pos->fd, buf, strlen(buf)); | |
5420 | 1270 g_free(buf); |
2086 | 1271 if (pos->modname) |
1272 g_free(pos->modname); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1273 pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); |
2086 | 1274 return; |
1275 } | |
1276 | |
1277 /* size of icbmui.ocm, the largest module in AIM 3.5 */ | |
1278 #define AIM_MAX_FILE_SIZE 98304 | |
1279 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1280 int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1281 va_list ap; |
1282 struct pieceofcrap *pos; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1283 fu32_t offset, len; |
2086 | 1284 char *modname; |
1285 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1286 va_start(ap, fr); |
4200 | 1287 offset = va_arg(ap, fu32_t); |
1288 len = va_arg(ap, fu32_t); | |
2086 | 1289 modname = va_arg(ap, char *); |
1290 va_end(ap); | |
1291 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1292 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
5556 | 1293 "offset: %u, len: %u, file: %s\n", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1294 offset, len, (modname ? modname : "aim.exe")); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1295 |
2086 | 1296 if (len == 0) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1297 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
|
1298 aim_sendmemblock(sess, fr->conn, offset, len, NULL, |
2086 | 1299 AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
1300 return 1; | |
1301 } | |
1302 /* uncomment this when you're convinced it's right. remember, it's been wrong before. | |
1303 if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) { | |
1304 char *buf; | |
1305 int i = 8; | |
1306 if (modname) | |
1307 i += strlen(modname); | |
1308 buf = g_malloc(i); | |
1309 i = 0; | |
1310 if (modname) { | |
1311 memcpy(buf, modname, strlen(modname)); | |
1312 i += strlen(modname); | |
1313 } | |
1314 buf[i++] = offset & 0xff; | |
1315 buf[i++] = (offset >> 8) & 0xff; | |
1316 buf[i++] = (offset >> 16) & 0xff; | |
1317 buf[i++] = (offset >> 24) & 0xff; | |
1318 buf[i++] = len & 0xff; | |
1319 buf[i++] = (len >> 8) & 0xff; | |
1320 buf[i++] = (len >> 16) & 0xff; | |
1321 buf[i++] = (len >> 24) & 0xff; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1322 gaim_debug(GAIM_DEBUG_MISC, "oscar", "len + offset is invalid, " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1323 "hashing request\n"); |
2086 | 1324 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
1325 g_free(buf); | |
1326 return 1; | |
1327 } | |
1328 */ | |
1329 | |
1330 pos = g_new0(struct pieceofcrap, 1); | |
1331 pos->gc = sess->aux_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1332 pos->conn = fr->conn; |
2086 | 1333 |
1334 pos->offset = offset; | |
1335 pos->len = len; | |
1336 pos->modname = modname ? g_strdup(modname) : NULL; | |
1337 | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1338 if (gaim_proxy_connect(pos->gc->account, "gaim.sourceforge.net", 80, straight_to_hell, pos) != 0) { |
4056 | 1339 char buf[256]; |
2086 | 1340 if (pos->modname) |
1341 g_free(pos->modname); | |
1342 g_free(pos); | |
4056 | 1343 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
|
1344 "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1345 gaim_notify_warning(pos->gc, NULL, |
7422 | 1346 _("Gaim was unable to get a valid login hash."), |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1347 buf); |
2086 | 1348 } |
1349 | |
1350 return 1; | |
1351 } | |
1352 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1353 static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1354 GaimConnection *gc = sess->aux_data; |
7283 | 1355 OscarData *od = gc->proto_data; |
5591
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1356 GaimAccount *account = gaim_connection_get_account(gc); |
5575 | 1357 GaimAccount *ac = gaim_connection_get_account(gc); |
7282 | 1358 #if 0 |
1359 struct client_info_s info = {"gaim", 7, 3, 2003, "us", "en", 0x0004, 0x0000, 0x04b}; | |
1360 #endif | |
7011 | 1361 va_list ap; |
1362 char *key; | |
2086 | 1363 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1364 va_start(ap, fr); |
2086 | 1365 key = va_arg(ap, char *); |
1366 va_end(ap); | |
1367 | |
4617 | 1368 if (od->icq) { |
3458 | 1369 struct client_info_s info = CLIENTINFO_ICQ_KNOWNGOOD; |
5591
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1370 aim_send_login(sess, fr->conn, gaim_account_get_username(ac), |
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1371 gaim_account_get_password(account), &info, key); |
3458 | 1372 } else { |
1373 struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD; | |
5591
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1374 aim_send_login(sess, fr->conn, gaim_account_get_username(ac), |
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1375 gaim_account_get_password(account), &info, key); |
3458 | 1376 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1377 |
7283 | 1378 gaim_connection_update_progress(gc, _("Password sent"), 2, OSCAR_CONNECT_STEPS); |
7282 | 1379 |
2086 | 1380 return 1; |
1381 } | |
1382 | |
2675 | 1383 static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1384 GaimConnection *gc = sess->aux_data; |
2647 | 1385 struct chat_connection *chatcon; |
1386 static int id = 1; | |
1387 | |
6905 | 1388 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, 0x0001, gaim_parse_genericerr, 0); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
1389 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN, gaim_conv_chat_join, 0); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
1390 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERLEAVE, gaim_conv_chat_leave, 0); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
1391 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE, gaim_conv_chat_info_update, 0); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
1392 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_conv_chat_incoming_msg, 0); |
2675 | 1393 |
2672 | 1394 aim_clientready(sess, fr->conn); |
2675 | 1395 |
2647 | 1396 chatcon = find_oscar_chat_by_conn(gc, fr->conn); |
1397 chatcon->id = id; | |
1398 chatcon->cnv = serv_got_joined_chat(gc, id++, chatcon->show); | |
1399 | |
1400 return 1; | |
1401 } | |
1402 | |
2675 | 1403 static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...) { |
1404 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1405 aim_conn_addhandler(sess, fr->conn, 0x000d, 0x0001, gaim_parse_genericerr, 0); |
2647 | 1406 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_INFO, gaim_chatnav_info, 0); |
2675 | 1407 |
1408 aim_clientready(sess, fr->conn); | |
1409 | |
1410 aim_chatnav_reqrights(sess, fr->conn); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1411 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1412 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1413 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1414 |
3694 | 1415 static int conninitdone_email(aim_session_t *sess, aim_frame_t *fr, ...) { |
1416 | |
1417 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); | |
1418 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_EML, AIM_CB_EML_MAILSTATUS, gaim_email_parseupdate, 0); | |
1419 | |
7282 | 1420 aim_email_sendcookies(sess); |
1421 aim_email_activate(sess); | |
3694 | 1422 aim_clientready(sess, fr->conn); |
1423 | |
1424 return 1; | |
1425 } | |
1426 | |
4804 | 1427 static int conninitdone_icon(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1428 GaimConnection *gc = sess->aux_data; |
7283 | 1429 OscarData *od = gc->proto_data; |
4804 | 1430 |
1431 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); | |
1432 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_ERROR, gaim_icon_error, 0); | |
1433 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_RESPONSE, gaim_icon_parseicon, 0); | |
1434 | |
1435 aim_clientready(sess, fr->conn); | |
1436 | |
4823 | 1437 od->iconconnecting = FALSE; |
1438 | |
4804 | 1439 if (od->icontimer) |
1440 g_source_remove(od->icontimer); | |
1441 od->icontimer = g_timeout_add(100, gaim_icon_timerfunc, gc); | |
1442 | |
1443 return 1; | |
1444 } | |
1445 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1446 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1447 GaimConnection *gc = data; |
7283 | 1448 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1449 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1450 aim_conn_t *tstconn; |
2086 | 1451 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1452 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1453 close(source); |
1454 return; | |
1455 } | |
1456 | |
4617 | 1457 od = gc->proto_data; |
1458 sess = od->sess; | |
2086 | 1459 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV); |
4366 | 1460 tstconn->fd = source; |
2086 | 1461 |
1462 if (source < 0) { | |
1463 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1464 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1465 "unable to connect to chatnav server\n"); |
2086 | 1466 return; |
1467 } | |
1468 | |
1469 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1470 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
|
1471 gaim_debug(GAIM_DEBUG_INFO, "oscar", "chatnav: connected\n"); |
2086 | 1472 } |
1473 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1474 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 1475 { |
5575 | 1476 GaimConnection *gc = data; |
7283 | 1477 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1478 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1479 aim_conn_t *tstconn; |
2086 | 1480 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1481 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1482 close(source); |
1483 return; | |
1484 } | |
1485 | |
4617 | 1486 od = gc->proto_data; |
1487 sess = od->sess; | |
2086 | 1488 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); |
4366 | 1489 tstconn->fd = source; |
2086 | 1490 |
1491 if (source < 0) { | |
1492 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1493 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1494 "unable to connect to authorizer\n"); |
2086 | 1495 return; |
1496 } | |
1497 | |
1498 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1499 od->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
6905 | 1500 gaim_debug(GAIM_DEBUG_INFO, "oscar", "admin: connected\n"); |
2086 | 1501 } |
1502 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1503 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 1504 { |
1505 struct chat_connection *ccon = data; | |
5575 | 1506 GaimConnection *gc = ccon->gc; |
7283 | 1507 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1508 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1509 aim_conn_t *tstconn; |
2086 | 1510 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1511 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1512 close(source); |
1513 g_free(ccon->show); | |
1514 g_free(ccon->name); | |
1515 g_free(ccon); | |
1516 return; | |
1517 } | |
1518 | |
4617 | 1519 od = gc->proto_data; |
1520 sess = od->sess; | |
2086 | 1521 tstconn = ccon->conn; |
4366 | 1522 tstconn->fd = source; |
2086 | 1523 |
1524 if (source < 0) { | |
1525 aim_conn_kill(sess, &tstconn); | |
1526 g_free(ccon->show); | |
1527 g_free(ccon->name); | |
1528 g_free(ccon); | |
1529 return; | |
1530 } | |
1531 | |
1532 aim_conn_completeconnect(sess, ccon->conn); | |
4617 | 1533 ccon->inpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
1534 od->oscar_chats = g_slist_append(od->oscar_chats, ccon); | |
2086 | 1535 } |
1536 | |
3694 | 1537 static void oscar_email_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1538 GaimConnection *gc = data; |
7283 | 1539 OscarData *od; |
3694 | 1540 aim_session_t *sess; |
1541 aim_conn_t *tstconn; | |
1542 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1543 if (!g_list_find(gaim_connections_get_all(), gc)) { |
3694 | 1544 close(source); |
1545 return; | |
1546 } | |
1547 | |
4617 | 1548 od = gc->proto_data; |
1549 sess = od->sess; | |
3694 | 1550 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_EMAIL); |
4366 | 1551 tstconn->fd = source; |
3694 | 1552 |
1553 if (source < 0) { | |
1554 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1555 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1556 "unable to connect to email server\n"); |
3694 | 1557 return; |
1558 } | |
1559 | |
1560 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1561 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
|
1562 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1563 "email: connected\n"); |
3694 | 1564 } |
1565 | |
4804 | 1566 static void oscar_icon_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1567 GaimConnection *gc = data; |
7283 | 1568 OscarData *od; |
4804 | 1569 aim_session_t *sess; |
1570 aim_conn_t *tstconn; | |
1571 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1572 if (!g_list_find(gaim_connections_get_all(), gc)) { |
4804 | 1573 close(source); |
1574 return; | |
1575 } | |
1576 | |
1577 od = gc->proto_data; | |
1578 sess = od->sess; | |
1579 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_ICON); | |
1580 tstconn->fd = source; | |
1581 | |
1582 if (source < 0) { | |
1583 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1584 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1585 "unable to connect to icon server\n"); |
4804 | 1586 return; |
1587 } | |
1588 | |
1589 aim_conn_completeconnect(sess, tstconn); | |
1590 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
|
1591 gaim_debug(GAIM_DEBUG_INFO, "oscar", "icon: connected\n"); |
4804 | 1592 } |
1593 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1594 /* 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
|
1595 static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1596 GaimConnection *gc = sess->aux_data; |
1597 GaimAccount *account = gaim_connection_get_account(gc); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1598 aim_conn_t *tstconn; |
4452 | 1599 int i; |
2086 | 1600 char *host; |
1601 int port; | |
4821 | 1602 va_list ap; |
1603 struct aim_redirect_data *redir; | |
2086 | 1604 |
5575 | 1605 port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); |
2086 | 1606 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1607 va_start(ap, fr); |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1608 redir = va_arg(ap, struct aim_redirect_data *); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1609 va_end(ap); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1610 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1611 for (i = 0; i < (int)strlen(redir->ip); i++) { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1612 if (redir->ip[i] == ':') { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1613 port = atoi(&(redir->ip[i+1])); |
2086 | 1614 break; |
1615 } | |
1616 } | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1617 host = g_strndup(redir->ip, i); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1618 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1619 switch(redir->group) { |
2086 | 1620 case 0x7: /* Authorizer */ |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1621 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1622 "Reconnecting with authorizor...\n"); |
2086 | 1623 tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); |
1624 if (tstconn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1625 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1626 "unable to reconnect with authorizer\n"); |
2086 | 1627 g_free(host); |
1628 return 1; | |
1629 } | |
4649 | 1630 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1631 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_admin, 0); |
2086 | 1632 |
1633 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1634 if (gaim_proxy_connect(account, host, port, oscar_auth_connect, gc) != 0) { |
2086 | 1635 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1636 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1637 "unable to reconnect with authorizer\n"); |
2086 | 1638 g_free(host); |
1639 return 1; | |
1640 } | |
4293 | 1641 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
4194 | 1642 break; |
1643 | |
2086 | 1644 case 0xd: /* ChatNav */ |
1645 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, NULL); | |
1646 if (tstconn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1647 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1648 "unable to connect to chatnav server\n"); |
2086 | 1649 g_free(host); |
1650 return 1; | |
1651 } | |
4649 | 1652 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1653 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chatnav, 0); |
2086 | 1654 |
1655 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1656 if (gaim_proxy_connect(account, host, port, oscar_chatnav_connect, gc) != 0) { |
2086 | 1657 aim_conn_kill(sess, &tstconn); |
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 chatnav server\n"); |
2086 | 1660 g_free(host); |
1661 return 1; | |
1662 } | |
4293 | 1663 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
4194 | 1664 break; |
1665 | |
1666 case 0xe: { /* Chat */ | |
2086 | 1667 struct chat_connection *ccon; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1668 |
2086 | 1669 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, NULL); |
1670 if (tstconn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1671 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1672 "unable to connect to chat server\n"); |
2086 | 1673 g_free(host); |
1674 return 1; | |
1675 } | |
1676 | |
4649 | 1677 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1678 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chat, 0); |
1679 | |
2086 | 1680 ccon = g_new0(struct chat_connection, 1); |
1681 ccon->conn = tstconn; | |
1682 ccon->gc = gc; | |
1683 ccon->fd = -1; | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1684 ccon->name = g_strdup(redir->chat.room); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1685 ccon->exchange = redir->chat.exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1686 ccon->instance = redir->chat.instance; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1687 ccon->show = extract_name(redir->chat.room); |
4634 | 1688 |
2086 | 1689 ccon->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1690 if (gaim_proxy_connect(account, host, port, oscar_chat_connect, ccon) != 0) { |
2086 | 1691 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1692 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1693 "unable to connect to chat server\n"); |
2086 | 1694 g_free(host); |
1695 g_free(ccon->show); | |
1696 g_free(ccon->name); | |
1697 g_free(ccon); | |
1698 return 1; | |
1699 } | |
4293 | 1700 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1701 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1702 "Connected to chat room %s exchange %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1703 ccon->name, ccon->exchange); |
4194 | 1704 } break; |
3694 | 1705 |
4804 | 1706 case 0x0010: { /* icon */ |
1707 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_ICON, NULL))) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1708 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1709 "unable to connect to icon server\n"); |
4804 | 1710 g_free(host); |
1711 return 1; | |
1712 } | |
1713 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); | |
1714 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_icon, 0); | |
1715 | |
1716 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1717 if (gaim_proxy_connect(account, host, port, oscar_icon_connect, gc) != 0) { |
4804 | 1718 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1719 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1720 "unable to connect to icon server\n"); |
4804 | 1721 g_free(host); |
1722 return 1; | |
1723 } | |
1724 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); | |
1725 } break; | |
1726 | |
3694 | 1727 case 0x0018: { /* email */ |
1728 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_EMAIL, NULL))) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1729 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1730 "unable to connect to email server\n"); |
3694 | 1731 g_free(host); |
1732 return 1; | |
1733 } | |
4649 | 1734 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
3694 | 1735 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_email, 0); |
1736 | |
1737 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1738 if (gaim_proxy_connect(account, host, port, oscar_email_connect, gc) != 0) { |
3694 | 1739 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1740 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1741 "unable to connect to email server\n"); |
3694 | 1742 g_free(host); |
1743 return 1; | |
1744 } | |
4293 | 1745 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
3694 | 1746 } break; |
1747 | |
2086 | 1748 default: /* huh? */ |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1749 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1750 "got redirect for unknown service 0x%04hx\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1751 redir->group); |
2086 | 1752 break; |
1753 } | |
1754 | |
1755 g_free(host); | |
1756 return 1; | |
1757 } | |
1758 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1759 static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1760 GaimConnection *gc = sess->aux_data; |
7283 | 1761 OscarData *od = gc->proto_data; |
4738 | 1762 struct buddyinfo *bi; |
2993 | 1763 time_t time_idle = 0, signon = 0; |
1764 int type = 0; | |
1765 int caps = 0; | |
2086 | 1766 va_list ap; |
4738 | 1767 aim_userinfo_t *info; |
4194 | 1768 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1769 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1770 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1771 va_end(ap); |
1772 | |
2993 | 1773 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) |
1774 caps = info->capabilities; | |
3267 | 1775 if (info->flags & AIM_FLAG_ACTIVEBUDDY) |
1776 type |= UC_AB; | |
1777 | |
4766 | 1778 if (info->present & AIM_USERINFO_PRESENT_FLAGS) { |
1779 if (info->flags & AIM_FLAG_UNCONFIRMED) | |
1780 type |= UC_UNCONFIRMED; | |
1781 if (info->flags & AIM_FLAG_ADMINISTRATOR) | |
1782 type |= UC_ADMIN; | |
1783 if (info->flags & AIM_FLAG_AOL) | |
1784 type |= UC_AOL; | |
1785 if (info->flags & AIM_FLAG_FREE) | |
1786 type |= UC_NORMAL; | |
1787 if (info->flags & AIM_FLAG_AWAY) | |
1788 type |= UC_UNAVAILABLE; | |
1789 if (info->flags & AIM_FLAG_WIRELESS) | |
1790 type |= UC_WIRELESS; | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1791 } |
2993 | 1792 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) { |
3595 | 1793 type = (info->icqinfo.status << 16); |
3013 | 1794 if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) && |
1795 (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) { | |
2993 | 1796 type |= UC_UNAVAILABLE; |
3013 | 1797 } |
2993 | 1798 } |
1799 | |
7141 | 1800 if (caps & AIM_CAPS_ICQ_DIRECT) |
1801 caps ^= AIM_CAPS_ICQ_DIRECT; | |
2993 | 1802 |
1803 if (info->present & AIM_USERINFO_PRESENT_IDLE) { | |
2086 | 1804 time(&time_idle); |
1805 time_idle -= info->idletime*60; | |
2993 | 1806 } |
1807 | |
5836 | 1808 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) |
1809 signon = info->onlinesince; | |
1810 else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) | |
2993 | 1811 signon = time(NULL) - info->sessionlen; |
2086 | 1812 |
5575 | 1813 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), info->sn)) |
1814 gaim_connection_set_display_name(gc, info->sn); | |
2305
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1815 |
7261 | 1816 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, info->sn)); |
4738 | 1817 if (!bi) { |
1818 bi = g_new0(struct buddyinfo, 1); | |
7261 | 1819 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, info->sn)), bi); |
4738 | 1820 } |
4739 | 1821 bi->typingnot = FALSE; |
1822 bi->ico_informed = FALSE; | |
6857 | 1823 bi->ipaddr = info->icqinfo.ipaddr; |
1824 | |
1825 /* Available message stuff */ | |
6292 | 1826 free(bi->availmsg); |
7011 | 1827 if (info->avail != NULL) |
1828 if (info->avail_encoding) { | |
1829 gchar *enc = g_strdup_printf("charset=\"%s\"", info->avail_encoding); | |
1830 bi->availmsg = oscar_encoding_to_utf8(enc, info->avail, info->avail_len); | |
6292 | 1831 g_free(enc); |
1832 } else { | |
1833 /* No explicit encoding means utf8. Yay. */ | |
7011 | 1834 bi->availmsg = g_strdup(info->avail); |
6292 | 1835 } |
5837 | 1836 else |
6292 | 1837 bi->availmsg = NULL; |
4732 | 1838 |
4804 | 1839 /* Server stored icon stuff */ |
4853 | 1840 if (info->iconcsumlen) { |
7125 | 1841 const char *filename = NULL, *saved_b16 = NULL; |
1842 char *b16 = NULL; | |
7093 | 1843 GaimBuddy *b = NULL; |
4853 | 1844 |
7106
db6bd3e794d8
[gaim-migrate @ 7671]
Christian Hammond <chipx86@chipx86.com>
parents:
7098
diff
changeset
|
1845 b16 = gaim_base16_encode(info->iconcsum, info->iconcsumlen); |
4853 | 1846 b = gaim_find_buddy(gc->account, info->sn); |
7093 | 1847 /* |
1848 * If for some reason the checksum is valid, but cached file is not.. | |
1849 * we want to know. | |
1850 */ | |
7693 | 1851 filename = gaim_blist_node_get_string((GaimBlistNode*)b, "buddy_icon"); |
7093 | 1852 if (filename != NULL) { |
1853 if (g_file_test(filename, G_FILE_TEST_EXISTS)) | |
7693 | 1854 saved_b16 = gaim_blist_node_get_string((GaimBlistNode*)b, |
1855 "icon_checksum"); | |
7093 | 1856 } else |
1857 saved_b16 = NULL; | |
7054
7c04a0775918
[gaim-migrate @ 7617]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7045
diff
changeset
|
1858 |
4853 | 1859 if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) { |
1860 GSList *cur = od->requesticon; | |
1861 while (cur && aim_sncmp((char *)cur->data, info->sn)) | |
1862 cur = cur->next; | |
1863 if (!cur) { | |
7475 | 1864 od->requesticon = g_slist_append(od->requesticon, g_strdup(gaim_normalize(gc->account, info->sn))); |
4853 | 1865 if (od->icontimer) |
1866 g_source_remove(od->icontimer); | |
1867 od->icontimer = g_timeout_add(500, gaim_icon_timerfunc, gc); | |
1868 } | |
1869 } | |
6053 | 1870 g_free(b16); |
4853 | 1871 } |
1872 | |
5628 | 1873 serv_got_update(gc, info->sn, 1, (info->warnlevel/10.0) + 0.5, signon, time_idle, type); |
2086 | 1874 |
1875 return 1; | |
1876 } | |
1877 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1878 static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1879 GaimConnection *gc = sess->aux_data; |
7283 | 1880 OscarData *od = gc->proto_data; |
2086 | 1881 va_list ap; |
4739 | 1882 aim_userinfo_t *info; |
2086 | 1883 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1884 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1885 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1886 va_end(ap); |
1887 | |
4732 | 1888 serv_got_update(gc, info->sn, 0, 0, 0, 0, 0); |
2086 | 1889 |
7261 | 1890 g_hash_table_remove(od->buddyinfo, gaim_normalize(gc->account, info->sn)); |
5837 | 1891 |
2086 | 1892 return 1; |
1893 } | |
1894 | |
3730 | 1895 static void cancel_direct_im(struct ask_direct *d) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1896 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Freeing DirectIM prompts.\n"); |
2086 | 1897 |
1898 g_free(d->sn); | |
1899 g_free(d); | |
1900 } | |
1901 | |
4617 | 1902 static void oscar_odc_callback(gpointer data, gint source, GaimInputCondition condition) { |
2086 | 1903 struct direct_im *dim = data; |
5575 | 1904 GaimConnection *gc = dim->gc; |
7283 | 1905 OscarData *od = gc->proto_data; |
5679 | 1906 GaimConversation *cnv; |
2086 | 1907 char buf[256]; |
3008 | 1908 struct sockaddr name; |
1909 socklen_t name_len = 1; | |
1910 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1911 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1912 g_free(dim); |
1913 return; | |
1914 } | |
1915 | |
1916 if (source < 0) { | |
1917 g_free(dim); | |
1918 return; | |
1919 } | |
1920 | |
4366 | 1921 dim->conn->fd = source; |
2086 | 1922 aim_conn_completeconnect(od->sess, dim->conn); |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
1923 cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, dim->name); |
3008 | 1924 |
1925 /* This is the best way to see if we're connected or not */ | |
1926 if (getpeername(source, &name, &name_len) == 0) { | |
1927 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name); | |
1928 dim->connected = TRUE; | |
6982 | 1929 gaim_conversation_write(cnv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
3008 | 1930 } |
2086 | 1931 od->direct_ims = g_slist_append(od->direct_ims, dim); |
3008 | 1932 |
4617 | 1933 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); |
2086 | 1934 } |
1935 | |
4617 | 1936 /* BBB */ |
3952 | 1937 /* |
4617 | 1938 * This is called after a remote AIM user has connected to us. We |
1939 * want to do some voodoo with the socket file descriptors, add a | |
1940 * callback or two, and then send the AIM_CB_OFT_PROMPT. | |
3952 | 1941 */ |
4656 | 1942 static int oscar_sendfile_estblsh(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1943 GaimConnection *gc = sess->aux_data; |
7283 | 1944 OscarData *od = (OscarData *)gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1945 GaimXfer *xfer; |
5146 | 1946 struct aim_oft_info *oft_info; |
3630 | 1947 va_list ap; |
1948 aim_conn_t *conn, *listenerconn; | |
4656 | 1949 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1950 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1951 "AAA - in oscar_sendfile_estblsh\n"); |
3630 | 1952 va_start(ap, fr); |
1953 conn = va_arg(ap, aim_conn_t *); | |
1954 listenerconn = va_arg(ap, aim_conn_t *); | |
1955 va_end(ap); | |
1956 | |
4617 | 1957 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, listenerconn))) |
1958 return 1; | |
1959 | |
5146 | 1960 if (!(oft_info = xfer->data)) |
4617 | 1961 return 1; |
1962 | |
3630 | 1963 /* Stop watching listener conn; watch transfer conn instead */ |
4617 | 1964 gaim_input_remove(xfer->watcher); |
3630 | 1965 aim_conn_kill(sess, &listenerconn); |
1966 | |
5146 | 1967 oft_info->conn = conn; |
1968 xfer->fd = oft_info->conn->fd; | |
1969 | |
1970 aim_conn_addhandler(sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ACK, oscar_sendfile_ack, 0); | |
1971 aim_conn_addhandler(sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DONE, oscar_sendfile_done, 0); | |
1972 xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
4617 | 1973 |
1974 /* Inform the other user that we are connected and ready to transfer */ | |
5146 | 1975 aim_oft_sendheader(sess, AIM_CB_OFT_PROMPT, oft_info); |
3630 | 1976 |
1977 return 0; | |
1978 } | |
1979 | |
3952 | 1980 /* |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1981 * This is the gaim callback passed to gaim_proxy_connect when connecting to another AIM |
4617 | 1982 * user in order to transfer a file. |
3952 | 1983 */ |
4617 | 1984 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
|
1985 GaimXfer *xfer; |
5146 | 1986 struct aim_oft_info *oft_info; |
4656 | 1987 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1988 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1989 "AAA - in oscar_sendfile_connected\n"); |
4617 | 1990 if (!(xfer = data)) |
1991 return; | |
5146 | 1992 if (!(oft_info = xfer->data)) |
3630 | 1993 return; |
4617 | 1994 if (source < 0) |
1995 return; | |
1996 | |
1997 xfer->fd = source; | |
5146 | 1998 oft_info->conn->fd = source; |
1999 | |
2000 aim_conn_completeconnect(oft_info->sess, oft_info->conn); | |
2001 xfer->watcher = gaim_input_add(xfer->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
4617 | 2002 |
2003 /* Inform the other user that we are connected and ready to transfer */ | |
5146 | 2004 aim_im_sendch2_sendfile_accept(oft_info->sess, oft_info); |
4617 | 2005 |
2006 return; | |
3630 | 2007 } |
2008 | |
3952 | 2009 /* |
4617 | 2010 * This is called when a buddy sends us some file info. This happens when they |
2011 * are sending a file to you, and you have just established a connection to them. | |
4650 | 2012 * You should send them the exact same info except use the real cookie. We also |
4617 | 2013 * get like totally ready to like, receive the file, kay? |
3952 | 2014 */ |
4617 | 2015 static int oscar_sendfile_prompt(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2016 GaimConnection *gc = sess->aux_data; |
7283 | 2017 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2018 GaimXfer *xfer; |
5146 | 2019 struct aim_oft_info *oft_info; |
4617 | 2020 va_list ap; |
2021 aim_conn_t *conn; | |
2022 fu8_t *cookie; | |
2023 struct aim_fileheader_t *fh; | |
4656 | 2024 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2025 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2026 "AAA - in oscar_sendfile_prompt\n"); |
4617 | 2027 va_start(ap, fr); |
2028 conn = va_arg(ap, aim_conn_t *); | |
2029 cookie = va_arg(ap, fu8_t *); | |
2030 fh = va_arg(ap, struct aim_fileheader_t *); | |
2031 va_end(ap); | |
2032 | |
2033 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, conn))) | |
2034 return 1; | |
2035 | |
5146 | 2036 if (!(oft_info = xfer->data)) |
4617 | 2037 return 1; |
2038 | |
2039 /* We want to stop listening with a normal thingy */ | |
2040 gaim_input_remove(xfer->watcher); | |
2041 xfer->watcher = 0; | |
2042 | |
5146 | 2043 /* They sent us some information about the file they're sending */ |
2044 memcpy(&oft_info->fh, fh, sizeof(*fh)); | |
2045 | |
2046 /* Fill in the cookie */ | |
2047 memcpy(&oft_info->fh.bcookie, oft_info->cookie, 8); | |
2048 | |
4617 | 2049 /* XXX - convert the name from UTF-8 to UCS-2 if necessary, and pass the encoding to the call below */ |
5146 | 2050 aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_ACK, oft_info); |
4617 | 2051 gaim_xfer_start(xfer, xfer->fd, NULL, 0); |
2052 | |
2053 return 0; | |
3630 | 2054 } |
2055 | |
3952 | 2056 /* |
4657 | 2057 * We are sending a file to someone else. They have just acknowledged our |
4617 | 2058 * prompt, so we want to start sending data like there's no tomorrow. |
3952 | 2059 */ |
4617 | 2060 static int oscar_sendfile_ack(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2061 GaimConnection *gc = sess->aux_data; |
7283 | 2062 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2063 GaimXfer *xfer; |
4617 | 2064 va_list ap; |
2065 aim_conn_t *conn; | |
2066 fu8_t *cookie; | |
2067 struct aim_fileheader_t *fh; | |
4656 | 2068 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2069 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_sendfile_ack\n"); |
4617 | 2070 va_start(ap, fr); |
2071 conn = va_arg(ap, aim_conn_t *); | |
2072 cookie = va_arg(ap, fu8_t *); | |
2073 fh = va_arg(ap, struct aim_fileheader_t *); | |
2074 va_end(ap); | |
2075 | |
2076 if (!(xfer = oscar_find_xfer_by_cookie(od->file_transfers, cookie))) | |
2077 return 1; | |
2078 | |
4656 | 2079 /* We want to stop listening with a normal thingy */ |
2080 gaim_input_remove(xfer->watcher); | |
2081 xfer->watcher = 0; | |
2082 | |
4617 | 2083 gaim_xfer_start(xfer, xfer->fd, NULL, 0); |
2084 | |
2085 return 0; | |
3630 | 2086 } |
4617 | 2087 |
2088 /* | |
2089 * We just sent a file to someone. They said they got it and everything, | |
2090 * so we can close our direct connection and what not. | |
2091 */ | |
2092 static int oscar_sendfile_done(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 2093 GaimConnection *gc = sess->aux_data; |
7283 | 2094 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2095 GaimXfer *xfer; |
4617 | 2096 va_list ap; |
2097 aim_conn_t *conn; | |
2098 fu8_t *cookie; | |
2099 struct aim_fileheader_t *fh; | |
4656 | 2100 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2101 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_sendfile_done\n"); |
4617 | 2102 va_start(ap, fr); |
2103 conn = va_arg(ap, aim_conn_t *); | |
2104 cookie = va_arg(ap, fu8_t *); | |
2105 fh = va_arg(ap, struct aim_fileheader_t *); | |
2106 va_end(ap); | |
2107 | |
2108 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, conn))) | |
2109 return 1; | |
2110 | |
4656 | 2111 xfer->fd = conn->fd; |
4617 | 2112 gaim_xfer_end(xfer); |
2113 | |
2114 return 0; | |
2115 } | |
3630 | 2116 |
4244 | 2117 static void accept_direct_im(struct ask_direct *d) { |
5575 | 2118 GaimConnection *gc = d->gc; |
7283 | 2119 OscarData *od; |
2086 | 2120 struct direct_im *dim; |
2945 | 2121 char *host; int port = 4443; |
4366 | 2122 int i, rc; |
2086 | 2123 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2124 if (!g_list_find(gaim_connections_get_all(), gc)) { |
4244 | 2125 cancel_direct_im(d); |
2126 return; | |
2127 } | |
2128 | |
7283 | 2129 od = (OscarData *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2130 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Accepted DirectIM.\n"); |
2086 | 2131 |
2132 dim = find_direct_im(od, d->sn); | |
2133 if (dim) { | |
3730 | 2134 cancel_direct_im(d); /* 40 */ |
4244 | 2135 return; |
2086 | 2136 } |
2137 dim = g_new0(struct direct_im, 1); | |
2138 dim->gc = d->gc; | |
2139 g_snprintf(dim->name, sizeof dim->name, "%s", d->sn); | |
2140 | |
4617 | 2141 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
|
2142 if (!dim->conn) { |
2086 | 2143 g_free(dim); |
3730 | 2144 cancel_direct_im(d); |
4244 | 2145 return; |
2086 | 2146 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2147 |
2086 | 2148 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, |
4617 | 2149 gaim_odc_incoming, 0); |
2086 | 2150 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, |
4617 | 2151 gaim_odc_typing, 0); |
3033 | 2152 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, |
6982 | 2153 gaim_odc_update_ui, 0); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2154 for (i = 0; i < (int)strlen(d->ip); i++) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2155 if (d->ip[i] == ':') { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2156 port = atoi(&(d->ip[i+1])); |
2086 | 2157 break; |
2158 } | |
2159 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2160 host = g_strndup(d->ip, i); |
2086 | 2161 dim->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
2162 rc = gaim_proxy_connect(gc->account, host, port, oscar_odc_callback, dim); |
2086 | 2163 g_free(host); |
4366 | 2164 if (rc < 0) { |
2086 | 2165 aim_conn_kill(od->sess, &dim->conn); |
2166 g_free(dim); | |
3730 | 2167 cancel_direct_im(d); |
4244 | 2168 return; |
2086 | 2169 } |
2170 | |
3730 | 2171 cancel_direct_im(d); |
2086 | 2172 |
4244 | 2173 return; |
2086 | 2174 } |
2175 | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2176 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { |
5575 | 2177 GaimConnection *gc = sess->aux_data; |
7283 | 2178 OscarData *od = gc->proto_data; |
7475 | 2179 gchar *tmp; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
2180 GaimConvImFlags flags = 0; |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
2181 gsize convlen; |
3659 | 2182 GError *err = NULL; |
4738 | 2183 struct buddyinfo *bi; |
5575 | 2184 const char *iconfile; |
4738 | 2185 |
7261 | 2186 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, userinfo->sn)); |
4738 | 2187 if (!bi) { |
2188 bi = g_new0(struct buddyinfo, 1); | |
7261 | 2189 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, userinfo->sn)), bi); |
4738 | 2190 } |
2273
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2191 |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2192 if (args->icbmflags & AIM_IMFLAGS_AWAY) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
2193 flags |= GAIM_CONV_IM_AUTO_RESP; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2194 |
4738 | 2195 if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT) |
2196 bi->typingnot = TRUE; | |
2197 else | |
2198 bi->typingnot = FALSE; | |
2199 | |
4380 | 2200 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
|
2201 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2202 "%s has an icon\n", userinfo->sn); |
4738 | 2203 if ((args->iconlen != bi->ico_len) || (args->iconsum != bi->ico_csum) || (args->iconstamp != bi->ico_time)) { |
2204 bi->ico_need = TRUE; | |
2205 bi->ico_len = args->iconlen; | |
2206 bi->ico_csum = args->iconsum; | |
2207 bi->ico_time = args->iconstamp; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2208 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2209 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2210 |
5575 | 2211 if ((iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc))) && |
7406 | 2212 (args->icbmflags & AIM_IMFLAGS_BUDDYREQ) && !bi->ico_sent && bi->ico_informed) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2213 FILE *file; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2214 struct stat st; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2215 |
5575 | 2216 if (!stat(iconfile, &st)) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2217 char *buf = g_malloc(st.st_size); |
5575 | 2218 file = fopen(iconfile, "rb"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2219 if (file) { |
2603
24664768a739
[gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
2220 int len = fread(buf, 1, st.st_size, file); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2221 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2222 "Sending buddy icon to %s (%d bytes, " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2223 "%lu reported)\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2224 userinfo->sn, len, st.st_size); |
4617 | 2225 aim_im_sendch2_icon(sess, userinfo->sn, buf, st.st_size, |
2226 st.st_mtime, aimutil_iconsum(buf, st.st_size)); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2227 fclose(file); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
2228 } else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2229 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2230 "Can't open buddy icon file!\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2231 g_free(buf); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
2232 } else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2233 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2234 "Can't stat buddy icon file!\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2235 } |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2236 |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2237 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2238 "Character set is %hu %hu\n", args->charset, args->charsubset); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2239 if (args->icbmflags & AIM_IMFLAGS_UNICODE) { |
3722 | 2240 /* This message is marked as UNICODE, so we have to |
2241 * convert it to utf-8 before handing it to the gaim core. | |
2242 * This conversion should *never* fail, if it does it | |
2243 * means that either the incoming ICBM is corrupted or | |
4662 | 2244 * there is something we don't understand about it. |
2245 * For the record, AIM Unicode is big-endian UCS-2 */ | |
2246 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2247 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Received UNICODE IM\n"); |
4121 | 2248 |
2249 if (!args->msg || !args->msglen) | |
2250 return 1; | |
4641 | 2251 |
3659 | 2252 tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err); |
2253 if (err) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2254 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2255 "Unicode IM conversion: %s\n", err->message); |
7475 | 2256 tmp = g_strdup(_("(There was an error receiving this message)")); |
4800 | 2257 g_error_free(err); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2258 } |
3722 | 2259 } else { |
3850 | 2260 /* This will get executed for both AIM_IMFLAGS_ISO_8859_1 and |
3722 | 2261 * unflagged messages, which are ASCII. That's OK because |
2262 * ASCII is a strict subset of ISO-8859-1; this should | |
2263 * help with compatibility with old, broken versions of | |
2264 * gaim (everything before 0.60) and other broken clients | |
2265 * that will happily send ISO-8859-1 without marking it as | |
2266 * such */ | |
4662 | 2267 if (args->icbmflags & AIM_IMFLAGS_ISO_8859_1) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2268 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2269 "Received ISO-8859-1 IM\n"); |
4121 | 2270 |
2271 if (!args->msg || !args->msglen) | |
2272 return 1; | |
2273 | |
3659 | 2274 tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &convlen, &err); |
2275 if (err) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2276 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2277 "ISO-8859-1 IM conversion: %s\n", err->message); |
7475 | 2278 tmp = g_strdup(_("(There was an error receiving this message)")); |
4800 | 2279 g_error_free(err); |
3659 | 2280 } |
3642 | 2281 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2282 |
7478
3c21f3084ff0
[gaim-migrate @ 8091]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7475
diff
changeset
|
2283 /* gaim_str_strip_cr(tmp); */ |
6982 | 2284 serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2285 g_free(tmp); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2286 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2287 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2288 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2289 |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2290 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { |
5575 | 2291 GaimConnection *gc = sess->aux_data; |
7283 | 2292 OscarData *od = gc->proto_data; |
5575 | 2293 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
|
2294 |
4121 | 2295 if (!args) |
2296 return 0; | |
4194 | 2297 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2298 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2299 "rendezvous with %s, status is %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2300 userinfo->sn, args->status); |
2869 | 2301 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2302 if (args->reqclass & AIM_CAPS_CHAT) { |
4121 | 2303 char *name; |
5234 | 2304 GHashTable *components; |
2305 | |
4121 | 2306 if (!args->info.chat.roominfo.name || !args->info.chat.roominfo.exchange || !args->msg) |
2307 return 1; | |
5234 | 2308 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
2309 g_free); | |
4121 | 2310 name = extract_name(args->info.chat.roominfo.name); |
5234 | 2311 g_hash_table_replace(components, g_strdup("room"), g_strdup(name ? name : args->info.chat.roominfo.name)); |
2312 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
|
2313 serv_got_chat_invite(gc, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2314 name ? name : args->info.chat.roominfo.name, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2315 userinfo->sn, |
6059 | 2316 args->msg, |
5234 | 2317 components); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2318 if (name) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2319 g_free(name); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2320 } else if (args->reqclass & AIM_CAPS_SENDFILE) { |
4617 | 2321 /* BBB */ |
2322 if (args->status == AIM_RENDEZVOUS_PROPOSE) { | |
2323 /* Someone wants to send a file (or files) to us */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2324 GaimXfer *xfer; |
5146 | 2325 struct aim_oft_info *oft_info; |
2326 | |
2327 if (!args->cookie || !args->port || !args->verifiedip || | |
2328 !args->info.sendfile.filename || !args->info.sendfile.totsize || | |
4656 | 2329 !args->info.sendfile.totfiles || !args->reqclass) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2330 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2331 "%s tried to send you a file with incomplete " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2332 "information.\n", userinfo->sn); |
5146 | 2333 if (args->proxyip) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2334 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2335 "IP for a proxy server was given. Gaim " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2336 "does not support this yet.\n"); |
4617 | 2337 return 1; |
4656 | 2338 } |
4617 | 2339 |
2340 if (args->info.sendfile.subtype == AIM_OFT_SUBTYPE_SEND_DIR) { | |
2341 /* last char of the ft req is a star, they are sending us a | |
2342 * directory -- remove the star and trailing slash so we dont save | |
2343 * directories that look like 'dirname\*' -- arl */ | |
2344 char *tmp = strrchr(args->info.sendfile.filename, '\\'); | |
2345 if (tmp && (tmp[1] == '*')) { | |
2346 tmp[0] = '\0'; | |
2347 } | |
2348 } | |
2349 | |
2350 /* Build the file transfer handle */ | |
2351 xfer = gaim_xfer_new(gc->account, GAIM_XFER_RECEIVE, userinfo->sn); | |
5163 | 2352 xfer->remote_ip = g_strdup(args->verifiedip); |
5146 | 2353 xfer->remote_port = args->port; |
4617 | 2354 gaim_xfer_set_filename(xfer, args->info.sendfile.filename); |
2355 gaim_xfer_set_size(xfer, args->info.sendfile.totsize); | |
5146 | 2356 |
2357 /* Create the oscar-specific data */ | |
5163 | 2358 oft_info = aim_oft_createinfo(od->sess, args->cookie, userinfo->sn, args->clientip, xfer->remote_port, 0, 0, NULL); |
4898 | 2359 if (args->proxyip) |
5146 | 2360 oft_info->proxyip = g_strdup(args->proxyip); |
4898 | 2361 if (args->verifiedip) |
5146 | 2362 oft_info->verifiedip = g_strdup(args->verifiedip); |
2363 xfer->data = oft_info; | |
4617 | 2364 |
2365 /* Setup our I/O op functions */ | |
2366 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init); | |
2367 gaim_xfer_set_start_fnc(xfer, oscar_xfer_start); | |
2368 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2369 gaim_xfer_set_cancel_send_fnc(xfer, oscar_xfer_cancel_send); |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2370 gaim_xfer_set_cancel_recv_fnc(xfer, oscar_xfer_cancel_recv); |
4617 | 2371 gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack); |
2372 | |
2373 /* | |
2374 * XXX - Should do something with args->msg, args->encoding, and args->language | |
2375 * probably make it apply to all ch2 messages. | |
3752 | 2376 */ |
4617 | 2377 |
2378 /* Keep track of this transfer for later */ | |
2379 od->file_transfers = g_slist_append(od->file_transfers, xfer); | |
2380 | |
2381 /* Now perform the request */ | |
2382 gaim_xfer_request(xfer); | |
2383 } else if (args->status == AIM_RENDEZVOUS_CANCEL) { | |
2384 /* The other user wants to cancel a file transfer */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2385 GaimXfer *xfer; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2386 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2387 "AAA - File transfer canceled by remote user\n"); |
4617 | 2388 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
|
2389 gaim_xfer_cancel_remote(xfer); |
4617 | 2390 } else if (args->status == AIM_RENDEZVOUS_ACCEPT) { |
2391 /* | |
2392 * This gets sent by the receiver of a file | |
2393 * as they connect directly to us. If we don't | |
2394 * get this, then maybe a third party connected | |
2395 * to us, and we shouldn't send them anything. | |
2396 */ | |
2397 } else { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2398 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2399 "unknown rendezvous status!\n"); |
3630 | 2400 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2401 } else if (args->reqclass & AIM_CAPS_GETFILE) { |
8092 | 2402 } else if (args->reqclass & AIM_CAPS_TALK) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2403 } else if (args->reqclass & AIM_CAPS_BUDDYICON) { |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
2404 gaim_buddy_icons_set_for_user(gaim_connection_get_account(gc), |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
2405 userinfo->sn, args->info.icon.icon, |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
2406 args->info.icon.length); |
6871 | 2407 } else if (args->reqclass & AIM_CAPS_DIRECTIM) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2408 struct ask_direct *d = g_new0(struct ask_direct, 1); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2409 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2410 |
4212 | 2411 if (!args->verifiedip) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2412 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2413 "directim kill blocked (%s)\n", userinfo->sn); |
4650 | 2414 return 1; |
4212 | 2415 } |
2416 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2417 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2418 "%s received direct im request from %s (%s)\n", |
5575 | 2419 username, userinfo->sn, args->verifiedip); |
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 d->gc = gc; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2422 d->sn = g_strdup(userinfo->sn); |
2869 | 2423 strncpy(d->ip, args->verifiedip, sizeof(d->ip)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2424 memcpy(d->cookie, args->cookie, 8); |
5575 | 2425 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
|
2426 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2427 gaim_request_action(gc, NULL, buf, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2428 _("This requires a direct connection between " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2429 "the two computers and is necessary for IM " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2430 "Images. Because your IP address will be " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2431 "revealed, this may be considered a privacy " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2432 "risk."), 0, d, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2433 _("Connect"), G_CALLBACK(accept_direct_im), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2434 _("Cancel"), G_CALLBACK(cancel_direct_im)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2435 } else { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2436 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2437 "Unknown reqclass %hu\n", args->reqclass); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2438 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2439 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2440 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2441 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2442 |
3453 | 2443 /* |
4230 | 2444 * Authorization Functions |
2445 * Most of these are callbacks from dialogs. They're used by both | |
2446 * methods of authorization (SSI and old-school channel 4 ICBM) | |
3453 | 2447 */ |
4269 | 2448 /* When you ask other people for authorization */ |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2449 static void gaim_auth_request(struct name_data *data, char *msg) { |
5575 | 2450 GaimConnection *gc = data->gc; |
4244 | 2451 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2452 if (g_list_find(gaim_connections_get_all(), gc)) { |
7283 | 2453 OscarData *od = gc->proto_data; |
6695 | 2454 GaimBuddy *buddy = gaim_find_buddy(gc->account, data->name); |
2455 GaimGroup *group = gaim_find_buddys_group(buddy); | |
4244 | 2456 if (buddy && group) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2457 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2458 "ssi: adding buddy %s to group %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2459 buddy->name, group->name); |
4889 | 2460 aim_ssi_sendauthrequest(od->sess, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list.")); |
4269 | 2461 if (!aim_ssi_itemlist_finditem(od->sess->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY)) |
4889 | 2462 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 1); |
4244 | 2463 } |
4230 | 2464 } |
4337 | 2465 } |
2466 | |
2467 static void gaim_auth_request_msgprompt(struct name_data *data) { | |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2468 gaim_request_input(data->gc, NULL, _("Authorization Request Message:"), |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
2469 NULL, _("Please authorize me!"), TRUE, FALSE, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2470 _("OK"), G_CALLBACK(gaim_auth_request), |
5836 | 2471 _("Cancel"), G_CALLBACK(oscar_free_name_data), |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2472 data); |
4230 | 2473 } |
2474 | |
2475 static void gaim_auth_dontrequest(struct name_data *data) { | |
5575 | 2476 GaimConnection *gc = data->gc; |
4244 | 2477 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2478 if (g_list_find(gaim_connections_get_all(), gc)) { |
8151 | 2479 /* Remove from local list */ |
2480 GaimBuddy *b = gaim_find_buddy(gaim_connection_get_account(gc), data->name); | |
2481 gaim_blist_remove_buddy(b); | |
4244 | 2482 } |
2483 | |
5836 | 2484 oscar_free_name_data(data); |
4230 | 2485 } |
2486 | |
5575 | 2487 static void gaim_auth_sendrequest(GaimConnection *gc, const char *name) { |
4269 | 2488 struct name_data *data = g_new(struct name_data, 1); |
6695 | 2489 GaimBuddy *buddy; |
4269 | 2490 gchar *dialog_msg, *nombre; |
2491 | |
4687 | 2492 buddy = gaim_find_buddy(gc->account, name); |
2493 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
2494 nombre = g_strdup_printf("%s (%s)", name, gaim_get_buddy_alias_only(buddy)); | |
4269 | 2495 else |
4830 | 2496 nombre = NULL; |
2497 | |
2498 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 | 2499 data->gc = gc; |
2500 data->name = g_strdup(name); | |
2501 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2502 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2503 gaim_request_action(gc, NULL, _("Request Authorization"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2504 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2505 _("Request Authorization"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2506 G_CALLBACK(gaim_auth_request_msgprompt), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2507 _("Cancel"), G_CALLBACK(gaim_auth_dontrequest)); |
4269 | 2508 |
2509 g_free(dialog_msg); | |
2510 g_free(nombre); | |
2511 } | |
2512 | |
4230 | 2513 /* When other people ask you for authorization */ |
2514 static void gaim_auth_grant(struct name_data *data) { | |
5575 | 2515 GaimConnection *gc = data->gc; |
4244 | 2516 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2517 if (g_list_find(gaim_connections_get_all(), gc)) { |
7283 | 2518 OscarData *od = gc->proto_data; |
4236 | 2519 #ifdef NOSSI |
6695 | 2520 GaimBuddy *buddy; |
4244 | 2521 gchar message; |
2522 message = 0; | |
4687 | 2523 buddy = gaim_find_buddy(gc->account, data->name); |
4617 | 2524 aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHGRANTED, &message); |
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
7011
diff
changeset
|
2525 gaim_account_notify_added(gc->account, NULL, data->name, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); |
4230 | 2526 #else |
4889 | 2527 aim_ssi_sendauthreply(od->sess, data->name, 0x01, NULL); |
4230 | 2528 #endif |
4244 | 2529 } |
2530 | |
5836 | 2531 oscar_free_name_data(data); |
3141 | 2532 } |
2533 | |
4230 | 2534 /* When other people ask you for authorization */ |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2535 static void gaim_auth_dontgrant(struct name_data *data, char *msg) { |
5575 | 2536 GaimConnection *gc = data->gc; |
4244 | 2537 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2538 if (g_list_find(gaim_connections_get_all(), gc)) { |
7283 | 2539 OscarData *od = gc->proto_data; |
4230 | 2540 #ifdef NOSSI |
4617 | 2541 aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHDENIED, msg ? msg : _("No reason given.")); |
4230 | 2542 #else |
4889 | 2543 aim_ssi_sendauthreply(od->sess, data->name, 0x00, msg ? msg : _("No reason given.")); |
4230 | 2544 #endif |
4244 | 2545 } |
4337 | 2546 } |
2547 | |
2548 static void gaim_auth_dontgrant_msgprompt(struct name_data *data) { | |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2549 gaim_request_input(data->gc, NULL, _("Authorization Denied Message:"), |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
2550 NULL, _("No reason given."), TRUE, FALSE, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2551 _("OK"), G_CALLBACK(gaim_auth_dontgrant), |
5836 | 2552 _("Cancel"), G_CALLBACK(oscar_free_name_data), |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2553 data); |
3141 | 2554 } |
2555 | |
7023 | 2556 /* When someone sends you buddies */ |
2557 static void gaim_icq_buddyadd(struct name_data *data) { | |
5575 | 2558 GaimConnection *gc = data->gc; |
4244 | 2559 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2560 if (g_list_find(gaim_connections_get_all(), gc)) { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7054
diff
changeset
|
2561 gaim_blist_request_add_buddy(gaim_connection_get_account(gc), data->name, NULL, data->nick); |
4244 | 2562 } |
2563 | |
5836 | 2564 oscar_free_name_data(data); |
3453 | 2565 } |
2566 | |
4075 | 2567 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 | 2568 GaimConnection *gc = sess->aux_data; |
4076 | 2569 gchar **msg1, **msg2; |
2570 GError *err = NULL; | |
6051 | 2571 int i, numtoks; |
4076 | 2572 |
4121 | 2573 if (!args->type || !args->msg || !args->uin) |
2574 return 1; | |
4194 | 2575 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2576 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2577 "Received a channel 4 message of type 0x%02hhx.\n", args->type); |
4076 | 2578 |
2579 /* Split up the message at the delimeter character, then convert each string to UTF-8 */ | |
4173 | 2580 msg1 = g_strsplit(args->msg, "\376", 0); |
6051 | 2581 for (numtoks=0; msg1[numtoks]; numtoks++); |
2582 msg2 = (gchar **)g_malloc((numtoks+1)*sizeof(gchar *)); | |
4076 | 2583 for (i=0; msg1[i]; i++) { |
7478
3c21f3084ff0
[gaim-migrate @ 8091]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7475
diff
changeset
|
2584 gaim_str_strip_cr(msg1[i]); |
4076 | 2585 msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err); |
4800 | 2586 if (err) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2587 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2588 "Error converting a string from ISO-8859-1 to " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2589 "UTF-8 in oscar ICBM channel 4 parsing\n"); |
4800 | 2590 g_error_free(err); |
2591 } | |
4076 | 2592 } |
2593 msg2[i] = NULL; | |
2594 | |
3952 | 2595 switch (args->type) { |
4173 | 2596 case 0x01: { /* MacICQ message or basic offline message */ |
4076 | 2597 if (i >= 1) { |
5556 | 2598 gchar *uin = g_strdup_printf("%u", args->uin); |
4076 | 2599 if (t) { /* This is an offline message */ |
2600 /* I think this timestamp is in UTC, or something */ | |
6982 | 2601 serv_got_im(gc, uin, msg2[0], 0, t); |
4076 | 2602 } else { /* This is a message from MacICQ/Miranda */ |
6982 | 2603 serv_got_im(gc, uin, msg2[0], 0, time(NULL)); |
4076 | 2604 } |
2605 g_free(uin); | |
4075 | 2606 } |
3316 | 2607 } break; |
2608 | |
4173 | 2609 case 0x04: { /* Someone sent you a URL */ |
4076 | 2610 if (i >= 2) { |
7385 | 2611 if (msg2[1] != NULL) { |
2612 gchar *uin = g_strdup_printf("%u", args->uin); | |
2613 gchar *message = g_strdup_printf("<A HREF=\"%s\">%s</A>", | |
2614 msg2[1], | |
2615 (msg2[0] && msg2[0][0]) ? msg2[0] : msg2[1]); | |
2616 serv_got_im(gc, uin, message, 0, time(NULL)); | |
2617 g_free(uin); | |
2618 g_free(message); | |
2619 } | |
3453 | 2620 } |
2621 } break; | |
2622 | |
4173 | 2623 case 0x06: { /* Someone requested authorization */ |
4076 | 2624 if (i >= 6) { |
4230 | 2625 struct name_data *data = g_new(struct name_data, 1); |
5556 | 2626 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
|
2627 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
5556 | 2628 "Received an authorization request from UIN %u\n", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2629 args->uin); |
4076 | 2630 data->gc = gc; |
5556 | 2631 data->name = g_strdup_printf("%u", args->uin); |
4230 | 2632 data->nick = NULL; |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2633 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2634 gaim_request_action(gc, NULL, _("Authorization Request"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2635 dialog_msg, 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2636 _("Authorize"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2637 G_CALLBACK(gaim_auth_grant), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2638 _("Deny"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2639 G_CALLBACK(gaim_auth_dontgrant_msgprompt)); |
4076 | 2640 g_free(dialog_msg); |
2641 } | |
3141 | 2642 } break; |
2643 | |
4173 | 2644 case 0x07: { /* Someone has denied you authorization */ |
4076 | 2645 if (i >= 1) { |
7023 | 2646 gchar *dialog_msg = g_strdup_printf(_("The user %u has denied your request to add them to your buddy 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
|
2647 gaim_notify_info(gc, NULL, _("ICQ authorization denied."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2648 dialog_msg); |
4076 | 2649 g_free(dialog_msg); |
2650 } | |
3141 | 2651 } break; |
2652 | |
4173 | 2653 case 0x08: { /* Someone has granted you authorization */ |
7023 | 2654 gchar *dialog_msg = g_strdup_printf(_("The user %u has granted your request to add them to your buddy list."), args->uin); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2655 gaim_notify_info(gc, NULL, "ICQ authorization accepted.", |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2656 dialog_msg); |
3141 | 2657 g_free(dialog_msg); |
2658 } break; | |
2659 | |
4333 | 2660 case 0x09: { /* Message from the Godly ICQ server itself, I think */ |
2661 if (i >= 5) { | |
2662 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
|
2663 gaim_notify_info(gc, NULL, "ICQ Server Message", dialog_msg); |
4333 | 2664 g_free(dialog_msg); |
2665 } | |
2666 } break; | |
2667 | |
4173 | 2668 case 0x0d: { /* Someone has sent you a pager message from http://www.icq.com/your_uin */ |
4076 | 2669 if (i >= 6) { |
4194 | 2670 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
|
2671 gaim_notify_info(gc, NULL, "ICQ Page", dialog_msg); |
4076 | 2672 g_free(dialog_msg); |
2673 } | |
4075 | 2674 } break; |
2675 | |
4173 | 2676 case 0x0e: { /* Someone has emailed you at your_uin@pager.icq.com */ |
4076 | 2677 if (i >= 6) { |
4308 | 2678 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
|
2679 gaim_notify_info(gc, NULL, "ICQ Email", dialog_msg); |
4076 | 2680 g_free(dialog_msg); |
2681 } | |
4075 | 2682 } break; |
2683 | |
4173 | 2684 case 0x12: { |
3141 | 2685 /* Ack for authorizing/denying someone. Or possibly an ack for sending any system notice */ |
7023 | 2686 /* Someone added you to their buddy list? */ |
3141 | 2687 } break; |
2688 | |
7023 | 2689 case 0x13: { /* Someone has sent you some ICQ buddies */ |
7631 | 2690 guint i, num; |
3453 | 2691 gchar **text; |
4173 | 2692 text = g_strsplit(args->msg, "\376", 0); |
3453 | 2693 if (text) { |
2694 num = 0; | |
2695 for (i=0; i<strlen(text[0]); i++) | |
2696 num = num*10 + text[0][i]-48; | |
2697 for (i=0; i<num; i++) { | |
4230 | 2698 struct name_data *data = g_new(struct name_data, 1); |
7023 | 2699 gchar *message = g_strdup_printf(_("ICQ user %u has sent you a buddy: %s (%s)"), args->uin, text[i*2+2], text[i*2+1]); |
3453 | 2700 data->gc = gc; |
4790 | 2701 data->name = g_strdup(text[i*2+1]); |
2702 data->nick = g_strdup(text[i*2+2]); | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2703 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2704 gaim_request_action(gc, NULL, message, |
7023 | 2705 _("Do you want to add this buddy " |
2706 "to your buddy list?"), | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2707 0, data, 2, |
7023 | 2708 _("Add"), G_CALLBACK(gaim_icq_buddyadd), |
5836 | 2709 _("Decline"), G_CALLBACK(oscar_free_name_data)); |
3453 | 2710 g_free(message); |
2711 } | |
2712 g_strfreev(text); | |
2713 } | |
2714 } break; | |
2715 | |
7023 | 2716 case 0x1a: { /* Someone has sent you a greeting card or requested buddies? */ |
3453 | 2717 /* This is boring and silly. */ |
2718 } break; | |
2719 | |
3141 | 2720 default: { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2721 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2722 "Received a channel 4 message of unknown type " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2723 "(type 0x%02hhx).\n", args->type); |
3141 | 2724 } break; |
2725 } | |
2726 | |
4076 | 2727 g_strfreev(msg1); |
2728 g_strfreev(msg2); | |
2729 | |
3141 | 2730 return 1; |
2731 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2732 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2733 static int gaim_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...) { |
4200 | 2734 fu16_t channel; |
2735 int ret = 0; | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2736 aim_userinfo_t *userinfo; |
2086 | 2737 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2738 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2739 va_start(ap, fr); |
4200 | 2740 channel = (fu16_t)va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2741 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 2742 |
3141 | 2743 switch (channel) { |
2744 case 1: { /* standard message */ | |
2745 struct aim_incomingim_ch1_args *args; | |
2746 args = va_arg(ap, struct aim_incomingim_ch1_args *); | |
2747 ret = incomingim_chan1(sess, fr->conn, userinfo, args); | |
2748 } break; | |
2749 | |
2750 case 2: { /* rendevous */ | |
2751 struct aim_incomingim_ch2_args *args; | |
2752 args = va_arg(ap, struct aim_incomingim_ch2_args *); | |
2753 ret = incomingim_chan2(sess, fr->conn, userinfo, args); | |
2754 } break; | |
2755 | |
2756 case 4: { /* ICQ */ | |
2757 struct aim_incomingim_ch4_args *args; | |
2758 args = va_arg(ap, struct aim_incomingim_ch4_args *); | |
4075 | 2759 ret = incomingim_chan4(sess, fr->conn, userinfo, args, 0); |
3141 | 2760 } break; |
2761 | |
2762 default: { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2763 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2764 "ICBM received on unsupported channel (channel " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2765 "0x%04hx).", channel); |
3141 | 2766 } break; |
2086 | 2767 } |
2768 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2769 va_end(ap); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2770 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2771 return ret; |
2086 | 2772 } |
2773 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2774 static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { |
5420 | 2775 char *buf; |
2086 | 2776 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2777 fu16_t chan, nummissed, reason; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2778 aim_userinfo_t *userinfo; |
2086 | 2779 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2780 va_start(ap, fr); |
4200 | 2781 chan = (fu16_t)va_arg(ap, unsigned int); |
2782 userinfo = va_arg(ap, aim_userinfo_t *); | |
2783 nummissed = (fu16_t)va_arg(ap, unsigned int); | |
2784 reason = (fu16_t)va_arg(ap, unsigned int); | |
2086 | 2785 va_end(ap); |
2786 | |
2787 switch(reason) { | |
5420 | 2788 case 0: /* Invalid (0) */ |
2789 buf = g_strdup_printf( | |
2790 ngettext( | |
4276 | 2791 "You missed %hu message from %s because it was invalid.", |
2792 "You missed %hu messages from %s because they were invalid.", | |
2793 nummissed), | |
4282 | 2794 nummissed, |
2795 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2796 break; |
5420 | 2797 case 1: /* Message too large */ |
2798 buf = g_strdup_printf( | |
2799 ngettext( | |
4276 | 2800 "You missed %hu message from %s because it was too large.", |
2801 "You missed %hu messages from %s because they were too large.", | |
2802 nummissed), | |
4282 | 2803 nummissed, |
2804 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2805 break; |
5420 | 2806 case 2: /* Rate exceeded */ |
2807 buf = g_strdup_printf( | |
2808 ngettext( | |
4276 | 2809 "You missed %hu message from %s because the rate limit has been exceeded.", |
2810 "You missed %hu messages from %s because the rate limit has been exceeded.", | |
2811 nummissed), | |
4282 | 2812 nummissed, |
2813 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2814 break; |
5420 | 2815 case 3: /* Evil Sender */ |
2816 buf = g_strdup_printf( | |
2817 ngettext( | |
4276 | 2818 "You missed %hu message from %s because he/she was too evil.", |
2819 "You missed %hu messages from %s because he/she was too evil.", | |
2820 nummissed), | |
4282 | 2821 nummissed, |
2822 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2823 break; |
5420 | 2824 case 4: /* Evil Receiver */ |
2825 buf = g_strdup_printf( | |
2826 ngettext( | |
4276 | 2827 "You missed %hu message from %s because you are too evil.", |
2828 "You missed %hu messages from %s because you are too evil.", | |
2829 nummissed), | |
4282 | 2830 nummissed, |
2831 userinfo->sn); | |
2086 | 2832 break; |
2833 default: | |
5420 | 2834 buf = g_strdup_printf( |
2835 ngettext( | |
4276 | 2836 "You missed %hu message from %s for an unknown reason.", |
2837 "You missed %hu messages from %s for an unknown reason.", | |
2838 nummissed), | |
4282 | 2839 nummissed, |
2840 userinfo->sn); | |
2086 | 2841 break; |
2842 } | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2843 gaim_notify_error(sess->aux_data, NULL, buf, NULL); |
5420 | 2844 g_free(buf); |
2086 | 2845 |
2846 return 1; | |
2847 } | |
2848 | |
3212 | 2849 static char *gaim_icq_status(int state) { |
2850 /* Make a cute little string that shows the status of the dude or dudet */ | |
2851 if (state & AIM_ICQ_STATE_CHAT) | |
4342 | 2852 return g_strdup_printf(_("Free For Chat")); |
3212 | 2853 else if (state & AIM_ICQ_STATE_DND) |
4342 | 2854 return g_strdup_printf(_("Do Not Disturb")); |
3212 | 2855 else if (state & AIM_ICQ_STATE_OUT) |
4342 | 2856 return g_strdup_printf(_("Not Available")); |
3212 | 2857 else if (state & AIM_ICQ_STATE_BUSY) |
4342 | 2858 return g_strdup_printf(_("Occupied")); |
3212 | 2859 else if (state & AIM_ICQ_STATE_AWAY) |
4342 | 2860 return g_strdup_printf(_("Away")); |
3212 | 2861 else if (state & AIM_ICQ_STATE_WEBAWARE) |
4342 | 2862 return g_strdup_printf(_("Web Aware")); |
3212 | 2863 else if (state & AIM_ICQ_STATE_INVISIBLE) |
4342 | 2864 return g_strdup_printf(_("Invisible")); |
3212 | 2865 else |
4342 | 2866 return g_strdup_printf(_("Online")); |
3212 | 2867 } |
2868 | |
4194 | 2869 static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const char *cookie) { |
5575 | 2870 GaimConnection *gc = sess->aux_data; |
7283 | 2871 OscarData *od = gc->proto_data; |
4617 | 2872 |
2873 /* BBB */ | |
3630 | 2874 switch (reason) { |
4151 | 2875 case 3: { /* Decline sendfile. */ |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2876 GaimXfer *xfer; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2877 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2878 "AAA - Other user declined file transfer\n"); |
4617 | 2879 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
|
2880 gaim_xfer_cancel_remote(xfer); |
4151 | 2881 } break; |
2882 | |
2883 default: { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2884 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2885 "Received an unknown rendezvous client auto-response " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2886 "from %s. Type 0x%04hx\n", who, reason); |
4151 | 2887 } |
3630 | 2888 |
2889 } | |
2890 | |
2891 return 0; | |
2892 } | |
2893 | |
4194 | 2894 static int gaim_parse_clientauto_ch4(aim_session_t *sess, char *who, fu16_t reason, fu32_t state, char *msg) { |
5575 | 2895 GaimConnection *gc = sess->aux_data; |
4151 | 2896 |
2897 switch(reason) { | |
2898 case 0x0003: { /* Reply from an ICQ status message request */ | |
2899 char *status_msg = gaim_icq_status(state); | |
2900 char *dialog_msg, **splitmsg; | |
2901 | |
2902 /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ | |
2903 splitmsg = g_strsplit(msg, "\r\n", 0); | |
2904 | |
7011 | 2905 dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<HR>%s"), who, status_msg, g_strjoinv("<BR>", splitmsg)); |
7032 | 2906 gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL, dialog_msg, NULL, NULL); |
4151 | 2907 |
2908 g_free(status_msg); | |
2909 g_free(dialog_msg); | |
2910 g_strfreev(splitmsg); | |
2911 } break; | |
2912 | |
2913 default: { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2914 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2915 "Received an unknown client auto-response from %s. " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2916 "Type 0x%04hx\n", who, reason); |
4151 | 2917 } break; |
2918 } /* end of switch */ | |
2919 | |
2920 return 0; | |
2921 } | |
2922 | |
3212 | 2923 static int gaim_parse_clientauto(aim_session_t *sess, aim_frame_t *fr, ...) { |
2924 va_list ap; | |
2925 fu16_t chan, reason; | |
2926 char *who; | |
2927 | |
2928 va_start(ap, fr); | |
4200 | 2929 chan = (fu16_t)va_arg(ap, unsigned int); |
3212 | 2930 who = va_arg(ap, char *); |
4200 | 2931 reason = (fu16_t)va_arg(ap, unsigned int); |
3212 | 2932 |
3952 | 2933 if (chan == 0x0002) { /* File transfer declined */ |
3630 | 2934 char *cookie = va_arg(ap, char *); |
4151 | 2935 return gaim_parse_clientauto_ch2(sess, who, reason, cookie); |
3952 | 2936 } else if (chan == 0x0004) { /* ICQ message */ |
4200 | 2937 fu32_t state = 0; |
4151 | 2938 char *msg = NULL; |
2939 if (reason == 0x0003) { | |
4200 | 2940 state = va_arg(ap, fu32_t); |
4151 | 2941 msg = va_arg(ap, char *); |
2942 } | |
2943 return gaim_parse_clientauto_ch4(sess, who, reason, state, msg); | |
2944 } | |
3952 | 2945 |
3212 | 2946 va_end(ap); |
2947 | |
2948 return 1; | |
2949 } | |
2950 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2951 static int gaim_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2952 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2953 fu16_t reason; |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2954 char *m; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2955 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2956 va_start(ap, fr); |
4199 | 2957 reason = (fu16_t) va_arg(ap, unsigned int); |
2086 | 2958 va_end(ap); |
2959 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2960 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2961 "snac threw error (reason 0x%04hx: %s)\n", reason, |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2962 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown"); |
2086 | 2963 |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2964 m = g_strdup_printf(_("SNAC threw error: %s\n"), |
5411 | 2965 reason < msgerrreasonlen ? _(msgerrreason[reason]) : _("Unknown error")); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2966 gaim_notify_error(sess->aux_data, NULL, m, NULL); |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2967 g_free(m); |
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2968 |
2086 | 2969 return 1; |
2970 } | |
2971 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2972 static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
4617 | 2973 #if 0 |
5575 | 2974 GaimConnection *gc = sess->aux_data; |
7283 | 2975 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2976 GaimXfer *xfer; |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2977 #endif |
4617 | 2978 va_list ap; |
2979 fu16_t reason; | |
2980 char *data, *buf; | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2981 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2982 va_start(ap, fr); |
4617 | 2983 reason = (fu16_t)va_arg(ap, unsigned int); |
3752 | 2984 data = va_arg(ap, char *); |
2086 | 2985 va_end(ap); |
2986 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2987 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2988 "Message error with data %s and reason %hu\n", data, reason); |
4617 | 2989 |
2990 /* BBB */ | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2991 #if 0 |
4617 | 2992 /* If this was a file transfer request, data is a cookie */ |
2993 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
|
2994 gaim_xfer_cancel_remote(xfer); |
3630 | 2995 return 1; |
2996 } | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2997 #endif |
3630 | 2998 |
4617 | 2999 /* Data is assumed to be the destination sn */ |
3000 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
|
3001 gaim_notify_error(sess->aux_data, NULL, buf, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3002 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); |
4617 | 3003 g_free(buf); |
2086 | 3004 |
3005 return 1; | |
3006 } | |
3007 | |
3595 | 3008 static int gaim_parse_mtn(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3009 GaimConnection *gc = sess->aux_data; |
3595 | 3010 va_list ap; |
3011 fu16_t type1, type2; | |
3012 char *sn; | |
3013 | |
3014 va_start(ap, fr); | |
4199 | 3015 type1 = (fu16_t) va_arg(ap, unsigned int); |
3595 | 3016 sn = va_arg(ap, char *); |
4199 | 3017 type2 = (fu16_t) va_arg(ap, unsigned int); |
3595 | 3018 va_end(ap); |
3019 | |
3020 switch (type2) { | |
3021 case 0x0000: { /* Text has been cleared */ | |
3022 serv_got_typing_stopped(gc, sn); | |
3023 } break; | |
3024 | |
3025 case 0x0001: { /* Paused typing */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
3026 serv_got_typing(gc, sn, 0, GAIM_TYPED); |
3595 | 3027 } break; |
3028 | |
3029 case 0x0002: { /* Typing */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
3030 serv_got_typing(gc, sn, 0, GAIM_TYPING); |
3595 | 3031 } break; |
3032 | |
3033 default: { | |
5435 | 3034 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 | 3035 } break; |
3036 } | |
3037 | |
3038 return 1; | |
3039 } | |
3040 | |
7141 | 3041 /* |
3042 * We get this error when there was an error in the locate family. This | |
7259 | 3043 * happens when you request info of someone who is offline. |
7141 | 3044 */ |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3045 static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
7259 | 3046 gchar *buf; |
2086 | 3047 va_list ap; |
5420 | 3048 fu16_t reason; |
2086 | 3049 char *destn; |
3050 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3051 va_start(ap, fr); |
4199 | 3052 reason = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3053 destn = va_arg(ap, char *); |
3054 va_end(ap); | |
3055 | |
7781 | 3056 if (destn == NULL) |
7793 | 3057 return 1; |
3058 | |
3059 buf = g_strdup_printf(_("User information for %s unavailable:"), destn); | |
7781 | 3060 |
3061 gaim_notify_error(sess->aux_data, NULL, buf, | |
3062 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); | |
3063 g_free(buf); | |
2086 | 3064 |
3065 return 1; | |
3066 } | |
3067 | |
6982 | 3068 #if 0 |
2086 | 3069 static char *images(int flags) { |
3070 static char buf[1024]; | |
3101 | 3071 g_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s", |
2679 | 3072 (flags & AIM_FLAG_ACTIVEBUDDY) ? "<IMG SRC=\"ab_icon.gif\">" : "", |
2086 | 3073 (flags & AIM_FLAG_UNCONFIRMED) ? "<IMG SRC=\"dt_icon.gif\">" : "", |
3074 (flags & AIM_FLAG_AOL) ? "<IMG SRC=\"aol_icon.gif\">" : "", | |
3101 | 3075 (flags & AIM_FLAG_ICQ) ? "<IMG SRC=\"icq_icon.gif\">" : "", |
2086 | 3076 (flags & AIM_FLAG_ADMINISTRATOR) ? "<IMG SRC=\"admin_icon.gif\">" : "", |
3079 | 3077 (flags & AIM_FLAG_FREE) ? "<IMG SRC=\"free_icon.gif\">" : "", |
3078 (flags & AIM_FLAG_WIRELESS) ? "<IMG SRC=\"wireless_icon.gif\">" : ""); | |
2086 | 3079 return buf; |
3080 } | |
6982 | 3081 #endif |
3101 | 3082 |
2920 | 3083 static char *caps_string(guint caps) |
3084 { | |
3085 static char buf[512], *tmp; | |
3086 int count = 0, i = 0; | |
3087 guint bit = 1; | |
4742 | 3088 |
3089 if (!caps) { | |
4744 | 3090 return NULL; |
6318 | 3091 } else while (bit <= AIM_CAPS_LAST) { |
2920 | 3092 if (bit & caps) { |
3093 switch (bit) { | |
6871 | 3094 case AIM_CAPS_BUDDYICON: |
2920 | 3095 tmp = _("Buddy Icon"); |
3096 break; | |
8092 | 3097 case AIM_CAPS_TALK: |
2920 | 3098 tmp = _("Voice"); |
3099 break; | |
6871 | 3100 case AIM_CAPS_DIRECTIM: |
7141 | 3101 tmp = _("AIM Direct IM"); |
2920 | 3102 break; |
6871 | 3103 case AIM_CAPS_CHAT: |
2920 | 3104 tmp = _("Chat"); |
3105 break; | |
6871 | 3106 case AIM_CAPS_GETFILE: |
2920 | 3107 tmp = _("Get File"); |
3108 break; | |
6871 | 3109 case AIM_CAPS_SENDFILE: |
2920 | 3110 tmp = _("Send File"); |
3111 break; | |
6871 | 3112 case AIM_CAPS_GAMES: |
3113 case AIM_CAPS_GAMES2: | |
2920 | 3114 tmp = _("Games"); |
3115 break; | |
8092 | 3116 case AIM_CAPS_ADDINS: |
4898 | 3117 tmp = _("Add-Ins"); |
2920 | 3118 break; |
6871 | 3119 case AIM_CAPS_SENDBUDDYLIST: |
2920 | 3120 tmp = _("Send Buddy List"); |
3121 break; | |
7141 | 3122 case AIM_CAPS_ICQ_DIRECT: |
3123 tmp = _("ICQ Direct Connect"); | |
2920 | 3124 break; |
6871 | 3125 case AIM_CAPS_APINFO: |
2920 | 3126 tmp = _("AP User"); |
3127 break; | |
6871 | 3128 case AIM_CAPS_ICQRTF: |
2920 | 3129 tmp = _("ICQ RTF"); |
3130 break; | |
6871 | 3131 case AIM_CAPS_EMPTY: |
2920 | 3132 tmp = _("Nihilist"); |
3133 break; | |
6871 | 3134 case AIM_CAPS_ICQSERVERRELAY: |
2920 | 3135 tmp = _("ICQ Server Relay"); |
3136 break; | |
6871 | 3137 case AIM_CAPS_ICQUTF8OLD: |
3138 tmp = _("Old ICQ UTF8"); | |
2920 | 3139 break; |
6871 | 3140 case AIM_CAPS_TRILLIANCRYPT: |
2920 | 3141 tmp = _("Trillian Encryption"); |
3142 break; | |
6871 | 3143 case AIM_CAPS_ICQUTF8: |
4742 | 3144 tmp = _("ICQ UTF8"); |
3145 break; | |
6318 | 3146 case AIM_CAPS_HIPTOP: |
3147 tmp = _("Hiptop"); | |
3148 break; | |
6871 | 3149 case AIM_CAPS_SECUREIM: |
7334 | 3150 tmp = _("Security Enabled"); |
6871 | 3151 break; |
7582 | 3152 case AIM_CAPS_VIDEO: |
3153 tmp = _("Video Chat"); | |
3154 break; | |
8092 | 3155 /* Not actually sure about this one... WinAIM doesn't show anything */ |
7945 | 3156 case AIM_CAPS_ICHATAV: |
3157 tmp = _("iChat AV"); | |
3158 break; | |
8092 | 3159 case AIM_CAPS_LIVEVIDEO: |
3160 tmp = _("Live Video"); | |
3161 break; | |
3162 case AIM_CAPS_CAMERA: | |
3163 tmp = _("Camera"); | |
3164 break; | |
2920 | 3165 default: |
3166 tmp = NULL; | |
3167 break; | |
3168 } | |
3169 if (tmp) | |
3170 i += g_snprintf(buf + i, sizeof(buf) - i, "%s%s", (count ? ", " : ""), | |
3171 tmp); | |
3172 count++; | |
3173 } | |
3174 bit <<= 1; | |
3175 } | |
4744 | 3176 return buf; |
2920 | 3177 } |
3178 | |
7011 | 3179 static int gaim_parse_userinfo(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3180 GaimConnection *gc = sess->aux_data; |
7011 | 3181 GString *text; |
7162 | 3182 gchar *info_utf8 = NULL, *away_utf8 = NULL; |
3183 const char *final = NULL; | |
4791 | 3184 va_list ap; |
7011 | 3185 aim_userinfo_t *userinfo; |
2086 | 3186 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3187 va_start(ap, fr); |
7011 | 3188 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 3189 va_end(ap); |
3190 | |
7011 | 3191 text = g_string_new(""); |
3192 g_string_append_printf(text, _("Username: <b>%s</b><br>\n"), userinfo->sn); | |
3193 g_string_append_printf(text, _("Warning Level: <b>%d%%</b><br>\n"), (int)((userinfo->warnlevel/10.0) + 0.5)); | |
3194 | |
3195 if (userinfo->present & AIM_USERINFO_PRESENT_ONLINESINCE) | |
3196 g_string_append_printf(text, _("Online Since: <b>%s</b><br>\n"), | |
3197 asctime(localtime((time_t *)&userinfo->onlinesince))); | |
3198 | |
3199 if (userinfo->present & AIM_USERINFO_PRESENT_MEMBERSINCE) | |
3200 g_string_append_printf(text, _("Member Since: <b>%s</b><br>\n"), | |
3201 asctime(localtime((time_t *)&userinfo->membersince))); | |
3202 | |
3203 if (userinfo->present & AIM_USERINFO_PRESENT_IDLE) { | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
3204 gchar *itime = gaim_str_seconds_to_string(userinfo->idletime*60); |
7011 | 3205 g_string_append_printf(text, _("Idle: <b>%s</b>"), itime); |
4426 | 3206 g_free(itime); |
2993 | 3207 } else |
7011 | 3208 g_string_append_printf(text, _("Idle: <b>Active</b>")); |
3209 | |
3210 if ((userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) { | |
3211 away_utf8 = oscar_encoding_to_utf8(userinfo->away_encoding, userinfo->away, userinfo->away_len); | |
3212 if (away_utf8 != NULL) { | |
7129 | 3213 g_string_append_printf(text, "<hr>%s", away_utf8); |
7011 | 3214 g_free(away_utf8); |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3215 } |
7011 | 3216 } |
3217 | |
3218 if ((userinfo->info_len > 0) && (userinfo->info != NULL) && (userinfo->info_encoding != NULL)) { | |
3219 info_utf8 = oscar_encoding_to_utf8(userinfo->info_encoding, userinfo->info, userinfo->info_len); | |
3220 if (info_utf8 != NULL) { | |
7129 | 3221 g_string_append_printf(text, "<hr>%s", info_utf8); |
7011 | 3222 g_free(info_utf8); |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3223 } |
7011 | 3224 } |
3225 | |
7164 | 3226 final = gaim_str_sub_away_formatters(text->str, gaim_account_get_username(gaim_connection_get_account(gc))); |
7011 | 3227 g_string_free(text, TRUE); |
7091 | 3228 gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL, final, NULL, NULL); |
4151 | 3229 |
2086 | 3230 return 1; |
3231 } | |
3232 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3233 static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3234 char *msg; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3235 fu16_t id; |
2086 | 3236 va_list ap; |
3237 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3238 va_start(ap, fr); |
4199 | 3239 id = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3240 msg = va_arg(ap, char *); |
3241 va_end(ap); | |
3242 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3243 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3244 "MOTD: %s (%hu)\n", msg ? msg : "Unknown", id); |
2092
59b0377d18aa
[gaim-migrate @ 2102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
3245 if (id < 4) |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3246 gaim_notify_warning(sess->aux_data, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3247 _("Your AIM connection may be lost."), NULL); |
2086 | 3248 |
3249 return 1; | |
3250 } | |
3251 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3252 static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3253 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3254 fu16_t type; |
5575 | 3255 GaimConnection *gc = sess->aux_data; |
7283 | 3256 OscarData *od = (OscarData *)gc->proto_data; |
2086 | 3257 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3258 va_start(ap, fr); |
4199 | 3259 type = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3260 |
3261 switch(type) { | |
3262 case 0x0002: { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3263 fu8_t maxrooms; |
2086 | 3264 struct aim_chat_exchangeinfo *exchanges; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3265 int exchangecount, i; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3266 |
4199 | 3267 maxrooms = (fu8_t) va_arg(ap, unsigned int); |
2086 | 3268 exchangecount = va_arg(ap, int); |
3269 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *); | |
3270 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3271 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3272 "chat info: Chat Rights:\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3273 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3274 "chat info: \tMax Concurrent Rooms: %hhd\n", maxrooms); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3275 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3276 "chat info: \tExchange List: (%d total)\n", exchangecount); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3277 for (i = 0; i < exchangecount; i++) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3278 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3279 "chat info: \t\t%hu %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3280 exchanges[i].number, exchanges[i].name ? exchanges[i].name : ""); |
4617 | 3281 while (od->create_rooms) { |
3282 struct create_room *cr = od->create_rooms->data; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3283 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3284 "creating room %s\n", cr->name); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3285 aim_chatnav_createroom(sess, fr->conn, cr->name, cr->exchange); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3286 g_free(cr->name); |
4617 | 3287 od->create_rooms = g_slist_remove(od->create_rooms, cr); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3288 g_free(cr); |
2086 | 3289 } |
3290 } | |
3291 break; | |
3292 case 0x0008: { | |
3293 char *fqcn, *name, *ck; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3294 fu16_t instance, flags, maxmsglen, maxoccupancy, unknown, exchange; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3295 fu8_t createperms; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3296 fu32_t createtime; |
2086 | 3297 |
3298 fqcn = va_arg(ap, char *); | |
4200 | 3299 instance = (fu16_t)va_arg(ap, unsigned int); |
3300 exchange = (fu16_t)va_arg(ap, unsigned int); | |
3301 flags = (fu16_t)va_arg(ap, unsigned int); | |
3302 createtime = va_arg(ap, fu32_t); | |
3303 maxmsglen = (fu16_t)va_arg(ap, unsigned int); | |
3304 maxoccupancy = (fu16_t)va_arg(ap, unsigned int); | |
3305 createperms = (fu8_t)va_arg(ap, unsigned int); | |
3306 unknown = (fu16_t)va_arg(ap, unsigned int); | |
3307 name = va_arg(ap, char *); | |
3308 ck = va_arg(ap, char *); | |
4194 | 3309 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3310 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
5556 | 3311 "created room: %s %hu %hu %hu %u %hu %hu %hhu %hu %s %s\n", |
2086 | 3312 fqcn, |
3313 exchange, instance, flags, | |
3314 createtime, | |
3315 maxmsglen, maxoccupancy, createperms, unknown, | |
3316 name, ck); | |
4617 | 3317 aim_chat_join(od->sess, od->conn, exchange, ck, instance); |
2086 | 3318 } |
3319 break; | |
3320 default: | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3321 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3322 "chatnav info: unknown type (%04hx)\n", type); |
2086 | 3323 break; |
3324 } | |
4194 | 3325 |
3326 va_end(ap); | |
3327 | |
2086 | 3328 return 1; |
3329 } | |
3330 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3331 static int gaim_conv_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3332 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3333 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3334 aim_userinfo_t *info; |
5575 | 3335 GaimConnection *g = sess->aux_data; |
2086 | 3336 |
3337 struct chat_connection *c = NULL; | |
3338 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3339 va_start(ap, fr); |
2086 | 3340 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3341 info = va_arg(ap, aim_userinfo_t *); |
2086 | 3342 va_end(ap); |
3343 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3344 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 3345 if (!c) |
3346 return 1; | |
3347 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3348 for (i = 0; i < count; i++) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3349 gaim_conv_chat_add_user(GAIM_CONV_CHAT(c->cnv), info[i].sn, NULL); |
2086 | 3350 |
3351 return 1; | |
3352 } | |
3353 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3354 static int gaim_conv_chat_leave(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++) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3372 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(c->cnv), info[i].sn, NULL); |
2086 | 3373 |
3374 return 1; | |
3375 } | |
3376 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3377 static int gaim_conv_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
|
3378 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3379 aim_userinfo_t *userinfo; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3380 struct aim_chat_roominfo *roominfo; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3381 char *roomname; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3382 int usercount; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3383 char *roomdesc; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3384 fu16_t unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3385 fu32_t creationtime; |
5575 | 3386 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3387 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
|
3388 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3389 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3390 roominfo = va_arg(ap, struct aim_chat_roominfo *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3391 roomname = va_arg(ap, char *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3392 usercount= va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3393 userinfo = va_arg(ap, aim_userinfo_t *); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3394 roomdesc = va_arg(ap, char *); |
4200 | 3395 unknown_c9 = (fu16_t)va_arg(ap, unsigned int); |
3396 creationtime = va_arg(ap, fu32_t); | |
3397 maxmsglen = (fu16_t)va_arg(ap, unsigned int); | |
3398 unknown_d2 = (fu16_t)va_arg(ap, unsigned int); | |
3399 unknown_d5 = (fu16_t)va_arg(ap, unsigned int); | |
3400 maxvisiblemsglen = (fu16_t)va_arg(ap, unsigned int); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3401 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3402 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3403 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3404 "inside chat_info_update (maxmsglen = %hu, maxvislen = %hu)\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3405 maxmsglen, maxvisiblemsglen); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3406 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3407 ccon->maxlen = maxmsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3408 ccon->maxvis = maxvisiblemsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3409 |
2086 | 3410 return 1; |
3411 } | |
3412 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3413 static int gaim_conv_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3414 GaimConnection *gc = sess->aux_data; |
2086 | 3415 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3416 aim_userinfo_t *info; |
8219 | 3417 GError *err = NULL; |
2086 | 3418 char *msg; |
8219 | 3419 char *tmp; |
3420 int len; | |
3421 char *charset; | |
3422 int convlen; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3423 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); |
2086 | 3424 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3425 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3426 info = va_arg(ap, aim_userinfo_t *); |
8219 | 3427 len = va_arg(ap, int); |
4194 | 3428 msg = va_arg(ap, char *); |
8219 | 3429 charset = va_arg(ap, char *); |
4194 | 3430 va_end(ap); |
2086 | 3431 |
8219 | 3432 if (charset) { |
3433 if (strcmp(charset, "unicode-2-0") == 0) | |
3434 charset = "UCS-2BE"; | |
3435 } else { | |
3436 charset = "iso-8859-1"; | |
3437 } | |
3438 | |
3439 tmp = g_convert(msg, len, "UTF-8", charset, NULL, &convlen, &err); | |
3440 | |
3441 if (err) { | |
3442 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
3443 "Unicode Chat conversion: %s\n", err->message); | |
3444 tmp = g_strdup(_("(There was an error receiving this message)")); | |
3445 g_error_free(err); | |
3446 } | |
3447 | |
3448 serv_got_chat_in(gc, ccon->id, info->sn, 0, tmp, time((time_t)NULL)); | |
3449 g_free(tmp); | |
2086 | 3450 |
3451 return 1; | |
3452 } | |
3453 | |
3694 | 3454 static int gaim_email_parseupdate(aim_session_t *sess, aim_frame_t *fr, ...) { |
3455 va_list ap; | |
5575 | 3456 GaimConnection *gc = sess->aux_data; |
3694 | 3457 struct aim_emailinfo *emailinfo; |
3725 | 3458 int havenewmail; |
7297 | 3459 char *alertitle, *alerturl; |
3694 | 3460 |
3461 va_start(ap, fr); | |
3462 emailinfo = va_arg(ap, struct aim_emailinfo *); | |
3725 | 3463 havenewmail = va_arg(ap, int); |
7301 | 3464 alertitle = va_arg(ap, char *); |
3465 alerturl = va_arg(ap, char *); | |
3694 | 3466 va_end(ap); |
3467 | |
5628 | 3468 if (emailinfo && gaim_account_get_check_mail(gc->account)) { |
5575 | 3469 gchar *to = g_strdup_printf("%s@%s", gaim_account_get_username(gaim_connection_get_account(gc)), emailinfo->domain); |
5542 | 3470 if (emailinfo->unread && havenewmail) |
3471 gaim_notify_emails(gc, emailinfo->nummsgs, FALSE, NULL, NULL, (const char **)&to, (const char **)&emailinfo->url, NULL, NULL); | |
5537 | 3472 g_free(to); |
3694 | 3473 } |
7297 | 3474 |
7301 | 3475 if (alertitle) |
7313 | 3476 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Got an alert '%s' %s\n", alertitle, alerturl ? alerturl : ""); |
3694 | 3477 |
3478 return 1; | |
3479 } | |
3480 | |
4804 | 3481 static int gaim_icon_error(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3482 GaimConnection *gc = sess->aux_data; |
7283 | 3483 OscarData *od = gc->proto_data; |
4804 | 3484 char *sn; |
3485 | |
3486 sn = od->requesticon->data; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3487 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3488 "removing %s from hash table\n", sn); |
4804 | 3489 od->requesticon = g_slist_remove(od->requesticon, sn); |
3490 free(sn); | |
3491 | |
3492 if (od->icontimer) | |
3493 g_source_remove(od->icontimer); | |
3494 od->icontimer = g_timeout_add(500, gaim_icon_timerfunc, gc); | |
3495 | |
3496 return 1; | |
3497 } | |
3498 | |
3499 static int gaim_icon_parseicon(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 3500 GaimConnection *gc = sess->aux_data; |
7283 | 3501 OscarData *od = gc->proto_data; |
4804 | 3502 GSList *cur; |
3503 va_list ap; | |
3504 char *sn; | |
4853 | 3505 fu8_t *iconcsum, *icon; |
3506 fu16_t iconcsumlen, iconlen; | |
4804 | 3507 |
3508 va_start(ap, fr); | |
3509 sn = va_arg(ap, char *); | |
4853 | 3510 iconcsum = va_arg(ap, fu8_t *); |
3511 iconcsumlen = va_arg(ap, int); | |
4804 | 3512 icon = va_arg(ap, fu8_t *); |
3513 iconlen = va_arg(ap, int); | |
3514 va_end(ap); | |
3515 | |
4853 | 3516 if (iconlen > 0) { |
3517 char *b16; | |
6695 | 3518 GaimBuddy *b = gaim_find_buddy(gc->account, sn); |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
3519 gaim_buddy_icons_set_for_user(gaim_connection_get_account(gc), |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
3520 sn, icon, iconlen); |
7106
db6bd3e794d8
[gaim-migrate @ 7671]
Christian Hammond <chipx86@chipx86.com>
parents:
7098
diff
changeset
|
3521 b16 = gaim_base16_encode(iconcsum, iconcsumlen); |
5129 | 3522 if (b16) { |
7693 | 3523 gaim_blist_node_set_string((GaimBlistNode*)b, "icon_checksum", b16); |
5129 | 3524 gaim_blist_save(); |
7162 | 3525 g_free(b16); |
5129 | 3526 } |
4853 | 3527 } |
4804 | 3528 |
3529 cur = od->requesticon; | |
3530 while (cur) { | |
3531 char *cursn = cur->data; | |
3532 if (!aim_sncmp(cursn, sn)) { | |
3533 od->requesticon = g_slist_remove(od->requesticon, cursn); | |
3534 free(cursn); | |
3535 cur = od->requesticon; | |
3536 } else | |
3537 cur = cur->next; | |
3538 } | |
3539 | |
3540 if (od->icontimer) | |
3541 g_source_remove(od->icontimer); | |
3542 od->icontimer = g_timeout_add(250, gaim_icon_timerfunc, gc); | |
3543 | |
3544 return 1; | |
3545 } | |
3546 | |
3547 static gboolean gaim_icon_timerfunc(gpointer data) { | |
5575 | 3548 GaimConnection *gc = data; |
7283 | 3549 OscarData *od = gc->proto_data; |
7011 | 3550 aim_userinfo_t *userinfo; |
4804 | 3551 aim_conn_t *conn; |
3552 | |
3553 conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON); | |
5892 | 3554 if (!conn) { |
3555 if (!od->iconconnecting) { | |
3556 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); | |
3557 od->iconconnecting = TRUE; | |
3558 } | |
4804 | 3559 return FALSE; |
3560 } | |
3561 | |
5842 | 3562 if (od->set_icon) { |
6039 | 3563 struct stat st; |
3564 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); | |
3565 if (iconfile == NULL) { | |
3566 /* Set an empty icon, or something */ | |
3567 } else if (!stat(iconfile, &st)) { | |
3568 char *buf = g_malloc(st.st_size); | |
3569 FILE *file = fopen(iconfile, "rb"); | |
3570 if (file) { | |
3571 fread(buf, 1, st.st_size, file); | |
3572 fclose(file); | |
3573 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
3574 "Uploading icon to icon server\n"); | |
6879 | 3575 aim_bart_upload(od->sess, buf, st.st_size); |
5842 | 3576 } else |
3577 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
6039 | 3578 "Can't open buddy icon file!\n"); |
3579 g_free(buf); | |
3580 } else { | |
3581 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
3582 "Can't stat buddy icon file!\n"); | |
5842 | 3583 } |
3584 od->set_icon = FALSE; | |
3585 } | |
3586 | |
3587 if (!od->requesticon) { | |
3588 gaim_debug(GAIM_DEBUG_MISC, "oscar", | |
3589 "no more icons to request\n"); | |
3590 return FALSE; | |
3591 } | |
3592 | |
7045 | 3593 userinfo = aim_locate_finduserinfo(od->sess, (char *)od->requesticon->data); |
7011 | 3594 if ((userinfo != NULL) && (userinfo->iconcsumlen > 0)) { |
3595 aim_bart_request(od->sess, od->requesticon->data, userinfo->iconcsum, userinfo->iconcsumlen); | |
4804 | 3596 return FALSE; |
3597 } else { | |
3598 char *sn = od->requesticon->data; | |
3599 od->requesticon = g_slist_remove(od->requesticon, sn); | |
3600 free(sn); | |
3601 } | |
3602 | |
3603 return TRUE; | |
3604 } | |
3605 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3606 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3607 * 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
|
3608 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3609 static int gaim_parse_msgack(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3610 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3611 fu16_t type; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3612 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3613 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3614 va_start(ap, fr); |
4199 | 3615 type = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3616 sn = va_arg(ap, char *); |
3617 va_end(ap); | |
3618 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3619 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Sent message to %s.\n", sn); |
2086 | 3620 |
3621 return 1; | |
3622 } | |
3623 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3624 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
|
3625 static const char *codes[5] = { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3626 "invalid", |
4194 | 3627 "change", |
3628 "warning", | |
3629 "limit", | |
3630 "limit cleared", | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3631 }; |
2086 | 3632 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3633 fu16_t code, rateclass; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3634 fu32_t windowsize, clear, alert, limit, disconnect, currentavg, maxavg; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3635 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3636 va_start(ap, fr); |
4200 | 3637 code = (fu16_t)va_arg(ap, unsigned int); |
3638 rateclass= (fu16_t)va_arg(ap, unsigned int); | |
3639 windowsize = va_arg(ap, fu32_t); | |
3640 clear = va_arg(ap, fu32_t); | |
3641 alert = va_arg(ap, fu32_t); | |
3642 limit = va_arg(ap, fu32_t); | |
3643 disconnect = va_arg(ap, fu32_t); | |
3644 currentavg = va_arg(ap, fu32_t); | |
3645 maxavg = va_arg(ap, fu32_t); | |
2086 | 3646 va_end(ap); |
3647 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3648 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
5556 | 3649 "rate %s (param ID 0x%04hx): curavg = %u, maxavg = %u, alert at %u, " |
3650 "clear warning at %u, limit at %u, disconnect at %u (window size = %u)\n", | |
2086 | 3651 (code < 5) ? codes[code] : codes[0], |
3652 rateclass, | |
3653 currentavg, maxavg, | |
3654 alert, clear, | |
3655 limit, disconnect, | |
3656 windowsize); | |
3657 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3658 /* XXX fix these values */ |
2086 | 3659 if (code == AIM_RATE_CODE_CHANGE) { |
3660 if (currentavg >= clear) | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3661 aim_conn_setlatency(fr->conn, 0); |
2086 | 3662 } else if (code == AIM_RATE_CODE_WARNING) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3663 aim_conn_setlatency(fr->conn, windowsize/4); |
2909
48ec70928d7f
[gaim-migrate @ 2922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2906
diff
changeset
|
3664 } else if (code == AIM_RATE_CODE_LIMIT) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3665 gaim_notify_error(sess->aux_data, NULL, _("Rate limiting error."), |
6040 | 3666 _("The last action you attempted could not be " |
3667 "performed because you are over the rate limit. " | |
3668 "Please wait 10 seconds and try again.")); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3669 aim_conn_setlatency(fr->conn, windowsize/2); |
2086 | 3670 } else if (code == AIM_RATE_CODE_CLEARLIMIT) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3671 aim_conn_setlatency(fr->conn, 0); |
2086 | 3672 } |
3673 | |
3674 return 1; | |
3675 } | |
3676 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3677 static int gaim_parse_evilnotify(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3678 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3679 fu16_t newevil; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3680 aim_userinfo_t *userinfo; |
5575 | 3681 GaimConnection *gc = sess->aux_data; |
2086 | 3682 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3683 va_start(ap, fr); |
4199 | 3684 newevil = (fu16_t) va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3685 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 3686 va_end(ap); |
3687 | |
7111 | 3688 serv_got_eviled(gc, (userinfo && userinfo->sn) ? userinfo->sn : NULL, (newevil/10.0) + 0.5); |
2086 | 3689 |
3690 return 1; | |
3691 } | |
3692 | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3693 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
|
3694 va_list ap; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3695 aim_userinfo_t *info; |
5575 | 3696 GaimConnection *gc = sess->aux_data; |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3697 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3698 va_start(ap, fr); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3699 info = va_arg(ap, aim_userinfo_t *); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3700 va_end(ap); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3701 |
5628 | 3702 gc->evil = (info->warnlevel/10.0) + 0.5; |
4841 | 3703 |
7872 | 3704 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) |
4841 | 3705 gc->login_time_official = info->onlinesince; |
7872 | 3706 else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) |
3707 gc->login_time_official = time(NULL) - info->sessionlen; | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3708 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3709 return 1; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3710 } |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3711 |
4649 | 3712 static int gaim_connerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3713 GaimConnection *gc = sess->aux_data; |
7283 | 3714 OscarData *od = gc->proto_data; |
4649 | 3715 va_list ap; |
3716 fu16_t code; | |
3717 char *msg; | |
3718 | |
3719 va_start(ap, fr); | |
3720 code = (fu16_t)va_arg(ap, int); | |
3721 msg = va_arg(ap, char *); | |
3722 va_end(ap); | |
3723 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3724 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3725 "Disconnected. Code is 0x%04x and msg is %s\n", code, msg); |
4649 | 3726 if ((fr) && (fr->conn) && (fr->conn->type == AIM_CONN_TYPE_BOS)) { |
4651 | 3727 if (code == 0x0001) { |
6113 | 3728 gc->wants_to_die = TRUE; |
5579 | 3729 gaim_connection_error(gc, _("You have been disconnected because you have signed on with this screen name at another location.")); |
4651 | 3730 } else { |
5579 | 3731 gaim_connection_error(gc, _("You have been signed off for an unknown reason.")); |
4651 | 3732 } |
4666 | 3733 od->killme = TRUE; |
4649 | 3734 } |
3735 | |
3736 return 1; | |
3737 } | |
3738 | |
2675 | 3739 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) { |
7283 | 3740 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3741 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3742 aim_reqpersonalinfo(sess, fr->conn); |
4230 | 3743 |
3744 #ifndef NOSSI | |
7334 | 3745 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: requesting rights and list\n"); |
4889 | 3746 aim_ssi_reqrights(sess); |
6350 | 3747 aim_ssi_reqdata(sess); |
4230 | 3748 #endif |
3749 | |
7011 | 3750 aim_locate_reqrights(sess); |
7285 | 3751 aim_buddylist_reqrights(sess, fr->conn); |
4617 | 3752 aim_im_reqparams(sess); |
7334 | 3753 aim_bos_reqrights(sess, fr->conn); /* XXX - Don't call this with ssi */ |
4230 | 3754 |
3755 #ifdef NOSSI | |
7334 | 3756 gaim_debug(GAIM_DEBUG_INFO, "oscar", "bos: requesting rights\n"); |
3757 aim_bos_reqrights(sess, fr->conn); | |
4230 | 3758 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS); |
3759 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE | AIM_PRIVFLAGS_ALLOWMEMBERSINCE); | |
3760 #endif | |
2086 | 3761 |
7283 | 3762 gaim_connection_update_progress(gc, _("Finalizing connection"), 5, OSCAR_CONNECT_STEPS); |
3763 | |
2086 | 3764 return 1; |
3765 } | |
3766 | |
2675 | 3767 static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3768 GaimConnection *gc = sess->aux_data; |
7283 | 3769 OscarData *od = gc->proto_data; |
2647 | 3770 |
6905 | 3771 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0003, gaim_info_change, 0); |
3772 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0005, gaim_info_change, 0); | |
3773 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0007, gaim_account_confirm, 0); | |
3774 | |
2672 | 3775 aim_clientready(sess, fr->conn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3776 gaim_debug(GAIM_DEBUG_INFO, "oscar", "connected to admin\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3777 |
2647 | 3778 if (od->chpass) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3779 gaim_debug(GAIM_DEBUG_INFO, "oscar", "changing password\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3780 aim_admin_changepasswd(sess, fr->conn, od->newp, od->oldp); |
2647 | 3781 g_free(od->oldp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3782 od->oldp = NULL; |
2647 | 3783 g_free(od->newp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3784 od->newp = NULL; |
2647 | 3785 od->chpass = FALSE; |
3786 } | |
2979 | 3787 if (od->setnick) { |
8152 | 3788 gaim_debug(GAIM_DEBUG_INFO, "oscar", "formatting screen name\n"); |
2979 | 3789 aim_admin_setnick(sess, fr->conn, od->newsn); |
3790 g_free(od->newsn); | |
3791 od->newsn = NULL; | |
3792 od->setnick = FALSE; | |
3793 } | |
2647 | 3794 if (od->conf) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3795 gaim_debug(GAIM_DEBUG_INFO, "oscar", "confirming account\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3796 aim_admin_reqconfirm(sess, fr->conn); |
2647 | 3797 od->conf = FALSE; |
3798 } | |
3799 if (od->reqemail) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3800 gaim_debug(GAIM_DEBUG_INFO, "oscar", "requesting email\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3801 aim_admin_getinfo(sess, fr->conn, 0x0011); |
2647 | 3802 od->reqemail = FALSE; |
3803 } | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3804 if (od->setemail) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3805 gaim_debug(GAIM_DEBUG_INFO, "oscar", "setting email\n"); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3806 aim_admin_setemail(sess, fr->conn, od->email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3807 g_free(od->email); |
5497 | 3808 od->email = NULL; |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3809 od->setemail = FALSE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3810 } |
2647 | 3811 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3812 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3813 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3814 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3815 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
|
3816 struct aim_icbmparameters *params; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3817 va_list ap; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3818 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3819 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3820 params = va_arg(ap, struct aim_icbmparameters *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3821 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3822 |
4194 | 3823 /* 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
|
3824 gaim_debug(GAIM_DEBUG_MISC, "oscar", "ICBM Parameters: maxchannel = %hu, default flags = 0x%08lx, max msg len = %hu, " |
5556 | 3825 "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
|
3826 params->maxchan, params->flags, params->maxmsglen, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3827 ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3828 params->minmsginterval); |
2427
5bc3b39fc0a5
[gaim-migrate @ 2440]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2421
diff
changeset
|
3829 */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3830 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3831 /* Maybe senderwarn and recverwarn should be user preferences... */ |
3595 | 3832 params->flags = 0x0000000b; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3833 params->maxmsglen = 8000; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3834 params->minmsginterval = 0; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3835 |
4617 | 3836 aim_im_setparams(sess, params); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3837 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3838 return 1; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3839 } |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3840 |
2993 | 3841 static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) |
3842 { | |
5575 | 3843 GaimConnection *gc = sess->aux_data; |
7283 | 3844 OscarData *od = (OscarData *)gc->proto_data; |
5306 | 3845 va_list ap; |
3846 fu16_t maxsiglen; | |
2993 | 3847 |
3848 va_start(ap, fr); | |
4199 | 3849 maxsiglen = (fu16_t) va_arg(ap, int); |
2993 | 3850 va_end(ap); |
3851 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3852 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3853 "locate rights: max sig len = %d\n", maxsiglen); |
2993 | 3854 |
4617 | 3855 od->rights.maxsiglen = od->rights.maxawaymsglen = (guint)maxsiglen; |
3856 | |
3857 if (od->icq) | |
7334 | 3858 aim_locate_setcaps(od->sess, caps_icq); |
5301 | 3859 else |
7334 | 3860 aim_locate_setcaps(od->sess, caps_aim); |
3861 oscar_set_info(gc, gc->account->user_info); | |
2993 | 3862 |
3863 return 1; | |
3864 } | |
3865 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3866 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
|
3867 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3868 fu16_t maxbuddies, maxwatchers; |
5575 | 3869 GaimConnection *gc = sess->aux_data; |
7283 | 3870 OscarData *od = (OscarData *)gc->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3871 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3872 va_start(ap, fr); |
4199 | 3873 maxbuddies = (fu16_t) va_arg(ap, unsigned int); |
3874 maxwatchers = (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 "buddy list rights: Max buddies = %hu / Max watchers = %hu\n", maxbuddies, maxwatchers); |
2086 | 3879 |
4617 | 3880 od->rights.maxbuddies = (guint)maxbuddies; |
3881 od->rights.maxwatchers = (guint)maxwatchers; | |
2993 | 3882 |
2086 | 3883 return 1; |
3884 } | |
3885 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3886 static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3887 GaimConnection *gc = sess->aux_data; |
7283 | 3888 OscarData *od = (OscarData *)gc->proto_data; |
7334 | 3889 va_list ap; |
3890 fu16_t maxpermits, maxdenies; | |
2086 | 3891 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3892 va_start(ap, fr); |
4199 | 3893 maxpermits = (fu16_t) va_arg(ap, unsigned int); |
3894 maxdenies = (fu16_t) va_arg(ap, unsigned int); | |
2086 | 3895 va_end(ap); |
3896 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3897 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3898 "BOS rights: Max permit = %hu / Max deny = %hu\n", maxpermits, maxdenies); |
2086 | 3899 |
4617 | 3900 od->rights.maxpermits = (guint)maxpermits; |
3901 od->rights.maxdenies = (guint)maxdenies; | |
2993 | 3902 |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
3903 gaim_connection_set_state(gc, GAIM_CONNECTED); |
2993 | 3904 serv_finish_login(gc); |
3905 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3906 gaim_debug(GAIM_DEBUG_INFO, "oscar", "buddy list loaded\n"); |
2993 | 3907 |
2672 | 3908 aim_clientready(sess, fr->conn); |
5948 | 3909 aim_srv_setavailmsg(sess, NULL); |
7474 | 3910 aim_srv_setidle(sess, 0); |
4617 | 3911 |
4664 | 3912 if (od->icq) { |
3913 aim_icq_reqofflinemsgs(sess); | |
3914 aim_icq_hideip(sess); | |
3915 } | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3916 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3917 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV); |
4102 | 3918 if (sess->authinfo->email) |
3919 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_EMAIL); | |
2086 | 3920 |
3921 return 1; | |
3922 } | |
3923 | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3924 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
|
3925 va_list ap; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3926 struct aim_icq_offlinemsg *msg; |
4075 | 3927 struct aim_incomingim_ch4_args args; |
3928 time_t t; | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3929 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3930 va_start(ap, fr); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3931 msg = va_arg(ap, struct aim_icq_offlinemsg *); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3932 va_end(ap); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3933 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3934 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3935 "Received offline message. Converting to channel 4 ICBM...\n"); |
4075 | 3936 args.uin = msg->sender; |
3937 args.type = msg->type; | |
4173 | 3938 args.flags = msg->flags; |
4076 | 3939 args.msglen = msg->msglen; |
4075 | 3940 args.msg = msg->msg; |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
3941 t = gaim_time_build(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0); |
4075 | 3942 incomingim_chan4(sess, fr->conn, NULL, &args, t); |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3943 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3944 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3945 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3946 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3947 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
|
3948 { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3949 aim_icq_ackofflinemsgs(sess); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3950 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3951 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3952 |
7388 | 3953 #if 0 |
3954 /* | |
7465 | 3955 * Update, 2003-11-09: |
3956 * Joseph S. Myers, a gcc dude, fixed this for gcc 3.4! Rock on! | |
3957 * | |
7388 | 3958 * It may not be my place to do this, but... |
3959 * I feel pretty strongly that the "last 2 digits" warning is ridiculously | |
3960 * stupid, and should not exist for % switches (%x in our case) that request | |
3961 * a year in the preferred representation for the current locale. For that | |
3962 * reason I've chosen to not use this workaround (n., see kluge). | |
3963 * | |
3964 * I have a date. I want to show it to the user in the "preferred" way. | |
3965 * Whether that displays a 2 digit year is perfectly fine--after all, it's | |
3966 * what the locale wanted. | |
3967 * | |
3968 * If I have a necessity for a full representation of the year in the current | |
3969 * locale, then I'll use a switch that returns a full representation of the | |
3970 * year. | |
3971 * | |
3972 * If you think the preferred locale should show 4 digits instead of 2 digits | |
3973 * (because you're anal, or whatever), then change the f***ing locale. | |
3974 * | |
3975 * I guess the bottom line is--I'm trying to show a date to the user how they | |
3976 * prefer to see it, why the hell does gcc want me to change that? | |
7389 | 3977 * |
3978 * See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3190 | |
3979 * See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8714 | |
7388 | 3980 */ |
3981 | |
3982 /* | |
3983 * This function was recommended by the STRFTIME(3) man page to remove the | |
7386 | 3984 * "last 2 digits" warning. |
3985 */ | |
3986 static size_t my_strftime(char *s, size_t max, const char *fmt, | |
3987 const struct tm *tm) | |
3988 { | |
3989 return strftime(s, max, fmt, tm); | |
3990 } | |
7388 | 3991 #endif |
7386 | 3992 |
4624 | 3993 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
|
3994 { |
5575 | 3995 GaimConnection *gc = sess->aux_data; |
4819 | 3996 gchar *buf, *tmp, *utf8; |
4624 | 3997 gchar who[16]; |
6873 | 3998 GaimBuddy *buddy; |
3999 gchar *primary; | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4000 va_list ap; |
4151 | 4001 struct aim_icq_info *info; |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4002 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4003 va_start(ap, fr); |
4151 | 4004 info = va_arg(ap, struct aim_icq_info *); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4005 va_end(ap); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4006 |
4664 | 4007 if (!info->uin) |
4008 return 0; | |
4009 | |
5556 | 4010 g_snprintf(who, sizeof(who), "%u", info->uin); |
6623 | 4011 buf = g_strdup_printf("<b>%s:</b> %s", _("UIN"), who); |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4012 if (info->nick && info->nick[0] && (utf8 = gaim_utf8_try_convert(info->nick))) { |
6623 | 4013 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Nick"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4819 | 4014 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4015 if (info->first && info->first[0] && (utf8 = gaim_utf8_try_convert(info->first))) { |
6623 | 4016 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("First Name"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4819 | 4017 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4018 if (info->last && info->last[0] && (utf8 = gaim_utf8_try_convert(info->last))) { |
6623 | 4019 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Last Name"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4819 | 4020 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4021 if (info->email && info->email[0] && (utf8 = gaim_utf8_try_convert(info->email))) { |
6623 | 4022 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 | 4023 } |
4024 if (info->numaddresses && info->email2) { | |
4025 int i; | |
4026 for (i = 0; i < info->numaddresses; i++) { | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4027 if (info->email2[i] && info->email2[i][0] && (utf8 = gaim_utf8_try_convert(info->email2[i]))) { |
6623 | 4028 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 | 4029 } |
4625 | 4030 } |
4624 | 4031 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4032 if (info->mobile && info->mobile[0] && (utf8 = gaim_utf8_try_convert(info->mobile))) { |
6623 | 4033 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Mobile Phone"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4625 | 4034 } |
4035 if (info->gender) { | |
6623 | 4036 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Gender"), ":</b> ", info->gender==1 ? _("Female") : _("Male"), NULL); g_free(tmp); |
4151 | 4037 } |
4624 | 4038 if (info->birthyear || info->birthmonth || info->birthday) { |
4627 | 4039 char date[30]; |
4040 struct tm tm; | |
4041 tm.tm_mday = (int)info->birthday; | |
4042 tm.tm_mon = (int)info->birthmonth-1; | |
4043 tm.tm_year = (int)info->birthyear-1900; | |
7388 | 4044 strftime(date, sizeof(date), "%x", &tm); |
6623 | 4045 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Birthday"), ":</b> ", date, NULL); g_free(tmp); |
4151 | 4046 } |
4624 | 4047 if (info->age) { |
4048 char age[5]; | |
4049 snprintf(age, sizeof(age), "%hhd", info->age); | |
6623 | 4050 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Age"), ":</b> ", age, NULL); g_free(tmp); |
4819 | 4051 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4052 if (info->personalwebpage && info->personalwebpage[0] && (utf8 = gaim_utf8_try_convert(info->personalwebpage))) { |
6623 | 4053 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Personal Web Page"), ":</b> <a href=\"", utf8, "\">", utf8, "</a>", NULL); g_free(tmp); g_free(utf8); |
4819 | 4054 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4055 if (info->info && info->info[0] && (utf8 = gaim_utf8_try_convert(info->info))) { |
6623 | 4056 tmp = buf; buf = g_strconcat(tmp, "<hr><b>", _("Additional Information"), ":</b><br>", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4057 } |
4058 tmp = buf; buf = g_strconcat(tmp, "<hr>\n", NULL); g_free(tmp); | |
4641 | 4059 if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) { |
6623 | 4060 tmp = buf; buf = g_strconcat(tmp, "<b>", _("Home Address"), ":</b>", NULL); g_free(tmp); |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4061 if (info->homeaddr && info->homeaddr[0] && (utf8 = gaim_utf8_try_convert(info->homeaddr))) { |
6623 | 4062 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Address"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4063 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4064 if (info->homecity && info->homecity[0] && (utf8 = gaim_utf8_try_convert(info->homecity))) { |
6623 | 4065 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("City"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4066 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4067 if (info->homestate && info->homestate[0] && (utf8 = gaim_utf8_try_convert(info->homestate))) { |
6623 | 4068 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("State"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4069 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4070 if (info->homezip && info->homezip[0] && (utf8 = gaim_utf8_try_convert(info->homezip))) { |
6623 | 4071 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Zip Code"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4072 } |
4073 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); | |
4151 | 4074 } |
4641 | 4075 if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) { |
6623 | 4076 tmp = buf; buf = g_strconcat(tmp, "<b>", _("Work Address"), ":</b>", NULL); g_free(tmp); |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4077 if (info->workaddr && info->workaddr[0] && (utf8 = gaim_utf8_try_convert(info->workaddr))) { |
6623 | 4078 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Address"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4079 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4080 if (info->workcity && info->workcity[0] && (utf8 = gaim_utf8_try_convert(info->workcity))) { |
6623 | 4081 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("City"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4082 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4083 if (info->workstate && info->workstate[0] && (utf8 = gaim_utf8_try_convert(info->workstate))) { |
6623 | 4084 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("State"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4085 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4086 if (info->workzip && info->workzip[0] && (utf8 = gaim_utf8_try_convert(info->workzip))) { |
6623 | 4087 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Zip Code"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4088 } |
4089 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); | |
4090 } | |
4641 | 4091 if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) { |
6623 | 4092 tmp = buf; buf = g_strconcat(tmp, "<b>", _("Work Information"), ":</b>", NULL); g_free(tmp); |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4093 if (info->workcompany && info->workcompany[0] && (utf8 = gaim_utf8_try_convert(info->workcompany))) { |
6623 | 4094 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Company"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4095 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4096 if (info->workdivision && info->workdivision[0] && (utf8 = gaim_utf8_try_convert(info->workdivision))) { |
6623 | 4097 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Division"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4098 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4099 if (info->workposition && info->workposition[0] && (utf8 = gaim_utf8_try_convert(info->workposition))) { |
6623 | 4100 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Position"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 4101 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4102 if (info->workwebpage && info->workwebpage[0] && (utf8 = gaim_utf8_try_convert(info->workwebpage))) { |
6623 | 4103 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 | 4104 } |
4105 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); | |
4151 | 4106 } |
4107 | |
6873 | 4108 buddy = gaim_find_buddy(gaim_connection_get_account(gc), who); |
4109 primary = g_strdup_printf(_("ICQ Info for %s"), gaim_get_buddy_alias(buddy)); | |
4110 gaim_notify_formatted(gc, NULL, primary, NULL, buf, NULL, NULL); | |
4111 g_free(primary); | |
4151 | 4112 g_free(buf); |
4113 | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4114 return 1; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4115 } |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4116 |
4759 | 4117 static int gaim_icqalias(aim_session_t *sess, aim_frame_t *fr, ...) |
4118 { | |
5575 | 4119 GaimConnection *gc = sess->aux_data; |
4820 | 4120 gchar who[16], *utf8; |
6695 | 4121 GaimBuddy *b; |
4759 | 4122 va_list ap; |
4123 struct aim_icq_info *info; | |
4124 | |
4125 va_start(ap, fr); | |
4126 info = va_arg(ap, struct aim_icq_info *); | |
4127 va_end(ap); | |
4128 | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4129 if (info->uin && info->nick && info->nick[0] && (utf8 = gaim_utf8_try_convert(info->nick))) { |
5556 | 4130 g_snprintf(who, sizeof(who), "%u", info->uin); |
4820 | 4131 serv_got_alias(gc, who, utf8); |
4759 | 4132 if ((b = gaim_find_buddy(gc->account, who))) { |
7693 | 4133 gaim_blist_node_set_string((GaimBlistNode*)b, "servernick", utf8); |
4759 | 4134 gaim_blist_save(); |
4135 } | |
4820 | 4136 g_free(utf8); |
4759 | 4137 } |
4138 | |
4139 return 1; | |
4140 } | |
4141 | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4142 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
|
4143 { |
7032 | 4144 GaimConnection *gc = sess->aux_data; |
4145 gchar *text; | |
4146 va_list ap; | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4147 char *msg, *url; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4148 fu16_t wid, hei, delay; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4149 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4150 va_start(ap, fr); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4151 msg = va_arg(ap, char *); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4152 url = va_arg(ap, char *); |
4199 | 4153 wid = (fu16_t) va_arg(ap, int); |
4154 hei = (fu16_t) va_arg(ap, int); | |
4155 delay = (fu16_t) va_arg(ap, int); | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4156 va_end(ap); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4157 |
7032 | 4158 text = g_strdup_printf("%s<br><a href=\"%s\">%s</a>", msg, url, url); |
4159 gaim_notify_formatted(gc, NULL, _("Pop-Up Message"), NULL, text, NULL, NULL); | |
4160 g_free(text); | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4161 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4162 return 1; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4163 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4164 |
7032 | 4165 static int gaim_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...) |
4166 { | |
6873 | 4167 GaimConnection *gc = sess->aux_data; |
4168 gchar *secondary; | |
4169 GString *text; | |
4170 int i, num; | |
2086 | 4171 va_list ap; |
6873 | 4172 char *email, *SNs; |
2086 | 4173 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4174 va_start(ap, fr); |
6873 | 4175 email = va_arg(ap, char *); |
2086 | 4176 num = va_arg(ap, int); |
4177 SNs = va_arg(ap, char *); | |
4178 va_end(ap); | |
4179 | |
8152 | 4180 secondary = g_strdup_printf(_("The following screen names are associated with %s"), email); |
6873 | 4181 text = g_string_new(""); |
2086 | 4182 for (i = 0; i < num; i++) |
6873 | 4183 g_string_append_printf(text, "%s<br>", &SNs[i * (MAXSNLEN + 1)]); |
4184 gaim_notify_formatted(gc, NULL, _("Search Results"), secondary, text->str, NULL, NULL); | |
4185 | |
4186 g_free(secondary); | |
4187 g_string_free(text, TRUE); | |
2086 | 4188 |
4189 return 1; | |
4190 } | |
4191 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4192 static int gaim_parse_searcherror(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 4193 va_list ap; |
6873 | 4194 char *email; |
5420 | 4195 char *buf; |
2086 | 4196 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4197 va_start(ap, fr); |
6873 | 4198 email = va_arg(ap, char *); |
2086 | 4199 va_end(ap); |
4200 | |
6873 | 4201 buf = g_strdup_printf(_("No results found for email address %s"), email); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4202 gaim_notify_error(sess->aux_data, NULL, buf, NULL); |
5420 | 4203 g_free(buf); |
2086 | 4204 |
4205 return 1; | |
4206 } | |
4207 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4208 static int gaim_account_confirm(aim_session_t *sess, aim_frame_t *fr, ...) { |
6873 | 4209 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4210 fu16_t status; |
2086 | 4211 va_list ap; |
4212 char msg[256]; | |
4213 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4214 va_start(ap, fr); |
4199 | 4215 status = (fu16_t) va_arg(ap, unsigned int); /* status code of confirmation request */ |
2086 | 4216 va_end(ap); |
4217 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4218 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4219 "account confirmation returned status 0x%04x (%s)\n", status, |
3912 | 4220 status ? "unknown" : "email sent"); |
4221 if (!status) { | |
5302 | 4222 g_snprintf(msg, sizeof(msg), _("You should receive an email asking to confirm %s."), |
5575 | 4223 gaim_account_get_username(gaim_connection_get_account(gc))); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4224 gaim_notify_info(gc, NULL, _("Account Confirmation Requested"), msg); |
2086 | 4225 } |
4226 | |
4227 return 1; | |
4228 } | |
4229 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4230 static int gaim_info_change(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4231 GaimConnection *gc = sess->aux_data; |
2086 | 4232 va_list ap; |
3912 | 4233 fu16_t perms, err; |
4234 char *url, *sn, *email; | |
4235 int change; | |
2086 | 4236 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4237 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4238 change = va_arg(ap, int); |
4199 | 4239 perms = (fu16_t) va_arg(ap, unsigned int); |
4240 err = (fu16_t) va_arg(ap, unsigned int); | |
3912 | 4241 url = va_arg(ap, char *); |
4242 sn = va_arg(ap, char *); | |
4243 email = va_arg(ap, char *); | |
2086 | 4244 va_end(ap); |
4245 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4246 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4247 "account info: because of %s, perms=0x%04x, err=0x%04x, url=%s, sn=%s, email=%s\n", |
3912 | 4248 change ? "change" : "request", perms, err, url, sn, email); |
4249 | |
4250 if (err && url) { | |
4251 char *dialog_msg; | |
4252 char *dialog_top = g_strdup_printf(_("Error Changing Account Info")); | |
4253 switch (err) { | |
4254 case 0x0001: { | |
4255 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name differs from the original."), err); | |
4256 } break; | |
4257 case 0x0006: { | |
4258 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name ends in a space."), err); | |
4259 } break; | |
4260 case 0x000b: { | |
4261 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name is too long."), err); | |
4262 } break; | |
4263 case 0x001d: { | |
4264 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); | |
4265 } break; | |
4266 case 0x0021: { | |
4267 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); | |
4268 } break; | |
4269 case 0x0023: { | |
4270 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because the given address is invalid."), err); | |
4271 } break; | |
4272 default: { | |
4273 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unknown error."), err); | |
4274 } break; | |
4275 } | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4276 gaim_notify_error(gc, NULL, dialog_top, dialog_msg); |
3912 | 4277 g_free(dialog_top); |
4278 g_free(dialog_msg); | |
4279 return 1; | |
4280 } | |
4281 | |
4282 if (sn) { | |
4585 | 4283 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
|
4284 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg); |
3912 | 4285 g_free(dialog_msg); |
4286 } | |
4287 | |
4288 if (email) { | |
5575 | 4289 char *dialog_msg = g_strdup_printf(_("The email address for %s is %s"), |
4290 gaim_account_get_username(gaim_connection_get_account(gc)), email); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4291 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg); |
3912 | 4292 g_free(dialog_msg); |
2086 | 4293 } |
4294 | |
4295 return 1; | |
4296 } | |
4297 | |
5575 | 4298 static void oscar_keepalive(GaimConnection *gc) { |
7283 | 4299 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 4300 aim_flap_nop(od->sess, od->conn); |
2086 | 4301 } |
4302 | |
6059 | 4303 static int oscar_send_typing(GaimConnection *gc, const char *name, int typing) { |
7283 | 4304 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 4305 struct direct_im *dim = find_direct_im(od, name); |
3595 | 4306 if (dim) |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4307 if (typing == GAIM_TYPING) |
4870 | 4308 aim_odc_send_typing(od->sess, dim->conn, 0x0002); |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4309 else if (typing == GAIM_TYPED) |
4870 | 4310 aim_odc_send_typing(od->sess, dim->conn, 0x0001); |
4311 else | |
4312 aim_odc_send_typing(od->sess, dim->conn, 0x0000); | |
3595 | 4313 else { |
5300 | 4314 /* Don't send if this turkey is in our deny list */ |
4315 GSList *list; | |
4316 for (list=gc->account->deny; (list && aim_sncmp(name, list->data)); list=list->next); | |
4317 if (!list) { | |
7261 | 4318 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name)); |
5300 | 4319 if (bi && bi->typingnot) { |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4320 if (typing == GAIM_TYPING) |
5300 | 4321 aim_im_sendmtn(od->sess, 0x0001, name, 0x0002); |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4322 else if (typing == GAIM_TYPED) |
5300 | 4323 aim_im_sendmtn(od->sess, 0x0001, name, 0x0001); |
4324 else | |
4325 aim_im_sendmtn(od->sess, 0x0001, name, 0x0000); | |
4326 } | |
3595 | 4327 } |
4328 } | |
2993 | 4329 return 0; |
4330 } | |
5575 | 4331 static void oscar_ask_direct_im(GaimConnection *gc, const char *name); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
4332 static int gaim_odc_send_im(aim_session_t *, aim_conn_t *, const char *, GaimConvImFlags); |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
4333 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
4334 static int oscar_send_im(GaimConnection *gc, const char *name, const char *message, GaimConvImFlags imflags) { |
7283 | 4335 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 4336 struct direct_im *dim = find_direct_im(od, name); |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4337 int ret = 0; |
3659 | 4338 GError *err = NULL; |
5575 | 4339 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
|
4340 char *tmpmsg = NULL; |
3458 | 4341 |
4838 | 4342 if (dim && dim->connected) { |
4343 /* If we're directly connected, send a direct IM */ | |
6982 | 4344 ret = gaim_odc_send_im(od->sess, dim->conn, message, imflags); |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
4345 } else if (imflags & GAIM_CONV_IM_IMAGES) { |
3044 | 4346 /* Trying to send an IM image outside of a direct connection. */ |
4347 oscar_ask_direct_im(gc, name); | |
4838 | 4348 ret = -ENOTCONN; |
2086 | 4349 } else { |
4738 | 4350 struct buddyinfo *bi; |
3008 | 4351 struct aim_sendimext_args args; |
4352 struct stat st; | |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
4353 gsize len; |
4269 | 4354 |
7261 | 4355 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name)); |
4738 | 4356 if (!bi) { |
4357 bi = g_new0(struct buddyinfo, 1); | |
7261 | 4358 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, name)), bi); |
4738 | 4359 } |
4360 | |
3008 | 4361 args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES; |
4665 | 4362 if (od->icq) { |
4363 args.features = features_icq; | |
4364 args.featureslen = sizeof(features_icq); | |
3008 | 4365 args.flags |= AIM_IMFLAGS_OFFLINE; |
4665 | 4366 } else { |
4367 args.features = features_aim; | |
4368 args.featureslen = sizeof(features_aim); | |
4972 | 4369 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
4370 if (imflags & GAIM_CONV_IM_AUTO_RESP) |
4972 | 4371 args.flags |= AIM_IMFLAGS_AWAY; |
4665 | 4372 } |
4269 | 4373 |
4738 | 4374 if (bi->ico_need) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4375 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4376 "Sending buddy icon request with message\n"); |
3008 | 4377 args.flags |= AIM_IMFLAGS_BUDDYREQ; |
4738 | 4378 bi->ico_need = FALSE; |
3008 | 4379 } |
4269 | 4380 |
5575 | 4381 if (iconfile && !stat(iconfile, &st)) { |
4382 FILE *file = fopen(iconfile, "r"); | |
3008 | 4383 if (file) { |
4384 char *buf = g_malloc(st.st_size); | |
4385 fread(buf, 1, st.st_size, file); | |
6039 | 4386 fclose(file); |
4269 | 4387 |
3008 | 4388 args.iconlen = st.st_size; |
4617 | 4389 args.iconsum = aimutil_iconsum(buf, st.st_size); |
3008 | 4390 args.iconstamp = st.st_mtime; |
4391 | |
7406 | 4392 if ((args.iconlen != bi->ico_me_len) || (args.iconsum != bi->ico_me_csum) || (args.iconstamp != bi->ico_me_time)) { |
4738 | 4393 bi->ico_informed = FALSE; |
7406 | 4394 bi->ico_sent = FALSE; |
4395 } | |
4738 | 4396 |
4397 if (!bi->ico_informed) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4398 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4399 "Claiming to have a buddy icon\n"); |
4738 | 4400 args.flags |= AIM_IMFLAGS_HASICON; |
4401 bi->ico_me_len = args.iconlen; | |
4402 bi->ico_me_csum = args.iconsum; | |
4403 bi->ico_me_time = args.iconstamp; | |
4404 bi->ico_informed = TRUE; | |
4405 } | |
4406 | |
3008 | 4407 g_free(buf); |
2086 | 4408 } |
4409 } | |
4269 | 4410 |
3008 | 4411 args.destsn = name; |
4269 | 4412 |
6310 | 4413 /* For ICQ send newlines as CR/LF, for AIM send newlines as <BR> */ |
4414 if (isdigit(name[0])) | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4415 tmpmsg = gaim_str_add_cr(message); |
6310 | 4416 else |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4417 tmpmsg = gaim_strdup_withhtml(message); |
6310 | 4418 len = strlen(tmpmsg); |
4419 | |
4420 args.flags |= oscar_encoding_check(tmpmsg); | |
3642 | 4421 if (args.flags & AIM_IMFLAGS_UNICODE) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4422 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Sending Unicode IM\n"); |
4662 | 4423 args.charset = 0x0002; |
4665 | 4424 args.charsubset = 0x0000; |
6310 | 4425 args.msg = g_convert(tmpmsg, len, "UCS-2BE", "UTF-8", NULL, &len, &err); |
3659 | 4426 if (err) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4427 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4428 "Error converting a unicode message: %s\n", err->message); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4429 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4430 "This really shouldn't happen!\n"); |
3659 | 4431 /* We really shouldn't try to send the |
4432 * IM now, but I'm not sure what to do */ | |
4800 | 4433 g_error_free(err); |
3659 | 4434 } |
3850 | 4435 } else if (args.flags & AIM_IMFLAGS_ISO_8859_1) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4436 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4437 "Sending ISO-8859-1 IM\n"); |
4662 | 4438 args.charset = 0x0003; |
4665 | 4439 args.charsubset = 0x0000; |
6310 | 4440 args.msg = g_convert(tmpmsg, len, "ISO-8859-1", "UTF-8", NULL, &len, &err); |
3659 | 4441 if (err) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4442 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4443 "conversion error: %s\n", err->message); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4444 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4445 "Someone tell Ethan his 8859-1 detection is wrong\n"); |
3642 | 4446 args.flags ^= AIM_IMFLAGS_ISO_8859_1 | AIM_IMFLAGS_UNICODE; |
6310 | 4447 len = strlen(tmpmsg); |
4800 | 4448 g_error_free(err); |
6310 | 4449 args.msg = g_convert(tmpmsg, len, "UCS-2BE", "UTF8", NULL, &len, &err); |
3659 | 4450 if (err) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4451 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4452 "Error in unicode fallback: %s\n", err->message); |
4800 | 4453 g_error_free(err); |
3659 | 4454 } |
3642 | 4455 } |
4456 } else { | |
4662 | 4457 args.charset = 0x0000; |
4458 args.charsubset = 0x0000; | |
6310 | 4459 args.msg = tmpmsg; |
3642 | 4460 } |
4461 args.msglen = len; | |
4269 | 4462 |
4617 | 4463 ret = aim_im_sendch1_ext(od->sess, &args); |
2086 | 4464 } |
4838 | 4465 |
6310 | 4466 g_free(tmpmsg); |
4467 | |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4468 if (ret >= 0) |
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4469 return 1; |
6310 | 4470 |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4471 return ret; |
2086 | 4472 } |
4473 | |
7011 | 4474 static void oscar_get_info(GaimConnection *gc, const char *name) { |
7283 | 4475 OscarData *od = (OscarData *)gc->proto_data; |
7011 | 4476 |
7173 | 4477 if (od->icq && isdigit(name[0])) |
4624 | 4478 aim_icq_getallinfo(od->sess, name); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4479 else |
7235 | 4480 aim_locate_getinfoshort(od->sess, name, 0x00000003); |
7011 | 4481 } |
4482 | |
4483 static void oscar_get_away(GaimConnection *gc, const char *who) { | |
7283 | 4484 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 4485 if (od->icq) { |
7011 | 4486 GaimBuddy *budlight = gaim_find_buddy(gc->account, who); |
3212 | 4487 if (budlight) |
3595 | 4488 if ((budlight->uc & 0xffff0000) >> 16) |
4687 | 4489 aim_im_sendch2_geticqaway(od->sess, who, (budlight->uc & 0xffff0000) >> 16); |
3212 | 4490 else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4491 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4492 "Error: The user %s has no status message, therefore not requesting.\n", who); |
3212 | 4493 else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4494 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
7023 | 4495 "Error: Could not find %s in local buddy list, therefore unable to request status message.\n", who); |
3212 | 4496 } else |
7011 | 4497 aim_locate_getinfoshort(od->sess, who, 0x00000002); |
4498 } | |
4499 | |
4500 static void oscar_set_dir(GaimConnection *gc, const char *first, const char *middle, const char *last, | |
3466 | 4501 const char *maiden, const char *city, const char *state, const char *country, int web) { |
4617 | 4502 /* XXX - some of these things are wrong, but i'm lazy */ |
7283 | 4503 OscarData *od = (OscarData *)gc->proto_data; |
7011 | 4504 aim_locate_setdirinfo(od->sess, first, middle, last, |
2086 | 4505 maiden, NULL, NULL, city, state, NULL, 0, web); |
4506 } | |
4507 | |
5575 | 4508 static void oscar_set_idle(GaimConnection *gc, int time) { |
7283 | 4509 OscarData *od = (OscarData *)gc->proto_data; |
7474 | 4510 aim_srv_setidle(od->sess, time); |
2086 | 4511 } |
4512 | |
5954 | 4513 static void oscar_set_info(GaimConnection *gc, const char *text) { |
7283 | 4514 OscarData *od = (OscarData *)gc->proto_data; |
5129 | 4515 fu32_t flags = 0; |
6019 | 4516 char *text_html = NULL; |
5129 | 4517 char *msg = NULL; |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
4518 gsize msglen = 0; |
2993 | 4519 |
4617 | 4520 if (od->rights.maxsiglen == 0) |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4521 gaim_notify_warning(gc, NULL, _("Unable to set AIM profile."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4522 _("You have probably requested to set your " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4523 "profile before the login procedure completed. " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4524 "Your profile remains unset; try setting it " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4525 "again when you are fully connected.")); |
4617 | 4526 |
7334 | 4527 if (!text) { |
4528 aim_locate_setprofile(od->sess, NULL, "", 0, NULL, NULL, 0); | |
4529 return; | |
4530 } | |
6019 | 4531 |
7334 | 4532 text_html = gaim_strdup_withhtml(text); |
4533 flags = oscar_encoding_check(text_html); | |
4534 if (flags & AIM_IMFLAGS_UNICODE) { | |
4535 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); | |
4536 aim_locate_setprofile(od->sess, "unicode-2-0", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); | |
4537 g_free(msg); | |
4538 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { | |
4539 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); | |
4540 aim_locate_setprofile(od->sess, "iso-8859-1", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); | |
4541 g_free(msg); | |
4542 } else { | |
4543 msglen = strlen(text_html); | |
4544 aim_locate_setprofile(od->sess, "us-ascii", text_html, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); | |
4545 } | |
4546 | |
4547 if (msglen > od->rights.maxsiglen) { | |
4548 gchar *errstr; | |
4549 errstr = g_strdup_printf(ngettext("The maximum profile length of %d byte " | |
4550 "has been exceeded. Gaim has truncated it for you.", | |
4551 "The maximum profile length of %d bytes " | |
4552 "has been exceeded. Gaim has truncated it for you.", | |
4553 od->rights.maxsiglen), od->rights.maxsiglen); | |
4554 gaim_notify_warning(gc, NULL, _("Profile too long."), errstr); | |
4555 g_free(errstr); | |
4556 } | |
4557 | |
4558 g_free(text_html); | |
2993 | 4559 |
4560 return; | |
2086 | 4561 } |
4562 | |
7283 | 4563 static void oscar_set_away_aim(GaimConnection *gc, OscarData *od, const char *text) |
2993 | 4564 { |
5129 | 4565 fu32_t flags = 0; |
6019 | 4566 gchar *text_html = NULL; |
5129 | 4567 char *msg = NULL; |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
4568 gsize msglen = 0; |
2993 | 4569 |
4570 if (od->rights.maxawaymsglen == 0) | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4571 gaim_notify_warning(gc, NULL, _("Unable to set AIM away message."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4572 _("You have probably requested to set your " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4573 "away message before the login procedure " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4574 "completed. You remain in a \"present\" " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4575 "state; try setting it again when you are " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4576 "fully connected.")); |
5129 | 4577 |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4578 if (gc->away) { |
2993 | 4579 g_free(gc->away); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4580 gc->away = NULL; |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4581 } |
2993 | 4582 |
5129 | 4583 if (!text) { |
7334 | 4584 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4585 return; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4586 } |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4587 |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4588 text_html = gaim_strdup_withhtml(text); |
6019 | 4589 flags = oscar_encoding_check(text_html); |
5129 | 4590 if (flags & AIM_IMFLAGS_UNICODE) { |
6019 | 4591 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); |
7011 | 4592 aim_locate_setprofile(od->sess, NULL, NULL, 0, "unicode-2-0", msg, |
7334 | 4593 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); |
5129 | 4594 g_free(msg); |
4595 gc->away = g_strndup(text, od->rights.maxawaymsglen/2); | |
4596 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { | |
6019 | 4597 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); |
7011 | 4598 aim_locate_setprofile(od->sess, NULL, NULL, 0, "iso-8859-1", msg, |
7334 | 4599 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); |
5129 | 4600 g_free(msg); |
6019 | 4601 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); |
5129 | 4602 } else { |
6019 | 4603 msglen = strlen(text_html); |
7011 | 4604 aim_locate_setprofile(od->sess, NULL, NULL, 0, "us-ascii", text_html, |
7334 | 4605 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); |
6019 | 4606 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); |
5129 | 4607 } |
4608 | |
4609 if (msglen > od->rights.maxawaymsglen) { | |
2993 | 4610 gchar *errstr; |
4611 | |
6308 | 4612 errstr = g_strdup_printf(ngettext("The maximum away message length of %d byte " |
4613 "has been exceeded. Gaim has truncated it for you.", | |
4614 "The maximum away message length of %d bytes " | |
4615 "has been exceeded. Gaim has truncated it for you.", | |
4616 od->rights.maxawaymsglen), od->rights.maxawaymsglen); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4617 gaim_notify_warning(gc, NULL, _("Away message too long."), errstr); |
2993 | 4618 g_free(errstr); |
4619 } | |
6019 | 4620 |
4621 g_free(text_html); | |
2993 | 4622 return; |
4623 } | |
4624 | |
7283 | 4625 static void oscar_set_away_icq(GaimConnection *gc, OscarData *od, const char *state, const char *message) |
2993 | 4626 { |
5575 | 4627 GaimAccount *account = gaim_connection_get_account(gc); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4628 if (gc->away) { |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4629 g_free(gc->away); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4630 gc->away = NULL; |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4631 } |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4632 |
4342 | 4633 if (strcmp(state, _("Invisible"))) { |
5575 | 4634 if ((od->sess->ssi.received_data) && (aim_ssi_getpermdeny(od->sess->ssi.local) != account->perm_deny)) |
4635 aim_ssi_setpermdeny(od->sess, account->perm_deny, 0xffffffff); | |
4636 account->perm_deny = 4; | |
4342 | 4637 } else { |
5542 | 4638 if ((od->sess->ssi.received_data) && (aim_ssi_getpermdeny(od->sess->ssi.local) != 0x03)) |
4889 | 4639 aim_ssi_setpermdeny(od->sess, 0x03, 0xffffffff); |
5575 | 4640 account->perm_deny = 3; |
4342 | 4641 } |
4642 | |
4643 if (!strcmp(state, _("Online"))) | |
4901 | 4644 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
4342 | 4645 else if (!strcmp(state, _("Away"))) { |
4901 | 4646 aim_setextstatus(od->sess, AIM_ICQ_STATE_AWAY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4647 gc->away = g_strdup(""); |
4342 | 4648 } else if (!strcmp(state, _("Do Not Disturb"))) { |
4901 | 4649 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
|
4650 gc->away = g_strdup(""); |
4342 | 4651 } else if (!strcmp(state, _("Not Available"))) { |
4901 | 4652 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
|
4653 gc->away = g_strdup(""); |
4342 | 4654 } else if (!strcmp(state, _("Occupied"))) { |
4901 | 4655 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
|
4656 gc->away = g_strdup(""); |
4342 | 4657 } else if (!strcmp(state, _("Free For Chat"))) { |
4901 | 4658 aim_setextstatus(od->sess, AIM_ICQ_STATE_CHAT); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4659 gc->away = g_strdup(""); |
4342 | 4660 } else if (!strcmp(state, _("Invisible"))) { |
4901 | 4661 aim_setextstatus(od->sess, AIM_ICQ_STATE_INVISIBLE); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4662 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4663 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { |
2998 | 4664 if (message) { |
4901 | 4665 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
|
4666 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4667 } else { |
4901 | 4668 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4669 } |
2086 | 4670 } |
2993 | 4671 |
4672 return; | |
4673 } | |
4674 | |
6059 | 4675 static void oscar_set_away(GaimConnection *gc, const char *state, const char *message) |
2993 | 4676 { |
7283 | 4677 OscarData *od = (OscarData *)gc->proto_data; |
2993 | 4678 |
4679 if (od->icq) | |
4680 oscar_set_away_icq(gc, od, state, message); | |
4681 else | |
4682 oscar_set_away_aim(gc, od, message); | |
4683 | |
4684 return; | |
2086 | 4685 } |
4686 | |
6059 | 4687 static void oscar_warn(GaimConnection *gc, const char *name, int anon) { |
7283 | 4688 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 4689 aim_im_warn(od->sess, od->conn, name, anon ? AIM_WARN_ANON : 0); |
2086 | 4690 } |
4691 | |
5575 | 4692 static void oscar_dir_search(GaimConnection *gc, const char *first, const char *middle, const char *last, |
3466 | 4693 const char *maiden, const char *city, const char *state, const char *country, const char *email) { |
7283 | 4694 OscarData *od = (OscarData *)gc->proto_data; |
2086 | 4695 if (strlen(email)) |
6879 | 4696 aim_search_address(od->sess, od->conn, email); |
2086 | 4697 } |
4698 | |
6787
faa491042c66
[gaim-migrate @ 7326]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4699 static void oscar_add_buddy(GaimConnection *gc, const char *name, GaimGroup *g) { |
7283 | 4700 OscarData *od = (OscarData *)gc->proto_data; |
8150 | 4701 GaimBuddy *b; |
4702 | |
4703 if (g == NULL) { | |
4704 /* If we were called from oscar_add_buddies... */ | |
4705 b = gaim_find_buddy(gaim_connection_get_account(gc), name); | |
4706 g = gaim_find_buddys_group(b); | |
4707 } else | |
4708 b = gaim_find_buddy_in_group(gaim_connection_get_account(gc), name, g); | |
8092 | 4709 |
4710 if (!aim_snvalid(name)) { | |
4711 gchar *buf; | |
8150 | 4712 buf = g_strdup_printf(_("Could not add the buddy %s because the screen name is invalid. Screen names must either start with a letter and contain only letters, numbers and spaces, or contain only numbers."), name); |
8092 | 4713 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
4714 g_free(buf); | |
8150 | 4715 |
4716 /* Remove from local list */ | |
4717 gaim_blist_remove_buddy(b); | |
4718 | |
8092 | 4719 return; |
4720 } | |
4721 | |
4230 | 4722 #ifdef NOSSI |
8143 | 4723 aim_buddylist_addbuddy(od->sess, od->conn, name); |
4230 | 4724 #else |
4725 if ((od->sess->ssi.received_data) && !(aim_ssi_itemlist_exists(od->sess->ssi.local, name))) { | |
8150 | 4726 if (b && g) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4727 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
8150 | 4728 "ssi: adding buddy %s to group %s\n", name, g->name); |
4729 aim_ssi_addbuddy(od->sess, b->name, g->name, gaim_get_buddy_alias_only(b), NULL, NULL, 0); | |
4230 | 4730 } |
4731 } | |
4732 #endif | |
8150 | 4733 |
4759 | 4734 if (od->icq) |
4735 aim_icq_getalias(od->sess, name); | |
4230 | 4736 } |
4737 | |
5575 | 4738 static void oscar_add_buddies(GaimConnection *gc, GList *buddies) { |
7283 | 4739 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 4740 #ifdef NOSSI |
4741 char buf[MSG_LEN]; | |
4742 int n=0; | |
4743 while (buddies) { | |
4744 if (n > MSG_LEN - 18) { | |
7285 | 4745 aim_buddylist_set(od->sess, od->conn, buf); |
4230 | 4746 n = 0; |
3092 | 4747 } |
8150 | 4748 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", (const char *)buddies->data); |
4230 | 4749 buddies = buddies->next; |
4750 } | |
7285 | 4751 aim_buddylist_set(od->sess, od->conn, buf); |
4230 | 4752 #else |
4753 if (od->sess->ssi.received_data) { | |
4754 while (buddies) { | |
8092 | 4755 oscar_add_buddy(gc, buddies->data, NULL); |
4230 | 4756 buddies = buddies->next; |
4757 } | |
4758 } | |
4759 #endif | |
4760 } | |
4761 | |
6059 | 4762 static void oscar_remove_buddy(GaimConnection *gc, const char *name, const char *group) { |
7283 | 4763 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 4764 #ifdef NOSSI |
8143 | 4765 aim_buddylist_removebuddy(od->sess, od->conn, name); |
4230 | 4766 #else |
4767 if (od->sess->ssi.received_data) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4768 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4769 "ssi: deleting buddy %s from group %s\n", name, group); |
4889 | 4770 aim_ssi_delbuddy(od->sess, name, group); |
4230 | 4771 } |
4772 #endif | |
4773 } | |
4774 | |
5575 | 4775 static void oscar_remove_buddies(GaimConnection *gc, GList *buddies, const char *group) { |
7283 | 4776 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 4777 #ifdef NOSSI |
4778 GList *cur; | |
4779 for (cur=buddies; cur; cur=cur->next) | |
8143 | 4780 aim_buddylist_removebuddy(od->sess, od->conn, cur->data); |
4230 | 4781 #else |
4782 if (od->sess->ssi.received_data) { | |
3092 | 4783 while (buddies) { |
8150 | 4784 oscar_remove_buddy(gc, buddies->data, group); |
3092 | 4785 buddies = buddies->next; |
4786 } | |
4230 | 4787 } |
4788 #endif | |
4789 } | |
4790 | |
4791 #ifndef NOSSI | |
5575 | 4792 static void oscar_move_buddy(GaimConnection *gc, const char *name, const char *old_group, const char *new_group) { |
7283 | 4793 OscarData *od = (OscarData *)gc->proto_data; |
4303 | 4794 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
|
4795 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4796 "ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group); |
4889 | 4797 aim_ssi_movebuddy(od->sess, old_group, new_group, name); |
4269 | 4798 } |
4799 } | |
4800 | |
5575 | 4801 static void oscar_alias_buddy(GaimConnection *gc, const char *name, const char *alias) { |
7283 | 4802 OscarData *od = (OscarData *)gc->proto_data; |
4269 | 4803 if (od->sess->ssi.received_data) { |
4804 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, name); | |
4805 if (gname) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4806 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4807 "ssi: changing the alias for buddy %s to %s\n", name, alias); |
4889 | 4808 aim_ssi_aliasbuddy(od->sess, gname, name, alias); |
4269 | 4809 } |
4810 } | |
4811 } | |
4812 | |
5575 | 4813 static void oscar_rename_group(GaimConnection *g, const char *old_group, const char *new_group, GList *members) { |
7283 | 4814 OscarData *od = (OscarData *)g->proto_data; |
4230 | 4815 |
4816 if (od->sess->ssi.received_data) { | |
4817 if (aim_ssi_itemlist_finditem(od->sess->ssi.local, new_group, NULL, AIM_SSI_TYPE_GROUP)) { | |
4818 oscar_remove_buddies(g, members, old_group); | |
4819 oscar_add_buddies(g, members); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4820 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4821 "ssi: moved all buddies from group %s to %s\n", old_group, new_group); |
4230 | 4822 } else { |
4889 | 4823 aim_ssi_rename_group(od->sess, old_group, new_group); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4824 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4825 "ssi: renamed group %s to %s\n", old_group, new_group); |
2995 | 4826 } |
4827 } | |
4828 } | |
4829 | |
5968 | 4830 static gboolean gaim_ssi_rerequestdata(gpointer data) { |
4831 aim_session_t *sess = data; | |
6350 | 4832 aim_ssi_reqdata(sess); |
5968 | 4833 return FALSE; |
4834 } | |
4835 | |
4642 | 4836 static int gaim_ssi_parseerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4837 GaimConnection *gc = sess->aux_data; |
7283 | 4838 OscarData *od = gc->proto_data; |
4642 | 4839 va_list ap; |
4840 fu16_t reason; | |
4841 | |
4842 va_start(ap, fr); | |
4843 reason = (fu16_t)va_arg(ap, unsigned int); | |
4844 va_end(ap); | |
4845 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4846 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: SNAC error %hu\n", reason); |
4642 | 4847 |
4848 if (reason == 0x0005) { | |
5892 | 4849 gaim_notify_error(gc, NULL, _("Unable To Retrieve Buddy List"), |
5828 | 4850 _("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 | 4851 od->getblisttimer = g_timeout_add(300000, gaim_ssi_rerequestdata, od->sess); |
4642 | 4852 } |
4853 | |
4854 /* Activate SSI */ | |
4855 /* Sending the enable causes other people to be able to see you, and you to see them */ | |
4856 /* Make sure your privacy setting/invisibility is set how you want it before this! */ | |
5968 | 4857 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: activating server-stored buddy list\n"); |
4642 | 4858 aim_ssi_enable(od->sess); |
4859 | |
4860 return 1; | |
4861 } | |
4862 | |
2991 | 4863 static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4864 GaimConnection *gc = sess->aux_data; |
7283 | 4865 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 4866 int numtypes, i; |
4867 fu16_t *maxitems; | |
2991 | 4868 va_list ap; |
4869 | |
4870 va_start(ap, fr); | |
4230 | 4871 numtypes = va_arg(ap, int); |
4872 maxitems = va_arg(ap, fu16_t *); | |
2991 | 4873 va_end(ap); |
4874 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4875 gaim_debug(GAIM_DEBUG_MISC, "oscar", "ssi rights:"); |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4876 |
4230 | 4877 for (i=0; i<numtypes; i++) |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4878 gaim_debug(GAIM_DEBUG_MISC, NULL, " max type 0x%04x=%hd,", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4879 i, maxitems[i]); |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4880 |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4881 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n"); |
4230 | 4882 |
4883 if (numtypes >= 0) | |
4884 od->rights.maxbuddies = maxitems[0]; | |
4885 if (numtypes >= 1) | |
4886 od->rights.maxgroups = maxitems[1]; | |
4887 if (numtypes >= 2) | |
4888 od->rights.maxpermits = maxitems[2]; | |
4889 if (numtypes >= 3) | |
4890 od->rights.maxdenies = maxitems[3]; | |
2991 | 4891 |
4892 return 1; | |
4893 } | |
4894 | |
4895 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 4896 GaimConnection *gc = sess->aux_data; |
4897 GaimAccount *account = gaim_connection_get_account(gc); | |
7283 | 4898 OscarData *od = (OscarData *)gc->proto_data; |
8150 | 4899 GaimGroup *g; |
4900 GaimBuddy *b; | |
2995 | 4901 struct aim_ssi_item *curitem; |
2991 | 4902 int tmp; |
4230 | 4903 va_list ap; |
8219 | 4904 fu16_t fmtver, numitems; |
4905 struct aim_ssi_item *items; | |
4906 fu32_t timestamp; | |
4230 | 4907 |
4908 va_start(ap, fr); | |
4909 fmtver = (fu16_t)va_arg(ap, int); | |
4910 numitems = (fu16_t)va_arg(ap, int); | |
8219 | 4911 items = va_arg(ap, struct aim_ssi_item *); |
4230 | 4912 timestamp = va_arg(ap, fu32_t); |
8219 | 4913 va_end(ap); |
2991 | 4914 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4915 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4916 "ssi: syncing local list and server list\n"); |
2991 | 4917 |
8219 | 4918 if ((timestamp == 0) || (numitems == 0)) { |
4919 gaim_notify_error(gc, NULL, "Got AIM SSI with a 0 timestamp or 0 numitems, not syncing, tell KingAnt! And tell him if your buddy list actually works or not. Thanks! Oh, IM him at markdoliner on AIM/ICQ.", NULL); | |
4920 return 1; | |
4921 } | |
4922 | |
2991 | 4923 /* Clean the buddy list */ |
4889 | 4924 aim_ssi_cleanlist(sess); |
2991 | 4925 |
8150 | 4926 { /* If not in server list then prune from local list */ |
4927 GaimBlistNode *gnode, *cnode, *bnode; | |
4928 GaimBuddyList *blist; | |
4929 GSList *cur; | |
4930 | |
4931 /* Buddies */ | |
4932 cur = NULL; | |
4933 if ((blist = gaim_get_blist()) != NULL) { | |
4934 for (gnode = blist->root; gnode; gnode = gnode->next) { | |
4935 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
4936 continue; | |
4937 g = (GaimGroup *)gnode; | |
4938 for (cnode = gnode->child; cnode; cnode = cnode->next) { | |
4939 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4940 continue; | |
4941 for (bnode = cnode->child; bnode; bnode = bnode->next) { | |
4942 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
4943 continue; | |
4944 b = (GaimBuddy *)bnode; | |
4945 if (b->account == gc->account) { | |
4946 if (aim_ssi_itemlist_exists(sess->ssi.local, b->name)) { | |
4947 /* If the buddy is an ICQ user then load his nickname */ | |
4948 const char *servernick = gaim_blist_node_get_string((GaimBlistNode*)b, "servernick"); | |
8214 | 4949 char *alias; |
8150 | 4950 if (servernick) |
4951 serv_got_alias(gc, b->name, servernick); | |
4952 | |
4953 /* Store local alias on server */ | |
8214 | 4954 alias = aim_ssi_getalias(sess->ssi.local, g->name, b->name); |
8150 | 4955 if (!alias && b->alias && strlen(b->alias)) |
4956 aim_ssi_aliasbuddy(sess, g->name, b->name, b->alias); | |
4957 free(alias); | |
4958 } else { | |
4959 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
4960 "ssi: removing buddy %s from local list\n", b->name); | |
4961 /* We can't actually remove now because it will screw up our looping */ | |
4962 cur = g_slist_prepend(cur, b); | |
4963 } | |
4964 } | |
4965 } | |
4966 } | |
4967 } | |
4968 } | |
8175 | 4969 |
8150 | 4970 while (cur != NULL) { |
4971 b = cur->data; | |
4972 cur = g_slist_remove(cur, b); | |
4973 gaim_blist_remove_buddy(b); | |
4974 } | |
4975 | |
4976 /* Permit list */ | |
4977 if (gc->account->permit) { | |
4978 for (cur=gc->account->permit; cur; cur=cur->next) | |
4979 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) { | |
4980 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
4981 "ssi: removing permit %s from local list\n", (const char *)cur->data); | |
4982 gaim_privacy_permit_remove(account, cur->data, TRUE); | |
4983 cur = gc->account->permit; | |
4984 } | |
4985 } | |
4986 | |
4987 /* Deny list */ | |
4988 if (gc->account->deny) { | |
4989 for (cur=gc->account->deny; cur; cur=cur->next) | |
4990 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_DENY)) { | |
4991 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
4992 "ssi: removing deny %s from local list\n", (const char *)cur->data); | |
4993 gaim_privacy_deny_remove(account, cur->data, TRUE); | |
4994 cur = gc->account->deny; | |
4995 } | |
4996 } | |
4997 /* Presence settings (idle time visibility) */ | |
4998 if ((tmp = aim_ssi_getpresence(sess->ssi.local)) != 0xFFFFFFFF) | |
4999 if (!(tmp & 0x400)) | |
5000 aim_ssi_setpresence(sess, tmp | 0x400); | |
5001 } /* end pruning buddies from local list */ | |
5002 | |
2991 | 5003 /* Add from server list to local list */ |
4230 | 5004 for (curitem=sess->ssi.local; curitem; curitem=curitem->next) { |
7328 | 5005 if ((curitem->name == NULL) || (g_utf8_validate(curitem->name, -1, NULL))) |
2991 | 5006 switch (curitem->type) { |
4230 | 5007 case 0x0000: { /* Buddy */ |
4251 | 5008 if (curitem->name) { |
4292 | 5009 char *gname = aim_ssi_itemlist_findparentname(sess->ssi.local, curitem->name); |
7166 | 5010 char *gname_utf8 = gname ? gaim_utf8_try_convert(gname) : NULL; |
4282 | 5011 char *alias = aim_ssi_getalias(sess->ssi.local, gname, curitem->name); |
7166 | 5012 char *alias_utf8 = alias ? gaim_utf8_try_convert(alias) : NULL; |
8150 | 5013 b = gaim_find_buddy(gc->account, curitem->name); |
4458 | 5014 /* Should gname be freed here? -- elb */ |
4754 | 5015 /* Not with the current code, but that might be cleaner -- med */ |
4458 | 5016 free(alias); |
8150 | 5017 if (b) { |
4292 | 5018 /* Get server stored alias */ |
4705 | 5019 if (alias_utf8) { |
8150 | 5020 g_free(b->alias); |
5021 b->alias = g_strdup(alias_utf8); | |
4705 | 5022 } |
4282 | 5023 } else { |
8150 | 5024 b = gaim_buddy_new(gc->account, curitem->name, alias_utf8); |
5146 | 5025 |
4754 | 5026 if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { |
4687 | 5027 g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); |
4754 | 5028 gaim_blist_add_group(g, NULL); |
5029 } | |
5146 | 5030 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5031 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
8150 | 5032 "ssi: adding b %s to group %s to local list\n", curitem->name, gname_utf8 ? gname_utf8 : _("Orphans")); |
5033 gaim_blist_add_buddy(b, NULL, g, NULL); | |
4251 | 5034 } |
7162 | 5035 g_free(gname_utf8); |
5036 g_free(alias_utf8); | |
2991 | 5037 } |
4230 | 5038 } break; |
5039 | |
5040 case 0x0001: { /* Group */ | |
4282 | 5041 /* Shouldn't add empty groups */ |
4230 | 5042 } break; |
5043 | |
5044 case 0x0002: { /* Permit buddy */ | |
2991 | 5045 if (curitem->name) { |
4230 | 5046 /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */ |
2991 | 5047 GSList *list; |
5575 | 5048 for (list=account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
2991 | 5049 if (!list) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5050 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5051 "ssi: adding permit buddy %s to local list\n", curitem->name); |
6400
588e88bcdac5
[gaim-migrate @ 6905]
Christian Hammond <chipx86@chipx86.com>
parents:
6378
diff
changeset
|
5052 gaim_privacy_permit_add(account, curitem->name, TRUE); |
2991 | 5053 } |
5054 } | |
4230 | 5055 } break; |
5056 | |
5057 case 0x0003: { /* Deny buddy */ | |
2991 | 5058 if (curitem->name) { |
5059 GSList *list; | |
5575 | 5060 for (list=account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
2991 | 5061 if (!list) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5062 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5063 "ssi: adding deny buddy %s to local list\n", curitem->name); |
6400
588e88bcdac5
[gaim-migrate @ 6905]
Christian Hammond <chipx86@chipx86.com>
parents:
6378
diff
changeset
|
5064 gaim_privacy_deny_add(account, curitem->name, TRUE); |
2991 | 5065 } |
5066 } | |
4230 | 5067 } break; |
5068 | |
5069 case 0x0004: { /* Permit/deny setting */ | |
2991 | 5070 if (curitem->data) { |
5071 fu8_t permdeny; | |
5575 | 5072 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
|
5073 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
5575 | 5074 "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, permdeny); |
5075 account->perm_deny = permdeny; | |
5076 if (od->icq && account->perm_deny == 0x03) { | |
4342 | 5077 serv_set_away(gc, "Invisible", ""); |
5078 } | |
2991 | 5079 } |
5080 } | |
4230 | 5081 } break; |
5082 | |
5083 case 0x0005: { /* Presence setting */ | |
3109 | 5084 /* We don't want to change Gaim's setting because it applies to all accounts */ |
4230 | 5085 } break; |
2991 | 5086 } /* End of switch on curitem->type */ |
5087 } /* End of for loop */ | |
4230 | 5088 |
4901 | 5089 /* Set our ICQ status */ |
5090 if (od->icq && !gc->away) { | |
5091 aim_setextstatus(sess, AIM_ICQ_STATE_NORMAL); | |
5092 } | |
5093 | |
4342 | 5094 /* Activate SSI */ |
5095 /* Sending the enable causes other people to be able to see you, and you to see them */ | |
5096 /* 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
|
5097 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5098 "ssi: activating server-stored buddy list\n"); |
4642 | 5099 aim_ssi_enable(sess); |
4342 | 5100 |
2991 | 5101 return 1; |
2086 | 5102 } |
4230 | 5103 |
5104 static int gaim_ssi_parseack(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5105 GaimConnection *gc = sess->aux_data; |
4230 | 5106 va_list ap; |
5107 struct aim_ssi_tmp *retval; | |
5108 | |
5109 va_start(ap, fr); | |
5110 retval = va_arg(ap, struct aim_ssi_tmp *); | |
5111 va_end(ap); | |
5112 | |
5113 while (retval) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5114 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5115 "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 | 5116 |
5117 if (retval->ack != 0xffff) | |
5118 switch (retval->ack) { | |
5119 case 0x0000: { /* added successfully */ | |
5120 } break; | |
5121 | |
4829 | 5122 case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */ |
5123 gchar *buf; | |
5124 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
|
5125 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
4829 | 5126 g_free(buf); |
5127 } | |
5128 | |
7023 | 5129 case 0x000e: { /* buddy requires authorization */ |
4828 | 5130 if ((retval->action == AIM_CB_SSI_ADD) && (retval->name)) |
4269 | 5131 gaim_auth_sendrequest(gc, retval->name); |
4230 | 5132 } break; |
5133 | |
5134 default: { /* La la la */ | |
5197 | 5135 gchar *buf; |
5402 | 5136 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack); |
5137 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
|
5138 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
5197 | 5139 g_free(buf); |
4230 | 5140 } break; |
5141 } | |
5142 | |
5143 retval = retval->next; | |
5144 } | |
5145 | |
5146 return 1; | |
5147 } | |
5148 | |
5149 static int gaim_ssi_authgiven(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5150 GaimConnection *gc = sess->aux_data; |
4230 | 5151 va_list ap; |
5152 char *sn, *msg; | |
4236 | 5153 gchar *dialog_msg, *nombre; |
4230 | 5154 struct name_data *data; |
6695 | 5155 GaimBuddy *buddy; |
4230 | 5156 |
5157 va_start(ap, fr); | |
5158 sn = va_arg(ap, char *); | |
5159 msg = va_arg(ap, char *); | |
5160 va_end(ap); | |
5161 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5162 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5163 "ssi: %s has given you permission to add him to your buddy list\n", sn); |
4230 | 5164 |
4687 | 5165 buddy = gaim_find_buddy(gc->account, sn); |
5166 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5167 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5168 else |
5169 nombre = g_strdup(sn); | |
5170 | |
5171 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 | 5172 data = g_new(struct name_data, 1); |
5173 data->gc = gc; | |
5174 data->name = g_strdup(sn); | |
5175 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5176 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5177 gaim_request_yes_no(gc, NULL, _("Authorization Given"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5178 0, data, |
7023 | 5179 G_CALLBACK(gaim_icq_buddyadd), |
5836 | 5180 G_CALLBACK(oscar_free_name_data)); |
4236 | 5181 |
4230 | 5182 g_free(dialog_msg); |
4236 | 5183 g_free(nombre); |
4230 | 5184 |
5185 return 1; | |
5186 } | |
5187 | |
5188 static int gaim_ssi_authrequest(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5189 GaimConnection *gc = sess->aux_data; |
4230 | 5190 va_list ap; |
5191 char *sn, *msg; | |
4236 | 5192 gchar *dialog_msg, *nombre; |
4230 | 5193 struct name_data *data; |
6695 | 5194 GaimBuddy *buddy; |
4230 | 5195 |
5196 va_start(ap, fr); | |
5197 sn = va_arg(ap, char *); | |
5198 msg = va_arg(ap, char *); | |
5199 va_end(ap); | |
5200 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5201 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5202 "ssi: received authorization request from %s\n", sn); |
4230 | 5203 |
4687 | 5204 buddy = gaim_find_buddy(gc->account, sn); |
5205 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5206 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5207 else |
5208 nombre = g_strdup(sn); | |
5209 | |
4337 | 5210 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 | 5211 data = g_new(struct name_data, 1); |
5212 data->gc = gc; | |
5213 data->name = g_strdup(sn); | |
5214 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5215 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5216 gaim_request_action(gc, NULL, _("Authorization Request"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5217 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5218 _("Authorize"), G_CALLBACK(gaim_auth_grant), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5219 _("Deny"), G_CALLBACK(gaim_auth_dontgrant_msgprompt)); |
4236 | 5220 |
4230 | 5221 g_free(dialog_msg); |
4236 | 5222 g_free(nombre); |
4230 | 5223 |
5224 return 1; | |
5225 } | |
5226 | |
5227 static int gaim_ssi_authreply(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5228 GaimConnection *gc = sess->aux_data; |
4230 | 5229 va_list ap; |
5230 char *sn, *msg; | |
4236 | 5231 gchar *dialog_msg, *nombre; |
4230 | 5232 fu8_t reply; |
6695 | 5233 GaimBuddy *buddy; |
4230 | 5234 |
5235 va_start(ap, fr); | |
5236 sn = va_arg(ap, char *); | |
5237 reply = (fu8_t)va_arg(ap, int); | |
5238 msg = va_arg(ap, char *); | |
5239 va_end(ap); | |
5240 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5241 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5242 "ssi: received authorization reply from %s. Reply is 0x%04hhx\n", sn, reply); |
4236 | 5243 |
4687 | 5244 buddy = gaim_find_buddy(gc->account, sn); |
5245 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5246 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5247 else |
5248 nombre = g_strdup(sn); | |
5249 | |
4230 | 5250 if (reply) { |
5251 /* Granted */ | |
7023 | 5252 dialog_msg = g_strdup_printf(_("The user %s has granted your request to add them to your buddy list."), nombre); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5253 gaim_notify_info(gc, NULL, _("Authorization Granted"), dialog_msg); |
4230 | 5254 } else { |
5255 /* Denied */ | |
7023 | 5256 dialog_msg = g_strdup_printf(_("The user %s has denied your request to add them to your buddy 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
|
5257 gaim_notify_info(gc, NULL, _("Authorization Denied"), dialog_msg); |
4230 | 5258 } |
5259 g_free(dialog_msg); | |
4236 | 5260 g_free(nombre); |
4230 | 5261 |
5262 return 1; | |
5263 } | |
5264 | |
5265 static int gaim_ssi_gotadded(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5266 GaimConnection *gc = sess->aux_data; |
4230 | 5267 va_list ap; |
5268 char *sn; | |
6695 | 5269 GaimBuddy *buddy; |
4230 | 5270 |
5271 va_start(ap, fr); | |
5272 sn = va_arg(ap, char *); | |
5273 va_end(ap); | |
5274 | |
4687 | 5275 buddy = gaim_find_buddy(gc->account, sn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5276 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5277 "ssi: %s added you to their buddy list\n", sn); |
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
7011
diff
changeset
|
5278 gaim_account_notify_added(gc->account, NULL, sn, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); |
4230 | 5279 |
5280 return 1; | |
5281 } | |
4269 | 5282 #endif |
2086 | 5283 |
5575 | 5284 static GList *oscar_chat_info(GaimConnection *gc) { |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5285 GList *m = NULL; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5286 struct proto_chat_entry *pce; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5287 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5288 pce = g_new0(struct proto_chat_entry, 1); |
7841 | 5289 pce->label = _("_Group:"); |
5234 | 5290 pce->identifier = "room"; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5291 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5292 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5293 pce = g_new0(struct proto_chat_entry, 1); |
7841 | 5294 pce->label = _("_Exchange:"); |
5234 | 5295 pce->identifier = "exchange"; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5296 pce->is_int = TRUE; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5297 pce->min = 4; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5298 pce->max = 20; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5299 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5300 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5301 return m; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5302 } |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5303 |
5575 | 5304 static void oscar_join_chat(GaimConnection *g, GHashTable *data) { |
7283 | 5305 OscarData *od = (OscarData *)g->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5306 aim_conn_t *cur; |
5234 | 5307 char *name, *exchange; |
5308 | |
5309 name = g_hash_table_lookup(data, "room"); | |
5310 exchange = g_hash_table_lookup(data, "exchange"); | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5311 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5312 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5313 "Attempting to join chat room %s.\n", name); |
4617 | 5314 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
|
5315 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5316 "chatnav exists, creating room\n"); |
5234 | 5317 aim_chatnav_createroom(od->sess, cur, name, atoi(exchange)); |
2086 | 5318 } else { |
5319 /* this gets tricky */ | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
5320 struct create_room *cr = g_new0(struct create_room, 1); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5321 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5322 "chatnav does not exist, opening chatnav\n"); |
5234 | 5323 cr->exchange = atoi(exchange); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
5324 cr->name = g_strdup(name); |
4617 | 5325 od->create_rooms = g_slist_append(od->create_rooms, cr); |
5326 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV); | |
2086 | 5327 } |
5328 } | |
5329 | |
5575 | 5330 static void oscar_chat_invite(GaimConnection *g, int id, const char *message, const char *name) { |
7283 | 5331 OscarData *od = (OscarData *)g->proto_data; |
2086 | 5332 struct chat_connection *ccon = find_oscar_chat(g, id); |
5333 | |
5334 if (!ccon) | |
5335 return; | |
5336 | |
4617 | 5337 aim_chat_invite(od->sess, od->conn, name, message ? message : "", |
2086 | 5338 ccon->exchange, ccon->name, 0x0); |
5339 } | |
5340 | |
5575 | 5341 static void oscar_chat_leave(GaimConnection *g, int id) { |
7283 | 5342 OscarData *od = g ? (OscarData *)g->proto_data : NULL; |
2086 | 5343 GSList *bcs = g->buddy_chats; |
5679 | 5344 GaimConversation *b = NULL; |
2086 | 5345 struct chat_connection *c = NULL; |
5346 int count = 0; | |
5347 | |
5348 while (bcs) { | |
5349 count++; | |
5679 | 5350 b = (GaimConversation *)bcs->data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5351 if (id == gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))) |
2086 | 5352 break; |
5353 bcs = bcs->next; | |
5354 b = NULL; | |
5355 } | |
5356 | |
5357 if (!b) | |
5358 return; | |
5359 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5360 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5361 "Attempting to leave room %s (currently in %d rooms)\n", b->name, count); |
2086 | 5362 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5363 c = find_oscar_chat(g, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))); |
2086 | 5364 if (c != NULL) { |
4617 | 5365 if (od) |
5366 od->oscar_chats = g_slist_remove(od->oscar_chats, c); | |
2086 | 5367 if (c->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
5368 gaim_input_remove(c->inpa); |
4617 | 5369 if (g && od->sess) |
5370 aim_conn_kill(od->sess, &c->conn); | |
2086 | 5371 g_free(c->name); |
5372 g_free(c->show); | |
5373 g_free(c); | |
5374 } | |
5375 /* we do this because with Oscar it doesn't tell us we left */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5376 serv_got_chat_left(g, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))); |
2086 | 5377 } |
5378 | |
8219 | 5379 static int oscar_send_chat(GaimConnection *gc, int id, const char *message) { |
5380 OscarData *od = (OscarData *)gc->proto_data; | |
5381 GError *err = NULL; | |
5382 GaimConversation *conv = NULL; | |
2086 | 5383 struct chat_connection *c = NULL; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5384 char *buf, *buf2; |
8219 | 5385 char *charset = NULL; |
5386 int encoding; | |
5387 int len; | |
5388 | |
5389 if (!(conv = gaim_find_chat(gc, id))) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5390 return -EINVAL; |
2086 | 5391 |
8219 | 5392 if (!(c = find_oscar_chat_by_conv(gc, conv))) |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5393 return -EINVAL; |
2086 | 5394 |
8219 | 5395 buf = gaim_strdup_withhtml(message); |
5396 len = strlen(buf); | |
5397 | |
5398 encoding = oscar_encoding_check(buf); | |
5399 if (encoding == AIM_IMFLAGS_UNICODE) { | |
5400 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Sending Unicode Chat\n"); | |
5401 charset = "unicode-2-0"; | |
5402 buf2 = g_convert(buf, len, "UCS-2BE", "UTF-8", NULL, &len, &err); | |
5403 if (err) { | |
5404 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5405 "Error converting a unicode message: %s\n", | |
5406 err->message); | |
5407 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5408 "This really shouldn't happen!\n"); | |
5409 /* We really shouldn't try to send the | |
5410 * IM now, but I'm not sure what to do */ | |
5411 g_error_free(err); | |
5412 } | |
5413 } else if (encoding & AIM_IMFLAGS_ISO_8859_1) { | |
5414 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
5415 "Sending ISO-8859-1 Chat\n"); | |
5416 charset = "iso-8859-1"; | |
5417 buf2 = g_convert(buf, len, "ISO-8859-1", "UTF-8", NULL, &len, &err); | |
5418 if (err) { | |
5419 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5420 "conversion error: %s\n", err->message); | |
5421 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5422 "Someone tell Ethan his 8859-1 detection is wrong\n"); | |
5423 g_error_free(err); | |
5424 encoding = AIM_IMFLAGS_UNICODE; | |
5425 buf2 = g_convert(buf, len, "UCS-2BE", "UTF8", NULL, &len, &err); | |
5426 if (err) { | |
5427 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5428 "Error in unicode fallback: %s\n", err->message); | |
5429 g_error_free(err); | |
5430 } | |
2086 | 5431 } |
8219 | 5432 } else { |
5433 charset = "us-ascii"; | |
5434 buf2 = g_strdup(buf); | |
5435 } | |
5436 | |
5437 if (len > c->maxlen) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5438 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5439 |
8219 | 5440 g_free(buf); |
5441 buf = gaim_markup_strip_html(buf2); | |
5442 g_free(buf2); | |
5443 if (strlen(buf) > c->maxvis) { | |
5444 g_free(buf); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5445 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5446 } |
8219 | 5447 |
5448 aim_chat_send_im(od->sess, c->conn, 0, buf, len, charset); | |
2086 | 5449 g_free(buf); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5450 return 0; |
2086 | 5451 } |
5452 | |
6695 | 5453 static const char *oscar_list_icon(GaimAccount *a, GaimBuddy *b) { |
4766 | 5454 if (!b || (b && b->name && b->name[0] == '+')) { |
5646
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
5455 if (a != NULL && isdigit(*gaim_account_get_username(a))) |
4687 | 5456 return "icq"; |
5457 else | |
5458 return "aim"; | |
5459 } | |
5646
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
5460 |
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
5461 if (b != NULL && isdigit(b->name[0])) |
4687 | 5462 return "icq"; |
5463 return "aim"; | |
5464 } | |
5465 | |
6695 | 5466 static void oscar_list_emblems(GaimBuddy *b, char **se, char **sw, char **nw, char **ne) |
4687 | 5467 { |
7334 | 5468 GaimAccount *account = NULL; |
5469 GaimConnection *gc = NULL; | |
5470 OscarData *od = NULL; | |
4687 | 5471 char *emblems[4] = {NULL,NULL,NULL,NULL}; |
5472 int i = 0; | |
7334 | 5473 aim_userinfo_t *userinfo = NULL; |
5474 | |
5475 if (b != NULL) | |
5476 account = b->account; | |
5477 if (account != NULL) | |
5478 gc = account->gc; | |
5479 if (gc != NULL) | |
5480 od = gc->proto_data; | |
7945 | 5481 if (od != NULL) |
5482 userinfo = aim_locate_finduserinfo(od->sess, b->name); | |
4687 | 5483 |
5131 | 5484 if (!GAIM_BUDDY_IS_ONLINE(b)) { |
5485 char *gname; | |
7334 | 5486 if ((b->name) && (od) && (od->sess->ssi.received_data) && |
5131 | 5487 (gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name)) && |
5488 (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name))) { | |
5489 emblems[i++] = "notauthorized"; | |
5490 } else { | |
5491 emblems[i++] = "offline"; | |
5492 } | |
5493 } | |
4916 | 5494 |
4766 | 5495 if (b->name && (b->uc & 0xffff0000) && isdigit(b->name[0])) { |
4960 | 5496 int uc = b->uc >> 16; |
4766 | 5497 if (uc & AIM_ICQ_STATE_INVISIBLE) |
4960 | 5498 emblems[i++] = "invisible"; |
4766 | 5499 else if (uc & AIM_ICQ_STATE_CHAT) |
4960 | 5500 emblems[i++] = "freeforchat"; |
4766 | 5501 else if (uc & AIM_ICQ_STATE_DND) |
4960 | 5502 emblems[i++] = "dnd"; |
4766 | 5503 else if (uc & AIM_ICQ_STATE_OUT) |
4960 | 5504 emblems[i++] = "na"; |
4766 | 5505 else if (uc & AIM_ICQ_STATE_BUSY) |
4960 | 5506 emblems[i++] = "occupied"; |
4766 | 5507 else if (uc & AIM_ICQ_STATE_AWAY) |
5508 emblems[i++] = "away"; | |
5509 } else { | |
5510 if (b->uc & UC_UNAVAILABLE) | |
5511 emblems[i++] = "away"; | |
5512 } | |
4687 | 5513 if (b->uc & UC_WIRELESS) |
5514 emblems[i++] = "wireless"; | |
5515 if (b->uc & UC_AOL) | |
5516 emblems[i++] = "aol"; | |
5517 if (b->uc & UC_ADMIN) | |
5518 emblems[i++] = "admin"; | |
5519 if (b->uc & UC_AB && i < 4) | |
5520 emblems[i++] = "activebuddy"; | |
4766 | 5521 /* if (b->uc & UC_UNCONFIRMED && i < 4) |
5522 emblems[i++] = "unconfirmed"; */ | |
7334 | 5523 |
7945 | 5524 if ((i < 4) && (userinfo != NULL) && (userinfo->capabilities & AIM_CAPS_HIPTOP)) |
5525 emblems[i++] = "hiptop"; | |
5526 | |
5527 if ((i < 4) && (userinfo != NULL) && (userinfo->capabilities & AIM_CAPS_SECUREIM)) | |
7334 | 5528 emblems[i++] = "secure"; |
5529 | |
4687 | 5530 *se = emblems[0]; |
5531 *sw = emblems[1]; | |
5532 *nw = emblems[2]; | |
5533 *ne = emblems[3]; | |
5534 } | |
5535 | |
6695 | 5536 static char *oscar_tooltip_text(GaimBuddy *b) { |
5575 | 5537 GaimConnection *gc = b->account->gc; |
7283 | 5538 OscarData *od = gc->proto_data; |
7692 | 5539 GaimGroup *g = gaim_find_buddys_group(b); |
7261 | 5540 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->account, b->name)); |
7045 | 5541 aim_userinfo_t *userinfo = aim_locate_finduserinfo(od->sess, b->name); |
7011 | 5542 gchar *tmp = NULL, *ret = g_strdup(""); |
5131 | 5543 |
5544 if (GAIM_BUDDY_IS_ONLINE(b)) { | |
5545 if (isdigit(b->name[0])) { | |
7011 | 5546 char *status; |
5131 | 5547 status = gaim_icq_status((b->uc & 0xffff0000) >> 16); |
7011 | 5548 tmp = ret; |
5549 ret = g_strconcat(tmp, _("<b>Status:</b> "), status, "\n", NULL); | |
5131 | 5550 g_free(tmp); |
5551 g_free(status); | |
5552 } | |
5553 | |
7011 | 5554 if ((bi != NULL) && (bi->ipaddr)) { |
7283 | 5555 char *tstr = g_strdup_printf("%hhu.%hhu.%hhu.%hhu", |
7011 | 5556 (bi->ipaddr & 0xff000000) >> 24, |
5557 (bi->ipaddr & 0x00ff0000) >> 16, | |
5558 (bi->ipaddr & 0x0000ff00) >> 8, | |
5559 (bi->ipaddr & 0x000000ff)); | |
5560 tmp = ret; | |
5561 ret = g_strconcat(tmp, _("<b>IP Address:</b> "), tstr, "\n", NULL); | |
7162 | 5562 g_free(tmp); |
5563 g_free(tstr); | |
7011 | 5564 } |
5565 | |
5566 if ((userinfo != NULL) && (userinfo->capabilities)) { | |
5567 char *caps = caps_string(userinfo->capabilities); | |
5568 tmp = ret; | |
5569 ret = g_strconcat(tmp, _("<b>Capabilities:</b> "), caps, "\n", NULL); | |
7162 | 5570 g_free(tmp); |
7011 | 5571 } |
5572 | |
7692 | 5573 if (g && g->name) { |
5574 char *comment = NULL; | |
5575 comment = aim_ssi_getcomment(od->sess->ssi.local, g->name, b->name); | |
5576 if (comment != NULL) { | |
5577 tmp = ret; | |
5578 ret = g_strconcat(tmp, _("<b>Buddy Comment:</b> "), comment, "\n", NULL); | |
5579 free(tmp); | |
5580 free(comment); | |
5581 } | |
5582 } | |
5583 | |
7011 | 5584 if ((bi != NULL) && (bi->availmsg != NULL) && !(b->uc & UC_UNAVAILABLE)) { |
5585 gchar *escaped = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg)); | |
5586 tmp = ret; | |
5587 ret = g_strconcat(tmp, _("<b>Available:</b> "), escaped, "\n", NULL); | |
7162 | 5588 g_free(tmp); |
7011 | 5589 g_free(escaped); |
5590 } | |
5591 | |
5592 if ((userinfo != NULL) && (userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) { | |
5593 gchar *away_utf8 = oscar_encoding_to_utf8(userinfo->away_encoding, userinfo->away, userinfo->away_len); | |
5594 if (away_utf8 != NULL) { | |
7091 | 5595 gchar *tmp1, *tmp2; |
7162 | 5596 const char *tmp3; |
7091 | 5597 tmp1 = gaim_strreplace(away_utf8, "<BR>", "\n"); |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7093
diff
changeset
|
5598 tmp2 = gaim_markup_strip_html(tmp1); |
7091 | 5599 g_free(tmp1); |
7235 | 5600 tmp1 = g_markup_escape_text(tmp2, strlen(tmp2)); |
7091 | 5601 g_free(tmp2); |
7235 | 5602 tmp3 = gaim_str_sub_away_formatters(tmp1, gaim_account_get_username(gaim_connection_get_account(gc))); |
5603 g_free(tmp1); | |
7011 | 5604 tmp = ret; |
7162 | 5605 ret = g_strconcat(tmp, _("<b>Away Message:</b> "), tmp3, "\n", NULL); |
5606 g_free(tmp); | |
7011 | 5607 g_free(away_utf8); |
5836 | 5608 } |
5131 | 5609 } |
5610 } else { | |
5611 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); | |
5612 if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) { | |
7011 | 5613 tmp = ret; |
5614 ret = g_strconcat(tmp, _("<b>Status:</b> Not Authorized"), "\n", NULL); | |
5131 | 5615 g_free(tmp); |
5616 } else { | |
7011 | 5617 tmp = ret; |
5618 ret = g_strconcat(tmp, _("<b>Status:</b> Offline"), "\n", NULL); | |
5131 | 5619 g_free(tmp); |
5620 } | |
5621 } | |
5622 | |
5623 /* remove the trailing newline character */ | |
7011 | 5624 if (ret) |
5625 ret[strlen(ret)-1] = '\0'; | |
5626 return ret; | |
5131 | 5627 } |
5628 | |
6695 | 5629 static char *oscar_status_text(GaimBuddy *b) { |
5575 | 5630 GaimConnection *gc = b->account->gc; |
7283 | 5631 OscarData *od = gc->proto_data; |
5167 | 5632 gchar *ret = NULL; |
5633 | |
5634 if ((b->uc & UC_UNAVAILABLE) || (((b->uc & 0xffff0000) >> 16) & AIM_ICQ_STATE_CHAT)) { | |
5635 if (isdigit(b->name[0])) | |
5636 ret = gaim_icq_status((b->uc & 0xffff0000) >> 16); | |
7038 | 5637 else |
5638 ret = g_strdup(_("Away")); | |
5836 | 5639 } else if (GAIM_BUDDY_IS_ONLINE(b)) { |
7261 | 5640 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->account, b->name)); |
6292 | 5641 if (bi->availmsg) |
5642 ret = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg)); | |
5836 | 5643 } else { |
5167 | 5644 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); |
5645 if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) | |
5646 ret = g_strdup(_("Not Authorized")); | |
5647 else | |
5648 ret = g_strdup(_("Offline")); | |
5649 } | |
5650 | |
5651 return ret; | |
5652 } | |
5653 | |
5842 | 5654 |
5844 | 5655 static int oscar_icon_req(aim_session_t *sess, aim_frame_t *fr, ...) { |
5842 | 5656 GaimConnection *gc = sess->aux_data; |
7283 | 5657 OscarData *od = gc->proto_data; |
5892 | 5658 va_list ap; |
5842 | 5659 fu16_t type; |
5892 | 5660 fu8_t flags = 0, length = 0; |
5661 char *md5 = NULL; | |
5662 | |
7334 | 5663 |
5842 | 5664 va_start(ap, fr); |
5665 type = va_arg(ap, int); | |
5892 | 5666 |
5667 switch(type) { | |
5668 case 0x0000: | |
5669 case 0x0001: { | |
5670 flags = va_arg(ap, int); | |
5671 length = va_arg(ap, int); | |
5672 md5 = va_arg(ap, char *); | |
5673 | |
5674 if (flags == 0x41) { | |
5675 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON) && !od->iconconnecting) { | |
5676 od->iconconnecting = TRUE; | |
5677 od->set_icon = TRUE; | |
5678 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); | |
5679 } else { | |
6039 | 5680 struct stat st; |
5681 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); | |
5682 if (iconfile == NULL) { | |
5683 /* Set an empty icon, or something */ | |
5684 } else if (!stat(iconfile, &st)) { | |
5685 char *buf = g_malloc(st.st_size); | |
5686 FILE *file = fopen(iconfile, "rb"); | |
5687 if (file) { | |
5688 fread(buf, 1, st.st_size, file); | |
5689 fclose(file); | |
5690 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
5691 "Uploading icon to icon server\n"); | |
6879 | 5692 aim_bart_upload(od->sess, buf, st.st_size); |
5892 | 5693 } else |
5694 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
6039 | 5695 "Can't open buddy icon file!\n"); |
5696 g_free(buf); | |
5697 } else { | |
5698 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5699 "Can't stat buddy icon file!\n"); | |
5892 | 5700 } |
5701 } | |
5893 | 5702 } else if (flags == 0x81) |
5703 aim_ssi_seticon(od->sess, md5, length); | |
5892 | 5704 } break; |
5705 | |
5706 case 0x0002: { /* We just set an "available" message? */ | |
5707 } break; | |
5708 } | |
5709 | |
5842 | 5710 va_end(ap); |
5844 | 5711 |
5712 return 0; | |
5842 | 5713 } |
5892 | 5714 |
3952 | 5715 /* |
4617 | 5716 * We have just established a socket with the other dude, so set up some handlers. |
3952 | 5717 */ |
4617 | 5718 static int gaim_odc_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5719 GaimConnection *gc = sess->aux_data; |
7283 | 5720 OscarData *od = (OscarData *)gc->proto_data; |
5679 | 5721 GaimConversation *cnv; |
2086 | 5722 struct direct_im *dim; |
5723 char buf[256]; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5724 char *sn; |
4617 | 5725 va_list ap; |
5726 aim_conn_t *newconn, *listenerconn; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5727 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5728 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5729 newconn = va_arg(ap, aim_conn_t *); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5730 listenerconn = va_arg(ap, aim_conn_t *); |
2086 | 5731 va_end(ap); |
5732 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5733 aim_conn_close(listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5734 aim_conn_kill(sess, &listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5735 |
4617 | 5736 sn = g_strdup(aim_odc_getsn(newconn)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5737 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5738 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5739 "DirectIM: initiate success to %s\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5740 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5741 |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
5742 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
|
5743 gaim_input_remove(dim->watcher); |
2086 | 5744 dim->conn = newconn; |
4617 | 5745 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); |
3008 | 5746 dim->connected = TRUE; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5747 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5748 g_free(sn); |
6982 | 5749 gaim_conversation_write(cnv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
2086 | 5750 |
4617 | 5751 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, gaim_odc_incoming, 0); |
5752 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, gaim_odc_typing, 0); | |
6982 | 5753 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, gaim_odc_update_ui, 0); |
4617 | 5754 |
2993 | 5755 return 1; |
5756 } | |
5757 | |
6982 | 5758 /* |
5759 * This is called when each chunk of an image is received. It can be used to | |
5760 * update a progress bar, or to eat lots of dry cat food. Wet cat food is | |
5761 * nasty, you sicko. | |
5762 */ | |
5763 static int gaim_odc_update_ui(aim_session_t *sess, aim_frame_t *fr, ...) { | |
2993 | 5764 va_list ap; |
5765 char *sn; | |
5766 double percent; | |
5575 | 5767 GaimConnection *gc = sess->aux_data; |
7283 | 5768 OscarData *od = (OscarData *)gc->proto_data; |
5679 | 5769 GaimConversation *c; |
2993 | 5770 struct direct_im *dim; |
5771 | |
5772 va_start(ap, fr); | |
5773 sn = va_arg(ap, char *); | |
5774 percent = va_arg(ap, double); | |
5775 va_end(ap); | |
6873 | 5776 |
2994 | 5777 if (!(dim = find_direct_im(od, sn))) |
5778 return 1; | |
3059 | 5779 if (dim->watcher) { |
5780 gaim_input_remove(dim->watcher); /* Otherwise, the callback will callback */ | |
5781 dim->watcher = 0; | |
5782 } | |
6982 | 5783 /* XXX is this really necessary? */ |
7082
25a616f16b6c
[gaim-migrate @ 7647]
Christian Hammond <chipx86@chipx86.com>
parents:
7080
diff
changeset
|
5784 gaim_core_mainloop_finish_events(); |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
5785 |
6982 | 5786 c = gaim_find_conversation_with_account(sn, gaim_connection_get_account(gc)); |
6873 | 5787 if (c != NULL) |
5788 gaim_conversation_update_progress(c, percent); | |
2993 | 5789 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
5790 oscar_callback, dim->conn); | |
2086 | 5791 |
5792 return 1; | |
5793 } | |
5794 | |
6982 | 5795 /* |
5796 * This is called after a direct IM has been received in its entirety. This | |
5797 * function is passed a long chunk of data which contains the IM with any | |
5798 * data chunks (images) appended to it. | |
5799 * | |
5800 * This function rips out all the data chunks and creates an imgstore for | |
5801 * each one. In order to do this, it first goes through the IM and takes | |
5802 * out all the IMG tags. When doing so, it rewrites the original IMG tag | |
5803 * with one compatable with the imgstore Gaim core code. For each one, we | |
5804 * then read in chunks of data from the end of the message and actually | |
5805 * create the img store using the given data. | |
5806 * | |
5807 * For somewhat easy reference, here's a sample message | |
5808 * (without the whitespace and asterisks): | |
5809 * | |
5810 * <HTML><BODY BGCOLOR="#ffffff"> | |
5811 * <FONT LANG="0"> | |
5812 * This is a really stupid picture:<BR> | |
5813 * <IMG SRC="Sample.jpg" ID="1" WIDTH="283" HEIGHT="212" DATASIZE="9894"><BR> | |
5814 * Yeah it is<BR> | |
5815 * Here is another one:<BR> | |
5816 * <IMG SRC="Soap Bubbles.bmp" ID="2" WIDTH="256" HEIGHT="256" DATASIZE="65978"> | |
5817 * </FONT> | |
5818 * </BODY></HTML> | |
5819 * <BINARY> | |
5820 * <DATA ID="1" SIZE="9894">datadatadatadata</DATA> | |
5821 * <DATA ID="2" SIZE="65978">datadatadatadata</DATA> | |
5822 * </BINARY> | |
5823 */ | |
4617 | 5824 static int gaim_odc_incoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5825 GaimConnection *gc = sess->aux_data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5826 GaimConvImFlags imflags = 0; |
6982 | 5827 GString *newmsg = g_string_new(""); |
5828 GSList *images = NULL; | |
2086 | 5829 va_list ap; |
6982 | 5830 const char *sn, *msg, *msgend, *binary; |
5831 size_t len; | |
5832 int encoding, isawaymsg; | |
2086 | 5833 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5834 va_start(ap, fr); |
6982 | 5835 sn = va_arg(ap, const char *); |
5836 msg = va_arg(ap, const char *); | |
5837 len = va_arg(ap, size_t); | |
3952 | 5838 encoding = va_arg(ap, int); |
4870 | 5839 isawaymsg = va_arg(ap, int); |
2086 | 5840 va_end(ap); |
6982 | 5841 msgend = msg + len; |
2086 | 5842 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5843 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5844 "Got DirectIM message from %s\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5845 |
4870 | 5846 if (isawaymsg) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5847 imflags |= GAIM_CONV_IM_AUTO_RESP; |
4870 | 5848 |
6982 | 5849 /* message has a binary trailer */ |
5850 if ((binary = gaim_strcasestr(msg, "<binary>"))) { | |
5851 GData *attribs; | |
5852 const char *tmp, *start, *end, *last = NULL; | |
5853 | |
5854 tmp = msg; | |
5855 | |
5856 /* for each valid image tag... */ | |
5857 while (gaim_markup_find_tag("img", tmp, &start, &end, &attribs)) { | |
5858 const char *id, *src, *datasize; | |
5859 const char *tag = NULL, *data = NULL; | |
5860 size_t size; | |
5861 int imgid = 0; | |
5862 | |
5863 /* update the location of the last img tag */ | |
5864 last = end; | |
5865 | |
5866 /* grab attributes */ | |
5867 id = g_datalist_get_data(&attribs, "id"); | |
5868 src = g_datalist_get_data(&attribs, "src"); | |
5869 datasize = g_datalist_get_data(&attribs, "datasize"); | |
5870 | |
5871 /* if we have id & datasize, build the data tag */ | |
5872 if (id && datasize) | |
5873 tag = g_strdup_printf("<data id=\"%s\" size=\"%s\">", id, datasize); | |
5874 | |
5875 /* if we have a tag, find the start of the data */ | |
5876 if (tag && (data = gaim_strcasestr(binary, tag))) | |
5877 data += strlen(tag); | |
5878 | |
5879 /* check the data is here and store it */ | |
5880 if (data + (size = atoi(datasize)) <= msgend) | |
5881 imgid = gaim_imgstore_add(data, size, src); | |
5882 | |
5883 /* if we have a stored image... */ | |
5884 if (imgid) { | |
5885 /* append the message up to the tag */ | |
5886 newmsg = g_string_append_len(newmsg, tmp, start - tmp); | |
5887 | |
5888 /* write the new image tag */ | |
5889 g_string_append_printf(newmsg, "<IMG ID=\"%d\">", imgid); | |
5890 | |
5891 /* and record the image number */ | |
5892 images = g_slist_append(images, GINT_TO_POINTER(imgid)); | |
5893 } else { | |
5894 /* otherwise, copy up to the end of the tag */ | |
5895 newmsg = g_string_append_len(newmsg, tmp, (end + 1) - tmp); | |
5896 } | |
5897 | |
5898 /* clear the attribute list */ | |
5899 g_datalist_clear(&attribs); | |
5900 | |
5901 /* continue from the end of the tag */ | |
5902 tmp = end + 1; | |
5903 } | |
5904 | |
5905 /* append any remaining message data (without the > :-) */ | |
5906 if (last++ && (last < binary)) | |
5907 newmsg = g_string_append_len(newmsg, last, binary - last); | |
5908 | |
5909 /* set the flag if we caught any images */ | |
5910 if (images) | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5911 imflags |= GAIM_CONV_IM_IMAGES; |
6982 | 5912 } else { |
5913 g_string_append_len(newmsg, msg, len); | |
5914 } | |
5915 | |
4617 | 5916 /* XXX - I imagine Paco-Paco will want to do some voodoo with the encoding here */ |
6982 | 5917 serv_got_im(gc, sn, newmsg->str, imflags, time(NULL)); |
5918 | |
5919 /* free up the message */ | |
5920 g_string_free(newmsg, TRUE); | |
5921 | |
5922 /* unref any images we allocated */ | |
5923 if (images) { | |
5924 GSList *tmp; | |
5925 int id; | |
5926 | |
5927 for (tmp = images; tmp != NULL; tmp = tmp->next) { | |
5928 id = GPOINTER_TO_INT(tmp->data); | |
5929 gaim_imgstore_unref(id); | |
5930 } | |
5931 | |
5932 g_slist_free(images); | |
5933 } | |
2086 | 5934 |
5935 return 1; | |
5936 } | |
5937 | |
4617 | 5938 static int gaim_odc_typing(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 5939 va_list ap; |
5940 char *sn; | |
2993 | 5941 int typing; |
5575 | 5942 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5943 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5944 va_start(ap, fr); |
2086 | 5945 sn = va_arg(ap, char *); |
2993 | 5946 typing = va_arg(ap, int); |
2086 | 5947 va_end(ap); |
5948 | |
4870 | 5949 if (typing == 0x0002) { |
2993 | 5950 /* 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
|
5951 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5952 "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
|
5953 serv_got_typing(gc, sn, 0, GAIM_TYPING); |
4870 | 5954 } else if (typing == 0x0001) |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
5955 serv_got_typing(gc, sn, 0, GAIM_TYPED); |
4870 | 5956 else |
4342 | 5957 serv_got_typing_stopped(gc, sn); |
2086 | 5958 return 1; |
5959 } | |
5960 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5961 static int gaim_odc_send_im(aim_session_t *sess, aim_conn_t *conn, const char *message, GaimConvImFlags imflags) { |
6982 | 5962 char *buf; |
5963 size_t len; | |
5964 int ret; | |
5965 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5966 if (imflags & GAIM_CONV_IM_IMAGES) { |
6982 | 5967 GString *msg = g_string_new(""); |
5968 GString *data = g_string_new("<BINARY>"); | |
5969 GData *attribs; | |
5970 const char *tmp, *start, *end, *last = NULL; | |
5971 int oscar_id = 0; | |
5972 | |
5973 tmp = message; | |
5974 | |
5975 /* for each valid IMG tag... */ | |
5976 while (gaim_markup_find_tag("img", tmp, &start, &end, &attribs)) { | |
5977 GaimStoredImage *image = NULL; | |
5978 const char *id; | |
5979 | |
5980 last = end; | |
5981 id = g_datalist_get_data(&attribs, "id"); | |
5982 | |
5983 /* ... if it refers to a valid gaim image ... */ | |
5984 if (id && (image = gaim_imgstore_get(atoi(id)))) { | |
5985 /* ... append the message from start to the tag ... */ | |
5986 msg = g_string_append_len(msg, tmp, start - tmp); | |
5987 oscar_id++; | |
5988 | |
5989 /* ... insert a new img tag with the oscar id ... */ | |
5990 if (image->filename) | |
5991 g_string_append_printf(msg, | |
5992 "<IMG SRC=\"file://%s\" ID=\"%d\" DATASIZE=\"%d\">", | |
7386 | 5993 image->filename, oscar_id, (int)image->size); |
6982 | 5994 else |
5995 g_string_append_printf(msg, | |
5996 "<IMG ID=\"%d\" DATASIZE=\"%d\">", | |
7386 | 5997 oscar_id, (int)image->size); |
6982 | 5998 |
5999 /* ... and append the data to the binary section ... */ | |
6000 g_string_append_printf(data, "<DATA ID=\"%d\" SIZE=\"%d\">", | |
7386 | 6001 oscar_id, (int)image->size); |
6982 | 6002 data = g_string_append_len(data, image->data, image->size); |
6003 data = g_string_append(data, "</DATA>"); | |
6004 } else { | |
6005 /* ... otherwise, allow the possibly invalid img tag through. */ | |
6006 /* should we do something else? */ | |
6007 msg = g_string_append_len(msg, tmp, (end + 1) - tmp); | |
6008 } | |
6009 | |
6010 g_datalist_clear(&attribs); | |
6011 | |
6012 /* continue from the end of the tag */ | |
6013 tmp = end + 1; | |
6014 } | |
6015 | |
6016 /* append any remaining message data (without the > :-) */ | |
6017 if (last++ && *last) | |
6018 msg = g_string_append(msg, last); | |
6019 | |
6020 /* if we inserted any images in the binary section, append it */ | |
6021 if (oscar_id) { | |
6022 msg = g_string_append_len(msg, data->str, data->len); | |
6023 msg = g_string_append(msg, "</BINARY>"); | |
6024 } | |
6025 | |
6026 len = msg->len; | |
6027 buf = msg->str; | |
6028 g_string_free(msg, FALSE); | |
6029 g_string_free(data, TRUE); | |
6030 } else { | |
6031 len = strlen(message); | |
6032 buf = g_memdup(message, len+1); | |
6033 } | |
6034 | |
6035 /* XXX - The last parameter below is the encoding. Let Paco-Paco do something with it. */ | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
6036 if (imflags & GAIM_CONV_IM_AUTO_RESP) |
6982 | 6037 ret = aim_odc_send_im(sess, conn, buf, len, 0, 1); |
6038 else | |
6039 ret = aim_odc_send_im(sess, conn, buf, len, 0, 0); | |
6040 | |
6041 g_free(buf); | |
6042 | |
6043 return ret; | |
6044 } | |
6045 | |
2086 | 6046 struct ask_do_dir_im { |
6047 char *who; | |
5575 | 6048 GaimConnection *gc; |
2086 | 6049 }; |
6050 | |
3730 | 6051 static void oscar_cancel_direct_im(struct ask_do_dir_im *data) { |
5136 | 6052 g_free(data->who); |
2086 | 6053 g_free(data); |
6054 } | |
6055 | |
3730 | 6056 static void oscar_direct_im(struct ask_do_dir_im *data) { |
5575 | 6057 GaimConnection *gc = data->gc; |
7283 | 6058 OscarData *od; |
2086 | 6059 struct direct_im *dim; |
6060 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
6061 if (!g_list_find(gaim_connections_get_all(), gc)) { |
5136 | 6062 g_free(data->who); |
4244 | 6063 g_free(data); |
6064 return; | |
6065 } | |
6066 | |
7283 | 6067 od = (OscarData *)gc->proto_data; |
4244 | 6068 |
2086 | 6069 dim = find_direct_im(od, data->who); |
6070 if (dim) { | |
3008 | 6071 if (!(dim->connected)) { /* We'll free the old, unconnected dim, and start over */ |
6072 od->direct_ims = g_slist_remove(od->direct_ims, dim); | |
6073 gaim_input_remove(dim->watcher); | |
6074 g_free(dim); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6075 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6076 "Gave up on old direct IM, trying again\n"); |
3008 | 6077 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
6078 gaim_notify_error(gc, NULL, "DirectIM already open.", NULL); |
5136 | 6079 g_free(data->who); |
4244 | 6080 g_free(data); |
3008 | 6081 return; |
6082 } | |
2086 | 6083 } |
6084 dim = g_new0(struct direct_im, 1); | |
6085 dim->gc = gc; | |
6086 g_snprintf(dim->name, sizeof dim->name, "%s", data->who); | |
6087 | |
4617 | 6088 dim->conn = aim_odc_initiate(od->sess, data->who); |
2086 | 6089 if (dim->conn != NULL) { |
6090 od->direct_ims = g_slist_append(od->direct_ims, dim); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
6091 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
2086 | 6092 oscar_callback, dim->conn); |
4617 | 6093 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIM_ESTABLISHED, |
6094 gaim_odc_initiate, 0); | |
2086 | 6095 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
6096 gaim_notify_error(gc, NULL, _("Unable to open Direct IM"), NULL); |
2086 | 6097 g_free(dim); |
6098 } | |
4244 | 6099 |
5136 | 6100 g_free(data->who); |
4244 | 6101 g_free(data); |
2086 | 6102 } |
6103 | |
5575 | 6104 static void oscar_ask_direct_im(GaimConnection *gc, const char *who) { |
5420 | 6105 gchar *buf; |
2086 | 6106 struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1); |
5136 | 6107 data->who = g_strdup(who); |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
6108 data->gc = gc; |
5420 | 6109 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
|
6110 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6111 gaim_request_action(gc, NULL, buf, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6112 _("Because this reveals your IP address, it " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6113 "may be considered a privacy risk. Do you " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6114 "wish to continue?"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6115 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6116 _("Connect"), G_CALLBACK(oscar_direct_im), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6117 _("Cancel"), G_CALLBACK(oscar_cancel_direct_im)); |
5420 | 6118 g_free(buf); |
2086 | 6119 } |
6120 | |
5575 | 6121 static void oscar_set_permit_deny(GaimConnection *gc) { |
6122 GaimAccount *account = gaim_connection_get_account(gc); | |
7283 | 6123 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 6124 #ifdef NOSSI |
8143 | 6125 GSList *list; |
4230 | 6126 char buf[MAXMSGLEN]; |
6127 int at; | |
6128 | |
5575 | 6129 switch(account->perm_deny) { |
8175 | 6130 case GAIM_PRIVACY_ALLOW_ALL: |
5575 | 6131 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gaim_account_get_username(account)); |
4230 | 6132 break; |
8175 | 6133 case GAIM_PRIVACY_DENY_ALL: |
5575 | 6134 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gaim_account_get_username(account)); |
4230 | 6135 break; |
8175 | 6136 case GAIM_PRIVACY_ALLOW_USERS: |
5575 | 6137 list = account->permit; |
4230 | 6138 at = 0; |
6139 while (list) { | |
6140 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
6141 list = list->next; | |
6142 } | |
6143 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); | |
6144 break; | |
8175 | 6145 case GAIM_PRIVACY_DENY_USERS: |
5575 | 6146 list = account->deny; |
4230 | 6147 at = 0; |
6148 while (list) { | |
6149 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
6150 list = list->next; | |
6151 } | |
6152 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf); | |
6153 break; | |
6154 default: | |
6155 break; | |
2086 | 6156 } |
4230 | 6157 #else |
8175 | 6158 if (od->sess->ssi.received_data) { |
6159 switch (account->perm_deny) { | |
6160 case GAIM_PRIVACY_ALLOW_ALL: | |
6161 aim_ssi_setpermdeny(od->sess, 0x01, 0xffffffff); | |
6162 break; | |
6163 case GAIM_PRIVACY_ALLOW_BUDDYLIST: | |
6164 aim_ssi_setpermdeny(od->sess, 0x05, 0xffffffff); | |
6165 break; | |
6166 case GAIM_PRIVACY_ALLOW_USERS: | |
6167 aim_ssi_setpermdeny(od->sess, 0x03, 0xffffffff); | |
6168 break; | |
6169 case GAIM_PRIVACY_DENY_ALL: | |
6170 aim_ssi_setpermdeny(od->sess, 0x02, 0xffffffff); | |
6171 break; | |
6172 case GAIM_PRIVACY_DENY_USERS: | |
6173 aim_ssi_setpermdeny(od->sess, 0x04, 0xffffffff); | |
6174 break; | |
6175 default: | |
6176 aim_ssi_setpermdeny(od->sess, 0x01, 0xffffffff); | |
6177 break; | |
6178 } | |
6179 } | |
4230 | 6180 #endif |
2086 | 6181 } |
6182 | |
5575 | 6183 static void oscar_add_permit(GaimConnection *gc, const char *who) { |
4269 | 6184 #ifdef NOSSI |
8143 | 6185 if (gc->account->perm_deny == 3) |
4269 | 6186 oscar_set_permit_deny(gc); |
6187 #else | |
7283 | 6188 OscarData *od = (OscarData *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6189 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a permit\n"); |
4230 | 6190 if (od->sess->ssi.received_data) |
4889 | 6191 aim_ssi_addpermit(od->sess, who); |
4230 | 6192 #endif |
2086 | 6193 } |
6194 | |
5575 | 6195 static void oscar_add_deny(GaimConnection *gc, const char *who) { |
4269 | 6196 #ifdef NOSSI |
8143 | 6197 if (gc->account->perm_deny == 4) |
4269 | 6198 oscar_set_permit_deny(gc); |
6199 #else | |
7283 | 6200 OscarData *od = (OscarData *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6201 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a deny\n"); |
4230 | 6202 if (od->sess->ssi.received_data) |
4889 | 6203 aim_ssi_adddeny(od->sess, who); |
4230 | 6204 #endif |
2086 | 6205 } |
6206 | |
5575 | 6207 static void oscar_rem_permit(GaimConnection *gc, const char *who) { |
4269 | 6208 #ifdef NOSSI |
8143 | 6209 if (gc->account->perm_deny == 3) |
4269 | 6210 oscar_set_permit_deny(gc); |
6211 #else | |
7283 | 6212 OscarData *od = (OscarData *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6213 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a permit\n"); |
4230 | 6214 if (od->sess->ssi.received_data) |
4889 | 6215 aim_ssi_delpermit(od->sess, who); |
4230 | 6216 #endif |
2086 | 6217 } |
6218 | |
5575 | 6219 static void oscar_rem_deny(GaimConnection *gc, const char *who) { |
4269 | 6220 #ifdef NOSSI |
8143 | 6221 if (gc->account->perm_deny == 4) |
4269 | 6222 oscar_set_permit_deny(gc); |
6223 #else | |
7283 | 6224 OscarData *od = (OscarData *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6225 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a deny\n"); |
4230 | 6226 if (od->sess->ssi.received_data) |
4889 | 6227 aim_ssi_deldeny(od->sess, who); |
4230 | 6228 #endif |
2086 | 6229 } |
6230 | |
5575 | 6231 static GList *oscar_away_states(GaimConnection *gc) |
2086 | 6232 { |
7283 | 6233 OscarData *od = gc->proto_data; |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6234 GList *m = NULL; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6235 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6236 if (!od->icq) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6237 return g_list_append(m, GAIM_AWAY_CUSTOM); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6238 |
4333 | 6239 m = g_list_append(m, _("Online")); |
6240 m = g_list_append(m, _("Away")); | |
6241 m = g_list_append(m, _("Do Not Disturb")); | |
6242 m = g_list_append(m, _("Not Available")); | |
6243 m = g_list_append(m, _("Occupied")); | |
6244 m = g_list_append(m, _("Free For Chat")); | |
6245 m = g_list_append(m, _("Invisible")); | |
6246 | |
6247 return m; | |
6248 } | |
6249 | |
7172 | 6250 static void oscar_ssi_editcomment(struct name_data *data, const char *text) { |
7283 | 6251 OscarData *od = data->gc->proto_data; |
7172 | 6252 GaimBuddy *b; |
6253 GaimGroup *g; | |
6254 | |
6255 if (!(b = gaim_find_buddy(gaim_connection_get_account(data->gc), data->name))) { | |
6256 oscar_free_name_data(data); | |
6257 return; | |
6258 } | |
6259 | |
6260 if (!(g = gaim_find_buddys_group(b))) { | |
6261 oscar_free_name_data(data); | |
6262 return; | |
6263 } | |
6264 | |
6265 aim_ssi_editcomment(od->sess, g->name, data->name, text); | |
6266 oscar_free_name_data(data); | |
6267 } | |
6268 | |
6269 static void oscar_buddycb_edit_comment(GaimConnection *gc, const char *name) { | |
7283 | 6270 OscarData *od = gc->proto_data; |
7172 | 6271 struct name_data *data = g_new(struct name_data, 1); |
6272 GaimBuddy *b; | |
6273 GaimGroup *g; | |
6274 char *comment; | |
6275 gchar *comment_utf8; | |
6276 | |
6277 if (!(b = gaim_find_buddy(gaim_connection_get_account(gc), name))) | |
6278 return; | |
6279 if (!(g = gaim_find_buddys_group(b))) | |
6280 return; | |
6281 comment = aim_ssi_getcomment(od->sess->ssi.local, g->name, name); | |
6282 comment_utf8 = comment ? gaim_utf8_try_convert(comment) : NULL; | |
6283 | |
6284 data->gc = gc; | |
6285 data->name = g_strdup(name); | |
6286 data->nick = NULL; | |
6287 | |
6288 gaim_request_input(gc, NULL, _("Buddy Comment:"), NULL, | |
6289 comment_utf8, TRUE, FALSE, | |
6290 _("OK"), G_CALLBACK(oscar_ssi_editcomment), | |
6291 _("Cancel"), G_CALLBACK(oscar_free_name_data), | |
6292 data); | |
6293 | |
6294 free(comment); | |
6295 g_free(comment_utf8); | |
6296 } | |
6297 | |
5575 | 6298 static GList *oscar_buddy_menu(GaimConnection *gc, const char *who) { |
7283 | 6299 OscarData *od = gc->proto_data; |
4333 | 6300 GList *m = NULL; |
6301 struct proto_buddy_menu *pbm; | |
6302 | |
7172 | 6303 pbm = g_new0(struct proto_buddy_menu, 1); |
6304 pbm->label = _("Edit Buddy Comment"); | |
6305 pbm->callback = oscar_buddycb_edit_comment; | |
6306 pbm->gc = gc; | |
6307 m = g_list_append(m, pbm); | |
6308 | |
4333 | 6309 if (od->icq) { |
4624 | 6310 #if 0 |
4333 | 6311 pbm = g_new0(struct proto_buddy_menu, 1); |
6312 pbm->label = _("Get Status Msg"); | |
4969 | 6313 pbm->callback = oscar_get_icqstatusmsg; |
4333 | 6314 pbm->gc = gc; |
6315 m = g_list_append(m, pbm); | |
4624 | 6316 #endif |
4333 | 6317 } else { |
6695 | 6318 GaimBuddy *b = gaim_find_buddy(gc->account, who); |
7011 | 6319 aim_userinfo_t *userinfo; |
5975 | 6320 |
6321 if (b) | |
7045 | 6322 userinfo = aim_locate_finduserinfo(od->sess, b->name); |
7011 | 6323 |
6324 if (b && userinfo && aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), who) && GAIM_BUDDY_IS_ONLINE(b)) { | |
6325 if (userinfo->capabilities & AIM_CAPS_DIRECTIM) { | |
5917 | 6326 pbm = g_new0(struct proto_buddy_menu, 1); |
6327 pbm->label = _("Direct IM"); | |
6328 pbm->callback = oscar_ask_direct_im; | |
6329 pbm->gc = gc; | |
6330 m = g_list_append(m, pbm); | |
6331 } | |
7650 | 6332 |
6333 if (userinfo->capabilities & AIM_CAPS_SENDFILE) { | |
6334 pbm = g_new0(struct proto_buddy_menu, 1); | |
6335 pbm->label = _("Send File"); | |
6336 pbm->callback = oscar_ask_sendfile; | |
6337 pbm->gc = gc; | |
6338 m = g_list_append(m, pbm); | |
6339 } | |
4826 | 6340 #if 0 |
7011 | 6341 if (userinfo->capabilities & AIM_CAPS_GETFILE) { |
5917 | 6342 pbm = g_new0(struct proto_buddy_menu, 1); |
6343 pbm->label = _("Get File"); | |
6344 pbm->callback = oscar_ask_getfile; | |
6345 pbm->gc = gc; | |
6346 m = g_list_append(m, pbm); | |
6347 } | |
4826 | 6348 #endif |
4333 | 6349 } |
5131 | 6350 } |
5197 | 6351 |
5131 | 6352 if (od->sess->ssi.received_data) { |
6353 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, who); | |
6354 if (gname && aim_ssi_waitingforauth(od->sess->ssi.local, gname, who)) { | |
6355 pbm = g_new0(struct proto_buddy_menu, 1); | |
6873 | 6356 pbm->label = _("Re-request Authorization"); |
5131 | 6357 pbm->callback = gaim_auth_sendrequest; |
6358 pbm->gc = gc; | |
6359 m = g_list_append(m, pbm); | |
4333 | 6360 } |
4916 | 6361 } |
6362 | |
4333 | 6363 return m; |
6364 } | |
6365 | |
5575 | 6366 static void oscar_format_screenname(GaimConnection *gc, const char *nick) { |
7283 | 6367 OscarData *od = gc->proto_data; |
5575 | 6368 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), nick)) { |
4333 | 6369 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { |
6370 od->setnick = TRUE; | |
6371 od->newsn = g_strdup(nick); | |
6372 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6373 } else { | |
6374 aim_admin_setnick(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH), nick); | |
6375 } | |
6376 } else { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
6377 gaim_notify_error(gc, NULL, _("The new formatting is invalid."), |
8152 | 6378 _("Screen name formatting can change only capitalization and whitespace.")); |
4333 | 6379 } |
6380 } | |
6381 | |
5575 | 6382 static void oscar_show_format_screenname(GaimConnection *gc) |
4333 | 6383 { |
8152 | 6384 gaim_request_input(gc, NULL, _("New screen name formatting:"), NULL, |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
6385 gaim_connection_get_display_name(gc), FALSE, FALSE, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6386 _("OK"), G_CALLBACK(oscar_format_screenname), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6387 _("Cancel"), NULL, |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6388 gc); |
4333 | 6389 } |
6390 | |
5575 | 6391 static void oscar_confirm_account(GaimConnection *gc) |
4333 | 6392 { |
7283 | 6393 OscarData *od = gc->proto_data; |
4333 | 6394 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6395 | |
6396 if (conn) { | |
6397 aim_admin_reqconfirm(od->sess, conn); | |
6398 } else { | |
6399 od->conf = TRUE; | |
6400 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6401 } | |
6402 } | |
6403 | |
5575 | 6404 static void oscar_show_email(GaimConnection *gc) |
4333 | 6405 { |
7283 | 6406 OscarData *od = gc->proto_data; |
4333 | 6407 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6408 | |
6409 if (conn) { | |
6410 aim_admin_getinfo(od->sess, conn, 0x11); | |
6411 } else { | |
6412 od->reqemail = TRUE; | |
6413 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6414 } | |
6415 } | |
6416 | |
5575 | 6417 static void oscar_change_email(GaimConnection *gc, const char *email) |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6418 { |
7283 | 6419 OscarData *od = gc->proto_data; |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6420 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
|
6421 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6422 if (conn) { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6423 aim_admin_setemail(od->sess, conn, email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6424 } else { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6425 od->setemail = TRUE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6426 od->email = g_strdup(email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6427 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6428 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6429 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6430 |
5575 | 6431 static void oscar_show_change_email(GaimConnection *gc) |
4333 | 6432 { |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
6433 gaim_request_input(gc, NULL, _("Change Address To:"), NULL, NULL, |
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
6434 FALSE, FALSE, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6435 _("OK"), G_CALLBACK(oscar_change_email), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6436 _("Cancel"), NULL, |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6437 gc); |
4333 | 6438 } |
6439 | |
5575 | 6440 static void oscar_show_awaitingauth(GaimConnection *gc) |
4333 | 6441 { |
7283 | 6442 OscarData *od = gc->proto_data; |
4333 | 6443 gchar *nombre, *text, *tmp; |
6695 | 6444 GaimBlistNode *gnode, *cnode, *bnode; |
4333 | 6445 int num=0; |
6446 | |
6873 | 6447 text = g_strdup(""); |
4333 | 6448 |
4785 | 6449 for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
6695 | 6450 GaimGroup *group = (GaimGroup *)gnode; |
4785 | 6451 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) |
6452 continue; | |
6695 | 6453 for (cnode = gnode->child; cnode; cnode = cnode->next) { |
6454 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 6455 continue; |
6695 | 6456 for (bnode = cnode->child; bnode; bnode = bnode->next) { |
6457 GaimBuddy *buddy = (GaimBuddy *)bnode; | |
6458 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
6459 continue; | |
6460 if (buddy->account == gc->account && aim_ssi_waitingforauth(od->sess->ssi.local, group->name, buddy->name)) { | |
6461 if (gaim_get_buddy_alias_only(buddy)) | |
6462 nombre = g_strdup_printf(" %s (%s)", buddy->name, gaim_get_buddy_alias_only(buddy)); | |
6463 else | |
6464 nombre = g_strdup_printf(" %s", buddy->name); | |
6873 | 6465 tmp = g_strdup_printf("%s%s<br>", text, nombre); |
6695 | 6466 g_free(text); |
6467 text = tmp; | |
6468 g_free(nombre); | |
6469 num++; | |
6470 } | |
4333 | 6471 } |
2979 | 6472 } |
4333 | 6473 } |
6474 | |
6475 if (!num) { | |
6476 g_free(text); | |
6873 | 6477 text = g_strdup(_("<i>you are not waiting for authorization</i>")); |
6478 } | |
6479 | |
6480 gaim_notify_formatted(gc, NULL, _("You are awaiting authorization from " | |
6481 "the following buddies"), _("You can re-request " | |
6482 "authorization from these buddies by " | |
6483 "right-clicking on them and selecting " | |
6484 "\"Re-request Authorization.\""), text, NULL, NULL); | |
4333 | 6485 g_free(text); |
2979 | 6486 } |
6487 | |
7080
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6488 static void search_by_email_cb(GaimConnection *gc, const char *email) |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6489 { |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6490 serv_dir_search(gc, "", "", "", "", "", "", "", email); |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6491 } |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6492 |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6493 static void oscar_show_find_email(GaimConnection *gc) |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6494 { |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6495 gaim_request_input(gc, _("Find Buddy by E-mail"), |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6496 _("Search for a buddy by e-mail address"), |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6497 _("Type the e-mail address of the buddy you are " |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6498 "searching for."), |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6499 NULL, FALSE, FALSE, |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6500 _("Search"), G_CALLBACK(search_by_email_cb), |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6501 _("Cancel"), NULL, gc); |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6502 } |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6503 |
7366 | 6504 #if 0 |
5917 | 6505 static void oscar_setavailmsg(GaimConnection *gc, char *text) { |
7283 | 6506 OscarData *od = (OscarData *)gc->proto_data; |
5917 | 6507 |
7334 | 6508 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0); |
5917 | 6509 aim_srv_setavailmsg(od->sess, text); |
6510 } | |
6511 | |
6512 static void oscar_show_setavailmsg(GaimConnection *gc) | |
6513 { | |
7313 | 6514 gaim_request_input(gc, NULL, _("Available Message:"), NULL, |
6515 _("I'm doing work and hoping for a distraction--IM me!"), | |
6516 TRUE, FALSE, | |
5917 | 6517 _("OK"), G_CALLBACK(oscar_setavailmsg), |
6518 _("Cancel"), NULL, | |
6519 gc); | |
6520 } | |
7366 | 6521 #endif |
5917 | 6522 |
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6523 static void oscar_show_set_info(GaimConnection *gc) |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6524 { |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6525 gaim_account_request_change_user_info(gaim_connection_get_account(gc)); |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6526 } |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6527 |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6528 static void oscar_change_pass(GaimConnection *gc) |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6529 { |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6530 gaim_account_request_change_password(gaim_connection_get_account(gc)); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6531 } |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6532 |
5575 | 6533 static void oscar_show_chpassurl(GaimConnection *gc) |
4333 | 6534 { |
7283 | 6535 OscarData *od = gc->proto_data; |
5575 | 6536 gchar *substituted = gaim_strreplace(od->sess->authinfo->chpassurl, "%s", gaim_account_get_username(gaim_connection_get_account(gc))); |
6465
fb64cc87bc96
[gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents:
6400
diff
changeset
|
6537 gaim_notify_uri(gc, substituted); |
5517 | 6538 g_free(substituted); |
4333 | 6539 } |
6540 | |
7026 | 6541 static void oscar_show_imforwardingurl(GaimConnection *gc) |
6542 { | |
6543 gaim_notify_uri(gc, "http://mymobile.aol.com/dbreg/register?action=imf&clientID=1"); | |
6544 } | |
6545 | |
5842 | 6546 static void oscar_set_icon(GaimConnection *gc, const char *iconfile) |
6547 { | |
7283 | 6548 OscarData *od = gc->proto_data; |
5844 | 6549 aim_session_t *sess = od->sess; |
5842 | 6550 FILE *file; |
6551 struct stat st; | |
5844 | 6552 |
6039 | 6553 if (iconfile == NULL) { |
6554 /* Set an empty icon, or something */ | |
6555 } else if (!stat(iconfile, &st)) { | |
5842 | 6556 char *buf = g_malloc(st.st_size); |
6557 file = fopen(iconfile, "rb"); | |
6558 if (file) { | |
6052 | 6559 md5_state_t *state; |
6039 | 6560 char md5[16]; |
5842 | 6561 int len = fread(buf, 1, st.st_size, file); |
6039 | 6562 fclose(file); |
6052 | 6563 state = g_malloc(sizeof(md5_state_t)); |
5842 | 6564 md5_init(state); |
6565 md5_append(state, buf, len); | |
6566 md5_finish(state, md5); | |
6567 g_free(state); | |
6568 aim_ssi_seticon(sess, md5, 16); | |
6569 } else | |
6570 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
6571 "Can't open buddy icon file!\n"); | |
6572 g_free(buf); | |
6573 } else | |
6574 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
6575 "Can't stat buddy icon file!\n"); | |
6576 } | |
6577 | |
6578 | |
5575 | 6579 static GList *oscar_actions(GaimConnection *gc) |
2086 | 6580 { |
7283 | 6581 OscarData *od = gc->proto_data; |
4333 | 6582 struct proto_actions_menu *pam; |
6583 GList *m = NULL; | |
6584 | |
6585 pam = g_new0(struct proto_actions_menu, 1); | |
7853 | 6586 pam->label = _("Set User Info..."); |
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6587 pam->callback = oscar_show_set_info; |
4333 | 6588 pam->gc = gc; |
6589 m = g_list_append(m, pam); | |
6590 | |
7366 | 6591 #if 0 |
5917 | 6592 pam = g_new0(struct proto_actions_menu, 1); |
7853 | 6593 pam->label = _("Set Available Message..."); |
5917 | 6594 pam->callback = oscar_show_setavailmsg; |
6595 pam->gc = gc; | |
6596 m = g_list_append(m, pam); | |
7366 | 6597 #endif |
5917 | 6598 |
5238 | 6599 pam = g_new0(struct proto_actions_menu, 1); |
7853 | 6600 pam->label = _("Change Password..."); |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6601 pam->callback = oscar_change_pass; |
5238 | 6602 pam->gc = gc; |
6603 m = g_list_append(m, pam); | |
4617 | 6604 |
6605 if (od->sess->authinfo->chpassurl) { | |
6606 pam = g_new0(struct proto_actions_menu, 1); | |
6607 pam->label = _("Change Password (URL)"); | |
6608 pam->callback = oscar_show_chpassurl; | |
6609 pam->gc = gc; | |
6610 m = g_list_append(m, pam); | |
6611 } | |
6612 | |
7026 | 6613 if (od->sess->authinfo->chpassurl) { |
6614 pam = g_new0(struct proto_actions_menu, 1); | |
6615 pam->label = _("Configure IM Forwarding (URL)"); | |
6616 pam->callback = oscar_show_imforwardingurl; | |
6617 pam->gc = gc; | |
6618 m = g_list_append(m, pam); | |
6619 } | |
6620 | |
5238 | 6621 if (!od->icq) { |
4617 | 6622 /* AIM actions */ |
6623 m = g_list_append(m, NULL); | |
4333 | 6624 |
5917 | 6625 pam = g_new0(struct proto_actions_menu, 1); |
8152 | 6626 pam->label = _("Format Screen Name..."); |
5844 | 6627 pam->callback = oscar_show_format_screenname; |
4333 | 6628 pam->gc = gc; |
6629 m = g_list_append(m, pam); | |
6630 | |
6631 pam = g_new0(struct proto_actions_menu, 1); | |
6632 pam->label = _("Confirm Account"); | |
6633 pam->callback = oscar_confirm_account; | |
6634 pam->gc = gc; | |
6635 m = g_list_append(m, pam); | |
6636 | |
6637 pam = g_new0(struct proto_actions_menu, 1); | |
7880 | 6638 pam->label = _("Display Currently Registered Address"); |
4333 | 6639 pam->callback = oscar_show_email; |
6640 pam->gc = gc; | |
6641 m = g_list_append(m, pam); | |
6642 | |
6643 pam = g_new0(struct proto_actions_menu, 1); | |
7880 | 6644 pam->label = _("Change Currently Registered Address..."); |
4333 | 6645 pam->callback = oscar_show_change_email; |
6646 pam->gc = gc; | |
6647 m = g_list_append(m, pam); | |
2086 | 6648 } |
4333 | 6649 |
6650 m = g_list_append(m, NULL); | |
6651 | |
6652 pam = g_new0(struct proto_actions_menu, 1); | |
6653 pam->label = _("Show Buddies Awaiting Authorization"); | |
6654 pam->callback = oscar_show_awaitingauth; | |
6655 pam->gc = gc; | |
6656 m = g_list_append(m, pam); | |
6657 | |
2086 | 6658 m = g_list_append(m, NULL); |
4333 | 6659 |
6660 pam = g_new0(struct proto_actions_menu, 1); | |
7853 | 6661 pam->label = _("Search for Buddy by Email..."); |
7080
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6662 pam->callback = oscar_show_find_email; |
4333 | 6663 pam->gc = gc; |
6664 m = g_list_append(m, pam); | |
6665 | |
4336 | 6666 /* pam = g_new0(struct proto_actions_menu, 1); |
4333 | 6667 pam->label = _("Search for Buddy by Information"); |
6668 pam->callback = show_find_info; | |
6669 pam->gc = gc; | |
4336 | 6670 m = g_list_append(m, pam); */ |
2086 | 6671 |
6672 return m; | |
6673 } | |
6674 | |
5575 | 6675 static void oscar_change_passwd(GaimConnection *gc, const char *old, const char *new) |
2086 | 6676 { |
7283 | 6677 OscarData *od = gc->proto_data; |
4617 | 6678 |
6679 if (od->icq) { | |
6680 aim_icq_changepasswd(od->sess, new); | |
2086 | 6681 } else { |
4617 | 6682 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6683 if (conn) { | |
6684 aim_admin_changepasswd(od->sess, conn, new, old); | |
6685 } else { | |
6686 od->chpass = TRUE; | |
6687 od->oldp = g_strdup(old); | |
6688 od->newp = g_strdup(new); | |
6689 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6690 } | |
2086 | 6691 } |
6692 } | |
6693 | |
6059 | 6694 static void oscar_convo_closed(GaimConnection *gc, const char *who) |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6695 { |
7283 | 6696 OscarData *od = gc->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6697 struct direct_im *dim = find_direct_im(od, who); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6698 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6699 if (!dim) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6700 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6701 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6702 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6703 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6704 aim_conn_kill(od->sess, &dim->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6705 g_free(dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6706 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6707 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6708 static GaimPluginProtocolInfo prpl_info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6709 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6710 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
|
6711 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6712 NULL, |
8170 | 6713 NULL, |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6714 oscar_list_icon, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6715 oscar_list_emblems, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6716 oscar_status_text, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6717 oscar_tooltip_text, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6718 oscar_away_states, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6719 oscar_actions, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6720 oscar_buddy_menu, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6721 oscar_chat_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6722 oscar_login, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6723 oscar_close, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6724 oscar_send_im, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6725 oscar_set_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6726 oscar_send_typing, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6727 oscar_get_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6728 oscar_set_away, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6729 oscar_get_away, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6730 oscar_set_dir, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6731 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6732 oscar_dir_search, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6733 oscar_set_idle, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6734 oscar_change_passwd, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6735 oscar_add_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6736 oscar_add_buddies, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6737 oscar_remove_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6738 oscar_remove_buddies, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6739 oscar_add_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6740 oscar_add_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6741 oscar_rem_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6742 oscar_rem_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6743 oscar_set_permit_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6744 oscar_warn, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6745 oscar_join_chat, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6746 oscar_chat_invite, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6747 oscar_chat_leave, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6748 NULL, |
8219 | 6749 oscar_send_chat, |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6750 oscar_keepalive, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6751 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6752 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6753 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6754 #ifndef NOSSI |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6755 oscar_alias_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6756 oscar_move_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6757 oscar_rename_group, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6758 #else |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6759 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6760 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6761 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6762 #endif |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6763 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6764 oscar_convo_closed, |
5842 | 6765 NULL, |
7650 | 6766 oscar_set_icon |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6767 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6768 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6769 static GaimPluginInfo info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6770 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6771 2, /**< api_version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6772 GAIM_PLUGIN_PROTOCOL, /**< type */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6773 NULL, /**< ui_requirement */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6774 0, /**< flags */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6775 NULL, /**< dependencies */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6776 GAIM_PRIORITY_DEFAULT, /**< priority */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6777 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6778 "prpl-oscar", /**< id */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6779 "AIM/ICQ", /**< name */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6780 VERSION, /**< version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6781 /** summary */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6782 N_("AIM/ICQ Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6783 /** description */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6784 N_("AIM/ICQ Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6785 NULL, /**< author */ |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6350
diff
changeset
|
6786 GAIM_WEBSITE, /**< homepage */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6787 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6788 NULL, /**< load */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6789 NULL, /**< unload */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6790 NULL, /**< destroy */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6791 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6792 NULL, /**< ui_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6793 &prpl_info /**< extra_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6794 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6795 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6796 static void |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5917
diff
changeset
|
6797 init_plugin(GaimPlugin *plugin) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6798 { |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6799 GaimAccountOption *option; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6800 |
5685
43ea75092684
[gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
6801 option = gaim_account_option_string_new(_("Auth host"), "server", |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6802 "login.oscar.aol.com"); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6803 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6804 option); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6805 |
5685
43ea75092684
[gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
6806 option = gaim_account_option_int_new(_("Auth port"), "port", 5190); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6807 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6808 option); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6809 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6810 my_protocol = plugin; |
2086 | 6811 } |
6812 | |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5917
diff
changeset
|
6813 GAIM_INIT_PLUGIN(oscar, init_plugin, info); |