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