Mercurial > pidgin.yaz
annotate src/protocols/oscar/oscar.c @ 9318:01c50436203e
[gaim-migrate @ 10126]
i think this is more intelligent scaling. it would certainly be hard for it to be less intelligent scaling
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sat, 19 Jun 2004 17:34:29 +0000 |
parents | b3bda982996b |
children | f1fd56e83567 |
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" |
8476 | 31 #include "away.h" |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
32 #include "buddyicon.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
33 #include "conversation.h" |
7083
3100a6e03644
[gaim-migrate @ 7648]
Christian Hammond <chipx86@chipx86.com>
parents:
7082
diff
changeset
|
34 #include "core.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
35 #include "debug.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
36 #include "ft.h" |
6982 | 37 #include "imgstore.h" |
2086 | 38 #include "multi.h" |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8227
diff
changeset
|
39 #include "network.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
40 #include "notify.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
41 #include "privacy.h" |
2086 | 42 #include "prpl.h" |
4889 | 43 #include "proxy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
44 #include "request.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
45 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
46 |
2086 | 47 #include "aim.h" |
5842 | 48 #include "md5.h" |
2086 | 49 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
50 #define UC_AOL 0x02 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
51 #define UC_ADMIN 0x04 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
52 #define UC_UNCONFIRMED 0x08 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
53 #define UC_NORMAL 0x10 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
54 #define UC_AB 0x20 |
3079 | 55 #define UC_WIRELESS 0x40 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
56 |
2086 | 57 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" |
58 | |
7283 | 59 #define OSCAR_CONNECT_STEPS 6 |
60 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
61 static GaimPlugin *my_protocol = NULL; |
4249 | 62 |
7376 | 63 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_INTEROPERATE | AIM_CAPS_ICHAT; |
64 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8 | AIM_CAPS_INTEROPERATE | AIM_CAPS_ICHAT; | |
3458 | 65 |
4665 | 66 static fu8_t features_aim[] = {0x01, 0x01, 0x01, 0x02}; |
67 static fu8_t features_icq[] = {0x01, 0x06}; | |
8341 | 68 static fu8_t ck[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
2086 | 69 |
7283 | 70 typedef struct _OscarData OscarData; |
71 struct _OscarData { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
72 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
73 aim_conn_t *conn; |
2086 | 74 |
75 guint cnpa; | |
76 guint paspa; | |
3694 | 77 guint emlpa; |
4804 | 78 guint icopa; |
2086 | 79 |
4823 | 80 gboolean iconconnecting; |
5842 | 81 gboolean set_icon; |
4823 | 82 |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
83 GSList *create_rooms; |
2086 | 84 |
85 gboolean conf; | |
86 gboolean reqemail; | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
87 gboolean setemail; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
88 char *email; |
2979 | 89 gboolean setnick; |
90 char *newsn; | |
2086 | 91 gboolean chpass; |
92 char *oldp; | |
93 char *newp; | |
5842 | 94 |
2086 | 95 GSList *oscar_chats; |
96 GSList *direct_ims; | |
3630 | 97 GSList *file_transfers; |
4738 | 98 GHashTable *buddyinfo; |
4804 | 99 GSList *requesticon; |
2086 | 100 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
101 gboolean killme; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
102 gboolean icq; |
4804 | 103 guint icontimer; |
5968 | 104 guint getblisttimer; |
8341 | 105 guint getinfotimer; |
2993 | 106 |
107 struct { | |
4230 | 108 guint maxwatchers; /* max users who can watch you */ |
2993 | 109 guint maxbuddies; /* max users you can watch */ |
4230 | 110 guint maxgroups; /* max groups in server list */ |
2993 | 111 guint maxpermits; /* max users on permit list */ |
112 guint maxdenies; /* max users on deny list */ | |
113 guint maxsiglen; /* max size (bytes) of profile */ | |
114 guint maxawaymsglen; /* max size (bytes) of posted away message */ | |
115 } rights; | |
2086 | 116 }; |
117 | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
118 struct create_room { |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
119 char *name; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
120 int exchange; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
121 }; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
122 |
2086 | 123 struct chat_connection { |
124 char *name; | |
125 char *show; /* AOL did something funny to us */ | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
126 fu16_t exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
127 fu16_t instance; |
2086 | 128 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
|
129 aim_conn_t *conn; |
2086 | 130 int inpa; |
131 int id; | |
5575 | 132 GaimConnection *gc; /* i hate this. */ |
8733 | 133 GaimConversation *conv; /* bah. */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
134 int maxlen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
135 int maxvis; |
2086 | 136 }; |
137 | |
8971 | 138 struct oscar_direct_im { |
5575 | 139 GaimConnection *gc; |
2086 | 140 char name[80]; |
141 int watcher; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
142 aim_conn_t *conn; |
3008 | 143 gboolean connected; |
8978 | 144 gboolean gpc_pend; |
145 gboolean killme; | |
8984 | 146 gboolean donttryagain; |
2086 | 147 }; |
148 | |
149 struct ask_direct { | |
5575 | 150 GaimConnection *gc; |
2086 | 151 char *sn; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
152 char ip[64]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
153 fu8_t cookie[8]; |
8984 | 154 gboolean donttryagain; |
2086 | 155 }; |
156 | |
7011 | 157 /* |
158 * Various PRPL-specific buddy info that we want to keep track of | |
159 * Some other info is maintained by locate.c, and I'd like to move | |
160 * the rest of this to libfaim, mostly im.c | |
161 */ | |
4738 | 162 struct buddyinfo { |
163 gboolean typingnot; | |
6292 | 164 gchar *availmsg; |
6857 | 165 fu32_t ipaddr; |
5836 | 166 |
167 unsigned long ico_me_len; | |
168 unsigned long ico_me_csum; | |
169 time_t ico_me_time; | |
170 gboolean ico_informed; | |
4738 | 171 |
172 unsigned long ico_len; | |
173 unsigned long ico_csum; | |
174 time_t ico_time; | |
175 gboolean ico_need; | |
7406 | 176 gboolean ico_sent; |
2086 | 177 }; |
178 | |
4230 | 179 struct name_data { |
5575 | 180 GaimConnection *gc; |
4230 | 181 gchar *name; |
3453 | 182 gchar *nick; |
3141 | 183 }; |
184 | |
5129 | 185 static char *msgerrreason[] = { |
186 N_("Invalid error"), | |
187 N_("Invalid SNAC"), | |
188 N_("Rate to host"), | |
189 N_("Rate to client"), | |
190 N_("Not logged in"), | |
191 N_("Service unavailable"), | |
192 N_("Service not defined"), | |
193 N_("Obsolete SNAC"), | |
194 N_("Not supported by host"), | |
195 N_("Not supported by client"), | |
196 N_("Refused by client"), | |
197 N_("Reply too big"), | |
198 N_("Responses lost"), | |
199 N_("Request denied"), | |
200 N_("Busted SNAC payload"), | |
201 N_("Insufficient rights"), | |
202 N_("In local permit/deny"), | |
203 N_("Too evil (sender)"), | |
204 N_("Too evil (receiver)"), | |
205 N_("User temporarily unavailable"), | |
206 N_("No match"), | |
207 N_("List overflow"), | |
208 N_("Request ambiguous"), | |
209 N_("Queue full"), | |
210 N_("Not while on AOL") | |
211 }; | |
212 static int msgerrreasonlen = 25; | |
213 | |
214 /* All the libfaim->gaim callback functions */ | |
215 static int gaim_parse_auth_resp (aim_session_t *, aim_frame_t *, ...); | |
216 static int gaim_parse_login (aim_session_t *, aim_frame_t *, ...); | |
217 static int gaim_handle_redirect (aim_session_t *, aim_frame_t *, ...); | |
218 static int gaim_info_change (aim_session_t *, aim_frame_t *, ...); | |
219 static int gaim_account_confirm (aim_session_t *, aim_frame_t *, ...); | |
220 static int gaim_parse_oncoming (aim_session_t *, aim_frame_t *, ...); | |
221 static int gaim_parse_offgoing (aim_session_t *, aim_frame_t *, ...); | |
222 static int gaim_parse_incoming_im(aim_session_t *, aim_frame_t *, ...); | |
223 static int gaim_parse_misses (aim_session_t *, aim_frame_t *, ...); | |
224 static int gaim_parse_clientauto (aim_session_t *, aim_frame_t *, ...); | |
7011 | 225 static int gaim_parse_userinfo (aim_session_t *, aim_frame_t *, ...); |
8341 | 226 static int gaim_reqinfo_timeout (aim_session_t *, aim_frame_t *, ...); |
5129 | 227 static int gaim_parse_motd (aim_session_t *, aim_frame_t *, ...); |
228 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
|
229 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
|
230 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
|
231 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
|
232 static int gaim_conv_chat_incoming_msg(aim_session_t *, aim_frame_t *, ...); |
5129 | 233 static int gaim_email_parseupdate(aim_session_t *, aim_frame_t *, ...); |
234 static int gaim_icon_error (aim_session_t *, aim_frame_t *, ...); | |
235 static int gaim_icon_parseicon (aim_session_t *, aim_frame_t *, ...); | |
5844 | 236 static int oscar_icon_req (aim_session_t *, aim_frame_t *, ...); |
5129 | 237 static int gaim_parse_msgack (aim_session_t *, aim_frame_t *, ...); |
238 static int gaim_parse_ratechange (aim_session_t *, aim_frame_t *, ...); | |
239 static int gaim_parse_evilnotify (aim_session_t *, aim_frame_t *, ...); | |
240 static int gaim_parse_searcherror(aim_session_t *, aim_frame_t *, ...); | |
241 static int gaim_parse_searchreply(aim_session_t *, aim_frame_t *, ...); | |
242 static int gaim_bosrights (aim_session_t *, aim_frame_t *, ...); | |
243 static int gaim_connerr (aim_session_t *, aim_frame_t *, ...); | |
244 static int conninitdone_admin (aim_session_t *, aim_frame_t *, ...); | |
245 static int conninitdone_bos (aim_session_t *, aim_frame_t *, ...); | |
246 static int conninitdone_chatnav (aim_session_t *, aim_frame_t *, ...); | |
247 static int conninitdone_chat (aim_session_t *, aim_frame_t *, ...); | |
248 static int conninitdone_email (aim_session_t *, aim_frame_t *, ...); | |
249 static int conninitdone_icon (aim_session_t *, aim_frame_t *, ...); | |
250 static int gaim_parse_msgerr (aim_session_t *, aim_frame_t *, ...); | |
251 static int gaim_parse_mtn (aim_session_t *, aim_frame_t *, ...); | |
252 static int gaim_parse_locaterights(aim_session_t *, aim_frame_t *, ...); | |
253 static int gaim_parse_buddyrights(aim_session_t *, aim_frame_t *, ...); | |
254 static int gaim_parse_locerr (aim_session_t *, aim_frame_t *, ...); | |
255 static int gaim_icbm_param_info (aim_session_t *, aim_frame_t *, ...); | |
256 static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...); | |
257 static int gaim_memrequest (aim_session_t *, aim_frame_t *, ...); | |
258 static int gaim_selfinfo (aim_session_t *, aim_frame_t *, ...); | |
259 static int gaim_offlinemsg (aim_session_t *, aim_frame_t *, ...); | |
260 static int gaim_offlinemsgdone (aim_session_t *, aim_frame_t *, ...); | |
261 static int gaim_icqalias (aim_session_t *, aim_frame_t *, ...); | |
262 static int gaim_icqinfo (aim_session_t *, aim_frame_t *, ...); | |
263 static int gaim_popup (aim_session_t *, aim_frame_t *, ...); | |
264 #ifndef NOSSI | |
265 static int gaim_ssi_parseerr (aim_session_t *, aim_frame_t *, ...); | |
266 static int gaim_ssi_parserights (aim_session_t *, aim_frame_t *, ...); | |
267 static int gaim_ssi_parselist (aim_session_t *, aim_frame_t *, ...); | |
268 static int gaim_ssi_parseack (aim_session_t *, aim_frame_t *, ...); | |
8227 | 269 static int gaim_ssi_parseadd (aim_session_t *, aim_frame_t *, ...); |
5129 | 270 static int gaim_ssi_authgiven (aim_session_t *, aim_frame_t *, ...); |
271 static int gaim_ssi_authrequest (aim_session_t *, aim_frame_t *, ...); | |
272 static int gaim_ssi_authreply (aim_session_t *, aim_frame_t *, ...); | |
273 static int gaim_ssi_gotadded (aim_session_t *, aim_frame_t *, ...); | |
274 #endif | |
275 | |
276 /* for DirectIM/image transfer */ | |
277 static int gaim_odc_initiate (aim_session_t *, aim_frame_t *, ...); | |
278 static int gaim_odc_incoming (aim_session_t *, aim_frame_t *, ...); | |
279 static int gaim_odc_typing (aim_session_t *, aim_frame_t *, ...); | |
6982 | 280 static int gaim_odc_update_ui (aim_session_t *, aim_frame_t *, ...); |
5129 | 281 |
282 /* for file transfer */ | |
283 static int oscar_sendfile_estblsh(aim_session_t *, aim_frame_t *, ...); | |
284 static int oscar_sendfile_prompt (aim_session_t *, aim_frame_t *, ...); | |
285 static int oscar_sendfile_ack (aim_session_t *, aim_frame_t *, ...); | |
286 static int oscar_sendfile_done (aim_session_t *, aim_frame_t *, ...); | |
287 | |
288 /* for icons */ | |
289 static gboolean gaim_icon_timerfunc(gpointer data); | |
290 | |
8971 | 291 /* just because */ |
292 static void oscar_callback(gpointer data, gint source, GaimInputCondition condition); | |
8983 | 293 static void oscar_direct_im_initiate(GaimConnection *gc, const char *who, const char *cookie); |
8971 | 294 |
8076 | 295 /* remove these at some point? */ |
7282 | 296 /* Because I don't like forward declarations? I think that was why... */ |
5954 | 297 static void oscar_set_info(GaimConnection *gc, const char *text); |
8076 | 298 static void oscar_set_away(GaimConnection *gc, const char *state, const char *message); |
5306 | 299 |
5836 | 300 static void oscar_free_name_data(struct name_data *data) { |
4230 | 301 g_free(data->name); |
302 g_free(data->nick); | |
303 g_free(data); | |
304 } | |
305 | |
5836 | 306 static void oscar_free_buddyinfo(void *data) { |
307 struct buddyinfo *bi = data; | |
6292 | 308 g_free(bi->availmsg); |
5836 | 309 g_free(bi); |
310 } | |
311 | |
5129 | 312 static fu32_t oscar_encoding_check(const char *utf8) |
313 { | |
314 int i = 0; | |
315 fu32_t encodingflag = 0; | |
316 | |
317 /* Determine how we can send this message. Per the warnings elsewhere | |
318 * in this file, these little checks determine the simplest encoding | |
319 * we can use for a given message send using it. */ | |
320 while (utf8[i]) { | |
321 if ((unsigned char)utf8[i] > 0x7f) { | |
322 /* not ASCII! */ | |
323 encodingflag = AIM_IMFLAGS_ISO_8859_1; | |
324 break; | |
325 } | |
326 i++; | |
327 } | |
328 while (utf8[i]) { | |
329 /* ISO-8859-1 is 0x00-0xbf in the first byte | |
330 * followed by 0xc0-0xc3 in the second */ | |
331 if ((unsigned char)utf8[i] < 0x80) { | |
332 i++; | |
333 continue; | |
334 } else if (((unsigned char)utf8[i] & 0xfc) == 0xc0 && | |
335 ((unsigned char)utf8[i + 1] & 0xc0) == 0x80) { | |
336 i += 2; | |
337 continue; | |
338 } | |
339 encodingflag = AIM_IMFLAGS_UNICODE; | |
340 break; | |
341 } | |
342 | |
343 return encodingflag; | |
344 } | |
345 | |
8225 | 346 /* |
347 * Take a string of the form charset="bleh" where bleh is | |
348 * one of us-ascii, utf-8, iso-8859-1, or unicode-2-0, and | |
349 * return a newly allocated string containing bleh. | |
350 */ | |
351 static gchar *oscar_encoding_extract(const char *encoding) | |
5129 | 352 { |
8225 | 353 gchar *ret = NULL; |
354 char *begin, *end; | |
355 | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8733
diff
changeset
|
356 /* Make sure encoding begins with charset= */ |
8225 | 357 if (strncmp(encoding, "text/aolrtf; charset=", 21)) |
358 return NULL; | |
359 | |
360 begin = strchr(encoding, '"'); | |
361 end = strrchr(encoding, '"'); | |
362 | |
363 if ((begin == NULL) || (end == NULL) || (begin >= end)) | |
364 return NULL; | |
365 | |
366 ret = g_strndup(begin+1, (end-1) - begin); | |
367 | |
368 return ret; | |
369 } | |
370 | |
371 /* | |
372 * Return the flag specifying the given encoding. | |
373 */ | |
374 static fu32_t oscar_encoding_parse(const char *encoding) | |
375 { | |
376 if ((encoding == NULL) || encoding[0] == '\0') { | |
8660 | 377 gaim_debug_warning("oscar", "Empty encoding, assuming ASCII\n"); |
5129 | 378 return 0; |
379 } | |
8225 | 380 |
381 if (!strcmp(encoding, "us-ascii") || !strcmp(encoding, "utf-8")) { | |
382 /* UTF-8 is our native encoding, ASCII is a proper subset */ | |
5129 | 383 return 0; |
8225 | 384 } else if (!strcmp(encoding, "iso-8859-1")) { |
5129 | 385 return AIM_IMFLAGS_ISO_8859_1; |
8225 | 386 } else if (!strcmp(encoding, "unicode-2-0")) { |
5129 | 387 return AIM_IMFLAGS_UNICODE; |
388 } else { | |
8660 | 389 gaim_debug_warning("oscar", |
8250 | 390 "Unrecognized character encoding '%s', attempting to convert to utf8 anyway\n", encoding); |
391 return 99; | |
5129 | 392 } |
393 } | |
394 | |
8233 | 395 gchar *oscar_encoding_to_utf8(const char *encoding, const char *text, int textlen) |
5129 | 396 { |
397 gchar *utf8 = NULL; | |
398 int flags = oscar_encoding_parse(encoding); | |
399 | |
400 switch (flags) { | |
401 case 0: | |
8250 | 402 utf8 = g_convert(text, textlen, "UTF-8", "UTF-8", NULL, NULL, NULL); |
5129 | 403 break; |
404 case AIM_IMFLAGS_ISO_8859_1: | |
405 utf8 = g_convert(text, textlen, "UTF-8", "ISO-8859-1", NULL, NULL, NULL); | |
406 break; | |
407 case AIM_IMFLAGS_UNICODE: | |
408 utf8 = g_convert(text, textlen, "UTF-8", "UCS-2BE", NULL, NULL, NULL); | |
409 break; | |
8250 | 410 case 99: |
411 utf8 = g_convert(text, textlen, "UTF-8", encoding, NULL, NULL, NULL); | |
412 if (utf8 == NULL) { | |
413 utf8 = g_convert(text, textlen, "UTF-8", "UTF-8", NULL, NULL, NULL); | |
414 } | |
415 break; | |
5129 | 416 } |
417 | |
418 return utf8; | |
419 } | |
420 | |
8701 | 421 static char *oscar_caps_to_string(guint caps) |
422 { | |
423 static char buf[512], *tmp; | |
424 int count = 0, i = 0; | |
425 guint bit = 1; | |
426 | |
427 if (!caps) { | |
428 return NULL; | |
429 } else while (bit <= AIM_CAPS_LAST) { | |
430 if (bit & caps) { | |
431 switch (bit) { | |
432 case AIM_CAPS_BUDDYICON: | |
433 tmp = _("Buddy Icon"); | |
434 break; | |
435 case AIM_CAPS_TALK: | |
436 tmp = _("Voice"); | |
437 break; | |
438 case AIM_CAPS_DIRECTIM: | |
439 tmp = _("AIM Direct IM"); | |
440 break; | |
441 case AIM_CAPS_CHAT: | |
442 tmp = _("Chat"); | |
443 break; | |
444 case AIM_CAPS_GETFILE: | |
445 tmp = _("Get File"); | |
446 break; | |
447 case AIM_CAPS_SENDFILE: | |
448 tmp = _("Send File"); | |
449 break; | |
450 case AIM_CAPS_GAMES: | |
451 case AIM_CAPS_GAMES2: | |
452 tmp = _("Games"); | |
453 break; | |
454 case AIM_CAPS_ADDINS: | |
455 tmp = _("Add-Ins"); | |
456 break; | |
457 case AIM_CAPS_SENDBUDDYLIST: | |
458 tmp = _("Send Buddy List"); | |
459 break; | |
460 case AIM_CAPS_ICQ_DIRECT: | |
461 tmp = _("ICQ Direct Connect"); | |
462 break; | |
463 case AIM_CAPS_APINFO: | |
464 tmp = _("AP User"); | |
465 break; | |
466 case AIM_CAPS_ICQRTF: | |
467 tmp = _("ICQ RTF"); | |
468 break; | |
469 case AIM_CAPS_EMPTY: | |
470 tmp = _("Nihilist"); | |
471 break; | |
472 case AIM_CAPS_ICQSERVERRELAY: | |
473 tmp = _("ICQ Server Relay"); | |
474 break; | |
475 case AIM_CAPS_ICQUTF8OLD: | |
476 tmp = _("Old ICQ UTF8"); | |
477 break; | |
478 case AIM_CAPS_TRILLIANCRYPT: | |
479 tmp = _("Trillian Encryption"); | |
480 break; | |
481 case AIM_CAPS_ICQUTF8: | |
482 tmp = _("ICQ UTF8"); | |
483 break; | |
484 case AIM_CAPS_HIPTOP: | |
485 tmp = _("Hiptop"); | |
486 break; | |
487 case AIM_CAPS_SECUREIM: | |
488 tmp = _("Security Enabled"); | |
489 break; | |
490 case AIM_CAPS_VIDEO: | |
491 tmp = _("Video Chat"); | |
492 break; | |
493 /* Not actually sure about this one... WinAIM doesn't show anything */ | |
494 case AIM_CAPS_ICHATAV: | |
495 tmp = _("iChat AV"); | |
496 break; | |
497 case AIM_CAPS_LIVEVIDEO: | |
498 tmp = _("Live Video"); | |
499 break; | |
500 case AIM_CAPS_CAMERA: | |
501 tmp = _("Camera"); | |
502 break; | |
503 default: | |
504 tmp = NULL; | |
505 break; | |
506 } | |
507 if (tmp) | |
508 i += g_snprintf(buf + i, sizeof(buf) - i, "%s%s", (count ? ", " : ""), | |
509 tmp); | |
510 count++; | |
511 } | |
512 bit <<= 1; | |
513 } | |
514 return buf; | |
515 } | |
516 | |
517 static char *oscar_icqstatus(int state) { | |
518 /* Make a cute little string that shows the status of the dude or dudet */ | |
519 if (state & AIM_ICQ_STATE_CHAT) | |
520 return g_strdup_printf(_("Free For Chat")); | |
521 else if (state & AIM_ICQ_STATE_DND) | |
522 return g_strdup_printf(_("Do Not Disturb")); | |
523 else if (state & AIM_ICQ_STATE_OUT) | |
524 return g_strdup_printf(_("Not Available")); | |
525 else if (state & AIM_ICQ_STATE_BUSY) | |
526 return g_strdup_printf(_("Occupied")); | |
527 else if (state & AIM_ICQ_STATE_AWAY) | |
528 return g_strdup_printf(_("Away")); | |
529 else if (state & AIM_ICQ_STATE_WEBAWARE) | |
530 return g_strdup_printf(_("Web Aware")); | |
531 else if (state & AIM_ICQ_STATE_INVISIBLE) | |
532 return g_strdup_printf(_("Invisible")); | |
533 else | |
534 return g_strdup_printf(_("Online")); | |
535 } | |
536 | |
537 static void oscar_string_append(GString *str, char *newline, char *name, char *value) | |
8700 | 538 { |
539 gchar *utf8; | |
540 | |
541 if (value && value[0] && (utf8 = gaim_utf8_try_convert(value))) { | |
8701 | 542 g_string_append_printf(str, "%s<b>%s:</b> %s", newline, name, utf8); |
8700 | 543 g_free(utf8); |
544 } | |
545 } | |
546 | |
8701 | 547 static void oscar_string_append_info(GaimConnection *gc, GString *str, char *newline, GaimBuddy *b, aim_userinfo_t *userinfo) |
548 { | |
549 OscarData *od = gc->proto_data; | |
550 GaimAccount *account = gaim_connection_get_account(gc); | |
551 GaimGroup *g = NULL; | |
552 struct buddyinfo *bi = NULL; | |
553 char *tmp; | |
554 | |
555 if ((str == NULL) || (str == NULL) || (newline == NULL) || ((b == NULL) && (userinfo == NULL))) | |
556 return; | |
557 | |
558 if (userinfo == NULL) | |
559 userinfo = aim_locate_finduserinfo(od->sess, b->name); | |
560 | |
561 if (b == NULL) | |
562 b = gaim_find_buddy(gc->account, userinfo->sn); | |
563 | |
564 if (b != NULL) | |
565 g = gaim_find_buddys_group(b); | |
566 | |
567 if (userinfo != NULL) | |
568 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, userinfo->sn)); | |
569 | |
8733 | 570 if (b != NULL) { |
571 if (GAIM_BUDDY_IS_ONLINE(b)) { | |
572 if (isdigit(b->name[0])) { | |
573 tmp = oscar_icqstatus((b->uc & 0xffff0000) >> 16); | |
574 oscar_string_append(str, newline, _("Status"), tmp); | |
575 g_free(tmp); | |
576 } | |
577 } else { | |
578 char *tmp = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); | |
579 if (aim_ssi_waitingforauth(od->sess->ssi.local, tmp, b->name)) | |
580 oscar_string_append(str, newline, _("Status"), _("Not Authorized")); | |
581 else | |
582 oscar_string_append(str, newline, _("Status"), _("Offline")); | |
8701 | 583 } |
8733 | 584 } |
8701 | 585 |
586 if ((bi != NULL) && (bi->ipaddr != 0)) { | |
587 char *tmp = g_strdup_printf("%hhu.%hhu.%hhu.%hhu", | |
588 (bi->ipaddr & 0xff000000) >> 24, | |
589 (bi->ipaddr & 0x00ff0000) >> 16, | |
590 (bi->ipaddr & 0x0000ff00) >> 8, | |
591 (bi->ipaddr & 0x000000ff)); | |
592 oscar_string_append(str, newline, _("IP Address"), tmp); | |
593 g_free(tmp); | |
594 } | |
595 | |
596 if ((userinfo != NULL) && (userinfo->capabilities != 0)) { | |
597 tmp = oscar_caps_to_string(userinfo->capabilities); | |
598 oscar_string_append(str, newline, _("Capabilities"), tmp); | |
599 } | |
600 | |
601 if ((b != NULL) && (b->name != NULL) && (g != NULL) && (g->name != NULL)) { | |
602 tmp = aim_ssi_getcomment(od->sess->ssi.local, g->name, b->name); | |
603 if (tmp != NULL) { | |
604 oscar_string_append(str, newline, _("Buddy Comment"), tmp); | |
605 g_free(tmp); | |
606 } | |
607 } | |
608 | |
609 if ((bi != NULL) && (bi->availmsg != NULL) && !(b->uc & UC_UNAVAILABLE)) { | |
610 tmp = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg)); | |
611 oscar_string_append(str, newline, _("Available"), tmp); | |
612 g_free(tmp); | |
613 } | |
614 } | |
615 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
616 static char *extract_name(const char *name) { |
4121 | 617 char *tmp, *x; |
2086 | 618 int i, j; |
4120 | 619 |
620 if (!name) | |
4121 | 621 return NULL; |
622 | |
4120 | 623 x = strchr(name, '-'); |
4121 | 624 |
2086 | 625 if (!x) return NULL; |
626 x = strchr(++x, '-'); | |
627 if (!x) return NULL; | |
628 tmp = g_strdup(++x); | |
629 | |
630 for (i = 0, j = 0; x[i]; i++) { | |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
631 char hex[3]; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
632 if (x[i] != '%') { |
2086 | 633 tmp[j++] = x[i]; |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
634 continue; |
2086 | 635 } |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
636 strncpy(hex, x + ++i, 2); hex[2] = 0; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
637 i++; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
638 tmp[j++] = strtol(hex, NULL, 16); |
2086 | 639 } |
640 | |
641 tmp[j] = 0; | |
642 return tmp; | |
643 } | |
644 | |
5575 | 645 static struct chat_connection *find_oscar_chat(GaimConnection *gc, int id) { |
7283 | 646 GSList *g = ((OscarData *)gc->proto_data)->oscar_chats; |
2086 | 647 struct chat_connection *c = NULL; |
648 | |
649 while (g) { | |
650 c = (struct chat_connection *)g->data; | |
651 if (c->id == id) | |
652 break; | |
653 g = g->next; | |
654 c = NULL; | |
655 } | |
656 | |
657 return c; | |
658 } | |
659 | |
5575 | 660 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
|
661 aim_conn_t *conn) { |
7283 | 662 GSList *g = ((OscarData *)gc->proto_data)->oscar_chats; |
2086 | 663 struct chat_connection *c = NULL; |
664 | |
665 while (g) { | |
666 c = (struct chat_connection *)g->data; | |
667 if (c->conn == conn) | |
668 break; | |
669 g = g->next; | |
670 c = NULL; | |
671 } | |
672 | |
673 return c; | |
674 } | |
675 | |
8219 | 676 static struct chat_connection *find_oscar_chat_by_conv(GaimConnection *gc, |
677 GaimConversation *conv) { | |
678 GSList *g = ((OscarData *)gc->proto_data)->oscar_chats; | |
679 struct chat_connection *c = NULL; | |
680 | |
681 while (g) { | |
682 c = (struct chat_connection *)g->data; | |
8733 | 683 if (c->conv == conv) |
8219 | 684 break; |
685 g = g->next; | |
686 c = NULL; | |
687 } | |
688 | |
689 return c; | |
690 } | |
691 | |
8971 | 692 /***************************************************************************** |
693 * Begin scary direct im stuff | |
694 *****************************************************************************/ | |
695 | |
696 static struct oscar_direct_im *oscar_direct_im_find(OscarData *od, const char *who) { | |
697 GSList *d = od->direct_ims; | |
698 struct oscar_direct_im *m = NULL; | |
699 | |
700 while (d) { | |
701 m = (struct oscar_direct_im *)d->data; | |
702 if (!aim_sncmp(who, m->name)) | |
703 return m; | |
704 d = d->next; | |
705 } | |
706 | |
707 return NULL; | |
708 } | |
709 | |
710 static void oscar_direct_im_destroy(OscarData *od, struct oscar_direct_im *dim) | |
711 { | |
712 gaim_debug_info("oscar", | |
713 "destroying Direct IM for %s.\n", dim->name); | |
714 | |
715 od->direct_ims = g_slist_remove(od->direct_ims, dim); | |
8978 | 716 if (dim->gpc_pend) { |
717 dim->killme = TRUE; | |
718 return; | |
719 } | |
8971 | 720 if (dim->watcher) |
721 gaim_input_remove(dim->watcher); | |
722 if (dim->conn) { | |
723 aim_conn_close(dim->conn); | |
724 aim_conn_kill(od->sess, &dim->conn); | |
725 } | |
726 g_free(dim); | |
727 } | |
728 | |
729 /* the only difference between this and destroy is this writes a conv message */ | |
730 static void oscar_direct_im_disconnect(OscarData *od, struct oscar_direct_im *dim) | |
731 { | |
732 GaimConversation *conv; | |
733 char buf[256]; | |
734 | |
735 gaim_debug_info("oscar", | |
736 "%s disconnected Direct IM.\n", dim->name); | |
737 | |
738 if (dim->connected) | |
739 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), dim->name); | |
8978 | 740 else |
8971 | 741 g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), dim->name); |
742 | |
743 conv = gaim_find_conversation_with_account(dim->name, gaim_connection_get_account(dim->gc)); | |
744 if (conv) { | |
745 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); | |
746 gaim_conversation_update_progress(conv, 0); | |
747 } else { | |
748 gaim_notify_error(dim->gc, NULL, _("Direct Connect failed"), buf); | |
749 } | |
750 | |
751 oscar_direct_im_destroy(od, dim); | |
752 | |
753 return; | |
754 } | |
755 | |
756 /* oops i made two of these. this one just calls the other one. */ | |
757 static void gaim_odc_disconnect(aim_session_t *sess, aim_conn_t *conn) | |
758 { | |
759 GaimConnection *gc = sess->aux_data; | |
760 OscarData *od = (OscarData *)gc->proto_data; | |
761 struct oscar_direct_im *dim; | |
762 char *sn; | |
763 | |
764 sn = g_strdup(aim_odc_getsn(conn)); | |
765 dim = oscar_direct_im_find(od, sn); | |
766 oscar_direct_im_disconnect(od, dim); | |
767 g_free(sn); | |
768 } | |
769 | |
770 static void destroy_direct_im_request(struct ask_direct *d) { | |
771 gaim_debug_info("oscar", "Freeing DirectIM prompts.\n"); | |
772 | |
773 g_free(d->sn); | |
774 g_free(d); | |
775 } | |
776 | |
777 /* this is just a gaim_proxy_connect cb that sets up the rest of the cbs */ | |
778 static void oscar_odc_callback(gpointer data, gint source, GaimInputCondition condition) { | |
779 struct oscar_direct_im *dim = data; | |
780 GaimConnection *gc = dim->gc; | |
781 OscarData *od = gc->proto_data; | |
782 GaimConversation *conv; | |
783 char buf[256]; | |
784 struct sockaddr name; | |
785 socklen_t name_len = 1; | |
786 | |
787 g_return_if_fail(gc != NULL); | |
788 | |
8978 | 789 dim->gpc_pend = FALSE; |
790 if (dim->killme) { | |
791 oscar_direct_im_destroy(od, dim); | |
792 return; | |
793 } | |
794 | |
8971 | 795 if (!g_list_find(gaim_connections_get_all(), gc)) { |
796 oscar_direct_im_destroy(od, dim); | |
797 return; | |
798 } | |
799 | |
800 if (source < 0) { | |
8984 | 801 if (dim->donttryagain) { |
802 oscar_direct_im_disconnect(od, dim); | |
803 return; | |
804 } else { | |
805 fu8_t cookie[8]; | |
806 char *who = g_strdup(dim->name); | |
807 const char *tmp = aim_odc_getcookie(dim->conn); | |
808 | |
809 memcpy(cookie, tmp, 8); | |
810 oscar_direct_im_destroy(od, dim); | |
811 oscar_direct_im_initiate(gc, who, cookie); | |
812 gaim_debug_info("oscar", "asking direct im initiator to connect to us\n"); | |
813 g_free(who); | |
814 return; | |
815 } | |
8971 | 816 } |
817 | |
818 dim->conn->fd = source; | |
819 aim_conn_completeconnect(od->sess, dim->conn); | |
820 conv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, dim->name); | |
821 | |
822 /* This is the best way to see if we're connected or not */ | |
8983 | 823 /* Is this really needed? */ |
8971 | 824 if (getpeername(source, &name, &name_len) == 0) { |
825 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name); | |
826 dim->connected = TRUE; | |
827 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); | |
8983 | 828 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); |
829 } else { | |
8984 | 830 if (dim->donttryagain) { |
831 oscar_direct_im_disconnect(od, dim); | |
832 return; | |
833 } else { | |
834 fu8_t cookie[8]; | |
835 char *who = g_strdup(dim->name); | |
836 const char *tmp = aim_odc_getcookie(dim->conn); | |
837 | |
838 memcpy(cookie, tmp, 8); | |
839 oscar_direct_im_destroy(od, dim); | |
840 oscar_direct_im_initiate(gc, who, cookie); | |
841 gaim_debug_info("oscar", "asking direct im initiator to connect to us\n"); | |
842 g_free(who); | |
843 return; | |
844 } | |
8983 | 845 } |
846 | |
847 | |
8971 | 848 } |
849 | |
850 static void accept_direct_im_request(struct ask_direct *d) { | |
851 GaimConnection *gc = d->gc; | |
852 OscarData *od; | |
853 struct oscar_direct_im *dim; | |
854 char *host; int port = 5190; | |
855 int i, rc; | |
8982 | 856 char *tmp; |
857 GaimConversation *conv; | |
8971 | 858 |
859 if (!g_list_find(gaim_connections_get_all(), gc)) { | |
860 destroy_direct_im_request(d); | |
861 return; | |
862 } | |
863 | |
864 od = (OscarData *)gc->proto_data; | |
865 gaim_debug_info("oscar", "Accepted DirectIM.\n"); | |
866 | |
867 dim = oscar_direct_im_find(od, d->sn); | |
868 if (dim && dim->connected) { | |
869 destroy_direct_im_request(d); /* 40 */ /* what does that 40 mean? */ | |
870 gaim_debug_info("oscar", "Wait, we're already connected, ignoring DirectIM.\n"); | |
871 return; | |
872 } | |
873 dim = g_new0(struct oscar_direct_im, 1); | |
874 dim->gc = d->gc; | |
8984 | 875 dim->donttryagain = d->donttryagain; |
8971 | 876 g_snprintf(dim->name, sizeof dim->name, "%s", d->sn); |
877 | |
878 dim->conn = aim_odc_connect(od->sess, d->sn, NULL, d->cookie); | |
879 od->direct_ims = g_slist_append(od->direct_ims, dim); | |
880 if (!dim->conn) { | |
881 oscar_direct_im_disconnect(od, dim); | |
882 destroy_direct_im_request(d); | |
883 return; | |
884 } | |
885 | |
886 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, | |
887 gaim_odc_incoming, 0); | |
888 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, | |
889 gaim_odc_typing, 0); | |
890 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, | |
891 gaim_odc_update_ui, 0); | |
892 | |
893 gaim_debug_info("oscar", "ip is %s.\n", d->ip); | |
894 for (i = 0; i < (int)strlen(d->ip); i++) { | |
895 if (d->ip[i] == ':') { | |
896 port = atoi(&(d->ip[i+1])); | |
897 break; | |
898 } | |
899 } | |
900 host = g_strndup(d->ip, i); | |
901 dim->conn->status |= AIM_CONN_STATUS_INPROGRESS; | |
8978 | 902 dim->gpc_pend = TRUE; |
8971 | 903 rc = gaim_proxy_connect(gc->account, host, port, oscar_odc_callback, dim); |
8982 | 904 |
905 conv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, d->sn); | |
906 tmp = g_strdup_printf(_("Attempting to connect to %s at %s:%hu for Direct IM."), d->sn, host, | |
907 port); | |
908 gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL)); | |
909 g_free(tmp); | |
8983 | 910 |
8971 | 911 g_free(host); |
912 if (rc < 0) { | |
8978 | 913 dim->gpc_pend = FALSE; |
8971 | 914 oscar_direct_im_disconnect(od, dim); |
915 destroy_direct_im_request(d); | |
916 return; | |
917 } | |
918 | |
919 destroy_direct_im_request(d); | |
920 | |
921 return; | |
922 } | |
923 | |
924 /* | |
925 * We have just established a socket with the other dude, so set up some handlers. | |
926 */ | |
927 static int gaim_odc_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 928 GaimConnection *gc = sess->aux_data; |
7283 | 929 OscarData *od = (OscarData *)gc->proto_data; |
8733 | 930 GaimConversation *conv; |
8971 | 931 struct oscar_direct_im *dim; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
932 char buf[256]; |
8971 | 933 char *sn; |
934 va_list ap; | |
935 aim_conn_t *newconn, *listenerconn; | |
936 | |
937 va_start(ap, fr); | |
938 newconn = va_arg(ap, aim_conn_t *); | |
939 listenerconn = va_arg(ap, aim_conn_t *); | |
940 va_end(ap); | |
941 | |
942 aim_conn_close(listenerconn); | |
943 aim_conn_kill(sess, &listenerconn); | |
944 | |
945 sn = g_strdup(aim_odc_getsn(newconn)); | |
946 | |
947 gaim_debug_info("oscar", | |
948 "DirectIM: initiate success to %s\n", sn); | |
949 dim = oscar_direct_im_find(od, sn); | |
950 | |
951 conv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, sn); | |
952 gaim_input_remove(dim->watcher); | |
953 dim->conn = newconn; | |
954 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); | |
955 dim->connected = TRUE; | |
956 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), sn); | |
957 g_free(sn); | |
958 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); | |
959 | |
960 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, gaim_odc_incoming, 0); | |
961 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, gaim_odc_typing, 0); | |
962 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, gaim_odc_update_ui, 0); | |
963 | |
964 return 1; | |
965 } | |
966 | |
967 /* | |
968 * This is called when each chunk of an image is received. It can be used to | |
969 * update a progress bar, or to eat lots of dry cat food. Wet cat food is | |
970 * nasty, you sicko. | |
971 */ | |
972 static int gaim_odc_update_ui(aim_session_t *sess, aim_frame_t *fr, ...) { | |
973 va_list ap; | |
974 char *sn; | |
975 double percent; | |
976 GaimConnection *gc = sess->aux_data; | |
977 OscarData *od = (OscarData *)gc->proto_data; | |
978 GaimConversation *c; | |
979 struct oscar_direct_im *dim; | |
980 | |
981 va_start(ap, fr); | |
982 sn = va_arg(ap, char *); | |
983 percent = va_arg(ap, double); | |
984 va_end(ap); | |
985 | |
986 if (!sn || !(dim = oscar_direct_im_find(od, sn))) | |
987 return 1; | |
988 if (dim->watcher) { | |
989 gaim_input_remove(dim->watcher); /* Otherwise, the callback will callback */ | |
990 /* The callback will callback? I don't get how that would happen here. */ | |
991 dim->watcher = 0; | |
992 } | |
993 | |
994 c = gaim_find_conversation_with_account(sn, gaim_connection_get_account(gc)); | |
995 if (c != NULL) | |
996 gaim_conversation_update_progress(c, percent); | |
997 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, | |
998 oscar_callback, dim->conn); | |
999 | |
1000 return 1; | |
1001 } | |
1002 | |
1003 /* | |
1004 * This is called after a direct IM has been received in its entirety. This | |
1005 * function is passed a long chunk of data which contains the IM with any | |
1006 * data chunks (images) appended to it. | |
1007 * | |
1008 * This function rips out all the data chunks and creates an imgstore for | |
1009 * each one. In order to do this, it first goes through the IM and takes | |
1010 * out all the IMG tags. When doing so, it rewrites the original IMG tag | |
1011 * with one compatible with the imgstore Gaim core code. For each one, we | |
1012 * then read in chunks of data from the end of the message and actually | |
1013 * create the img store using the given data. | |
1014 * | |
1015 * For somewhat easy reference, here's a sample message | |
1016 * (without the whitespace and asterisks): | |
1017 * | |
1018 * <HTML><BODY BGCOLOR="#ffffff"> | |
1019 * <FONT LANG="0"> | |
1020 * This is a really stupid picture:<BR> | |
1021 * <IMG SRC="Sample.jpg" ID="1" WIDTH="283" HEIGHT="212" DATASIZE="9894"><BR> | |
1022 * Yeah it is<BR> | |
1023 * Here is another one:<BR> | |
1024 * <IMG SRC="Soap Bubbles.bmp" ID="2" WIDTH="256" HEIGHT="256" DATASIZE="65978"> | |
1025 * </FONT> | |
1026 * </BODY></HTML> | |
1027 * <BINARY> | |
1028 * <DATA ID="1" SIZE="9894">datadatadatadata</DATA> | |
1029 * <DATA ID="2" SIZE="65978">datadatadatadata</DATA> | |
1030 * </BINARY> | |
1031 */ | |
1032 static int gaim_odc_incoming(aim_session_t *sess, aim_frame_t *fr, ...) { | |
1033 GaimConnection *gc = sess->aux_data; | |
1034 GaimConvImFlags imflags = 0; | |
1035 gchar *utf8; | |
1036 GString *newmsg = g_string_new(""); | |
1037 GSList *images = NULL; | |
1038 va_list ap; | |
1039 const char *sn, *msg, *msgend, *binary; | |
1040 size_t len; | |
1041 int encoding, isawaymsg; | |
1042 | |
1043 va_start(ap, fr); | |
1044 sn = va_arg(ap, const char *); | |
1045 msg = va_arg(ap, const char *); | |
1046 len = va_arg(ap, size_t); | |
1047 encoding = va_arg(ap, int); | |
1048 isawaymsg = va_arg(ap, int); | |
1049 va_end(ap); | |
1050 msgend = msg + len; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1051 |
8660 | 1052 gaim_debug_info("oscar", |
8971 | 1053 "Got DirectIM message from %s\n", sn); |
1054 | |
1055 if (isawaymsg) | |
1056 imflags |= GAIM_CONV_IM_AUTO_RESP; | |
1057 | |
1058 /* message has a binary trailer */ | |
1059 if ((binary = gaim_strcasestr(msg, "<binary>"))) { | |
1060 GData *attribs; | |
1061 const char *tmp, *start, *end, *last = NULL; | |
1062 | |
1063 tmp = msg; | |
1064 | |
1065 /* for each valid image tag... */ | |
1066 while (gaim_markup_find_tag("img", tmp, &start, &end, &attribs)) { | |
1067 const char *id, *src, *datasize; | |
1068 const char *tag = NULL, *data = NULL; | |
1069 size_t size; | |
1070 int imgid = 0; | |
1071 | |
1072 /* update the location of the last img tag */ | |
1073 last = end; | |
1074 | |
1075 /* grab attributes */ | |
1076 id = g_datalist_get_data(&attribs, "id"); | |
1077 src = g_datalist_get_data(&attribs, "src"); | |
1078 datasize = g_datalist_get_data(&attribs, "datasize"); | |
1079 | |
1080 /* if we have id & datasize, build the data tag */ | |
1081 if (id && datasize) | |
1082 tag = g_strdup_printf("<data id=\"%s\" size=\"%s\">", id, datasize); | |
1083 | |
1084 /* if we have a tag, find the start of the data */ | |
1085 if (tag && (data = gaim_strcasestr(binary, tag))) | |
1086 data += strlen(tag); | |
1087 | |
1088 /* check the data is here and store it */ | |
1089 if (data + (size = atoi(datasize)) <= msgend) | |
1090 imgid = gaim_imgstore_add(data, size, src); | |
1091 | |
1092 /* | |
1093 * XXX - The code below contains some calls to oscar_encoding_to_utf8 | |
1094 * The hardcoded "us-ascii" value REALLY needs to be removed. | |
1095 */ | |
1096 /* if we have a stored image... */ | |
1097 if (imgid) { | |
1098 /* append the message up to the tag */ | |
1099 utf8 = oscar_encoding_to_utf8("us-ascii", tmp, start - tmp); | |
1100 if (utf8 != NULL) { | |
1101 newmsg = g_string_append(newmsg, utf8); | |
1102 g_free(utf8); | |
1103 } | |
1104 | |
1105 /* write the new image tag */ | |
1106 g_string_append_printf(newmsg, "<IMG ID=\"%d\">", imgid); | |
1107 | |
1108 /* and record the image number */ | |
1109 images = g_slist_append(images, GINT_TO_POINTER(imgid)); | |
1110 } else { | |
1111 /* otherwise, copy up to the end of the tag */ | |
1112 utf8 = oscar_encoding_to_utf8("us-ascii", tmp, (end + 1) - tmp); | |
1113 if (utf8 != NULL) { | |
1114 newmsg = g_string_append(newmsg, utf8); | |
1115 g_free(utf8); | |
1116 } | |
1117 } | |
1118 | |
1119 /* clear the attribute list */ | |
1120 g_datalist_clear(&attribs); | |
1121 | |
1122 /* continue from the end of the tag */ | |
1123 tmp = end + 1; | |
1124 } | |
1125 | |
1126 /* append any remaining message data (without the > :-) */ | |
1127 if (last++ && (last < binary)) | |
1128 newmsg = g_string_append_len(newmsg, last, binary - last); | |
1129 | |
1130 /* set the flag if we caught any images */ | |
1131 if (images) | |
1132 imflags |= GAIM_CONV_IM_IMAGES; | |
1133 } else { | |
1134 g_string_append_len(newmsg, msg, len); | |
1135 } | |
1136 | |
1137 /* XXX - I imagine Paco-Paco will want to do some voodoo with the encoding here */ | |
1138 serv_got_im(gc, sn, newmsg->str, imflags, time(NULL)); | |
1139 | |
1140 /* free up the message */ | |
1141 g_string_free(newmsg, TRUE); | |
1142 | |
1143 /* unref any images we allocated */ | |
1144 if (images) { | |
1145 GSList *tmp; | |
1146 int id; | |
1147 | |
1148 for (tmp = images; tmp != NULL; tmp = tmp->next) { | |
1149 id = GPOINTER_TO_INT(tmp->data); | |
1150 gaim_imgstore_unref(id); | |
1151 } | |
1152 | |
1153 g_slist_free(images); | |
1154 } | |
1155 | |
1156 return 1; | |
1157 } | |
1158 | |
1159 static int gaim_odc_typing(aim_session_t *sess, aim_frame_t *fr, ...) { | |
1160 va_list ap; | |
1161 char *sn; | |
1162 int typing; | |
1163 GaimConnection *gc = sess->aux_data; | |
1164 | |
1165 va_start(ap, fr); | |
1166 sn = va_arg(ap, char *); | |
1167 typing = va_arg(ap, int); | |
1168 va_end(ap); | |
1169 | |
1170 if (typing == 0x0002) { | |
1171 /* I had to leave this. It's just too funny. It reminds me of my sister. */ | |
1172 gaim_debug_info("oscar", | |
1173 "ohmigod! %s has started typing (DirectIM). He's going to send you a message! *squeal*\n", sn); | |
1174 serv_got_typing(gc, sn, 0, GAIM_TYPING); | |
1175 } else if (typing == 0x0001) | |
1176 serv_got_typing(gc, sn, 0, GAIM_TYPED); | |
1177 else | |
1178 serv_got_typing_stopped(gc, sn); | |
1179 return 1; | |
1180 } | |
1181 | |
1182 static int gaim_odc_send_im(aim_session_t *sess, aim_conn_t *conn, const char *message, GaimConvImFlags imflags) { | |
1183 char *buf; | |
1184 size_t len; | |
1185 int ret; | |
1186 GString *msg = g_string_new("<HTML><BODY>"); | |
1187 GString *data = g_string_new("</BODY></HTML><BINARY>"); | |
1188 GData *attribs; | |
1189 const char *start, *end, *last; | |
1190 int oscar_id = 0; | |
1191 | |
1192 last = message; | |
1193 | |
1194 /* for each valid IMG tag... */ | |
1195 while (last && *last && gaim_markup_find_tag("img", last, &start, &end, &attribs)) { | |
1196 GaimStoredImage *image = NULL; | |
1197 const char *id; | |
1198 | |
1199 if (start - last) { | |
1200 g_string_append_len(msg, last, start - last); | |
1201 } | |
1202 | |
1203 id = g_datalist_get_data(&attribs, "id"); | |
1204 | |
1205 /* ... if it refers to a valid gaim image ... */ | |
1206 if (id && (image = gaim_imgstore_get(atoi(id)))) { | |
1207 /* ... append the message from start to the tag ... */ | |
9126 | 1208 unsigned long size = gaim_imgstore_get_size(image); |
8971 | 1209 const char *filename = gaim_imgstore_get_filename(image); |
1210 gpointer imgdata = gaim_imgstore_get_data(image); | |
1211 | |
1212 oscar_id++; | |
1213 | |
1214 /* ... insert a new img tag with the oscar id ... */ | |
1215 if (filename) | |
1216 g_string_append_printf(msg, | |
9126 | 1217 "<IMG SRC=\"%s\" ID=\"%d\" DATASIZE=\"%lu\">", |
8971 | 1218 filename, oscar_id, size); |
1219 else | |
1220 g_string_append_printf(msg, | |
9126 | 1221 "<IMG ID=\"%d\" DATASIZE=\"%lu\">", |
8971 | 1222 oscar_id, size); |
1223 | |
1224 /* ... and append the data to the binary section ... */ | |
9126 | 1225 g_string_append_printf(data, "<DATA ID=\"%d\" SIZE=\"%lu\">", |
8971 | 1226 oscar_id, size); |
1227 data = g_string_append_len(data, imgdata, size); | |
1228 data = g_string_append(data, "</DATA>"); | |
1229 } | |
1230 /* If the tag is invalid, skip it, thus no else here */ | |
1231 | |
1232 g_datalist_clear(&attribs); | |
1233 | |
1234 /* continue from the end of the tag */ | |
1235 last = end + 1; | |
1236 } | |
1237 | |
1238 /* append any remaining message data (without the > :-) */ | |
1239 if (last && *last) | |
1240 msg = g_string_append(msg, last); | |
1241 | |
1242 /* if we inserted any images in the binary section, append it */ | |
1243 if (oscar_id) { | |
1244 msg = g_string_append_len(msg, data->str, data->len); | |
1245 msg = g_string_append(msg, "</BINARY>"); | |
1246 } | |
1247 | |
1248 len = msg->len; | |
1249 buf = msg->str; | |
1250 g_string_free(msg, FALSE); | |
1251 g_string_free(data, TRUE); | |
1252 | |
1253 | |
1254 /* XXX - The last parameter below is the encoding. Let Paco-Paco do something with it. */ | |
1255 if (imflags & GAIM_CONV_IM_AUTO_RESP) | |
1256 ret = aim_odc_send_im(sess, conn, buf, len, 0, 1); | |
1257 else | |
1258 ret = aim_odc_send_im(sess, conn, buf, len, 0, 0); | |
1259 | |
1260 g_free(buf); | |
1261 | |
1262 return ret; | |
1263 } | |
1264 | |
1265 struct ask_do_dir_im { | |
1266 char *who; | |
1267 GaimConnection *gc; | |
1268 }; | |
1269 | |
1270 static void oscar_cancel_direct_im(struct ask_do_dir_im *data) { | |
1271 g_free(data->who); | |
1272 g_free(data); | |
1273 } | |
1274 | |
8983 | 1275 /* this function is used to initiate a direct im session with someone. |
1276 * we start listening on a port and send a request. they either connect | |
1277 * or send some kind of reply. If they can't connect, they ask us to | |
1278 * connect to them, and so we do that. | |
1279 * | |
1280 * this function will also get called if the other side initiate's a direct | |
1281 * im and we try to connect and fail. in that case cookie will not be null. | |
1282 * | |
1283 * note that cookie is an 8 byte string that isn't NULL terminated | |
1284 */ | |
1285 static void oscar_direct_im_initiate(GaimConnection *gc, const char *who, const char *cookie) { | |
8971 | 1286 OscarData *od; |
1287 struct oscar_direct_im *dim; | |
1288 int listenfd; | |
8982 | 1289 const char *ip; |
8971 | 1290 |
1291 od = (OscarData *)gc->proto_data; | |
1292 | |
8983 | 1293 dim = oscar_direct_im_find(od, who); |
8971 | 1294 if (dim) { |
1295 if (!(dim->connected)) { /* We'll free the old, unconnected dim, and start over */ | |
1296 oscar_direct_im_disconnect(od, dim); | |
1297 gaim_debug_info("oscar", | |
1298 "Gave up on old direct IM, trying again\n"); | |
1299 } else { | |
1300 gaim_notify_error(gc, NULL, "DirectIM already open.", NULL); | |
8980 | 1301 return; |
8971 | 1302 } |
1303 } | |
1304 dim = g_new0(struct oscar_direct_im, 1); | |
1305 dim->gc = gc; | |
8983 | 1306 g_snprintf(dim->name, sizeof dim->name, "%s", who); |
8971 | 1307 |
1308 listenfd = gaim_network_listen_range(5190, 5199); | |
8982 | 1309 ip = gaim_network_get_my_ip(od->conn ? od->conn->fd : -1); |
8983 | 1310 dim->conn = aim_odc_initiate(od->sess, who, listenfd, gaim_network_ip_atoi(ip), gaim_network_get_port_from_fd(listenfd), cookie); |
8971 | 1311 if (dim->conn != NULL) { |
8982 | 1312 char *tmp; |
1313 GaimConversation *conv; | |
1314 | |
8971 | 1315 od->direct_ims = g_slist_append(od->direct_ims, dim); |
1316 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, | |
1317 oscar_callback, dim->conn); | |
1318 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIM_ESTABLISHED, | |
1319 gaim_odc_initiate, 0); | |
8982 | 1320 |
8983 | 1321 conv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, who); |
1322 tmp = g_strdup_printf(_("Asking %s to connect to us at %s:%hu for Direct IM."), who, ip, | |
8982 | 1323 gaim_network_get_port_from_fd(listenfd)); |
1324 gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, time(NULL)); | |
1325 g_free(tmp); | |
8971 | 1326 } else { |
1327 gaim_notify_error(gc, NULL, _("Unable to open Direct IM"), NULL); | |
1328 oscar_direct_im_destroy(od, dim); | |
1329 } | |
8983 | 1330 } |
1331 | |
1332 static void oscar_direct_im(struct ask_do_dir_im *data) { | |
1333 GaimConnection *gc = data->gc; | |
1334 | |
1335 if (!g_list_find(gaim_connections_get_all(), gc)) { | |
1336 g_free(data->who); | |
1337 g_free(data); | |
1338 return; | |
1339 } | |
1340 | |
1341 oscar_direct_im_initiate(gc, data->who, NULL); | |
8971 | 1342 g_free(data->who); |
1343 g_free(data); | |
1344 } | |
1345 | |
1346 /* this is the right click menu cb thingy */ | |
9030 | 1347 static void oscar_ask_direct_im(GaimBlistNode *node, gpointer ignored) { |
1348 | |
1349 GaimBuddy *buddy; | |
1350 GaimConnection *gc; | |
8971 | 1351 gchar *buf; |
9030 | 1352 struct ask_do_dir_im *data; |
1353 | |
1354 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); | |
1355 | |
1356 buddy = (GaimBuddy *) node; | |
1357 gc = gaim_account_get_connection(buddy->account); | |
1358 | |
1359 data = g_new0(struct ask_do_dir_im, 1); | |
1360 data->who = g_strdup(buddy->name); | |
8971 | 1361 data->gc = gc; |
9030 | 1362 buf = g_strdup_printf(_("You have selected to open a Direct IM connection with %s."), |
1363 buddy->name); | |
8971 | 1364 |
1365 gaim_request_action(gc, NULL, buf, | |
9030 | 1366 _("Because this reveals your IP address, it " |
1367 "may be considered a privacy risk. Do you " | |
1368 "wish to continue?"), | |
1369 0, data, 2, | |
1370 _("Connect"), G_CALLBACK(oscar_direct_im), | |
1371 _("Cancel"), G_CALLBACK(oscar_cancel_direct_im)); | |
8971 | 1372 g_free(buf); |
1373 } | |
1374 | |
1375 /***************************************************************************** | |
1376 * End scary direct im stuff | |
1377 *****************************************************************************/ | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1378 |
4617 | 1379 static void oscar_callback(gpointer data, gint source, GaimInputCondition condition) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1380 aim_conn_t *conn = (aim_conn_t *)data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1381 aim_session_t *sess = aim_conn_getsess(conn); |
5575 | 1382 GaimConnection *gc = sess ? sess->aux_data : NULL; |
7283 | 1383 OscarData *od; |
2086 | 1384 |
1385 if (!gc) { | |
8660 | 1386 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1387 "oscar callback for closed connection (1).\n"); |
2086 | 1388 return; |
1389 } | |
1390 | |
7283 | 1391 od = (OscarData *)gc->proto_data; |
2086 | 1392 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1393 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1394 /* oh boy. this is probably bad. i guess the only thing we |
1395 * can really do is return? */ | |
8660 | 1396 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1397 "oscar callback for closed connection (2).\n"); |
8660 | 1398 gaim_debug_misc("oscar", "gc = %p\n", gc); |
2086 | 1399 return; |
1400 } | |
1401 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1402 if (condition & GAIM_INPUT_READ) { |
4617 | 1403 if (conn->type == AIM_CONN_TYPE_LISTENER) { |
8660 | 1404 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1405 "got information on rendezvous listener\n"); |
4617 | 1406 if (aim_handlerendconnect(od->sess, conn) < 0) { |
8660 | 1407 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1408 "connection error (rendezvous listener)\n"); |
4617 | 1409 aim_conn_kill(od->sess, &conn); |
8446 | 1410 /* AAA - Don't we need to gaim_xfer_cancel here? --marv */ |
2086 | 1411 } |
1412 } else { | |
4617 | 1413 if (aim_get_command(od->sess, conn) >= 0) { |
1414 aim_rxdispatch(od->sess); | |
6029 | 1415 if (od->killme) { |
8660 | 1416 gaim_debug_error("oscar", "Waiting to be destroyed\n"); |
6029 | 1417 return; |
1418 } | |
2086 | 1419 } else { |
1420 if ((conn->type == AIM_CONN_TYPE_BOS) || | |
4617 | 1421 !(aim_getconn_type(od->sess, AIM_CONN_TYPE_BOS))) { |
8660 | 1422 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1423 "major connection error\n"); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1424 gaim_connection_error(gc, _("Disconnected.")); |
2086 | 1425 } else if (conn->type == AIM_CONN_TYPE_CHAT) { |
1426 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); | |
5420 | 1427 char *buf; |
8660 | 1428 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1429 "disconnected from chat room %s\n", c->name); |
2086 | 1430 c->conn = NULL; |
1431 if (c->inpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1432 gaim_input_remove(c->inpa); |
2086 | 1433 c->inpa = 0; |
1434 c->fd = -1; | |
4617 | 1435 aim_conn_kill(od->sess, &conn); |
5420 | 1436 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
|
1437 gaim_notify_error(gc, NULL, buf, NULL); |
5420 | 1438 g_free(buf); |
2086 | 1439 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { |
4617 | 1440 if (od->cnpa > 0) |
1441 gaim_input_remove(od->cnpa); | |
1442 od->cnpa = 0; | |
8660 | 1443 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1444 "removing chatnav input watcher\n"); |
4617 | 1445 while (od->create_rooms) { |
1446 struct create_room *cr = od->create_rooms->data; | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
1447 g_free(cr->name); |
4617 | 1448 od->create_rooms = |
1449 g_slist_remove(od->create_rooms, cr); | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
1450 g_free(cr); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1451 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1452 _("Chat is currently unavailable"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1453 NULL); |
2086 | 1454 } |
4617 | 1455 aim_conn_kill(od->sess, &conn); |
2086 | 1456 } else if (conn->type == AIM_CONN_TYPE_AUTH) { |
4617 | 1457 if (od->paspa > 0) |
1458 gaim_input_remove(od->paspa); | |
1459 od->paspa = 0; | |
8660 | 1460 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1461 "removing authconn input watcher\n"); |
4617 | 1462 aim_conn_kill(od->sess, &conn); |
3694 | 1463 } else if (conn->type == AIM_CONN_TYPE_EMAIL) { |
4617 | 1464 if (od->emlpa > 0) |
1465 gaim_input_remove(od->emlpa); | |
1466 od->emlpa = 0; | |
8660 | 1467 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1468 "removing email input watcher\n"); |
4617 | 1469 aim_conn_kill(od->sess, &conn); |
4804 | 1470 } else if (conn->type == AIM_CONN_TYPE_ICON) { |
1471 if (od->icopa > 0) | |
1472 gaim_input_remove(od->icopa); | |
1473 od->icopa = 0; | |
8660 | 1474 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1475 "removing icon input watcher\n"); |
4804 | 1476 aim_conn_kill(od->sess, &conn); |
2086 | 1477 } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1478 if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) |
4617 | 1479 gaim_odc_disconnect(od->sess, conn); |
1480 aim_conn_kill(od->sess, &conn); | |
2086 | 1481 } else { |
8660 | 1482 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1483 "holy crap! generic connection error! %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1484 conn->type); |
4617 | 1485 aim_conn_kill(od->sess, &conn); |
2086 | 1486 } |
1487 } | |
1488 } | |
1489 } | |
1490 } | |
1491 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1492 static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) { |
5575 | 1493 GaimConnection *gc = sess->aux_data; |
7285 | 1494 gchar *s = g_strdup_vprintf(format, va); |
1495 gchar *buf; | |
1496 | |
1497 buf = g_strdup_printf("%s %d: %s", gaim_account_get_username(gaim_connection_get_account(gc)), level, s); | |
8660 | 1498 gaim_debug_info("oscar", buf); |
7285 | 1499 if (buf[strlen(buf)-1] != '\n') |
8660 | 1500 gaim_debug_info(NULL, "\n"); |
7285 | 1501 g_free(buf); |
2086 | 1502 g_free(s); |
1503 } | |
1504 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1505 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 1506 { |
5575 | 1507 GaimConnection *gc = data; |
7283 | 1508 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1509 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1510 aim_conn_t *conn; |
2086 | 1511 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1512 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1513 close(source); |
1514 return; | |
1515 } | |
1516 | |
4617 | 1517 od = gc->proto_data; |
1518 sess = od->sess; | |
2086 | 1519 conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); |
4366 | 1520 conn->fd = source; |
2086 | 1521 |
1522 if (source < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1523 gaim_connection_error(gc, _("Couldn't connect to host")); |
2086 | 1524 return; |
1525 } | |
1526 | |
1527 aim_conn_completeconnect(sess, conn); | |
4617 | 1528 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); |
7282 | 1529 aim_request_login(sess, conn, gaim_account_get_username(gaim_connection_get_account(gc))); |
1530 | |
8660 | 1531 gaim_debug_info("oscar", |
7282 | 1532 "Screen name sent, waiting for response\n"); |
7283 | 1533 gaim_connection_update_progress(gc, _("Screen name sent"), 1, OSCAR_CONNECT_STEPS); |
8341 | 1534 ck[1] = 0x65; |
2086 | 1535 } |
1536 | |
5575 | 1537 static void oscar_login(GaimAccount *account) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1538 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1539 aim_conn_t *conn; |
5575 | 1540 GaimConnection *gc = gaim_account_get_connection(account); |
7283 | 1541 OscarData *od = gc->proto_data = g_new0(OscarData, 1); |
2086 | 1542 |
8660 | 1543 gaim_debug_misc("oscar", "oscar_login: gc = %p\n", gc); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
1544 |
8437 | 1545 if (!aim_snvalid(gaim_account_get_username(account))) { |
1546 gchar *buf; | |
8590 | 1547 buf = g_strdup_printf(_("Unable to login: Could not sign on as %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."), gaim_account_get_username(account)); |
8437 | 1548 gaim_connection_error(gc, buf); |
1549 g_free(buf); | |
1550 } | |
1551 | |
5575 | 1552 if (isdigit(*(gaim_account_get_username(account)))) { |
4617 | 1553 od->icq = TRUE; |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
1554 } else { |
6622 | 1555 gc->flags |= GAIM_CONNECTION_HTML; |
1556 gc->flags |= GAIM_CONNECTION_AUTO_RESP; | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
1557 } |
5836 | 1558 od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, oscar_free_buddyinfo); |
2086 | 1559 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1560 sess = g_new0(aim_session_t, 1); |
7285 | 1561 aim_session_init(sess, TRUE, 0); |
2086 | 1562 aim_setdebuggingcb(sess, oscar_debug); |
7282 | 1563 /* |
1564 * We need an immediate queue because we don't use a while-loop | |
1565 * to see if things need to be sent. | |
1566 */ | |
2086 | 1567 aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL); |
4617 | 1568 od->sess = sess; |
2086 | 1569 sess->aux_data = gc; |
1570 | |
1571 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); | |
1572 if (conn == NULL) { | |
8660 | 1573 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1574 "internal connection error\n"); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1575 gaim_connection_error(gc, _("Unable to login to AIM")); |
2086 | 1576 return; |
1577 } | |
1578 | |
4649 | 1579 aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2086 | 1580 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); |
1581 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); | |
1582 | |
1583 conn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1584 if (gaim_proxy_connect(account, gaim_account_get_string(account, "server", FAIM_LOGIN_SERVER), |
5575 | 1585 gaim_account_get_int(account, "port", FAIM_LOGIN_PORT), |
1586 oscar_login_connect, gc) < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1587 gaim_connection_error(gc, _("Couldn't connect to host")); |
2086 | 1588 return; |
1589 } | |
7282 | 1590 |
7283 | 1591 gaim_connection_update_progress(gc, _("Connecting"), 0, OSCAR_CONNECT_STEPS); |
8341 | 1592 ck[0] = 0x5a; |
5575 | 1593 } |
1594 | |
1595 static void oscar_close(GaimConnection *gc) { | |
7283 | 1596 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 1597 |
1598 while (od->oscar_chats) { | |
1599 struct chat_connection *n = od->oscar_chats->data; | |
2086 | 1600 if (n->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1601 gaim_input_remove(n->inpa); |
2086 | 1602 g_free(n->name); |
1603 g_free(n->show); | |
4617 | 1604 od->oscar_chats = g_slist_remove(od->oscar_chats, n); |
2086 | 1605 g_free(n); |
1606 } | |
4617 | 1607 while (od->direct_ims) { |
8971 | 1608 struct oscar_direct_im *n = od->direct_ims->data; |
1609 oscar_direct_im_destroy(od, n); | |
2086 | 1610 } |
4617 | 1611 /* BBB */ |
1612 while (od->file_transfers) { | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1613 GaimXfer *xfer; |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1614 xfer = (GaimXfer *)od->file_transfers->data; |
7805 | 1615 gaim_xfer_cancel_local(xfer); |
3630 | 1616 } |
4804 | 1617 while (od->requesticon) { |
1618 char *sn = od->requesticon->data; | |
1619 od->requesticon = g_slist_remove(od->requesticon, sn); | |
1620 free(sn); | |
1621 } | |
4738 | 1622 g_hash_table_destroy(od->buddyinfo); |
4617 | 1623 while (od->create_rooms) { |
1624 struct create_room *cr = od->create_rooms->data; | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
1625 g_free(cr->name); |
4617 | 1626 od->create_rooms = g_slist_remove(od->create_rooms, cr); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
1627 g_free(cr); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
1628 } |
4617 | 1629 if (od->email) |
1630 g_free(od->email); | |
1631 if (od->newp) | |
1632 g_free(od->newp); | |
1633 if (od->oldp) | |
1634 g_free(od->oldp); | |
2086 | 1635 if (gc->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1636 gaim_input_remove(gc->inpa); |
4617 | 1637 if (od->cnpa > 0) |
1638 gaim_input_remove(od->cnpa); | |
1639 if (od->paspa > 0) | |
1640 gaim_input_remove(od->paspa); | |
1641 if (od->emlpa > 0) | |
1642 gaim_input_remove(od->emlpa); | |
4804 | 1643 if (od->icopa > 0) |
1644 gaim_input_remove(od->icopa); | |
6907 | 1645 if (od->icontimer > 0) |
8287
ef881489396e
[gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents:
8273
diff
changeset
|
1646 gaim_timeout_remove(od->icontimer); |
8341 | 1647 if (od->getblisttimer > 0) |
8287
ef881489396e
[gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents:
8273
diff
changeset
|
1648 gaim_timeout_remove(od->getblisttimer); |
8341 | 1649 if (od->getinfotimer > 0) |
1650 gaim_timeout_remove(od->getinfotimer); | |
4617 | 1651 aim_session_kill(od->sess); |
1652 g_free(od->sess); | |
1653 od->sess = NULL; | |
2086 | 1654 g_free(gc->proto_data); |
1655 gc->proto_data = NULL; | |
8660 | 1656 gaim_debug_info("oscar", "Signed off.\n"); |
2086 | 1657 } |
1658 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1659 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1660 GaimConnection *gc = data; |
7283 | 1661 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1662 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1663 aim_conn_t *bosconn; |
2086 | 1664 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1665 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1666 close(source); |
1667 return; | |
1668 } | |
1669 | |
4617 | 1670 od = gc->proto_data; |
1671 sess = od->sess; | |
1672 bosconn = od->conn; | |
4366 | 1673 bosconn->fd = source; |
2086 | 1674 |
1675 if (source < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1676 gaim_connection_error(gc, _("Could Not Connect")); |
2086 | 1677 return; |
1678 } | |
1679 | |
1680 aim_conn_completeconnect(sess, bosconn); | |
4617 | 1681 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); |
7283 | 1682 |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1683 gaim_connection_update_progress(gc, |
7283 | 1684 _("Connection established, cookie sent"), 4, OSCAR_CONNECT_STEPS); |
8341 | 1685 ck[4] = 0x61; |
2086 | 1686 } |
1687 | |
4617 | 1688 /* BBB */ |
4656 | 1689 /* |
1690 * This little area in oscar.c is the nexus of file transfer code, | |
1691 * so I wrote a little explanation of what happens. I am such a | |
1692 * ninja. | |
1693 * | |
1694 * The series of events for a file send is: | |
1695 * -Create xfer and call gaim_xfer_request (this happens in oscar_ask_sendfile) | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8733
diff
changeset
|
1696 * -User chooses a file and oscar_xfer_init is called. It establishes a |
4656 | 1697 * listening socket, then asks the remote user to connect to us (and |
1698 * gives them the file name, port, IP, etc.) | |
1699 * -They connect to us and we send them an AIM_CB_OFT_PROMPT (this happens | |
1700 * in oscar_sendfile_estblsh) | |
1701 * -They send us an AIM_CB_OFT_ACK and then we start sending data | |
1702 * -When we finish, they send us an AIM_CB_OFT_DONE and they close the | |
1703 * connection. | |
1704 * -We get drunk because file transfer kicks ass. | |
1705 * | |
1706 * The series of events for a file receive is: | |
1707 * -Create xfer and call gaim_xfer request (this happens in incomingim_chan2) | |
1708 * -Gaim user selects file to name and location to save file to and | |
1709 * oscar_xfer_init is called | |
1710 * -It connects to the remote user using the IP they gave us earlier | |
1711 * -After connecting, they send us an AIM_CB_OFT_PROMPT. In reply, we send | |
1712 * them an AIM_CB_OFT_ACK. | |
1713 * -They begin to send us lots of raw data. | |
1714 * -When they finish sending data we send an AIM_CB_OFT_DONE and then close | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8733
diff
changeset
|
1715 * the connection. |
4656 | 1716 */ |
1717 static void oscar_sendfile_connected(gpointer data, gint source, GaimInputCondition condition); | |
1718 | |
8446 | 1719 /* |
1720 * Miscellaneous xfer functions | |
1721 */ | |
1722 static GaimXfer *oscar_find_xfer_by_cookie(GSList *fts, const fu8_t *ck) | |
4656 | 1723 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1724 GaimXfer *xfer; |
5146 | 1725 struct aim_oft_info *oft_info; |
4656 | 1726 |
1727 while (fts) { | |
1728 xfer = fts->data; | |
5146 | 1729 oft_info = xfer->data; |
1730 | |
8446 | 1731 if (oft_info && !memcmp(ck, oft_info->cookie, 8)) |
4656 | 1732 return xfer; |
1733 | |
1734 fts = g_slist_next(fts); | |
1735 } | |
1736 | |
1737 return NULL; | |
1738 } | |
1739 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1740 static GaimXfer *oscar_find_xfer_by_conn(GSList *fts, aim_conn_t *conn) |
4656 | 1741 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1742 GaimXfer *xfer; |
5146 | 1743 struct aim_oft_info *oft_info; |
4656 | 1744 |
1745 while (fts) { | |
1746 xfer = fts->data; | |
5146 | 1747 oft_info = xfer->data; |
1748 | |
1749 if (oft_info && (conn == oft_info->conn)) | |
4656 | 1750 return xfer; |
1751 | |
1752 fts = g_slist_next(fts); | |
1753 } | |
1754 | |
1755 return NULL; | |
1756 } | |
1757 | |
8446 | 1758 static void oscar_xfer_end(GaimXfer *xfer) |
1759 { | |
1760 struct aim_oft_info *oft_info = xfer->data; | |
1761 GaimConnection *gc = oft_info->sess->aux_data; | |
1762 OscarData *od = gc->proto_data; | |
1763 | |
8660 | 1764 gaim_debug_info("oscar", "AAA - in oscar_xfer_end\n"); |
8446 | 1765 |
1766 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
1767 oft_info->fh.nrecvd = gaim_xfer_get_bytes_sent(xfer); | |
1768 aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_DONE, oft_info); | |
1769 } | |
1770 | |
1771 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
1772 aim_oft_destroyinfo(oft_info); | |
1773 xfer->data = NULL; | |
1774 od->file_transfers = g_slist_remove(od->file_transfers, xfer); | |
1775 } | |
1776 | |
1777 /* | |
1778 * xfer functions used when receiving files | |
1779 */ | |
1780 | |
1781 static void oscar_xfer_init_recv(GaimXfer *xfer) | |
1782 { | |
1783 struct aim_oft_info *oft_info = xfer->data; | |
1784 GaimConnection *gc = oft_info->sess->aux_data; | |
1785 OscarData *od = gc->proto_data; | |
1786 | |
8660 | 1787 gaim_debug_info("oscar", "AAA - in oscar_xfer_recv_init\n"); |
8446 | 1788 |
1789 oft_info->conn = aim_newconn(od->sess, AIM_CONN_TYPE_RENDEZVOUS, NULL); | |
1790 if (oft_info->conn) { | |
1791 oft_info->conn->subtype = AIM_CONN_SUBTYPE_OFT_SENDFILE; | |
1792 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_PROMPT, oscar_sendfile_prompt, 0); | |
1793 oft_info->conn->fd = xfer->fd = gaim_proxy_connect(gaim_connection_get_account(gc), | |
1794 xfer->remote_ip, xfer->remote_port, oscar_sendfile_connected, xfer); | |
1795 if (xfer->fd == -1) { | |
1796 gaim_xfer_error(GAIM_XFER_RECEIVE, xfer->who, | |
1797 _("Unable to establish file descriptor.")); | |
1798 gaim_xfer_cancel_local(xfer); | |
1799 } | |
1800 } else { | |
1801 gaim_xfer_error(GAIM_XFER_RECEIVE, xfer->who, | |
1802 _("Unable to create new connection.")); | |
1803 gaim_xfer_cancel_local(xfer); | |
1804 /* Try a different port? Ask them to connect to us? /join #gaim and whine? */ | |
1805 } | |
1806 | |
1807 } | |
1808 | |
1809 static void oscar_xfer_cancel_recv(GaimXfer *xfer) | |
1810 { | |
1811 struct aim_oft_info *oft_info = xfer->data; | |
1812 GaimConnection *gc = oft_info->sess->aux_data; | |
1813 OscarData *od = gc->proto_data; | |
1814 | |
8660 | 1815 gaim_debug_info("oscar", "AAA - in oscar_xfer_cancel_recv\n"); |
8446 | 1816 |
1817 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); | |
1818 | |
1819 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
1820 aim_oft_destroyinfo(oft_info); | |
1821 xfer->data = NULL; | |
1822 od->file_transfers = g_slist_remove(od->file_transfers, xfer); | |
1823 } | |
1824 | |
1825 static void oscar_xfer_ack_recv(GaimXfer *xfer, const char *buffer, size_t size) | |
1826 { | |
1827 struct aim_oft_info *oft_info = xfer->data; | |
1828 | |
1829 /* Update our rolling checksum. Like Walmart, yo. */ | |
1830 oft_info->fh.recvcsum = aim_oft_checksum_chunk(buffer, size, oft_info->fh.recvcsum); | |
1831 } | |
1832 | |
1833 /* | |
1834 * xfer functions used when sending files | |
1835 */ | |
1836 | |
1837 static void oscar_xfer_init_send(GaimXfer *xfer) | |
1838 { | |
1839 struct aim_oft_info *oft_info = xfer->data; | |
1840 GaimConnection *gc = oft_info->sess->aux_data; | |
1841 OscarData *od = gc->proto_data; | |
1842 int listenfd; | |
1843 | |
8660 | 1844 gaim_debug_info("oscar", "AAA - in oscar_xfer_send_init\n"); |
8446 | 1845 |
1846 xfer->filename = g_path_get_basename(xfer->local_filename); | |
1847 strncpy(oft_info->fh.name, xfer->filename, 64); | |
1848 oft_info->fh.name[63] = '\0'; | |
1849 oft_info->fh.totsize = gaim_xfer_get_size(xfer); | |
1850 oft_info->fh.size = gaim_xfer_get_size(xfer); | |
1851 oft_info->fh.checksum = aim_oft_checksum_file(xfer->local_filename); | |
1852 | |
1853 /* Create a listening socket and an associated libfaim conn */ | |
1854 if ((listenfd = gaim_network_listen_range(5190, 5199)) < 0) { | |
1855 gaim_xfer_cancel_local(xfer); | |
1856 return; | |
1857 } | |
1858 xfer->local_port = gaim_network_get_port_from_fd(listenfd); | |
1859 oft_info->port = xfer->local_port; | |
1860 if (aim_sendfile_listen(od->sess, oft_info, listenfd) != 0) { | |
1861 gaim_xfer_cancel_local(xfer); | |
1862 return; | |
1863 } | |
8660 | 1864 gaim_debug_misc("oscar", |
8446 | 1865 "port is %hu, ip is %s\n", |
1866 xfer->local_port, oft_info->clientip); | |
1867 if (oft_info->conn) { | |
1868 xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
1869 aim_im_sendch2_sendfile_ask(od->sess, oft_info); | |
1870 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ESTABLISHED, oscar_sendfile_estblsh, 0); | |
1871 } else { | |
1872 gaim_xfer_error(GAIM_XFER_SEND, xfer->who, | |
1873 _("Unable to establish listener socket.")); | |
1874 gaim_xfer_cancel_local(xfer); | |
1875 } | |
1876 } | |
1877 | |
1878 static void oscar_xfer_cancel_send(GaimXfer *xfer) | |
1879 { | |
1880 struct aim_oft_info *oft_info = xfer->data; | |
1881 GaimConnection *gc = oft_info->sess->aux_data; | |
1882 OscarData *od = gc->proto_data; | |
1883 | |
8660 | 1884 gaim_debug_info("oscar", "AAA - in oscar_xfer_cancel_send\n"); |
8446 | 1885 |
1886 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); | |
1887 | |
1888 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
1889 aim_oft_destroyinfo(oft_info); | |
1890 xfer->data = NULL; | |
1891 od->file_transfers = g_slist_remove(od->file_transfers, xfer); | |
1892 } | |
1893 | |
1894 static void oscar_xfer_ack_send(GaimXfer *xfer, const char *buffer, size_t size) | |
1895 { | |
1896 struct aim_oft_info *oft_info = xfer->data; | |
1897 | |
1898 /* I'm not sure I like how we do this. --marv | |
1899 * I do. AIM file transfers aren't really meant to be thought | |
1900 * of as a transferring just a single file. The rendezvous | |
1901 * establishes a connection between two computers, and then | |
1902 * those computers can use the same connection for transferring | |
1903 * multiple files. So we don't want the Gaim core up and closing | |
1904 * the socket all willy-nilly. We want to do that in the oscar | |
1905 * prpl, whenever one side or the other says they're finished | |
1906 * using the connection. There might be a better way to intercept | |
1907 * the socket from the core, however... --KingAnt | |
1908 */ | |
1909 | |
1910 /* | |
1911 * If we're done sending, intercept the socket from the core ft code | |
1912 * and wait for the other guy to send the "done" OFT packet. | |
1913 */ | |
1914 if (gaim_xfer_get_bytes_remaining(xfer) <= 0) { | |
1915 gaim_input_remove(xfer->watcher); | |
1916 xfer->watcher = gaim_input_add(xfer->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
1917 xfer->fd = 0; | |
1918 gaim_xfer_set_completed(xfer, TRUE); | |
1919 } | |
1920 } | |
1921 | |
9030 | 1922 static void oscar_ask_sendfile(GaimBlistNode *node, gpointer data) { |
1923 | |
1924 GaimBuddy *buddy; | |
1925 GaimConnection *gc; | |
1926 | |
1927 OscarData *od; | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1928 GaimXfer *xfer; |
5146 | 1929 struct aim_oft_info *oft_info; |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8227
diff
changeset
|
1930 const char *ip; |
3752 | 1931 |
9030 | 1932 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); |
1933 | |
1934 buddy = (GaimBuddy *) node; | |
1935 gc = gaim_account_get_connection(buddy->account); | |
1936 od = (OscarData *)gc->proto_data; | |
1937 | |
4617 | 1938 /* You want to send a file to someone else, you're so generous */ |
1939 | |
1940 /* Build the file transfer handle */ | |
9030 | 1941 xfer = gaim_xfer_new(buddy->account, GAIM_XFER_SEND, buddy->name); |
4617 | 1942 |
5146 | 1943 /* Create the oscar-specific data */ |
8838 | 1944 ip = gaim_network_get_my_ip(od->conn ? od->conn->fd : -1); |
9030 | 1945 oft_info = aim_oft_createinfo(od->sess, NULL, buddy->name, ip, 0, 0, 0, NULL); |
5146 | 1946 xfer->data = oft_info; |
1947 | |
4617 | 1948 /* Setup our I/O op functions */ |
8446 | 1949 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init_send); |
4617 | 1950 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
1951 gaim_xfer_set_cancel_send_fnc(xfer, oscar_xfer_cancel_send); |
8446 | 1952 gaim_xfer_set_request_denied_fnc(xfer, oscar_xfer_cancel_send); |
1953 gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack_send); | |
4617 | 1954 |
1955 /* Keep track of this transfer for later */ | |
1956 od->file_transfers = g_slist_append(od->file_transfers, xfer); | |
1957 | |
1958 /* Now perform the request */ | |
1959 gaim_xfer_request(xfer); | |
3630 | 1960 } |
1961 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1962 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { |
6029 | 1963 GaimConnection *gc = sess->aux_data; |
7283 | 1964 OscarData *od = gc->proto_data; |
6029 | 1965 GaimAccount *account = gc->account; |
1966 aim_conn_t *bosconn; | |
1967 char *host; int port; | |
1968 int i, rc; | |
2086 | 1969 va_list ap; |
2704 | 1970 struct aim_authresp_info *info; |
6029 | 1971 |
5575 | 1972 port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); |
2086 | 1973 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1974 va_start(ap, fr); |
2704 | 1975 info = va_arg(ap, struct aim_authresp_info *); |
2086 | 1976 va_end(ap); |
1977 | |
8660 | 1978 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1979 "inside auth_resp (Screen name: %s)\n", info->sn); |
2704 | 1980 |
4293 | 1981 if (info->errorcode || !info->bosip || !info->cookielen || !info->cookie) { |
4056 | 1982 char buf[256]; |
2704 | 1983 switch (info->errorcode) { |
2086 | 1984 case 0x05: |
1985 /* Incorrect nick/password */ | |
6498 | 1986 gc->wants_to_die = TRUE; |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1987 gaim_connection_error(gc, _("Incorrect nickname or password.")); |
2086 | 1988 break; |
1989 case 0x11: | |
1990 /* Suspended account */ | |
6498 | 1991 gc->wants_to_die = TRUE; |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1992 gaim_connection_error(gc, _("Your account is currently suspended.")); |
2086 | 1993 break; |
3498 | 1994 case 0x14: |
1995 /* service temporarily unavailable */ | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1996 gaim_connection_error(gc, _("The AOL Instant Messenger service is temporarily unavailable.")); |
3498 | 1997 break; |
2086 | 1998 case 0x18: |
1999 /* connecting too frequently */ | |
6498 | 2000 gc->wants_to_die = TRUE; |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
2001 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 | 2002 break; |
2003 case 0x1c: | |
2004 /* client too old */ | |
6498 | 2005 gc->wants_to_die = TRUE; |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6350
diff
changeset
|
2006 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
|
2007 gaim_connection_error(gc, buf); |
2086 | 2008 break; |
2009 default: | |
6623 | 2010 gaim_connection_error(gc, _("Authentication failed")); |
2086 | 2011 break; |
2012 } | |
8660 | 2013 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2014 "Login Error Code 0x%04hx\n", info->errorcode); |
8660 | 2015 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2016 "Error URL: %s\n", info->errorurl); |
2086 | 2017 od->killme = TRUE; |
2018 return 1; | |
2019 } | |
2020 | |
2021 | |
8660 | 2022 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2023 "Reg status: %hu\n", info->regstatus); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2024 |
2704 | 2025 if (info->email) { |
8660 | 2026 gaim_debug_misc("oscar", "Email: %s\n", info->email); |
2086 | 2027 } else { |
8660 | 2028 gaim_debug_misc("oscar", "Email is NULL\n"); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2029 } |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2030 |
8660 | 2031 gaim_debug_misc("oscar", "BOSIP: %s\n", info->bosip); |
2032 gaim_debug_info("oscar", | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2033 "Closing auth connection...\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2034 aim_conn_kill(sess, &fr->conn); |
2086 | 2035 |
2036 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL); | |
2037 if (bosconn == NULL) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
2038 gaim_connection_error(gc, _("Internal Error")); |
2086 | 2039 od->killme = TRUE; |
2040 return 0; | |
2041 } | |
2042 | |
4649 | 2043 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 2044 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_bos, 0); |
2086 | 2045 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, gaim_bosrights, 0); |
2046 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0); | |
2047 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, gaim_handle_redirect, 0); | |
2993 | 2048 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_RIGHTSINFO, gaim_parse_locaterights, 0); |
2086 | 2049 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_RIGHTSINFO, gaim_parse_buddyrights, 0); |
2050 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, gaim_parse_oncoming, 0); | |
2051 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, gaim_parse_offgoing, 0); | |
2052 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, gaim_parse_incoming_im, 0); | |
2053 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, gaim_parse_locerr, 0); | |
2054 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, gaim_parse_misses, 0); | |
3212 | 2055 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_CLIENTAUTORESP, gaim_parse_clientauto, 0); |
2086 | 2056 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, gaim_parse_ratechange, 0); |
2057 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL, gaim_parse_evilnotify, 0); | |
2058 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, AIM_CB_LOK_ERROR, gaim_parse_searcherror, 0); | |
2059 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, 0x0003, gaim_parse_searchreply, 0); | |
2060 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, gaim_parse_msgerr, 0); | |
3595 | 2061 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parse_mtn, 0); |
7011 | 2062 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parse_userinfo, 0); |
8341 | 2063 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_REQUESTINFOTIMEOUT, gaim_reqinfo_timeout, 0); |
2086 | 2064 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK, gaim_parse_msgack, 0); |
2065 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
|
2066 aim_conn_addhandler(sess, bosconn, 0x0004, 0x0005, gaim_icbm_param_info, 0); |
2086 | 2067 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, gaim_parse_genericerr, 0); |
2068 aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, gaim_parse_genericerr, 0); | |
2069 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, gaim_parse_genericerr, 0); | |
2070 aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, gaim_memrequest, 0); | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
2071 aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0); |
5844 | 2072 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
|
2073 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
|
2074 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
|
2075 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_POP, 0x0002, gaim_popup, 0); |
4759 | 2076 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_ALIAS, gaim_icqalias, 0); |
4624 | 2077 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_INFO, gaim_icqinfo, 0); |
4230 | 2078 #ifndef NOSSI |
4642 | 2079 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ERROR, gaim_ssi_parseerr, 0); |
2991 | 2080 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RIGHTSINFO, gaim_ssi_parserights, 0); |
2081 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_LIST, gaim_ssi_parselist, 0); | |
2082 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_NOLIST, gaim_ssi_parselist, 0); | |
4230 | 2083 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_SRVACK, gaim_ssi_parseack, 0); |
8227 | 2084 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ADD, gaim_ssi_parseadd, 0); |
4230 | 2085 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTH, gaim_ssi_authgiven, 0); |
2086 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREQ, gaim_ssi_authrequest, 0); | |
2087 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREP, gaim_ssi_authreply, 0); | |
2088 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ADDED, gaim_ssi_gotadded, 0); | |
2089 #endif | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2090 |
7283 | 2091 od->conn = bosconn; |
2704 | 2092 for (i = 0; i < (int)strlen(info->bosip); i++) { |
2093 if (info->bosip[i] == ':') { | |
2094 port = atoi(&(info->bosip[i+1])); | |
2086 | 2095 break; |
2096 } | |
2097 } | |
2704 | 2098 host = g_strndup(info->bosip, i); |
2086 | 2099 bosconn->status |= AIM_CONN_STATUS_INPROGRESS; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
2100 rc = gaim_proxy_connect(gc->account, host, port, oscar_bos_connect, gc); |
2086 | 2101 g_free(host); |
4366 | 2102 if (rc < 0) { |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
2103 gaim_connection_error(gc, _("Could Not Connect")); |
2086 | 2104 od->killme = TRUE; |
2105 return 0; | |
2106 } | |
4293 | 2107 aim_sendcookie(sess, bosconn, info->cookielen, info->cookie); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
2108 gaim_input_remove(gc->inpa); |
2704 | 2109 |
7283 | 2110 gaim_connection_update_progress(gc, _("Received authorization"), 3, OSCAR_CONNECT_STEPS); |
8341 | 2111 ck[3] = 0x64; |
7282 | 2112 |
2086 | 2113 return 1; |
2114 } | |
2115 | |
7285 | 2116 /* XXX - Should use gaim_url_fetch for the below stuff */ |
2086 | 2117 struct pieceofcrap { |
5575 | 2118 GaimConnection *gc; |
2086 | 2119 unsigned long offset; |
2120 unsigned long len; | |
2121 char *modname; | |
2122 int fd; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2123 aim_conn_t *conn; |
2086 | 2124 unsigned int inpa; |
2125 }; | |
2126 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
2127 static void damn_you(gpointer data, gint source, GaimInputCondition c) |
2086 | 2128 { |
2129 struct pieceofcrap *pos = data; | |
7283 | 2130 OscarData *od = pos->gc->proto_data; |
2086 | 2131 char in = '\0'; |
2132 int x = 0; | |
2133 unsigned char m[17]; | |
2134 | |
2135 while (read(pos->fd, &in, 1) == 1) { | |
2136 if (in == '\n') | |
2137 x++; | |
2138 else if (in != '\r') | |
2139 x = 0; | |
2140 if (x == 2) | |
2141 break; | |
2142 in = '\0'; | |
2143 } | |
2144 if (in != '\n') { | |
4056 | 2145 char buf[256]; |
2146 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
|
2147 "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2148 gaim_notify_warning(pos->gc, NULL, |
7422 | 2149 _("Gaim was unable to get a valid AIM login hash."), |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2150 buf); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
2151 gaim_input_remove(pos->inpa); |
2086 | 2152 close(pos->fd); |
2153 g_free(pos); | |
2154 return; | |
2155 } | |
2156 read(pos->fd, m, 16); | |
2157 m[16] = '\0'; | |
8660 | 2158 gaim_debug_misc("oscar", "Sending hash: "); |
2086 | 2159 for (x = 0; x < 16; x++) |
8660 | 2160 gaim_debug_misc(NULL, "%02hhx ", (unsigned char)m[x]); |
2161 | |
2162 gaim_debug_misc(NULL, "\n"); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
2163 gaim_input_remove(pos->inpa); |
2086 | 2164 close(pos->fd); |
2165 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); | |
2166 g_free(pos); | |
2167 } | |
2168 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
2169 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) { |
2086 | 2170 struct pieceofcrap *pos = data; |
5420 | 2171 gchar *buf; |
2086 | 2172 |
4366 | 2173 pos->fd = source; |
2174 | |
2086 | 2175 if (source < 0) { |
5420 | 2176 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
|
2177 "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2178 gaim_notify_warning(pos->gc, NULL, |
7422 | 2179 _("Gaim was unable to get a valid AIM login hash."), |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2180 buf); |
5420 | 2181 g_free(buf); |
2086 | 2182 if (pos->modname) |
2183 g_free(pos->modname); | |
2184 g_free(pos); | |
2185 return; | |
2186 } | |
2187 | |
5420 | 2188 buf = g_strdup_printf("GET " AIMHASHDATA "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n", |
2086 | 2189 pos->offset, pos->len, pos->modname ? pos->modname : ""); |
2190 write(pos->fd, buf, strlen(buf)); | |
5420 | 2191 g_free(buf); |
2086 | 2192 if (pos->modname) |
2193 g_free(pos->modname); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
2194 pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); |
2086 | 2195 return; |
2196 } | |
2197 | |
2198 /* size of icbmui.ocm, the largest module in AIM 3.5 */ | |
2199 #define AIM_MAX_FILE_SIZE 98304 | |
2200 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2201 int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2202 va_list ap; |
2203 struct pieceofcrap *pos; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2204 fu32_t offset, len; |
2086 | 2205 char *modname; |
2206 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2207 va_start(ap, fr); |
4200 | 2208 offset = va_arg(ap, fu32_t); |
2209 len = va_arg(ap, fu32_t); | |
2086 | 2210 modname = va_arg(ap, char *); |
2211 va_end(ap); | |
2212 | |
8660 | 2213 gaim_debug_misc("oscar", |
5556 | 2214 "offset: %u, len: %u, file: %s\n", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2215 offset, len, (modname ? modname : "aim.exe")); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2216 |
2086 | 2217 if (len == 0) { |
8660 | 2218 gaim_debug_misc("oscar", "len is 0, hashing NULL\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2219 aim_sendmemblock(sess, fr->conn, offset, len, NULL, |
2086 | 2220 AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
2221 return 1; | |
2222 } | |
2223 /* uncomment this when you're convinced it's right. remember, it's been wrong before. | |
2224 if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) { | |
2225 char *buf; | |
2226 int i = 8; | |
2227 if (modname) | |
2228 i += strlen(modname); | |
2229 buf = g_malloc(i); | |
2230 i = 0; | |
2231 if (modname) { | |
2232 memcpy(buf, modname, strlen(modname)); | |
2233 i += strlen(modname); | |
2234 } | |
2235 buf[i++] = offset & 0xff; | |
2236 buf[i++] = (offset >> 8) & 0xff; | |
2237 buf[i++] = (offset >> 16) & 0xff; | |
2238 buf[i++] = (offset >> 24) & 0xff; | |
2239 buf[i++] = len & 0xff; | |
2240 buf[i++] = (len >> 8) & 0xff; | |
2241 buf[i++] = (len >> 16) & 0xff; | |
2242 buf[i++] = (len >> 24) & 0xff; | |
8660 | 2243 gaim_debug_misc("oscar", "len + offset is invalid, " |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2244 "hashing request\n"); |
2086 | 2245 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
2246 g_free(buf); | |
2247 return 1; | |
2248 } | |
2249 */ | |
2250 | |
2251 pos = g_new0(struct pieceofcrap, 1); | |
2252 pos->gc = sess->aux_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2253 pos->conn = fr->conn; |
2086 | 2254 |
2255 pos->offset = offset; | |
2256 pos->len = len; | |
2257 pos->modname = modname ? g_strdup(modname) : NULL; | |
2258 | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
2259 if (gaim_proxy_connect(pos->gc->account, "gaim.sourceforge.net", 80, straight_to_hell, pos) != 0) { |
4056 | 2260 char buf[256]; |
2086 | 2261 if (pos->modname) |
2262 g_free(pos->modname); | |
2263 g_free(pos); | |
4056 | 2264 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
|
2265 "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2266 gaim_notify_warning(pos->gc, NULL, |
7422 | 2267 _("Gaim was unable to get a valid login hash."), |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2268 buf); |
2086 | 2269 } |
2270 | |
2271 return 1; | |
2272 } | |
2273 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2274 static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2275 GaimConnection *gc = sess->aux_data; |
7283 | 2276 OscarData *od = gc->proto_data; |
5591
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
2277 GaimAccount *account = gaim_connection_get_account(gc); |
5575 | 2278 GaimAccount *ac = gaim_connection_get_account(gc); |
7282 | 2279 #if 0 |
2280 struct client_info_s info = {"gaim", 7, 3, 2003, "us", "en", 0x0004, 0x0000, 0x04b}; | |
2281 #endif | |
7011 | 2282 va_list ap; |
2283 char *key; | |
2086 | 2284 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2285 va_start(ap, fr); |
2086 | 2286 key = va_arg(ap, char *); |
2287 va_end(ap); | |
2288 | |
4617 | 2289 if (od->icq) { |
3458 | 2290 struct client_info_s info = CLIENTINFO_ICQ_KNOWNGOOD; |
5591
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
2291 aim_send_login(sess, fr->conn, gaim_account_get_username(ac), |
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
2292 gaim_account_get_password(account), &info, key); |
3458 | 2293 } else { |
2294 struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD; | |
5591
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
2295 aim_send_login(sess, fr->conn, gaim_account_get_username(ac), |
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
2296 gaim_account_get_password(account), &info, key); |
3458 | 2297 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2298 |
7283 | 2299 gaim_connection_update_progress(gc, _("Password sent"), 2, OSCAR_CONNECT_STEPS); |
8341 | 2300 ck[2] = 0x6c; |
7282 | 2301 |
2086 | 2302 return 1; |
2303 } | |
2304 | |
2675 | 2305 static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2306 GaimConnection *gc = sess->aux_data; |
2647 | 2307 struct chat_connection *chatcon; |
2308 static int id = 1; | |
2309 | |
6905 | 2310 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
|
2311 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
|
2312 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
|
2313 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
|
2314 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_conv_chat_incoming_msg, 0); |
2675 | 2315 |
2672 | 2316 aim_clientready(sess, fr->conn); |
2675 | 2317 |
2647 | 2318 chatcon = find_oscar_chat_by_conn(gc, fr->conn); |
2319 chatcon->id = id; | |
8733 | 2320 chatcon->conv = serv_got_joined_chat(gc, id++, chatcon->show); |
2647 | 2321 |
2322 return 1; | |
2323 } | |
2324 | |
2675 | 2325 static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...) { |
2326 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
2327 aim_conn_addhandler(sess, fr->conn, 0x000d, 0x0001, gaim_parse_genericerr, 0); |
2647 | 2328 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_INFO, gaim_chatnav_info, 0); |
2675 | 2329 |
2330 aim_clientready(sess, fr->conn); | |
2331 | |
2332 aim_chatnav_reqrights(sess, fr->conn); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2333 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2334 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2335 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2336 |
3694 | 2337 static int conninitdone_email(aim_session_t *sess, aim_frame_t *fr, ...) { |
2338 | |
2339 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); | |
2340 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_EML, AIM_CB_EML_MAILSTATUS, gaim_email_parseupdate, 0); | |
2341 | |
7282 | 2342 aim_email_sendcookies(sess); |
2343 aim_email_activate(sess); | |
3694 | 2344 aim_clientready(sess, fr->conn); |
2345 | |
2346 return 1; | |
2347 } | |
2348 | |
4804 | 2349 static int conninitdone_icon(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2350 GaimConnection *gc = sess->aux_data; |
7283 | 2351 OscarData *od = gc->proto_data; |
4804 | 2352 |
2353 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); | |
2354 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_ERROR, gaim_icon_error, 0); | |
2355 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_RESPONSE, gaim_icon_parseicon, 0); | |
2356 | |
2357 aim_clientready(sess, fr->conn); | |
2358 | |
4823 | 2359 od->iconconnecting = FALSE; |
2360 | |
4804 | 2361 if (od->icontimer) |
8287
ef881489396e
[gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents:
8273
diff
changeset
|
2362 gaim_timeout_remove(od->icontimer); |
8273
f24172f53650
[gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents:
8266
diff
changeset
|
2363 od->icontimer = gaim_timeout_add(100, gaim_icon_timerfunc, gc); |
4804 | 2364 |
2365 return 1; | |
2366 } | |
2367 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2368 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 2369 GaimConnection *gc = data; |
7283 | 2370 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2371 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2372 aim_conn_t *tstconn; |
2086 | 2373 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2374 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 2375 close(source); |
2376 return; | |
2377 } | |
2378 | |
4617 | 2379 od = gc->proto_data; |
2380 sess = od->sess; | |
2086 | 2381 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV); |
4366 | 2382 tstconn->fd = source; |
2086 | 2383 |
2384 if (source < 0) { | |
2385 aim_conn_kill(sess, &tstconn); | |
8660 | 2386 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2387 "unable to connect to chatnav server\n"); |
2086 | 2388 return; |
2389 } | |
2390 | |
2391 aim_conn_completeconnect(sess, tstconn); | |
4617 | 2392 od->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
8660 | 2393 gaim_debug_info("oscar", "chatnav: connected\n"); |
2086 | 2394 } |
2395 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
2396 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 2397 { |
5575 | 2398 GaimConnection *gc = data; |
7283 | 2399 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2400 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2401 aim_conn_t *tstconn; |
2086 | 2402 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2403 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 2404 close(source); |
2405 return; | |
2406 } | |
2407 | |
4617 | 2408 od = gc->proto_data; |
2409 sess = od->sess; | |
2086 | 2410 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); |
4366 | 2411 tstconn->fd = source; |
2086 | 2412 |
2413 if (source < 0) { | |
2414 aim_conn_kill(sess, &tstconn); | |
8660 | 2415 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2416 "unable to connect to authorizer\n"); |
2086 | 2417 return; |
2418 } | |
2419 | |
2420 aim_conn_completeconnect(sess, tstconn); | |
4617 | 2421 od->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
8660 | 2422 gaim_debug_info("oscar", "admin: connected\n"); |
2086 | 2423 } |
2424 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
2425 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 2426 { |
2427 struct chat_connection *ccon = data; | |
5575 | 2428 GaimConnection *gc = ccon->gc; |
7283 | 2429 OscarData *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2430 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2431 aim_conn_t *tstconn; |
2086 | 2432 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2433 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 2434 close(source); |
2435 g_free(ccon->show); | |
2436 g_free(ccon->name); | |
2437 g_free(ccon); | |
2438 return; | |
2439 } | |
2440 | |
4617 | 2441 od = gc->proto_data; |
2442 sess = od->sess; | |
2086 | 2443 tstconn = ccon->conn; |
4366 | 2444 tstconn->fd = source; |
2086 | 2445 |
2446 if (source < 0) { | |
2447 aim_conn_kill(sess, &tstconn); | |
2448 g_free(ccon->show); | |
2449 g_free(ccon->name); | |
2450 g_free(ccon); | |
2451 return; | |
2452 } | |
2453 | |
2454 aim_conn_completeconnect(sess, ccon->conn); | |
4617 | 2455 ccon->inpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
2456 od->oscar_chats = g_slist_append(od->oscar_chats, ccon); | |
2086 | 2457 } |
2458 | |
3694 | 2459 static void oscar_email_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 2460 GaimConnection *gc = data; |
7283 | 2461 OscarData *od; |
3694 | 2462 aim_session_t *sess; |
2463 aim_conn_t *tstconn; | |
2464 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2465 if (!g_list_find(gaim_connections_get_all(), gc)) { |
3694 | 2466 close(source); |
2467 return; | |
2468 } | |
2469 | |
4617 | 2470 od = gc->proto_data; |
2471 sess = od->sess; | |
3694 | 2472 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_EMAIL); |
4366 | 2473 tstconn->fd = source; |
3694 | 2474 |
2475 if (source < 0) { | |
2476 aim_conn_kill(sess, &tstconn); | |
8660 | 2477 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2478 "unable to connect to email server\n"); |
3694 | 2479 return; |
2480 } | |
2481 | |
2482 aim_conn_completeconnect(sess, tstconn); | |
4617 | 2483 od->emlpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
8660 | 2484 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2485 "email: connected\n"); |
3694 | 2486 } |
2487 | |
4804 | 2488 static void oscar_icon_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 2489 GaimConnection *gc = data; |
7283 | 2490 OscarData *od; |
4804 | 2491 aim_session_t *sess; |
2492 aim_conn_t *tstconn; | |
2493 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2494 if (!g_list_find(gaim_connections_get_all(), gc)) { |
4804 | 2495 close(source); |
2496 return; | |
2497 } | |
2498 | |
2499 od = gc->proto_data; | |
2500 sess = od->sess; | |
2501 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_ICON); | |
2502 tstconn->fd = source; | |
2503 | |
2504 if (source < 0) { | |
2505 aim_conn_kill(sess, &tstconn); | |
8660 | 2506 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2507 "unable to connect to icon server\n"); |
4804 | 2508 return; |
2509 } | |
2510 | |
2511 aim_conn_completeconnect(sess, tstconn); | |
2512 od->icopa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); | |
8660 | 2513 gaim_debug_info("oscar", "icon: connected\n"); |
4804 | 2514 } |
2515 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2516 /* 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
|
2517 static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2518 GaimConnection *gc = sess->aux_data; |
2519 GaimAccount *account = gaim_connection_get_account(gc); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2520 aim_conn_t *tstconn; |
4452 | 2521 int i; |
2086 | 2522 char *host; |
2523 int port; | |
4821 | 2524 va_list ap; |
2525 struct aim_redirect_data *redir; | |
2086 | 2526 |
5575 | 2527 port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); |
2086 | 2528 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2529 va_start(ap, fr); |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
2530 redir = va_arg(ap, struct aim_redirect_data *); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
2531 va_end(ap); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
2532 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
2533 for (i = 0; i < (int)strlen(redir->ip); i++) { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
2534 if (redir->ip[i] == ':') { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
2535 port = atoi(&(redir->ip[i+1])); |
2086 | 2536 break; |
2537 } | |
2538 } | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
2539 host = g_strndup(redir->ip, i); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
2540 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
2541 switch(redir->group) { |
2086 | 2542 case 0x7: /* Authorizer */ |
8660 | 2543 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2544 "Reconnecting with authorizor...\n"); |
2086 | 2545 tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); |
2546 if (tstconn == NULL) { | |
8660 | 2547 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2548 "unable to reconnect with authorizer\n"); |
2086 | 2549 g_free(host); |
2550 return 1; | |
2551 } | |
4649 | 2552 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 2553 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_admin, 0); |
2086 | 2554 |
2555 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
2556 if (gaim_proxy_connect(account, host, port, oscar_auth_connect, gc) != 0) { |
2086 | 2557 aim_conn_kill(sess, &tstconn); |
8660 | 2558 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2559 "unable to reconnect with authorizer\n"); |
2086 | 2560 g_free(host); |
2561 return 1; | |
2562 } | |
4293 | 2563 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
4194 | 2564 break; |
2565 | |
2086 | 2566 case 0xd: /* ChatNav */ |
2567 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, NULL); | |
2568 if (tstconn == NULL) { | |
8660 | 2569 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2570 "unable to connect to chatnav server\n"); |
2086 | 2571 g_free(host); |
2572 return 1; | |
2573 } | |
4649 | 2574 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 2575 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chatnav, 0); |
2086 | 2576 |
2577 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
2578 if (gaim_proxy_connect(account, host, port, oscar_chatnav_connect, gc) != 0) { |
2086 | 2579 aim_conn_kill(sess, &tstconn); |
8660 | 2580 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2581 "unable to connect to chatnav server\n"); |
2086 | 2582 g_free(host); |
2583 return 1; | |
2584 } | |
4293 | 2585 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
4194 | 2586 break; |
2587 | |
2588 case 0xe: { /* Chat */ | |
2086 | 2589 struct chat_connection *ccon; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2590 |
2086 | 2591 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, NULL); |
2592 if (tstconn == NULL) { | |
8660 | 2593 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2594 "unable to connect to chat server\n"); |
2086 | 2595 g_free(host); |
2596 return 1; | |
2597 } | |
2598 | |
4649 | 2599 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 2600 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chat, 0); |
2601 | |
2086 | 2602 ccon = g_new0(struct chat_connection, 1); |
2603 ccon->conn = tstconn; | |
2604 ccon->gc = gc; | |
2605 ccon->fd = -1; | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
2606 ccon->name = g_strdup(redir->chat.room); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
2607 ccon->exchange = redir->chat.exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
2608 ccon->instance = redir->chat.instance; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
2609 ccon->show = extract_name(redir->chat.room); |
4634 | 2610 |
2086 | 2611 ccon->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
2612 if (gaim_proxy_connect(account, host, port, oscar_chat_connect, ccon) != 0) { |
2086 | 2613 aim_conn_kill(sess, &tstconn); |
8660 | 2614 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2615 "unable to connect to chat server\n"); |
2086 | 2616 g_free(host); |
2617 g_free(ccon->show); | |
2618 g_free(ccon->name); | |
2619 g_free(ccon); | |
2620 return 1; | |
2621 } | |
4293 | 2622 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
8660 | 2623 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2624 "Connected to chat room %s exchange %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2625 ccon->name, ccon->exchange); |
4194 | 2626 } break; |
3694 | 2627 |
4804 | 2628 case 0x0010: { /* icon */ |
2629 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_ICON, NULL))) { | |
8660 | 2630 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2631 "unable to connect to icon server\n"); |
4804 | 2632 g_free(host); |
2633 return 1; | |
2634 } | |
2635 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); | |
2636 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_icon, 0); | |
2637 | |
2638 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
2639 if (gaim_proxy_connect(account, host, port, oscar_icon_connect, gc) != 0) { |
4804 | 2640 aim_conn_kill(sess, &tstconn); |
8660 | 2641 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2642 "unable to connect to icon server\n"); |
4804 | 2643 g_free(host); |
2644 return 1; | |
2645 } | |
2646 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); | |
2647 } break; | |
2648 | |
3694 | 2649 case 0x0018: { /* email */ |
2650 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_EMAIL, NULL))) { | |
8660 | 2651 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2652 "unable to connect to email server\n"); |
3694 | 2653 g_free(host); |
2654 return 1; | |
2655 } | |
4649 | 2656 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
3694 | 2657 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_email, 0); |
2658 | |
2659 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
2660 if (gaim_proxy_connect(account, host, port, oscar_email_connect, gc) != 0) { |
3694 | 2661 aim_conn_kill(sess, &tstconn); |
8660 | 2662 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2663 "unable to connect to email server\n"); |
3694 | 2664 g_free(host); |
2665 return 1; | |
2666 } | |
4293 | 2667 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
3694 | 2668 } break; |
2669 | |
2086 | 2670 default: /* huh? */ |
8660 | 2671 gaim_debug_warning("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2672 "got redirect for unknown service 0x%04hx\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2673 redir->group); |
2086 | 2674 break; |
2675 } | |
2676 | |
2677 g_free(host); | |
2678 return 1; | |
2679 } | |
2680 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2681 static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2682 GaimConnection *gc = sess->aux_data; |
9058 | 2683 GaimAccount *account = gaim_connection_get_account(gc); |
7283 | 2684 OscarData *od = gc->proto_data; |
4738 | 2685 struct buddyinfo *bi; |
2993 | 2686 time_t time_idle = 0, signon = 0; |
2687 int type = 0; | |
2688 int caps = 0; | |
2086 | 2689 va_list ap; |
4738 | 2690 aim_userinfo_t *info; |
4194 | 2691 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2692 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2693 info = va_arg(ap, aim_userinfo_t *); |
2086 | 2694 va_end(ap); |
2695 | |
2993 | 2696 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) |
2697 caps = info->capabilities; | |
3267 | 2698 if (info->flags & AIM_FLAG_ACTIVEBUDDY) |
2699 type |= UC_AB; | |
2700 | |
4766 | 2701 if (info->present & AIM_USERINFO_PRESENT_FLAGS) { |
2702 if (info->flags & AIM_FLAG_UNCONFIRMED) | |
2703 type |= UC_UNCONFIRMED; | |
2704 if (info->flags & AIM_FLAG_ADMINISTRATOR) | |
2705 type |= UC_ADMIN; | |
2706 if (info->flags & AIM_FLAG_AOL) | |
2707 type |= UC_AOL; | |
2708 if (info->flags & AIM_FLAG_FREE) | |
2709 type |= UC_NORMAL; | |
2710 if (info->flags & AIM_FLAG_AWAY) | |
2711 type |= UC_UNAVAILABLE; | |
2712 if (info->flags & AIM_FLAG_WIRELESS) | |
2713 type |= UC_WIRELESS; | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
2714 } |
2993 | 2715 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) { |
3595 | 2716 type = (info->icqinfo.status << 16); |
3013 | 2717 if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) && |
2718 (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) { | |
2993 | 2719 type |= UC_UNAVAILABLE; |
3013 | 2720 } |
2993 | 2721 } |
2722 | |
7141 | 2723 if (caps & AIM_CAPS_ICQ_DIRECT) |
2724 caps ^= AIM_CAPS_ICQ_DIRECT; | |
2993 | 2725 |
2726 if (info->present & AIM_USERINFO_PRESENT_IDLE) { | |
2086 | 2727 time(&time_idle); |
2728 time_idle -= info->idletime*60; | |
9295 | 2729 /* time_idle should be the seconds since epoch at which the user became idle */ |
2993 | 2730 } |
2731 | |
5836 | 2732 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) |
2733 signon = info->onlinesince; | |
2734 else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) | |
2993 | 2735 signon = time(NULL) - info->sessionlen; |
2086 | 2736 |
5575 | 2737 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), info->sn)) |
2738 gaim_connection_set_display_name(gc, info->sn); | |
2305
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
2739 |
7261 | 2740 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, info->sn)); |
4738 | 2741 if (!bi) { |
2742 bi = g_new0(struct buddyinfo, 1); | |
7261 | 2743 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, info->sn)), bi); |
4738 | 2744 } |
4739 | 2745 bi->typingnot = FALSE; |
2746 bi->ico_informed = FALSE; | |
6857 | 2747 bi->ipaddr = info->icqinfo.ipaddr; |
2748 | |
2749 /* Available message stuff */ | |
6292 | 2750 free(bi->availmsg); |
7011 | 2751 if (info->avail != NULL) |
8225 | 2752 bi->availmsg = oscar_encoding_to_utf8(info->avail_encoding, info->avail, info->avail_len); |
5837 | 2753 else |
6292 | 2754 bi->availmsg = NULL; |
4732 | 2755 |
4804 | 2756 /* Server stored icon stuff */ |
4853 | 2757 if (info->iconcsumlen) { |
7125 | 2758 const char *filename = NULL, *saved_b16 = NULL; |
2759 char *b16 = NULL; | |
7093 | 2760 GaimBuddy *b = NULL; |
4853 | 2761 |
7106
db6bd3e794d8
[gaim-migrate @ 7671]
Christian Hammond <chipx86@chipx86.com>
parents:
7098
diff
changeset
|
2762 b16 = gaim_base16_encode(info->iconcsum, info->iconcsumlen); |
4853 | 2763 b = gaim_find_buddy(gc->account, info->sn); |
7093 | 2764 /* |
2765 * If for some reason the checksum is valid, but cached file is not.. | |
2766 * we want to know. | |
2767 */ | |
7693 | 2768 filename = gaim_blist_node_get_string((GaimBlistNode*)b, "buddy_icon"); |
7093 | 2769 if (filename != NULL) { |
2770 if (g_file_test(filename, G_FILE_TEST_EXISTS)) | |
7693 | 2771 saved_b16 = gaim_blist_node_get_string((GaimBlistNode*)b, |
2772 "icon_checksum"); | |
7093 | 2773 } else |
2774 saved_b16 = NULL; | |
7054
7c04a0775918
[gaim-migrate @ 7617]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7045
diff
changeset
|
2775 |
4853 | 2776 if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) { |
2777 GSList *cur = od->requesticon; | |
2778 while (cur && aim_sncmp((char *)cur->data, info->sn)) | |
2779 cur = cur->next; | |
2780 if (!cur) { | |
7475 | 2781 od->requesticon = g_slist_append(od->requesticon, g_strdup(gaim_normalize(gc->account, info->sn))); |
4853 | 2782 if (od->icontimer) |
8287
ef881489396e
[gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents:
8273
diff
changeset
|
2783 gaim_timeout_remove(od->icontimer); |
8273
f24172f53650
[gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents:
8266
diff
changeset
|
2784 od->icontimer = gaim_timeout_add(500, gaim_icon_timerfunc, gc); |
4853 | 2785 } |
2786 } | |
6053 | 2787 g_free(b16); |
4853 | 2788 } |
2789 | |
9058 | 2790 /* |
2791 * If we have info for ourselves, then update our local warning | |
2792 * level and set our official time of login. Is this necessary? | |
2793 * XXX - This needs to be changed some how. evil should not be | |
2794 * handled by the core at all? | |
2795 */ | |
2796 if (!aim_sncmp(info->sn, gaim_account_get_username(account))) { | |
2797 gc->evil = (info->warnlevel/10.0); | |
2798 gc->login_time_official = signon; | |
2799 } | |
2800 | |
5628 | 2801 serv_got_update(gc, info->sn, 1, (info->warnlevel/10.0) + 0.5, signon, time_idle, type); |
2086 | 2802 |
2803 return 1; | |
2804 } | |
2805 | |
8341 | 2806 static void gaim_check_comment(OscarData *od, const char *str) { |
2807 if ((str == NULL) || strcmp(str, ck)) | |
2808 aim_locate_setcaps(od->sess, caps_aim); | |
2809 else | |
2810 aim_locate_setcaps(od->sess, caps_aim | AIM_CAPS_SECUREIM); | |
2811 } | |
2812 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2813 static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2814 GaimConnection *gc = sess->aux_data; |
7283 | 2815 OscarData *od = gc->proto_data; |
2086 | 2816 va_list ap; |
4739 | 2817 aim_userinfo_t *info; |
2086 | 2818 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2819 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2820 info = va_arg(ap, aim_userinfo_t *); |
2086 | 2821 va_end(ap); |
2822 | |
4732 | 2823 serv_got_update(gc, info->sn, 0, 0, 0, 0, 0); |
2086 | 2824 |
7261 | 2825 g_hash_table_remove(od->buddyinfo, gaim_normalize(gc->account, info->sn)); |
5837 | 2826 |
2086 | 2827 return 1; |
2828 } | |
2829 | |
4617 | 2830 /* BBB */ |
3952 | 2831 /* |
4617 | 2832 * This is called after a remote AIM user has connected to us. We |
2833 * want to do some voodoo with the socket file descriptors, add a | |
2834 * callback or two, and then send the AIM_CB_OFT_PROMPT. | |
3952 | 2835 */ |
4656 | 2836 static int oscar_sendfile_estblsh(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2837 GaimConnection *gc = sess->aux_data; |
7283 | 2838 OscarData *od = (OscarData *)gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2839 GaimXfer *xfer; |
5146 | 2840 struct aim_oft_info *oft_info; |
3630 | 2841 va_list ap; |
2842 aim_conn_t *conn, *listenerconn; | |
4656 | 2843 |
8660 | 2844 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2845 "AAA - in oscar_sendfile_estblsh\n"); |
3630 | 2846 va_start(ap, fr); |
2847 conn = va_arg(ap, aim_conn_t *); | |
2848 listenerconn = va_arg(ap, aim_conn_t *); | |
2849 va_end(ap); | |
2850 | |
4617 | 2851 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, listenerconn))) |
2852 return 1; | |
2853 | |
5146 | 2854 if (!(oft_info = xfer->data)) |
4617 | 2855 return 1; |
2856 | |
3630 | 2857 /* Stop watching listener conn; watch transfer conn instead */ |
4617 | 2858 gaim_input_remove(xfer->watcher); |
3630 | 2859 aim_conn_kill(sess, &listenerconn); |
2860 | |
5146 | 2861 oft_info->conn = conn; |
2862 xfer->fd = oft_info->conn->fd; | |
2863 | |
2864 aim_conn_addhandler(sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ACK, oscar_sendfile_ack, 0); | |
2865 aim_conn_addhandler(sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DONE, oscar_sendfile_done, 0); | |
2866 xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
4617 | 2867 |
2868 /* Inform the other user that we are connected and ready to transfer */ | |
5146 | 2869 aim_oft_sendheader(sess, AIM_CB_OFT_PROMPT, oft_info); |
3630 | 2870 |
2871 return 0; | |
2872 } | |
2873 | |
3952 | 2874 /* |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
2875 * This is the gaim callback passed to gaim_proxy_connect when connecting to another AIM |
4617 | 2876 * user in order to transfer a file. |
3952 | 2877 */ |
4617 | 2878 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
|
2879 GaimXfer *xfer; |
5146 | 2880 struct aim_oft_info *oft_info; |
4656 | 2881 |
8660 | 2882 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2883 "AAA - in oscar_sendfile_connected\n"); |
4617 | 2884 if (!(xfer = data)) |
2885 return; | |
5146 | 2886 if (!(oft_info = xfer->data)) |
3630 | 2887 return; |
8446 | 2888 if (source < 0) { |
2889 gaim_xfer_cancel_remote(xfer); | |
4617 | 2890 return; |
8446 | 2891 } |
4617 | 2892 |
2893 xfer->fd = source; | |
5146 | 2894 oft_info->conn->fd = source; |
2895 | |
2896 aim_conn_completeconnect(oft_info->sess, oft_info->conn); | |
2897 xfer->watcher = gaim_input_add(xfer->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
4617 | 2898 |
2899 /* Inform the other user that we are connected and ready to transfer */ | |
5146 | 2900 aim_im_sendch2_sendfile_accept(oft_info->sess, oft_info); |
4617 | 2901 |
2902 return; | |
3630 | 2903 } |
2904 | |
3952 | 2905 /* |
4617 | 2906 * This is called when a buddy sends us some file info. This happens when they |
2907 * are sending a file to you, and you have just established a connection to them. | |
4650 | 2908 * You should send them the exact same info except use the real cookie. We also |
4617 | 2909 * get like totally ready to like, receive the file, kay? |
3952 | 2910 */ |
4617 | 2911 static int oscar_sendfile_prompt(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2912 GaimConnection *gc = sess->aux_data; |
7283 | 2913 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2914 GaimXfer *xfer; |
5146 | 2915 struct aim_oft_info *oft_info; |
4617 | 2916 va_list ap; |
2917 aim_conn_t *conn; | |
2918 fu8_t *cookie; | |
2919 struct aim_fileheader_t *fh; | |
4656 | 2920 |
8660 | 2921 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2922 "AAA - in oscar_sendfile_prompt\n"); |
4617 | 2923 va_start(ap, fr); |
2924 conn = va_arg(ap, aim_conn_t *); | |
2925 cookie = va_arg(ap, fu8_t *); | |
2926 fh = va_arg(ap, struct aim_fileheader_t *); | |
2927 va_end(ap); | |
2928 | |
2929 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, conn))) | |
2930 return 1; | |
2931 | |
5146 | 2932 if (!(oft_info = xfer->data)) |
4617 | 2933 return 1; |
2934 | |
2935 /* We want to stop listening with a normal thingy */ | |
2936 gaim_input_remove(xfer->watcher); | |
2937 xfer->watcher = 0; | |
2938 | |
5146 | 2939 /* They sent us some information about the file they're sending */ |
2940 memcpy(&oft_info->fh, fh, sizeof(*fh)); | |
2941 | |
2942 /* Fill in the cookie */ | |
2943 memcpy(&oft_info->fh.bcookie, oft_info->cookie, 8); | |
2944 | |
4617 | 2945 /* XXX - convert the name from UTF-8 to UCS-2 if necessary, and pass the encoding to the call below */ |
5146 | 2946 aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_ACK, oft_info); |
4617 | 2947 gaim_xfer_start(xfer, xfer->fd, NULL, 0); |
2948 | |
2949 return 0; | |
3630 | 2950 } |
2951 | |
3952 | 2952 /* |
4657 | 2953 * We are sending a file to someone else. They have just acknowledged our |
4617 | 2954 * prompt, so we want to start sending data like there's no tomorrow. |
3952 | 2955 */ |
4617 | 2956 static int oscar_sendfile_ack(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2957 GaimConnection *gc = sess->aux_data; |
7283 | 2958 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2959 GaimXfer *xfer; |
4617 | 2960 va_list ap; |
2961 aim_conn_t *conn; | |
2962 fu8_t *cookie; | |
2963 struct aim_fileheader_t *fh; | |
4656 | 2964 |
8660 | 2965 gaim_debug_info("oscar", "AAA - in oscar_sendfile_ack\n"); |
4617 | 2966 va_start(ap, fr); |
2967 conn = va_arg(ap, aim_conn_t *); | |
2968 cookie = va_arg(ap, fu8_t *); | |
2969 fh = va_arg(ap, struct aim_fileheader_t *); | |
2970 va_end(ap); | |
2971 | |
2972 if (!(xfer = oscar_find_xfer_by_cookie(od->file_transfers, cookie))) | |
2973 return 1; | |
2974 | |
4656 | 2975 /* We want to stop listening with a normal thingy */ |
2976 gaim_input_remove(xfer->watcher); | |
2977 xfer->watcher = 0; | |
2978 | |
4617 | 2979 gaim_xfer_start(xfer, xfer->fd, NULL, 0); |
2980 | |
2981 return 0; | |
3630 | 2982 } |
4617 | 2983 |
2984 /* | |
2985 * We just sent a file to someone. They said they got it and everything, | |
2986 * so we can close our direct connection and what not. | |
2987 */ | |
2988 static int oscar_sendfile_done(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 2989 GaimConnection *gc = sess->aux_data; |
7283 | 2990 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2991 GaimXfer *xfer; |
4617 | 2992 va_list ap; |
2993 aim_conn_t *conn; | |
2994 fu8_t *cookie; | |
2995 struct aim_fileheader_t *fh; | |
4656 | 2996 |
8660 | 2997 gaim_debug_info("oscar", "AAA - in oscar_sendfile_done\n"); |
4617 | 2998 va_start(ap, fr); |
2999 conn = va_arg(ap, aim_conn_t *); | |
3000 cookie = va_arg(ap, fu8_t *); | |
3001 fh = va_arg(ap, struct aim_fileheader_t *); | |
3002 va_end(ap); | |
3003 | |
3004 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, conn))) | |
3005 return 1; | |
3006 | |
4656 | 3007 xfer->fd = conn->fd; |
4617 | 3008 gaim_xfer_end(xfer); |
3009 | |
3010 return 0; | |
3011 } | |
3630 | 3012 |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3013 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { |
5575 | 3014 GaimConnection *gc = sess->aux_data; |
7283 | 3015 OscarData *od = gc->proto_data; |
8708 | 3016 GaimAccount *account = gaim_connection_get_account(gc); |
7475 | 3017 gchar *tmp; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3018 GaimConvImFlags flags = 0; |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
3019 gsize convlen; |
3659 | 3020 GError *err = NULL; |
4738 | 3021 struct buddyinfo *bi; |
5575 | 3022 const char *iconfile; |
4738 | 3023 |
8708 | 3024 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, userinfo->sn)); |
4738 | 3025 if (!bi) { |
3026 bi = g_new0(struct buddyinfo, 1); | |
8708 | 3027 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(account, userinfo->sn)), bi); |
4738 | 3028 } |
2273
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
3029 |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
3030 if (args->icbmflags & AIM_IMFLAGS_AWAY) |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
3031 flags |= GAIM_CONV_IM_AUTO_RESP; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3032 |
4738 | 3033 if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT) |
3034 bi->typingnot = TRUE; | |
3035 else | |
3036 bi->typingnot = FALSE; | |
3037 | |
4380 | 3038 if ((args->icbmflags & AIM_IMFLAGS_HASICON) && (args->iconlen) && (args->iconsum) && (args->iconstamp)) { |
8660 | 3039 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3040 "%s has an icon\n", userinfo->sn); |
4738 | 3041 if ((args->iconlen != bi->ico_len) || (args->iconsum != bi->ico_csum) || (args->iconstamp != bi->ico_time)) { |
3042 bi->ico_need = TRUE; | |
3043 bi->ico_len = args->iconlen; | |
3044 bi->ico_csum = args->iconsum; | |
3045 bi->ico_time = args->iconstamp; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3046 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3047 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3048 |
8708 | 3049 if ((iconfile = gaim_account_get_buddy_icon(account)) && |
7406 | 3050 (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
|
3051 FILE *file; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3052 struct stat st; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3053 |
5575 | 3054 if (!stat(iconfile, &st)) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3055 char *buf = g_malloc(st.st_size); |
5575 | 3056 file = fopen(iconfile, "rb"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3057 if (file) { |
2603
24664768a739
[gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
3058 int len = fread(buf, 1, st.st_size, file); |
8660 | 3059 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3060 "Sending buddy icon to %s (%d bytes, " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3061 "%lu reported)\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3062 userinfo->sn, len, st.st_size); |
4617 | 3063 aim_im_sendch2_icon(sess, userinfo->sn, buf, st.st_size, |
3064 st.st_mtime, aimutil_iconsum(buf, st.st_size)); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3065 fclose(file); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
3066 } else |
8660 | 3067 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3068 "Can't open buddy icon file!\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3069 g_free(buf); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
3070 } else |
8660 | 3071 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3072 "Can't stat buddy icon file!\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3073 } |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3074 |
8660 | 3075 gaim_debug_misc("oscar", |
8623 | 3076 "Received message from %s with charset %hu %hu\n", |
3077 userinfo->sn, args->charset, args->charsubset); | |
3078 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3079 if (args->icbmflags & AIM_IMFLAGS_UNICODE) { |
3722 | 3080 /* This message is marked as UNICODE, so we have to |
3081 * convert it to utf-8 before handing it to the gaim core. | |
3082 * This conversion should *never* fail, if it does it | |
3083 * means that either the incoming ICBM is corrupted or | |
4662 | 3084 * there is something we don't understand about it. |
3085 * For the record, AIM Unicode is big-endian UCS-2 */ | |
3086 | |
8660 | 3087 gaim_debug_info("oscar", "Received UNICODE IM\n"); |
4121 | 3088 |
3089 if (!args->msg || !args->msglen) | |
3090 return 1; | |
4641 | 3091 |
3659 | 3092 tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err); |
3093 if (err) { | |
8660 | 3094 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3095 "Unicode IM conversion: %s\n", err->message); |
7475 | 3096 tmp = g_strdup(_("(There was an error receiving this message)")); |
4800 | 3097 g_error_free(err); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3098 } |
3722 | 3099 } else { |
3850 | 3100 /* This will get executed for both AIM_IMFLAGS_ISO_8859_1 and |
3722 | 3101 * unflagged messages, which are ASCII. That's OK because |
3102 * ASCII is a strict subset of ISO-8859-1; this should | |
3103 * help with compatibility with old, broken versions of | |
3104 * gaim (everything before 0.60) and other broken clients | |
3105 * that will happily send ISO-8859-1 without marking it as | |
3106 * such */ | |
4662 | 3107 if (args->icbmflags & AIM_IMFLAGS_ISO_8859_1) |
8660 | 3108 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3109 "Received ISO-8859-1 IM\n"); |
4121 | 3110 |
3111 if (!args->msg || !args->msglen) | |
3112 return 1; | |
3113 | |
3659 | 3114 tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &convlen, &err); |
3115 if (err) { | |
8660 | 3116 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3117 "ISO-8859-1 IM conversion: %s\n", err->message); |
7475 | 3118 tmp = g_strdup(_("(There was an error receiving this message)")); |
4800 | 3119 g_error_free(err); |
3659 | 3120 } |
3642 | 3121 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3122 |
8666 | 3123 /* |
8995 | 3124 * If the message is being received by an ICQ user then escape any HTML, |
9016 | 3125 * because HTML is not sent over ICQ as a means to format a message. |
8995 | 3126 * so any HTML we receive is intended to be displayed |
3127 * | |
3128 * Note: There *may* be some clients which send messages as HTML formatted - | |
3129 * they need to be special-cased somehow. | |
8666 | 3130 */ |
8995 | 3131 if (isdigit(gaim_account_get_username(account)[0]) && isdigit(userinfo->sn[0])) { |
3132 /* being recevied by ICQ from ICQ - escape HTML so it is displayed as sent */ | |
3133 gchar *tmp2 = gaim_escape_html(tmp); | |
8493 | 3134 g_free(tmp); |
3135 tmp = tmp2; | |
3136 } | |
3137 | |
6982 | 3138 serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3139 g_free(tmp); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3140 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3141 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3142 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3143 |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3144 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { |
9070 | 3145 GaimConnection *gc; |
3146 OscarData *od; | |
3147 const char *username; | |
3148 | |
3149 g_return_val_if_fail(sess != NULL, 0); | |
3150 g_return_val_if_fail(sess->aux_data != NULL, 0); | |
3151 | |
3152 gc = sess->aux_data; | |
3153 od = gc->proto_data; | |
3154 username = gaim_account_get_username(gaim_connection_get_account(gc)); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3155 |
4121 | 3156 if (!args) |
3157 return 0; | |
4194 | 3158 |
8660 | 3159 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3160 "rendezvous with %s, status is %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3161 userinfo->sn, args->status); |
2869 | 3162 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3163 if (args->reqclass & AIM_CAPS_CHAT) { |
4121 | 3164 char *name; |
5234 | 3165 GHashTable *components; |
3166 | |
4121 | 3167 if (!args->info.chat.roominfo.name || !args->info.chat.roominfo.exchange || !args->msg) |
3168 return 1; | |
5234 | 3169 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
3170 g_free); | |
4121 | 3171 name = extract_name(args->info.chat.roominfo.name); |
5234 | 3172 g_hash_table_replace(components, g_strdup("room"), g_strdup(name ? name : args->info.chat.roominfo.name)); |
3173 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
|
3174 serv_got_chat_invite(gc, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3175 name ? name : args->info.chat.roominfo.name, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3176 userinfo->sn, |
6059 | 3177 args->msg, |
5234 | 3178 components); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3179 if (name) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3180 g_free(name); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3181 } else if (args->reqclass & AIM_CAPS_SENDFILE) { |
4617 | 3182 /* BBB */ |
3183 if (args->status == AIM_RENDEZVOUS_PROPOSE) { | |
3184 /* Someone wants to send a file (or files) to us */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
3185 GaimXfer *xfer; |
5146 | 3186 struct aim_oft_info *oft_info; |
3187 | |
3188 if (!args->cookie || !args->port || !args->verifiedip || | |
3189 !args->info.sendfile.filename || !args->info.sendfile.totsize || | |
4656 | 3190 !args->info.sendfile.totfiles || !args->reqclass) { |
8660 | 3191 gaim_debug_warning("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3192 "%s tried to send you a file with incomplete " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3193 "information.\n", userinfo->sn); |
5146 | 3194 if (args->proxyip) |
8660 | 3195 gaim_debug_warning("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3196 "IP for a proxy server was given. Gaim " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3197 "does not support this yet.\n"); |
4617 | 3198 return 1; |
4656 | 3199 } |
4617 | 3200 |
3201 if (args->info.sendfile.subtype == AIM_OFT_SUBTYPE_SEND_DIR) { | |
3202 /* last char of the ft req is a star, they are sending us a | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8733
diff
changeset
|
3203 * directory -- remove the star and trailing slash so we don't save |
4617 | 3204 * directories that look like 'dirname\*' -- arl */ |
3205 char *tmp = strrchr(args->info.sendfile.filename, '\\'); | |
3206 if (tmp && (tmp[1] == '*')) { | |
3207 tmp[0] = '\0'; | |
3208 } | |
8660 | 3209 gaim_debug_warning("oscar", |
8446 | 3210 "We're receiving a whole directory! What fun! " |
3211 "Especially since we don't support that!\n"); | |
4617 | 3212 } |
3213 | |
3214 /* Build the file transfer handle */ | |
3215 xfer = gaim_xfer_new(gc->account, GAIM_XFER_RECEIVE, userinfo->sn); | |
5163 | 3216 xfer->remote_ip = g_strdup(args->verifiedip); |
5146 | 3217 xfer->remote_port = args->port; |
4617 | 3218 gaim_xfer_set_filename(xfer, args->info.sendfile.filename); |
3219 gaim_xfer_set_size(xfer, args->info.sendfile.totsize); | |
5146 | 3220 |
3221 /* Create the oscar-specific data */ | |
5163 | 3222 oft_info = aim_oft_createinfo(od->sess, args->cookie, userinfo->sn, args->clientip, xfer->remote_port, 0, 0, NULL); |
4898 | 3223 if (args->proxyip) |
5146 | 3224 oft_info->proxyip = g_strdup(args->proxyip); |
4898 | 3225 if (args->verifiedip) |
5146 | 3226 oft_info->verifiedip = g_strdup(args->verifiedip); |
3227 xfer->data = oft_info; | |
4617 | 3228 |
3229 /* Setup our I/O op functions */ | |
8446 | 3230 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init_recv); |
4617 | 3231 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); |
8446 | 3232 gaim_xfer_set_request_denied_fnc(xfer, oscar_xfer_cancel_recv); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
3233 gaim_xfer_set_cancel_recv_fnc(xfer, oscar_xfer_cancel_recv); |
8446 | 3234 gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack_recv); |
4617 | 3235 |
3236 /* | |
3237 * XXX - Should do something with args->msg, args->encoding, and args->language | |
3238 * probably make it apply to all ch2 messages. | |
3752 | 3239 */ |
4617 | 3240 |
3241 /* Keep track of this transfer for later */ | |
3242 od->file_transfers = g_slist_append(od->file_transfers, xfer); | |
3243 | |
3244 /* Now perform the request */ | |
3245 gaim_xfer_request(xfer); | |
3246 } else if (args->status == AIM_RENDEZVOUS_CANCEL) { | |
3247 /* The other user wants to cancel a file transfer */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
3248 GaimXfer *xfer; |
8660 | 3249 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3250 "AAA - File transfer canceled by remote user\n"); |
4617 | 3251 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
|
3252 gaim_xfer_cancel_remote(xfer); |
4617 | 3253 } else if (args->status == AIM_RENDEZVOUS_ACCEPT) { |
3254 /* | |
3255 * This gets sent by the receiver of a file | |
3256 * as they connect directly to us. If we don't | |
3257 * get this, then maybe a third party connected | |
3258 * to us, and we shouldn't send them anything. | |
3259 */ | |
3260 } else { | |
8660 | 3261 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3262 "unknown rendezvous status!\n"); |
3630 | 3263 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3264 } else if (args->reqclass & AIM_CAPS_GETFILE) { |
8092 | 3265 } else if (args->reqclass & AIM_CAPS_TALK) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3266 } else if (args->reqclass & AIM_CAPS_BUDDYICON) { |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
3267 gaim_buddy_icons_set_for_user(gaim_connection_get_account(gc), |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
3268 userinfo->sn, args->info.icon.icon, |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
3269 args->info.icon.length); |
6871 | 3270 } else if (args->reqclass & AIM_CAPS_DIRECTIM) { |
8971 | 3271 /* Consider moving all this into a helper func in the direct im block way up there */ |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3272 struct ask_direct *d = g_new0(struct ask_direct, 1); |
8971 | 3273 struct oscar_direct_im *dim = oscar_direct_im_find(od, userinfo->sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3274 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3275 |
4212 | 3276 if (!args->verifiedip) { |
8983 | 3277 /* TODO: do something about this, after figuring out what it means */ |
8660 | 3278 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3279 "directim kill blocked (%s)\n", userinfo->sn); |
4650 | 3280 return 1; |
4212 | 3281 } |
3282 | |
8660 | 3283 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3284 "%s received direct im request from %s (%s)\n", |
8983 | 3285 username, userinfo->sn, args->clientip); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3286 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3287 d->gc = gc; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3288 d->sn = g_strdup(userinfo->sn); |
8983 | 3289 /* Let's use the clientip here, because I think that's what AIM does. |
3290 * Besides, if the clientip is wrong, we'll probably timeout faster, | |
3291 * and then ask them to connect to us. */ | |
3292 snprintf(d->ip, sizeof(d->ip), "%s:%d", args->clientip, args->port?args->port:5190); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3293 memcpy(d->cookie, args->cookie, 8); |
9070 | 3294 if (dim && !dim->connected && aim_odc_getcookie(dim->conn) && args->cookie && |
3295 (!memcmp(aim_odc_getcookie(dim->conn), args->cookie, 8))) { | |
3296 | |
8971 | 3297 oscar_direct_im_destroy(od, dim); |
8984 | 3298 d->donttryagain = TRUE; |
8971 | 3299 accept_direct_im_request(d); |
3300 } else { | |
8983 | 3301 if (dim && !dim->connected) |
8971 | 3302 gaim_debug_warning("oscar", "DirectIM: received direct im request while " |
3303 "already connected to that buddy!"); | |
5575 | 3304 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
|
3305 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3306 gaim_request_action(gc, NULL, buf, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3307 _("This requires a direct connection between " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3308 "the two computers and is necessary for IM " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3309 "Images. Because your IP address will be " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3310 "revealed, this may be considered a privacy " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3311 "risk."), 0, d, 2, |
8971 | 3312 _("Connect"), G_CALLBACK(accept_direct_im_request), |
3313 _("Cancel"), G_CALLBACK(destroy_direct_im_request)); | |
3314 /* FIXME: we should actually send a packet on cancel */ | |
3315 } | |
8708 | 3316 } else if (args->reqclass & AIM_CAPS_ICQSERVERRELAY) { |
3317 gaim_debug_error("oscar", "Got an ICQ Server Relay message of type %d\n", args->info.rtfmsg.msgtype); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3318 } else { |
8660 | 3319 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3320 "Unknown reqclass %hu\n", args->reqclass); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3321 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3322 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3323 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3324 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3325 |
3453 | 3326 /* |
4230 | 3327 * Authorization Functions |
3328 * Most of these are callbacks from dialogs. They're used by both | |
3329 * methods of authorization (SSI and old-school channel 4 ICBM) | |
3453 | 3330 */ |
4269 | 3331 /* When you ask other people for authorization */ |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3332 static void gaim_auth_request(struct name_data *data, char *msg) { |
5575 | 3333 GaimConnection *gc = data->gc; |
4244 | 3334 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
3335 if (g_list_find(gaim_connections_get_all(), gc)) { |
7283 | 3336 OscarData *od = gc->proto_data; |
6695 | 3337 GaimBuddy *buddy = gaim_find_buddy(gc->account, data->name); |
3338 GaimGroup *group = gaim_find_buddys_group(buddy); | |
4244 | 3339 if (buddy && group) { |
8660 | 3340 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3341 "ssi: adding buddy %s to group %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3342 buddy->name, group->name); |
4889 | 3343 aim_ssi_sendauthrequest(od->sess, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list.")); |
4269 | 3344 if (!aim_ssi_itemlist_finditem(od->sess->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY)) |
4889 | 3345 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 1); |
4244 | 3346 } |
4230 | 3347 } |
4337 | 3348 } |
3349 | |
3350 static void gaim_auth_request_msgprompt(struct name_data *data) { | |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
3351 gaim_request_input(data->gc, NULL, _("Authorization Request Message:"), |
8697 | 3352 NULL, _("Please authorize me!"), TRUE, FALSE, NULL, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
3353 _("OK"), G_CALLBACK(gaim_auth_request), |
5836 | 3354 _("Cancel"), G_CALLBACK(oscar_free_name_data), |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
3355 data); |
4230 | 3356 } |
3357 | |
3358 static void gaim_auth_dontrequest(struct name_data *data) { | |
5575 | 3359 GaimConnection *gc = data->gc; |
4244 | 3360 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
3361 if (g_list_find(gaim_connections_get_all(), gc)) { |
8151 | 3362 /* Remove from local list */ |
3363 GaimBuddy *b = gaim_find_buddy(gaim_connection_get_account(gc), data->name); | |
3364 gaim_blist_remove_buddy(b); | |
4244 | 3365 } |
3366 | |
5836 | 3367 oscar_free_name_data(data); |
4230 | 3368 } |
3369 | |
9030 | 3370 |
3371 static void gaim_auth_sendrequest(GaimConnection *gc, char *name) { | |
4269 | 3372 struct name_data *data = g_new(struct name_data, 1); |
6695 | 3373 GaimBuddy *buddy; |
4269 | 3374 gchar *dialog_msg, *nombre; |
3375 | |
4687 | 3376 buddy = gaim_find_buddy(gc->account, name); |
3377 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
3378 nombre = g_strdup_printf("%s (%s)", name, gaim_get_buddy_alias_only(buddy)); | |
4269 | 3379 else |
4830 | 3380 nombre = NULL; |
3381 | |
3382 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 | 3383 data->gc = gc; |
3384 data->name = g_strdup(name); | |
3385 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3386 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3387 gaim_request_action(gc, NULL, _("Request Authorization"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3388 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3389 _("Request Authorization"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3390 G_CALLBACK(gaim_auth_request_msgprompt), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3391 _("Cancel"), G_CALLBACK(gaim_auth_dontrequest)); |
4269 | 3392 |
3393 g_free(dialog_msg); | |
3394 g_free(nombre); | |
3395 } | |
3396 | |
9030 | 3397 |
3398 static void gaim_auth_sendrequest_menu(GaimBlistNode *node, gpointer ignored) { | |
3399 GaimBuddy *buddy; | |
3400 GaimConnection *gc; | |
3401 | |
3402 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); | |
3403 | |
3404 buddy = (GaimBuddy *) node; | |
3405 gc = gaim_account_get_connection(buddy->account); | |
3406 gaim_auth_sendrequest(gc, buddy->name); | |
3407 } | |
3408 | |
4230 | 3409 /* When other people ask you for authorization */ |
3410 static void gaim_auth_grant(struct name_data *data) { | |
5575 | 3411 GaimConnection *gc = data->gc; |
4244 | 3412 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
3413 if (g_list_find(gaim_connections_get_all(), gc)) { |
7283 | 3414 OscarData *od = gc->proto_data; |
4236 | 3415 #ifdef NOSSI |
6695 | 3416 GaimBuddy *buddy; |
4244 | 3417 gchar message; |
3418 message = 0; | |
4687 | 3419 buddy = gaim_find_buddy(gc->account, data->name); |
4617 | 3420 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
|
3421 gaim_account_notify_added(gc->account, NULL, data->name, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); |
4230 | 3422 #else |
4889 | 3423 aim_ssi_sendauthreply(od->sess, data->name, 0x01, NULL); |
4230 | 3424 #endif |
4244 | 3425 } |
3426 | |
5836 | 3427 oscar_free_name_data(data); |
3141 | 3428 } |
3429 | |
4230 | 3430 /* When other people ask you for authorization */ |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3431 static void gaim_auth_dontgrant(struct name_data *data, char *msg) { |
5575 | 3432 GaimConnection *gc = data->gc; |
4244 | 3433 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
3434 if (g_list_find(gaim_connections_get_all(), gc)) { |
7283 | 3435 OscarData *od = gc->proto_data; |
4230 | 3436 #ifdef NOSSI |
4617 | 3437 aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHDENIED, msg ? msg : _("No reason given.")); |
4230 | 3438 #else |
4889 | 3439 aim_ssi_sendauthreply(od->sess, data->name, 0x00, msg ? msg : _("No reason given.")); |
4230 | 3440 #endif |
4244 | 3441 } |
4337 | 3442 } |
3443 | |
3444 static void gaim_auth_dontgrant_msgprompt(struct name_data *data) { | |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
3445 gaim_request_input(data->gc, NULL, _("Authorization Denied Message:"), |
8697 | 3446 NULL, _("No reason given."), TRUE, FALSE, NULL, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
3447 _("OK"), G_CALLBACK(gaim_auth_dontgrant), |
5836 | 3448 _("Cancel"), G_CALLBACK(oscar_free_name_data), |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
3449 data); |
3141 | 3450 } |
3451 | |
7023 | 3452 /* When someone sends you buddies */ |
3453 static void gaim_icq_buddyadd(struct name_data *data) { | |
5575 | 3454 GaimConnection *gc = data->gc; |
4244 | 3455 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
3456 if (g_list_find(gaim_connections_get_all(), gc)) { |
7060
9946001989a3
[gaim-migrate @ 7623]
Christian Hammond <chipx86@chipx86.com>
parents:
7054
diff
changeset
|
3457 gaim_blist_request_add_buddy(gaim_connection_get_account(gc), data->name, NULL, data->nick); |
4244 | 3458 } |
3459 | |
5836 | 3460 oscar_free_name_data(data); |
3453 | 3461 } |
3462 | |
4075 | 3463 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 | 3464 GaimConnection *gc = sess->aux_data; |
4076 | 3465 gchar **msg1, **msg2; |
3466 GError *err = NULL; | |
6051 | 3467 int i, numtoks; |
4076 | 3468 |
4121 | 3469 if (!args->type || !args->msg || !args->uin) |
3470 return 1; | |
4194 | 3471 |
8660 | 3472 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3473 "Received a channel 4 message of type 0x%02hhx.\n", args->type); |
4076 | 3474 |
3475 /* Split up the message at the delimeter character, then convert each string to UTF-8 */ | |
4173 | 3476 msg1 = g_strsplit(args->msg, "\376", 0); |
6051 | 3477 for (numtoks=0; msg1[numtoks]; numtoks++); |
3478 msg2 = (gchar **)g_malloc((numtoks+1)*sizeof(gchar *)); | |
4076 | 3479 for (i=0; msg1[i]; i++) { |
7478
3c21f3084ff0
[gaim-migrate @ 8091]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
7475
diff
changeset
|
3480 gaim_str_strip_cr(msg1[i]); |
4076 | 3481 msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err); |
4800 | 3482 if (err) { |
8660 | 3483 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3484 "Error converting a string from ISO-8859-1 to " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3485 "UTF-8 in oscar ICBM channel 4 parsing\n"); |
4800 | 3486 g_error_free(err); |
3487 } | |
4076 | 3488 } |
3489 msg2[i] = NULL; | |
3490 | |
3952 | 3491 switch (args->type) { |
4173 | 3492 case 0x01: { /* MacICQ message or basic offline message */ |
4076 | 3493 if (i >= 1) { |
5556 | 3494 gchar *uin = g_strdup_printf("%u", args->uin); |
8493 | 3495 gchar *tmp; |
3496 | |
3497 /* If the message came from an ICQ user then escape any HTML */ | |
8501 | 3498 tmp = gaim_escape_html(msg2[0]); |
8493 | 3499 |
4076 | 3500 if (t) { /* This is an offline message */ |
3501 /* I think this timestamp is in UTC, or something */ | |
8514 | 3502 serv_got_im(gc, uin, tmp, 0, t); |
4076 | 3503 } else { /* This is a message from MacICQ/Miranda */ |
8514 | 3504 serv_got_im(gc, uin, tmp, 0, time(NULL)); |
4076 | 3505 } |
3506 g_free(uin); | |
8493 | 3507 g_free(tmp); |
4075 | 3508 } |
3316 | 3509 } break; |
3510 | |
4173 | 3511 case 0x04: { /* Someone sent you a URL */ |
4076 | 3512 if (i >= 2) { |
7385 | 3513 if (msg2[1] != NULL) { |
3514 gchar *uin = g_strdup_printf("%u", args->uin); | |
3515 gchar *message = g_strdup_printf("<A HREF=\"%s\">%s</A>", | |
3516 msg2[1], | |
3517 (msg2[0] && msg2[0][0]) ? msg2[0] : msg2[1]); | |
3518 serv_got_im(gc, uin, message, 0, time(NULL)); | |
3519 g_free(uin); | |
3520 g_free(message); | |
3521 } | |
3453 | 3522 } |
3523 } break; | |
3524 | |
4173 | 3525 case 0x06: { /* Someone requested authorization */ |
4076 | 3526 if (i >= 6) { |
4230 | 3527 struct name_data *data = g_new(struct name_data, 1); |
5556 | 3528 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.")); |
8660 | 3529 gaim_debug_info("oscar", |
5556 | 3530 "Received an authorization request from UIN %u\n", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3531 args->uin); |
4076 | 3532 data->gc = gc; |
5556 | 3533 data->name = g_strdup_printf("%u", args->uin); |
4230 | 3534 data->nick = NULL; |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3535 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3536 gaim_request_action(gc, NULL, _("Authorization Request"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3537 dialog_msg, 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3538 _("Authorize"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3539 G_CALLBACK(gaim_auth_grant), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3540 _("Deny"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3541 G_CALLBACK(gaim_auth_dontgrant_msgprompt)); |
4076 | 3542 g_free(dialog_msg); |
3543 } | |
3141 | 3544 } break; |
3545 | |
4173 | 3546 case 0x07: { /* Someone has denied you authorization */ |
4076 | 3547 if (i >= 1) { |
7023 | 3548 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
|
3549 gaim_notify_info(gc, NULL, _("ICQ authorization denied."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3550 dialog_msg); |
4076 | 3551 g_free(dialog_msg); |
3552 } | |
3141 | 3553 } break; |
3554 | |
4173 | 3555 case 0x08: { /* Someone has granted you authorization */ |
7023 | 3556 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
|
3557 gaim_notify_info(gc, NULL, "ICQ authorization accepted.", |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3558 dialog_msg); |
3141 | 3559 g_free(dialog_msg); |
3560 } break; | |
3561 | |
4333 | 3562 case 0x09: { /* Message from the Godly ICQ server itself, I think */ |
3563 if (i >= 5) { | |
3564 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
|
3565 gaim_notify_info(gc, NULL, "ICQ Server Message", dialog_msg); |
4333 | 3566 g_free(dialog_msg); |
3567 } | |
3568 } break; | |
3569 | |
4173 | 3570 case 0x0d: { /* Someone has sent you a pager message from http://www.icq.com/your_uin */ |
4076 | 3571 if (i >= 6) { |
4194 | 3572 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
|
3573 gaim_notify_info(gc, NULL, "ICQ Page", dialog_msg); |
4076 | 3574 g_free(dialog_msg); |
3575 } | |
4075 | 3576 } break; |
3577 | |
4173 | 3578 case 0x0e: { /* Someone has emailed you at your_uin@pager.icq.com */ |
4076 | 3579 if (i >= 6) { |
4308 | 3580 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
|
3581 gaim_notify_info(gc, NULL, "ICQ Email", dialog_msg); |
4076 | 3582 g_free(dialog_msg); |
3583 } | |
4075 | 3584 } break; |
3585 | |
4173 | 3586 case 0x12: { |
3141 | 3587 /* Ack for authorizing/denying someone. Or possibly an ack for sending any system notice */ |
7023 | 3588 /* Someone added you to their buddy list? */ |
3141 | 3589 } break; |
3590 | |
7023 | 3591 case 0x13: { /* Someone has sent you some ICQ buddies */ |
7631 | 3592 guint i, num; |
3453 | 3593 gchar **text; |
4173 | 3594 text = g_strsplit(args->msg, "\376", 0); |
3453 | 3595 if (text) { |
3596 num = 0; | |
3597 for (i=0; i<strlen(text[0]); i++) | |
3598 num = num*10 + text[0][i]-48; | |
3599 for (i=0; i<num; i++) { | |
4230 | 3600 struct name_data *data = g_new(struct name_data, 1); |
7023 | 3601 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 | 3602 data->gc = gc; |
4790 | 3603 data->name = g_strdup(text[i*2+1]); |
3604 data->nick = g_strdup(text[i*2+2]); | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3605 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3606 gaim_request_action(gc, NULL, message, |
7023 | 3607 _("Do you want to add this buddy " |
3608 "to your buddy list?"), | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
3609 0, data, 2, |
7023 | 3610 _("Add"), G_CALLBACK(gaim_icq_buddyadd), |
5836 | 3611 _("Decline"), G_CALLBACK(oscar_free_name_data)); |
3453 | 3612 g_free(message); |
3613 } | |
3614 g_strfreev(text); | |
3615 } | |
3616 } break; | |
3617 | |
7023 | 3618 case 0x1a: { /* Someone has sent you a greeting card or requested buddies? */ |
3453 | 3619 /* This is boring and silly. */ |
3620 } break; | |
3621 | |
3141 | 3622 default: { |
8660 | 3623 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3624 "Received a channel 4 message of unknown type " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3625 "(type 0x%02hhx).\n", args->type); |
3141 | 3626 } break; |
3627 } | |
3628 | |
4076 | 3629 g_strfreev(msg1); |
3630 g_strfreev(msg2); | |
3631 | |
3141 | 3632 return 1; |
3633 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3634 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3635 static int gaim_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...) { |
4200 | 3636 fu16_t channel; |
3637 int ret = 0; | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3638 aim_userinfo_t *userinfo; |
2086 | 3639 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3640 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3641 va_start(ap, fr); |
4200 | 3642 channel = (fu16_t)va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3643 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 3644 |
3141 | 3645 switch (channel) { |
3646 case 1: { /* standard message */ | |
3647 struct aim_incomingim_ch1_args *args; | |
3648 args = va_arg(ap, struct aim_incomingim_ch1_args *); | |
3649 ret = incomingim_chan1(sess, fr->conn, userinfo, args); | |
3650 } break; | |
3651 | |
8735
92cbf9713795
[gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents:
8733
diff
changeset
|
3652 case 2: { /* rendezvous */ |
3141 | 3653 struct aim_incomingim_ch2_args *args; |
3654 args = va_arg(ap, struct aim_incomingim_ch2_args *); | |
3655 ret = incomingim_chan2(sess, fr->conn, userinfo, args); | |
3656 } break; | |
3657 | |
3658 case 4: { /* ICQ */ | |
3659 struct aim_incomingim_ch4_args *args; | |
3660 args = va_arg(ap, struct aim_incomingim_ch4_args *); | |
4075 | 3661 ret = incomingim_chan4(sess, fr->conn, userinfo, args, 0); |
3141 | 3662 } break; |
3663 | |
3664 default: { | |
8660 | 3665 gaim_debug_warning("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3666 "ICBM received on unsupported channel (channel " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3667 "0x%04hx).", channel); |
3141 | 3668 } break; |
2086 | 3669 } |
3670 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3671 va_end(ap); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3672 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3673 return ret; |
2086 | 3674 } |
3675 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3676 static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { |
8733 | 3677 GaimConnection *gc = sess->aux_data; |
3678 GaimAccount *account = gaim_connection_get_account(gc); | |
3679 GaimConversation *conv; | |
5420 | 3680 char *buf; |
2086 | 3681 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3682 fu16_t chan, nummissed, reason; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3683 aim_userinfo_t *userinfo; |
2086 | 3684 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3685 va_start(ap, fr); |
4200 | 3686 chan = (fu16_t)va_arg(ap, unsigned int); |
3687 userinfo = va_arg(ap, aim_userinfo_t *); | |
3688 nummissed = (fu16_t)va_arg(ap, unsigned int); | |
3689 reason = (fu16_t)va_arg(ap, unsigned int); | |
2086 | 3690 va_end(ap); |
3691 | |
3692 switch(reason) { | |
5420 | 3693 case 0: /* Invalid (0) */ |
3694 buf = g_strdup_printf( | |
3695 ngettext( | |
4276 | 3696 "You missed %hu message from %s because it was invalid.", |
3697 "You missed %hu messages from %s because they were invalid.", | |
3698 nummissed), | |
4282 | 3699 nummissed, |
3700 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3701 break; |
5420 | 3702 case 1: /* Message too large */ |
3703 buf = g_strdup_printf( | |
3704 ngettext( | |
4276 | 3705 "You missed %hu message from %s because it was too large.", |
3706 "You missed %hu messages from %s because they were too large.", | |
3707 nummissed), | |
4282 | 3708 nummissed, |
3709 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3710 break; |
5420 | 3711 case 2: /* Rate exceeded */ |
3712 buf = g_strdup_printf( | |
3713 ngettext( | |
4276 | 3714 "You missed %hu message from %s because the rate limit has been exceeded.", |
3715 "You missed %hu messages from %s because the rate limit has been exceeded.", | |
3716 nummissed), | |
4282 | 3717 nummissed, |
3718 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3719 break; |
5420 | 3720 case 3: /* Evil Sender */ |
3721 buf = g_strdup_printf( | |
3722 ngettext( | |
4276 | 3723 "You missed %hu message from %s because he/she was too evil.", |
3724 "You missed %hu messages from %s because he/she was too evil.", | |
3725 nummissed), | |
4282 | 3726 nummissed, |
3727 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3728 break; |
5420 | 3729 case 4: /* Evil Receiver */ |
3730 buf = g_strdup_printf( | |
3731 ngettext( | |
4276 | 3732 "You missed %hu message from %s because you are too evil.", |
3733 "You missed %hu messages from %s because you are too evil.", | |
3734 nummissed), | |
4282 | 3735 nummissed, |
3736 userinfo->sn); | |
2086 | 3737 break; |
3738 default: | |
5420 | 3739 buf = g_strdup_printf( |
3740 ngettext( | |
4276 | 3741 "You missed %hu message from %s for an unknown reason.", |
3742 "You missed %hu messages from %s for an unknown reason.", | |
3743 nummissed), | |
4282 | 3744 nummissed, |
3745 userinfo->sn); | |
2086 | 3746 break; |
3747 } | |
8733 | 3748 |
3749 conv = gaim_find_conversation_with_account(userinfo->sn, account); | |
3750 if (conv != NULL) | |
3751 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_ERROR, time(NULL)); | |
3752 else | |
3753 gaim_notify_error(sess->aux_data, NULL, buf, NULL); | |
5420 | 3754 g_free(buf); |
2086 | 3755 |
3756 return 1; | |
3757 } | |
3758 | |
4194 | 3759 static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const char *cookie) { |
5575 | 3760 GaimConnection *gc = sess->aux_data; |
7283 | 3761 OscarData *od = gc->proto_data; |
4617 | 3762 |
3763 /* BBB */ | |
3630 | 3764 switch (reason) { |
4151 | 3765 case 3: { /* Decline sendfile. */ |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
3766 GaimXfer *xfer; |
8971 | 3767 struct oscar_direct_im *dim; |
3768 | |
8660 | 3769 gaim_debug_info("oscar", |
9070 | 3770 "AAA - Other user declined some sort of direct " |
8971 | 3771 "connect attempt (automaticly?)\n"); |
4617 | 3772 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
|
3773 gaim_xfer_cancel_remote(xfer); |
8971 | 3774 else if ((dim = oscar_direct_im_find(od, who))) { |
3775 /* AAA should use find by cookie or something here */ | |
3776 oscar_direct_im_disconnect(od, dim); | |
3777 } | |
4151 | 3778 } break; |
3779 | |
3780 default: { | |
8660 | 3781 gaim_debug_warning("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3782 "Received an unknown rendezvous client auto-response " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3783 "from %s. Type 0x%04hx\n", who, reason); |
4151 | 3784 } |
3630 | 3785 |
3786 } | |
3787 | |
3788 return 0; | |
3789 } | |
3790 | |
4194 | 3791 static int gaim_parse_clientauto_ch4(aim_session_t *sess, char *who, fu16_t reason, fu32_t state, char *msg) { |
5575 | 3792 GaimConnection *gc = sess->aux_data; |
4151 | 3793 |
3794 switch(reason) { | |
3795 case 0x0003: { /* Reply from an ICQ status message request */ | |
9244 | 3796 char *title, *statusmsg, **splitmsg, *dialogmsg; |
3797 | |
3798 title = g_strdup_printf(_("Info for %s"), who); | |
4151 | 3799 |
3800 /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ | |
9244 | 3801 statusmsg = oscar_icqstatus(state); |
4151 | 3802 splitmsg = g_strsplit(msg, "\r\n", 0); |
9244 | 3803 dialogmsg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<HR>%s"), who, statusmsg, g_strjoinv("<BR>", splitmsg)); |
3804 g_free(statusmsg); | |
4151 | 3805 g_strfreev(splitmsg); |
9244 | 3806 |
3807 gaim_notify_formatted(gc, title, _("Buddy Information"), NULL, dialogmsg, NULL, NULL); | |
3808 | |
3809 g_free(title); | |
3810 g_free(dialogmsg); | |
4151 | 3811 } break; |
3812 | |
3813 default: { | |
8660 | 3814 gaim_debug_warning("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3815 "Received an unknown client auto-response from %s. " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3816 "Type 0x%04hx\n", who, reason); |
4151 | 3817 } break; |
3818 } /* end of switch */ | |
3819 | |
3820 return 0; | |
3821 } | |
3822 | |
3212 | 3823 static int gaim_parse_clientauto(aim_session_t *sess, aim_frame_t *fr, ...) { |
3824 va_list ap; | |
3825 fu16_t chan, reason; | |
3826 char *who; | |
3827 | |
3828 va_start(ap, fr); | |
4200 | 3829 chan = (fu16_t)va_arg(ap, unsigned int); |
3212 | 3830 who = va_arg(ap, char *); |
4200 | 3831 reason = (fu16_t)va_arg(ap, unsigned int); |
3212 | 3832 |
3952 | 3833 if (chan == 0x0002) { /* File transfer declined */ |
3630 | 3834 char *cookie = va_arg(ap, char *); |
4151 | 3835 return gaim_parse_clientauto_ch2(sess, who, reason, cookie); |
3952 | 3836 } else if (chan == 0x0004) { /* ICQ message */ |
4200 | 3837 fu32_t state = 0; |
4151 | 3838 char *msg = NULL; |
3839 if (reason == 0x0003) { | |
4200 | 3840 state = va_arg(ap, fu32_t); |
4151 | 3841 msg = va_arg(ap, char *); |
3842 } | |
3843 return gaim_parse_clientauto_ch4(sess, who, reason, state, msg); | |
3844 } | |
3952 | 3845 |
3212 | 3846 va_end(ap); |
3847 | |
3848 return 1; | |
3849 } | |
3850 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3851 static int gaim_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3852 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3853 fu16_t reason; |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
3854 char *m; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3855 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3856 va_start(ap, fr); |
4199 | 3857 reason = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3858 va_end(ap); |
3859 | |
8660 | 3860 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3861 "snac threw error (reason 0x%04hx: %s)\n", reason, |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3862 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown"); |
2086 | 3863 |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
3864 m = g_strdup_printf(_("SNAC threw error: %s\n"), |
5411 | 3865 reason < msgerrreasonlen ? _(msgerrreason[reason]) : _("Unknown error")); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3866 gaim_notify_error(sess->aux_data, NULL, m, NULL); |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
3867 g_free(m); |
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
3868 |
2086 | 3869 return 1; |
3870 } | |
3871 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3872 static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
4617 | 3873 #if 0 |
5575 | 3874 GaimConnection *gc = sess->aux_data; |
7283 | 3875 OscarData *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
3876 GaimXfer *xfer; |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
3877 #endif |
4617 | 3878 va_list ap; |
3879 fu16_t reason; | |
3880 char *data, *buf; | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
3881 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3882 va_start(ap, fr); |
4617 | 3883 reason = (fu16_t)va_arg(ap, unsigned int); |
3752 | 3884 data = va_arg(ap, char *); |
2086 | 3885 va_end(ap); |
3886 | |
8660 | 3887 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3888 "Message error with data %s and reason %hu\n", data, reason); |
4617 | 3889 |
3890 /* BBB */ | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
3891 #if 0 |
4617 | 3892 /* If this was a file transfer request, data is a cookie */ |
3893 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
|
3894 gaim_xfer_cancel_remote(xfer); |
3630 | 3895 return 1; |
3896 } | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
3897 #endif |
3630 | 3898 |
4617 | 3899 /* Data is assumed to be the destination sn */ |
3900 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
|
3901 gaim_notify_error(sess->aux_data, NULL, buf, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3902 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); |
4617 | 3903 g_free(buf); |
2086 | 3904 |
3905 return 1; | |
3906 } | |
3907 | |
3595 | 3908 static int gaim_parse_mtn(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3909 GaimConnection *gc = sess->aux_data; |
3595 | 3910 va_list ap; |
3911 fu16_t type1, type2; | |
3912 char *sn; | |
3913 | |
3914 va_start(ap, fr); | |
4199 | 3915 type1 = (fu16_t) va_arg(ap, unsigned int); |
3595 | 3916 sn = va_arg(ap, char *); |
4199 | 3917 type2 = (fu16_t) va_arg(ap, unsigned int); |
3595 | 3918 va_end(ap); |
3919 | |
3920 switch (type2) { | |
3921 case 0x0000: { /* Text has been cleared */ | |
3922 serv_got_typing_stopped(gc, sn); | |
3923 } break; | |
3924 | |
3925 case 0x0001: { /* Paused typing */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
3926 serv_got_typing(gc, sn, 0, GAIM_TYPED); |
3595 | 3927 } break; |
3928 | |
3929 case 0x0002: { /* Typing */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
3930 serv_got_typing(gc, sn, 0, GAIM_TYPING); |
3595 | 3931 } break; |
3932 | |
3933 default: { | |
8660 | 3934 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 | 3935 } break; |
3936 } | |
3937 | |
3938 return 1; | |
3939 } | |
3940 | |
7141 | 3941 /* |
3942 * We get this error when there was an error in the locate family. This | |
7259 | 3943 * happens when you request info of someone who is offline. |
7141 | 3944 */ |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3945 static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
7259 | 3946 gchar *buf; |
2086 | 3947 va_list ap; |
5420 | 3948 fu16_t reason; |
2086 | 3949 char *destn; |
3950 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3951 va_start(ap, fr); |
4199 | 3952 reason = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3953 destn = va_arg(ap, char *); |
3954 va_end(ap); | |
3955 | |
7781 | 3956 if (destn == NULL) |
7793 | 3957 return 1; |
3958 | |
3959 buf = g_strdup_printf(_("User information for %s unavailable:"), destn); | |
7781 | 3960 |
3961 gaim_notify_error(sess->aux_data, NULL, buf, | |
3962 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); | |
3963 g_free(buf); | |
2086 | 3964 |
3965 return 1; | |
3966 } | |
3967 | |
7011 | 3968 static int gaim_parse_userinfo(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3969 GaimConnection *gc = sess->aux_data; |
8700 | 3970 GaimAccount *account = gaim_connection_get_account(gc); |
3971 GString *str; | |
9244 | 3972 gchar *tmp = NULL, *info_utf8 = NULL, *away_utf8 = NULL, *title = NULL; |
4791 | 3973 va_list ap; |
7011 | 3974 aim_userinfo_t *userinfo; |
2086 | 3975 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3976 va_start(ap, fr); |
7011 | 3977 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 3978 va_end(ap); |
3979 | |
8700 | 3980 str = g_string_new(""); |
3981 g_string_append_printf(str, "<b>%s:</b> %s", _("Screen Name"), userinfo->sn); | |
3982 g_string_append_printf(str, "\n<br><b>%s</b>: %d%%", _("Warning Level"), (int)((userinfo->warnlevel/10.0) + 0.5)); | |
7011 | 3983 |
3984 if (userinfo->present & AIM_USERINFO_PRESENT_ONLINESINCE) | |
8701 | 3985 oscar_string_append(str, "\n<br>", _("Online Since"), |
8700 | 3986 asctime(localtime((time_t *)&userinfo->onlinesince))); |
7011 | 3987 |
3988 if (userinfo->present & AIM_USERINFO_PRESENT_MEMBERSINCE) | |
8701 | 3989 oscar_string_append(str, "\n<br>", _("Member Since"), |
8700 | 3990 asctime(localtime((time_t *)&userinfo->membersince))); |
7011 | 3991 |
3992 if (userinfo->present & AIM_USERINFO_PRESENT_IDLE) { | |
8700 | 3993 tmp = gaim_str_seconds_to_string(userinfo->idletime*60); |
8701 | 3994 oscar_string_append(str, "\n<br>", _("Idle"), tmp); |
8700 | 3995 g_free(tmp); |
3996 } | |
3997 | |
8701 | 3998 oscar_string_append_info(gc, str, "\n<br>", NULL, userinfo); |
7011 | 3999 |
4000 if ((userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) { | |
8700 | 4001 tmp = oscar_encoding_extract(userinfo->away_encoding); |
4002 away_utf8 = oscar_encoding_to_utf8(tmp, userinfo->away, userinfo->away_len); | |
4003 g_free(tmp); | |
7011 | 4004 if (away_utf8 != NULL) { |
8700 | 4005 g_string_append_printf(str, "\n<hr>%s", away_utf8); |
7011 | 4006 g_free(away_utf8); |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
4007 } |
7011 | 4008 } |
4009 | |
4010 if ((userinfo->info_len > 0) && (userinfo->info != NULL) && (userinfo->info_encoding != NULL)) { | |
8700 | 4011 tmp = oscar_encoding_extract(userinfo->info_encoding); |
4012 info_utf8 = oscar_encoding_to_utf8(tmp, userinfo->info, userinfo->info_len); | |
4013 g_free(tmp); | |
7011 | 4014 if (info_utf8 != NULL) { |
8700 | 4015 g_string_append_printf(str, "\n<hr>%s", info_utf8); |
7011 | 4016 g_free(info_utf8); |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
4017 } |
7011 | 4018 } |
4019 | |
8701 | 4020 tmp = gaim_str_sub_away_formatters(str->str, gaim_account_get_username(account)); |
8700 | 4021 g_string_free(str, TRUE); |
9244 | 4022 title = g_strdup_printf(_("Info for %s"), userinfo->sn); |
4023 gaim_notify_formatted(gc, title, _("Buddy Information"), NULL, tmp, NULL, NULL); | |
4024 g_free(title); | |
8700 | 4025 g_free(tmp); |
4151 | 4026 |
2086 | 4027 return 1; |
4028 } | |
4029 | |
8341 | 4030 static gboolean gaim_reqinfo_timeout_cb(void *data) |
4031 { | |
4032 aim_session_t *sess = data; | |
4033 GaimConnection *gc = sess->aux_data; | |
4034 OscarData *od = (OscarData *)gc->proto_data; | |
4035 | |
4036 aim_locate_dorequest(data); | |
4037 od->getinfotimer = 0; | |
4038 | |
4039 return FALSE; | |
4040 } | |
4041 | |
4042 static int gaim_reqinfo_timeout(aim_session_t *sess, aim_frame_t *fr, ...) | |
4043 { | |
4044 GaimConnection *gc = sess->aux_data; | |
4045 OscarData *od = (OscarData *)gc->proto_data; | |
4046 | |
4047 /* | |
4048 * Wait a little while then call aim_locate_dorequest(sess). This keeps | |
4049 * us from hitting the rate limit due to request away messages and info | |
4050 * too quickly. | |
4051 */ | |
4052 if (od->getinfotimer == 0) | |
4053 od->getinfotimer = gaim_timeout_add(1200, gaim_reqinfo_timeout_cb, sess); | |
4054 | |
4055 return 1; | |
4056 } | |
4057 | |
4058 static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) | |
4059 { | |
2086 | 4060 char *msg; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4061 fu16_t id; |
2086 | 4062 va_list ap; |
4063 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4064 va_start(ap, fr); |
4199 | 4065 id = (fu16_t) va_arg(ap, unsigned int); |
2086 | 4066 msg = va_arg(ap, char *); |
4067 va_end(ap); | |
4068 | |
8660 | 4069 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4070 "MOTD: %s (%hu)\n", msg ? msg : "Unknown", id); |
2092
59b0377d18aa
[gaim-migrate @ 2102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
4071 if (id < 4) |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4072 gaim_notify_warning(sess->aux_data, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4073 _("Your AIM connection may be lost."), NULL); |
2086 | 4074 |
4075 return 1; | |
4076 } | |
4077 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4078 static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 4079 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4080 fu16_t type; |
5575 | 4081 GaimConnection *gc = sess->aux_data; |
7283 | 4082 OscarData *od = (OscarData *)gc->proto_data; |
2086 | 4083 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4084 va_start(ap, fr); |
4199 | 4085 type = (fu16_t) va_arg(ap, unsigned int); |
2086 | 4086 |
4087 switch(type) { | |
4088 case 0x0002: { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4089 fu8_t maxrooms; |
2086 | 4090 struct aim_chat_exchangeinfo *exchanges; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4091 int exchangecount, i; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4092 |
4199 | 4093 maxrooms = (fu8_t) va_arg(ap, unsigned int); |
2086 | 4094 exchangecount = va_arg(ap, int); |
4095 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *); | |
4096 | |
8660 | 4097 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4098 "chat info: Chat Rights:\n"); |
8660 | 4099 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4100 "chat info: \tMax Concurrent Rooms: %hhd\n", maxrooms); |
8660 | 4101 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4102 "chat info: \tExchange List: (%d total)\n", exchangecount); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4103 for (i = 0; i < exchangecount; i++) |
8660 | 4104 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4105 "chat info: \t\t%hu %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4106 exchanges[i].number, exchanges[i].name ? exchanges[i].name : ""); |
4617 | 4107 while (od->create_rooms) { |
4108 struct create_room *cr = od->create_rooms->data; | |
8660 | 4109 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4110 "creating room %s\n", cr->name); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
4111 aim_chatnav_createroom(sess, fr->conn, cr->name, cr->exchange); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
4112 g_free(cr->name); |
4617 | 4113 od->create_rooms = g_slist_remove(od->create_rooms, cr); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
4114 g_free(cr); |
2086 | 4115 } |
4116 } | |
4117 break; | |
4118 case 0x0008: { | |
4119 char *fqcn, *name, *ck; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4120 fu16_t instance, flags, maxmsglen, maxoccupancy, unknown, exchange; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4121 fu8_t createperms; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4122 fu32_t createtime; |
2086 | 4123 |
4124 fqcn = va_arg(ap, char *); | |
4200 | 4125 instance = (fu16_t)va_arg(ap, unsigned int); |
4126 exchange = (fu16_t)va_arg(ap, unsigned int); | |
4127 flags = (fu16_t)va_arg(ap, unsigned int); | |
4128 createtime = va_arg(ap, fu32_t); | |
4129 maxmsglen = (fu16_t)va_arg(ap, unsigned int); | |
4130 maxoccupancy = (fu16_t)va_arg(ap, unsigned int); | |
4131 createperms = (fu8_t)va_arg(ap, unsigned int); | |
4132 unknown = (fu16_t)va_arg(ap, unsigned int); | |
4133 name = va_arg(ap, char *); | |
4134 ck = va_arg(ap, char *); | |
4194 | 4135 |
8660 | 4136 gaim_debug_misc("oscar", |
5556 | 4137 "created room: %s %hu %hu %hu %u %hu %hu %hhu %hu %s %s\n", |
2086 | 4138 fqcn, |
4139 exchange, instance, flags, | |
4140 createtime, | |
4141 maxmsglen, maxoccupancy, createperms, unknown, | |
4142 name, ck); | |
4617 | 4143 aim_chat_join(od->sess, od->conn, exchange, ck, instance); |
2086 | 4144 } |
4145 break; | |
4146 default: | |
8660 | 4147 gaim_debug_warning("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4148 "chatnav info: unknown type (%04hx)\n", type); |
2086 | 4149 break; |
4150 } | |
4194 | 4151 |
4152 va_end(ap); | |
4153 | |
2086 | 4154 return 1; |
4155 } | |
4156 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
4157 static int gaim_conv_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 4158 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4159 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
4160 aim_userinfo_t *info; |
5575 | 4161 GaimConnection *g = sess->aux_data; |
2086 | 4162 |
4163 struct chat_connection *c = NULL; | |
4164 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4165 va_start(ap, fr); |
2086 | 4166 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
4167 info = va_arg(ap, aim_userinfo_t *); |
2086 | 4168 va_end(ap); |
4169 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4170 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 4171 if (!c) |
4172 return 1; | |
4173 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4174 for (i = 0; i < count; i++) |
8733 | 4175 gaim_conv_chat_add_user(GAIM_CONV_CHAT(c->conv), info[i].sn, NULL); |
2086 | 4176 |
4177 return 1; | |
4178 } | |
4179 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
4180 static int gaim_conv_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 4181 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4182 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
4183 aim_userinfo_t *info; |
5575 | 4184 GaimConnection *g = sess->aux_data; |
2086 | 4185 |
4186 struct chat_connection *c = NULL; | |
4187 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4188 va_start(ap, fr); |
2086 | 4189 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
4190 info = va_arg(ap, aim_userinfo_t *); |
2086 | 4191 va_end(ap); |
4192 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4193 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 4194 if (!c) |
4195 return 1; | |
4196 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4197 for (i = 0; i < count; i++) |
8733 | 4198 gaim_conv_chat_remove_user(GAIM_CONV_CHAT(c->conv), info[i].sn, NULL); |
2086 | 4199 |
4200 return 1; | |
4201 } | |
4202 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
4203 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
|
4204 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
4205 aim_userinfo_t *userinfo; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4206 struct aim_chat_roominfo *roominfo; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4207 char *roomname; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4208 int usercount; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4209 char *roomdesc; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4210 fu16_t unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4211 fu32_t creationtime; |
5575 | 4212 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4213 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
|
4214 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4215 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4216 roominfo = va_arg(ap, struct aim_chat_roominfo *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4217 roomname = va_arg(ap, char *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4218 usercount= va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
4219 userinfo = va_arg(ap, aim_userinfo_t *); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4220 roomdesc = va_arg(ap, char *); |
4200 | 4221 unknown_c9 = (fu16_t)va_arg(ap, unsigned int); |
4222 creationtime = va_arg(ap, fu32_t); | |
4223 maxmsglen = (fu16_t)va_arg(ap, unsigned int); | |
4224 unknown_d2 = (fu16_t)va_arg(ap, unsigned int); | |
4225 unknown_d5 = (fu16_t)va_arg(ap, unsigned int); | |
4226 maxvisiblemsglen = (fu16_t)va_arg(ap, unsigned int); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4227 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4228 |
8660 | 4229 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4230 "inside chat_info_update (maxmsglen = %hu, maxvislen = %hu)\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4231 maxmsglen, maxvisiblemsglen); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4232 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4233 ccon->maxlen = maxmsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4234 ccon->maxvis = maxvisiblemsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4235 |
2086 | 4236 return 1; |
4237 } | |
4238 | |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
4239 static int gaim_conv_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4240 GaimConnection *gc = sess->aux_data; |
8225 | 4241 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); |
4242 gchar *utf8; | |
2086 | 4243 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
4244 aim_userinfo_t *info; |
8225 | 4245 int len; |
2086 | 4246 char *msg; |
8219 | 4247 char *charset; |
2086 | 4248 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4249 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
4250 info = va_arg(ap, aim_userinfo_t *); |
8219 | 4251 len = va_arg(ap, int); |
4194 | 4252 msg = va_arg(ap, char *); |
8219 | 4253 charset = va_arg(ap, char *); |
4194 | 4254 va_end(ap); |
2086 | 4255 |
8225 | 4256 utf8 = oscar_encoding_to_utf8(charset, msg, len); |
8667 | 4257 if (utf8 == NULL) |
4258 /* The conversion failed! */ | |
8668 | 4259 utf8 = g_strdup(_("[Unable to display a message from this user because it contained invalid characters.]")); |
8225 | 4260 serv_got_chat_in(gc, ccon->id, info->sn, 0, utf8, time((time_t)NULL)); |
4261 g_free(utf8); | |
2086 | 4262 |
4263 return 1; | |
4264 } | |
4265 | |
3694 | 4266 static int gaim_email_parseupdate(aim_session_t *sess, aim_frame_t *fr, ...) { |
4267 va_list ap; | |
5575 | 4268 GaimConnection *gc = sess->aux_data; |
3694 | 4269 struct aim_emailinfo *emailinfo; |
3725 | 4270 int havenewmail; |
7297 | 4271 char *alertitle, *alerturl; |
3694 | 4272 |
4273 va_start(ap, fr); | |
4274 emailinfo = va_arg(ap, struct aim_emailinfo *); | |
3725 | 4275 havenewmail = va_arg(ap, int); |
7301 | 4276 alertitle = va_arg(ap, char *); |
4277 alerturl = va_arg(ap, char *); | |
3694 | 4278 va_end(ap); |
4279 | |
5628 | 4280 if (emailinfo && gaim_account_get_check_mail(gc->account)) { |
5575 | 4281 gchar *to = g_strdup_printf("%s@%s", gaim_account_get_username(gaim_connection_get_account(gc)), emailinfo->domain); |
5542 | 4282 if (emailinfo->unread && havenewmail) |
4283 gaim_notify_emails(gc, emailinfo->nummsgs, FALSE, NULL, NULL, (const char **)&to, (const char **)&emailinfo->url, NULL, NULL); | |
5537 | 4284 g_free(to); |
3694 | 4285 } |
7297 | 4286 |
7301 | 4287 if (alertitle) |
8660 | 4288 gaim_debug_misc("oscar", "Got an alert '%s' %s\n", alertitle, alerturl ? alerturl : ""); |
3694 | 4289 |
4290 return 1; | |
4291 } | |
4292 | |
4804 | 4293 static int gaim_icon_error(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4294 GaimConnection *gc = sess->aux_data; |
7283 | 4295 OscarData *od = gc->proto_data; |
4804 | 4296 char *sn; |
4297 | |
4298 sn = od->requesticon->data; | |
8660 | 4299 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4300 "removing %s from hash table\n", sn); |
4804 | 4301 od->requesticon = g_slist_remove(od->requesticon, sn); |
4302 free(sn); | |
4303 | |
4304 if (od->icontimer) | |
8287
ef881489396e
[gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents:
8273
diff
changeset
|
4305 gaim_timeout_remove(od->icontimer); |
8273
f24172f53650
[gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents:
8266
diff
changeset
|
4306 od->icontimer = gaim_timeout_add(500, gaim_icon_timerfunc, gc); |
4804 | 4307 |
4308 return 1; | |
4309 } | |
4310 | |
4311 static int gaim_icon_parseicon(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 4312 GaimConnection *gc = sess->aux_data; |
7283 | 4313 OscarData *od = gc->proto_data; |
4804 | 4314 GSList *cur; |
4315 va_list ap; | |
4316 char *sn; | |
4853 | 4317 fu8_t *iconcsum, *icon; |
4318 fu16_t iconcsumlen, iconlen; | |
4804 | 4319 |
4320 va_start(ap, fr); | |
4321 sn = va_arg(ap, char *); | |
4853 | 4322 iconcsum = va_arg(ap, fu8_t *); |
4323 iconcsumlen = va_arg(ap, int); | |
4804 | 4324 icon = va_arg(ap, fu8_t *); |
4325 iconlen = va_arg(ap, int); | |
4326 va_end(ap); | |
4327 | |
4853 | 4328 if (iconlen > 0) { |
4329 char *b16; | |
6695 | 4330 GaimBuddy *b = gaim_find_buddy(gc->account, sn); |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
4331 gaim_buddy_icons_set_for_user(gaim_connection_get_account(gc), |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
4332 sn, icon, iconlen); |
7106
db6bd3e794d8
[gaim-migrate @ 7671]
Christian Hammond <chipx86@chipx86.com>
parents:
7098
diff
changeset
|
4333 b16 = gaim_base16_encode(iconcsum, iconcsumlen); |
5129 | 4334 if (b16) { |
7693 | 4335 gaim_blist_node_set_string((GaimBlistNode*)b, "icon_checksum", b16); |
7162 | 4336 g_free(b16); |
5129 | 4337 } |
4853 | 4338 } |
4804 | 4339 |
4340 cur = od->requesticon; | |
4341 while (cur) { | |
4342 char *cursn = cur->data; | |
4343 if (!aim_sncmp(cursn, sn)) { | |
4344 od->requesticon = g_slist_remove(od->requesticon, cursn); | |
4345 free(cursn); | |
4346 cur = od->requesticon; | |
4347 } else | |
4348 cur = cur->next; | |
4349 } | |
4350 | |
4351 if (od->icontimer) | |
8287
ef881489396e
[gaim-migrate @ 9011]
Christian Hammond <chipx86@chipx86.com>
parents:
8273
diff
changeset
|
4352 gaim_timeout_remove(od->icontimer); |
8273
f24172f53650
[gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents:
8266
diff
changeset
|
4353 od->icontimer = gaim_timeout_add(250, gaim_icon_timerfunc, gc); |
4804 | 4354 |
4355 return 1; | |
4356 } | |
4357 | |
4358 static gboolean gaim_icon_timerfunc(gpointer data) { | |
5575 | 4359 GaimConnection *gc = data; |
7283 | 4360 OscarData *od = gc->proto_data; |
7011 | 4361 aim_userinfo_t *userinfo; |
4804 | 4362 aim_conn_t *conn; |
4363 | |
4364 conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON); | |
5892 | 4365 if (!conn) { |
4366 if (!od->iconconnecting) { | |
4367 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); | |
4368 od->iconconnecting = TRUE; | |
4369 } | |
4804 | 4370 return FALSE; |
4371 } | |
4372 | |
5842 | 4373 if (od->set_icon) { |
6039 | 4374 struct stat st; |
4375 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); | |
4376 if (iconfile == NULL) { | |
8363 | 4377 aim_ssi_delicon(od->sess); |
6039 | 4378 } else if (!stat(iconfile, &st)) { |
4379 char *buf = g_malloc(st.st_size); | |
4380 FILE *file = fopen(iconfile, "rb"); | |
4381 if (file) { | |
4382 fread(buf, 1, st.st_size, file); | |
4383 fclose(file); | |
8660 | 4384 gaim_debug_info("oscar", |
6039 | 4385 "Uploading icon to icon server\n"); |
6879 | 4386 aim_bart_upload(od->sess, buf, st.st_size); |
5842 | 4387 } else |
8660 | 4388 gaim_debug_error("oscar", |
6039 | 4389 "Can't open buddy icon file!\n"); |
4390 g_free(buf); | |
4391 } else { | |
8660 | 4392 gaim_debug_error("oscar", |
6039 | 4393 "Can't stat buddy icon file!\n"); |
5842 | 4394 } |
4395 od->set_icon = FALSE; | |
4396 } | |
4397 | |
4398 if (!od->requesticon) { | |
8660 | 4399 gaim_debug_misc("oscar", |
5842 | 4400 "no more icons to request\n"); |
4401 return FALSE; | |
4402 } | |
4403 | |
7045 | 4404 userinfo = aim_locate_finduserinfo(od->sess, (char *)od->requesticon->data); |
7011 | 4405 if ((userinfo != NULL) && (userinfo->iconcsumlen > 0)) { |
4406 aim_bart_request(od->sess, od->requesticon->data, userinfo->iconcsum, userinfo->iconcsumlen); | |
4804 | 4407 return FALSE; |
4408 } else { | |
4409 char *sn = od->requesticon->data; | |
4410 od->requesticon = g_slist_remove(od->requesticon, sn); | |
4411 free(sn); | |
4412 } | |
4413 | |
4414 return TRUE; | |
4415 } | |
4416 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4417 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4418 * 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
|
4419 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4420 static int gaim_parse_msgack(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 4421 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4422 fu16_t type; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4423 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4424 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4425 va_start(ap, fr); |
4199 | 4426 type = (fu16_t) va_arg(ap, unsigned int); |
2086 | 4427 sn = va_arg(ap, char *); |
4428 va_end(ap); | |
4429 | |
8660 | 4430 gaim_debug_info("oscar", "Sent message to %s.\n", sn); |
2086 | 4431 |
4432 return 1; | |
4433 } | |
4434 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4435 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
|
4436 static const char *codes[5] = { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4437 "invalid", |
4194 | 4438 "change", |
4439 "warning", | |
4440 "limit", | |
4441 "limit cleared", | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4442 }; |
2086 | 4443 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4444 fu16_t code, rateclass; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4445 fu32_t windowsize, clear, alert, limit, disconnect, currentavg, maxavg; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4446 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4447 va_start(ap, fr); |
4200 | 4448 code = (fu16_t)va_arg(ap, unsigned int); |
4449 rateclass= (fu16_t)va_arg(ap, unsigned int); | |
4450 windowsize = va_arg(ap, fu32_t); | |
4451 clear = va_arg(ap, fu32_t); | |
4452 alert = va_arg(ap, fu32_t); | |
4453 limit = va_arg(ap, fu32_t); | |
4454 disconnect = va_arg(ap, fu32_t); | |
4455 currentavg = va_arg(ap, fu32_t); | |
4456 maxavg = va_arg(ap, fu32_t); | |
2086 | 4457 va_end(ap); |
4458 | |
8660 | 4459 gaim_debug_misc("oscar", |
5556 | 4460 "rate %s (param ID 0x%04hx): curavg = %u, maxavg = %u, alert at %u, " |
4461 "clear warning at %u, limit at %u, disconnect at %u (window size = %u)\n", | |
2086 | 4462 (code < 5) ? codes[code] : codes[0], |
4463 rateclass, | |
4464 currentavg, maxavg, | |
4465 alert, clear, | |
4466 limit, disconnect, | |
4467 windowsize); | |
4468 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4469 /* XXX fix these values */ |
2086 | 4470 if (code == AIM_RATE_CODE_CHANGE) { |
4471 if (currentavg >= clear) | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4472 aim_conn_setlatency(fr->conn, 0); |
2086 | 4473 } else if (code == AIM_RATE_CODE_WARNING) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4474 aim_conn_setlatency(fr->conn, windowsize/4); |
2909
48ec70928d7f
[gaim-migrate @ 2922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2906
diff
changeset
|
4475 } else if (code == AIM_RATE_CODE_LIMIT) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4476 gaim_notify_error(sess->aux_data, NULL, _("Rate limiting error."), |
6040 | 4477 _("The last action you attempted could not be " |
4478 "performed because you are over the rate limit. " | |
4479 "Please wait 10 seconds and try again.")); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4480 aim_conn_setlatency(fr->conn, windowsize/2); |
2086 | 4481 } else if (code == AIM_RATE_CODE_CLEARLIMIT) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4482 aim_conn_setlatency(fr->conn, 0); |
2086 | 4483 } |
4484 | |
4485 return 1; | |
4486 } | |
4487 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4488 static int gaim_parse_evilnotify(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 4489 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4490 fu16_t newevil; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
4491 aim_userinfo_t *userinfo; |
5575 | 4492 GaimConnection *gc = sess->aux_data; |
2086 | 4493 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4494 va_start(ap, fr); |
4199 | 4495 newevil = (fu16_t) va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
4496 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 4497 va_end(ap); |
4498 | |
7111 | 4499 serv_got_eviled(gc, (userinfo && userinfo->sn) ? userinfo->sn : NULL, (newevil/10.0) + 0.5); |
2086 | 4500 |
4501 return 1; | |
4502 } | |
4503 | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
4504 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
|
4505 va_list ap; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
4506 aim_userinfo_t *info; |
5575 | 4507 GaimConnection *gc = sess->aux_data; |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
4508 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
4509 va_start(ap, fr); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
4510 info = va_arg(ap, aim_userinfo_t *); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
4511 va_end(ap); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
4512 |
5628 | 4513 gc->evil = (info->warnlevel/10.0) + 0.5; |
4841 | 4514 |
7872 | 4515 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) |
4841 | 4516 gc->login_time_official = info->onlinesince; |
7872 | 4517 else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) |
4518 gc->login_time_official = time(NULL) - info->sessionlen; | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
4519 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
4520 return 1; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
4521 } |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
4522 |
4649 | 4523 static int gaim_connerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4524 GaimConnection *gc = sess->aux_data; |
7283 | 4525 OscarData *od = gc->proto_data; |
4649 | 4526 va_list ap; |
4527 fu16_t code; | |
4528 char *msg; | |
4529 | |
4530 va_start(ap, fr); | |
4531 code = (fu16_t)va_arg(ap, int); | |
4532 msg = va_arg(ap, char *); | |
4533 va_end(ap); | |
4534 | |
8660 | 4535 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4536 "Disconnected. Code is 0x%04x and msg is %s\n", code, msg); |
4649 | 4537 if ((fr) && (fr->conn) && (fr->conn->type == AIM_CONN_TYPE_BOS)) { |
4651 | 4538 if (code == 0x0001) { |
6113 | 4539 gc->wants_to_die = TRUE; |
5579 | 4540 gaim_connection_error(gc, _("You have been disconnected because you have signed on with this screen name at another location.")); |
4651 | 4541 } else { |
5579 | 4542 gaim_connection_error(gc, _("You have been signed off for an unknown reason.")); |
4651 | 4543 } |
4666 | 4544 od->killme = TRUE; |
4649 | 4545 } |
4546 | |
4547 return 1; | |
4548 } | |
4549 | |
2675 | 4550 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) { |
7283 | 4551 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4552 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
4553 aim_reqpersonalinfo(sess, fr->conn); |
4230 | 4554 |
4555 #ifndef NOSSI | |
8660 | 4556 gaim_debug_info("oscar", "ssi: requesting rights and list\n"); |
4889 | 4557 aim_ssi_reqrights(sess); |
6350 | 4558 aim_ssi_reqdata(sess); |
4230 | 4559 #endif |
4560 | |
7011 | 4561 aim_locate_reqrights(sess); |
7285 | 4562 aim_buddylist_reqrights(sess, fr->conn); |
4617 | 4563 aim_im_reqparams(sess); |
7334 | 4564 aim_bos_reqrights(sess, fr->conn); /* XXX - Don't call this with ssi */ |
4230 | 4565 |
4566 #ifdef NOSSI | |
8660 | 4567 gaim_debug_info("oscar", "bos: requesting rights\n"); |
7334 | 4568 aim_bos_reqrights(sess, fr->conn); |
4230 | 4569 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS); |
4570 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE | AIM_PRIVFLAGS_ALLOWMEMBERSINCE); | |
4571 #endif | |
2086 | 4572 |
7283 | 4573 gaim_connection_update_progress(gc, _("Finalizing connection"), 5, OSCAR_CONNECT_STEPS); |
4574 | |
2086 | 4575 return 1; |
4576 } | |
4577 | |
2675 | 4578 static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4579 GaimConnection *gc = sess->aux_data; |
7283 | 4580 OscarData *od = gc->proto_data; |
2647 | 4581 |
6905 | 4582 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0003, gaim_info_change, 0); |
4583 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0005, gaim_info_change, 0); | |
4584 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0007, gaim_account_confirm, 0); | |
4585 | |
2672 | 4586 aim_clientready(sess, fr->conn); |
8660 | 4587 gaim_debug_info("oscar", "connected to admin\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4588 |
2647 | 4589 if (od->chpass) { |
8660 | 4590 gaim_debug_info("oscar", "changing password\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
4591 aim_admin_changepasswd(sess, fr->conn, od->newp, od->oldp); |
2647 | 4592 g_free(od->oldp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4593 od->oldp = NULL; |
2647 | 4594 g_free(od->newp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4595 od->newp = NULL; |
2647 | 4596 od->chpass = FALSE; |
4597 } | |
2979 | 4598 if (od->setnick) { |
8660 | 4599 gaim_debug_info("oscar", "formatting screen name\n"); |
2979 | 4600 aim_admin_setnick(sess, fr->conn, od->newsn); |
4601 g_free(od->newsn); | |
4602 od->newsn = NULL; | |
4603 od->setnick = FALSE; | |
4604 } | |
2647 | 4605 if (od->conf) { |
8660 | 4606 gaim_debug_info("oscar", "confirming account\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
4607 aim_admin_reqconfirm(sess, fr->conn); |
2647 | 4608 od->conf = FALSE; |
4609 } | |
4610 if (od->reqemail) { | |
8660 | 4611 gaim_debug_info("oscar", "requesting email\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
4612 aim_admin_getinfo(sess, fr->conn, 0x0011); |
2647 | 4613 od->reqemail = FALSE; |
4614 } | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4615 if (od->setemail) { |
8660 | 4616 gaim_debug_info("oscar", "setting email\n"); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4617 aim_admin_setemail(sess, fr->conn, od->email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4618 g_free(od->email); |
5497 | 4619 od->email = NULL; |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4620 od->setemail = FALSE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4621 } |
2647 | 4622 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4623 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4624 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4625 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4626 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
|
4627 struct aim_icbmparameters *params; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4628 va_list ap; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4629 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4630 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4631 params = va_arg(ap, struct aim_icbmparameters *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4632 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4633 |
4194 | 4634 /* XXX - evidently this crashes on solaris. i have no clue why |
8660 | 4635 gaim_debug_misc("oscar", "ICBM Parameters: maxchannel = %hu, default flags = 0x%08lx, max msg len = %hu, " |
5556 | 4636 "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
|
4637 params->maxchan, params->flags, params->maxmsglen, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4638 ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4639 params->minmsginterval); |
2427
5bc3b39fc0a5
[gaim-migrate @ 2440]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2421
diff
changeset
|
4640 */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4641 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4642 /* Maybe senderwarn and recverwarn should be user preferences... */ |
3595 | 4643 params->flags = 0x0000000b; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4644 params->maxmsglen = 8000; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4645 params->minmsginterval = 0; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4646 |
4617 | 4647 aim_im_setparams(sess, params); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4648 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4649 return 1; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4650 } |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
4651 |
2993 | 4652 static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) |
4653 { | |
5575 | 4654 GaimConnection *gc = sess->aux_data; |
7283 | 4655 OscarData *od = (OscarData *)gc->proto_data; |
5306 | 4656 va_list ap; |
4657 fu16_t maxsiglen; | |
2993 | 4658 |
4659 va_start(ap, fr); | |
4199 | 4660 maxsiglen = (fu16_t) va_arg(ap, int); |
2993 | 4661 va_end(ap); |
4662 | |
8660 | 4663 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4664 "locate rights: max sig len = %d\n", maxsiglen); |
2993 | 4665 |
4617 | 4666 od->rights.maxsiglen = od->rights.maxawaymsglen = (guint)maxsiglen; |
4667 | |
4668 if (od->icq) | |
7334 | 4669 aim_locate_setcaps(od->sess, caps_icq); |
5301 | 4670 else |
7334 | 4671 aim_locate_setcaps(od->sess, caps_aim); |
4672 oscar_set_info(gc, gc->account->user_info); | |
2993 | 4673 |
4674 return 1; | |
4675 } | |
4676 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4677 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
|
4678 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4679 fu16_t maxbuddies, maxwatchers; |
5575 | 4680 GaimConnection *gc = sess->aux_data; |
7283 | 4681 OscarData *od = (OscarData *)gc->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4682 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4683 va_start(ap, fr); |
4199 | 4684 maxbuddies = (fu16_t) va_arg(ap, unsigned int); |
4685 maxwatchers = (fu16_t) va_arg(ap, unsigned int); | |
2086 | 4686 va_end(ap); |
4687 | |
8660 | 4688 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4689 "buddy list rights: Max buddies = %hu / Max watchers = %hu\n", maxbuddies, maxwatchers); |
2086 | 4690 |
4617 | 4691 od->rights.maxbuddies = (guint)maxbuddies; |
4692 od->rights.maxwatchers = (guint)maxwatchers; | |
2993 | 4693 |
2086 | 4694 return 1; |
4695 } | |
4696 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4697 static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4698 GaimConnection *gc = sess->aux_data; |
7283 | 4699 OscarData *od = (OscarData *)gc->proto_data; |
7334 | 4700 va_list ap; |
4701 fu16_t maxpermits, maxdenies; | |
2086 | 4702 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4703 va_start(ap, fr); |
4199 | 4704 maxpermits = (fu16_t) va_arg(ap, unsigned int); |
4705 maxdenies = (fu16_t) va_arg(ap, unsigned int); | |
2086 | 4706 va_end(ap); |
4707 | |
8660 | 4708 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4709 "BOS rights: Max permit = %hu / Max deny = %hu\n", maxpermits, maxdenies); |
2086 | 4710 |
4617 | 4711 od->rights.maxpermits = (guint)maxpermits; |
4712 od->rights.maxdenies = (guint)maxdenies; | |
2993 | 4713 |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
4714 gaim_connection_set_state(gc, GAIM_CONNECTED); |
2993 | 4715 serv_finish_login(gc); |
4716 | |
8660 | 4717 gaim_debug_info("oscar", "buddy list loaded\n"); |
2993 | 4718 |
2672 | 4719 aim_clientready(sess, fr->conn); |
5948 | 4720 aim_srv_setavailmsg(sess, NULL); |
7474 | 4721 aim_srv_setidle(sess, 0); |
4617 | 4722 |
4664 | 4723 if (od->icq) { |
4724 aim_icq_reqofflinemsgs(sess); | |
4725 aim_icq_hideip(sess); | |
4726 } | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4727 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
4728 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV); |
4102 | 4729 if (sess->authinfo->email) |
4730 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_EMAIL); | |
2086 | 4731 |
4732 return 1; | |
4733 } | |
4734 | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4735 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
|
4736 va_list ap; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4737 struct aim_icq_offlinemsg *msg; |
4075 | 4738 struct aim_incomingim_ch4_args args; |
4739 time_t t; | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4740 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4741 va_start(ap, fr); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4742 msg = va_arg(ap, struct aim_icq_offlinemsg *); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4743 va_end(ap); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4744 |
8660 | 4745 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4746 "Received offline message. Converting to channel 4 ICBM...\n"); |
4075 | 4747 args.uin = msg->sender; |
4748 args.type = msg->type; | |
4173 | 4749 args.flags = msg->flags; |
4076 | 4750 args.msglen = msg->msglen; |
4075 | 4751 args.msg = msg->msg; |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4752 t = gaim_time_build(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0); |
4075 | 4753 incomingim_chan4(sess, fr->conn, NULL, &args, t); |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4754 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4755 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4756 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4757 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4758 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
|
4759 { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4760 aim_icq_ackofflinemsgs(sess); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4761 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4762 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
4763 |
7388 | 4764 #if 0 |
4765 /* | |
7465 | 4766 * Update, 2003-11-09: |
4767 * Joseph S. Myers, a gcc dude, fixed this for gcc 3.4! Rock on! | |
4768 * | |
7388 | 4769 * It may not be my place to do this, but... |
4770 * I feel pretty strongly that the "last 2 digits" warning is ridiculously | |
4771 * stupid, and should not exist for % switches (%x in our case) that request | |
4772 * a year in the preferred representation for the current locale. For that | |
4773 * reason I've chosen to not use this workaround (n., see kluge). | |
4774 * | |
4775 * I have a date. I want to show it to the user in the "preferred" way. | |
4776 * Whether that displays a 2 digit year is perfectly fine--after all, it's | |
4777 * what the locale wanted. | |
4778 * | |
4779 * If I have a necessity for a full representation of the year in the current | |
4780 * locale, then I'll use a switch that returns a full representation of the | |
4781 * year. | |
4782 * | |
4783 * If you think the preferred locale should show 4 digits instead of 2 digits | |
4784 * (because you're anal, or whatever), then change the f***ing locale. | |
4785 * | |
4786 * I guess the bottom line is--I'm trying to show a date to the user how they | |
4787 * prefer to see it, why the hell does gcc want me to change that? | |
7389 | 4788 * |
4789 * See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3190 | |
4790 * See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8714 | |
7388 | 4791 */ |
4792 | |
4793 /* | |
4794 * This function was recommended by the STRFTIME(3) man page to remove the | |
7386 | 4795 * "last 2 digits" warning. |
4796 */ | |
4797 static size_t my_strftime(char *s, size_t max, const char *fmt, | |
4798 const struct tm *tm) | |
4799 { | |
4800 return strftime(s, max, fmt, tm); | |
4801 } | |
7388 | 4802 #endif |
7386 | 4803 |
4624 | 4804 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
|
4805 { |
5575 | 4806 GaimConnection *gc = sess->aux_data; |
8670 | 4807 OscarData *od = (OscarData *)gc->proto_data; |
4808 GaimBuddy *buddy; | |
8853 | 4809 struct buddyinfo *bi = NULL; |
4624 | 4810 gchar who[16]; |
8670 | 4811 GString *str; |
4812 gchar *primary, *utf8; | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4813 va_list ap; |
4151 | 4814 struct aim_icq_info *info; |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4815 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4816 va_start(ap, fr); |
4151 | 4817 info = va_arg(ap, struct aim_icq_info *); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4818 va_end(ap); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4819 |
4664 | 4820 if (!info->uin) |
4821 return 0; | |
4822 | |
8670 | 4823 str = g_string_sized_new(100); |
5556 | 4824 g_snprintf(who, sizeof(who), "%u", info->uin); |
8670 | 4825 buddy = gaim_find_buddy(gaim_connection_get_account(gc), who); |
4826 if (buddy != NULL) | |
4827 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(buddy->account, buddy->name)); | |
4828 | |
4829 g_string_append_printf(str, "<b>%s:</b> %s", _("UIN"), who); | |
8701 | 4830 oscar_string_append(str, "\n<br>", _("Nick"), info->nick); |
8670 | 4831 if ((bi != NULL) && (bi->ipaddr != 0)) { |
4832 char *tstr = g_strdup_printf("%hhu.%hhu.%hhu.%hhu", | |
4833 (bi->ipaddr & 0xff000000) >> 24, | |
4834 (bi->ipaddr & 0x00ff0000) >> 16, | |
4835 (bi->ipaddr & 0x0000ff00) >> 8, | |
4836 (bi->ipaddr & 0x000000ff)); | |
8701 | 4837 oscar_string_append(str, "\n<br>", _("IP Address"), tstr); |
8670 | 4838 g_free(tstr); |
4839 } | |
8701 | 4840 oscar_string_append(str, "\n<br>", _("First Name"), info->first); |
4841 oscar_string_append(str, "\n<br>", _("Last Name"), info->last); | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4842 if (info->email && info->email[0] && (utf8 = gaim_utf8_try_convert(info->email))) { |
8670 | 4843 g_string_append_printf(str, "\n<br><b>%s:</b> <a href=\"mailto:%s\">%s</a>", _("Email Address"), utf8, utf8); |
4844 g_free(utf8); | |
4625 | 4845 } |
4846 if (info->numaddresses && info->email2) { | |
4847 int i; | |
4848 for (i = 0; i < info->numaddresses; i++) { | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4849 if (info->email2[i] && info->email2[i][0] && (utf8 = gaim_utf8_try_convert(info->email2[i]))) { |
8670 | 4850 g_string_append_printf(str, "\n<br><b>%s:</b> <a href=\"mailto%s\">%s</a>", _("Email Address"), utf8, utf8); |
4851 g_free(utf8); | |
4643 | 4852 } |
4625 | 4853 } |
4624 | 4854 } |
8701 | 4855 oscar_string_append(str, "\n<br>", _("Mobile Phone"), info->mobile); |
8902 | 4856 oscar_string_append(str, "\n<br>", _("Gender"), info->gender == 0 ? _("Not specified") : |
4857 info->gender == 1 ? _("Female") : _("Male")); | |
4624 | 4858 if (info->birthyear || info->birthmonth || info->birthday) { |
4627 | 4859 char date[30]; |
4860 struct tm tm; | |
4861 tm.tm_mday = (int)info->birthday; | |
4862 tm.tm_mon = (int)info->birthmonth-1; | |
4863 tm.tm_year = (int)info->birthyear-1900; | |
7388 | 4864 strftime(date, sizeof(date), "%x", &tm); |
8701 | 4865 oscar_string_append(str, "\n<br>", _("Birthday"), date); |
4151 | 4866 } |
4624 | 4867 if (info->age) { |
4868 char age[5]; | |
4869 snprintf(age, sizeof(age), "%hhd", info->age); | |
8701 | 4870 oscar_string_append(str, "\n<br>", _("Age"), age); |
4819 | 4871 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4872 if (info->personalwebpage && info->personalwebpage[0] && (utf8 = gaim_utf8_try_convert(info->personalwebpage))) { |
8670 | 4873 g_string_append_printf(str, "\n<br><b>%s:</b> <a href=\"%s\">%s</a>", _("Personal Web Page"), utf8, utf8); |
4874 g_free(utf8); | |
4819 | 4875 } |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4876 if (info->info && info->info[0] && (utf8 = gaim_utf8_try_convert(info->info))) { |
8670 | 4877 g_string_append_printf(str, "<hr><b>%s:</b><br>%s", _("Additional Information"), utf8); |
4878 g_free(utf8); | |
4879 } | |
4880 g_string_append_printf(str, "<hr>\n"); | |
4641 | 4881 if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) { |
8670 | 4882 g_string_append_printf(str, "<b>%s:</b>", _("Home Address")); |
8701 | 4883 oscar_string_append(str, "\n<br>", _("Address"), info->homeaddr); |
4884 oscar_string_append(str, "\n<br>", _("City"), info->homecity); | |
4885 oscar_string_append(str, "\n<br>", _("State"), info->homestate); | |
4886 oscar_string_append(str, "\n<br>", _("Zip Code"), info->homezip); | |
8670 | 4887 g_string_append_printf(str, "\n<hr>\n"); |
4151 | 4888 } |
4641 | 4889 if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) { |
8670 | 4890 g_string_append_printf(str, "<b>%s:</b>", _("Work Address")); |
8701 | 4891 oscar_string_append(str, "\n<br>", _("Address"), info->workaddr); |
4892 oscar_string_append(str, "\n<br>", _("City"), info->workcity); | |
4893 oscar_string_append(str, "\n<br>", _("State"), info->workstate); | |
4894 oscar_string_append(str, "\n<br>", _("Zip Code"), info->workzip); | |
8670 | 4895 g_string_append_printf(str, "\n<hr>\n"); |
4624 | 4896 } |
4641 | 4897 if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) { |
8670 | 4898 g_string_append_printf(str, "<b>%s:</b>", _("Work Information")); |
8701 | 4899 oscar_string_append(str, "\n<br>", _("Company"), info->workcompany); |
4900 oscar_string_append(str, "\n<br>", _("Division"), info->workdivision); | |
4901 oscar_string_append(str, "\n<br>", _("Position"), info->workposition); | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4902 if (info->workwebpage && info->workwebpage[0] && (utf8 = gaim_utf8_try_convert(info->workwebpage))) { |
8670 | 4903 g_string_append_printf(str, "\n<br><b>%s:</b> <a href=\"%s\">%s</a>", _("Web Page"), utf8, utf8); |
4904 g_free(utf8); | |
4624 | 4905 } |
8670 | 4906 g_string_append_printf(str, "\n<hr>\n"); |
4907 } | |
4908 | |
6873 | 4909 primary = g_strdup_printf(_("ICQ Info for %s"), gaim_get_buddy_alias(buddy)); |
8670 | 4910 gaim_notify_formatted(gc, NULL, primary, NULL, str->str, NULL, NULL); |
6873 | 4911 g_free(primary); |
8670 | 4912 g_string_free(str, TRUE); |
4151 | 4913 |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4914 return 1; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4915 } |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4916 |
4759 | 4917 static int gaim_icqalias(aim_session_t *sess, aim_frame_t *fr, ...) |
4918 { | |
5575 | 4919 GaimConnection *gc = sess->aux_data; |
4820 | 4920 gchar who[16], *utf8; |
6695 | 4921 GaimBuddy *b; |
4759 | 4922 va_list ap; |
4923 struct aim_icq_info *info; | |
4924 | |
4925 va_start(ap, fr); | |
4926 info = va_arg(ap, struct aim_icq_info *); | |
4927 va_end(ap); | |
4928 | |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
4929 if (info->uin && info->nick && info->nick[0] && (utf8 = gaim_utf8_try_convert(info->nick))) { |
5556 | 4930 g_snprintf(who, sizeof(who), "%u", info->uin); |
4820 | 4931 serv_got_alias(gc, who, utf8); |
4759 | 4932 if ((b = gaim_find_buddy(gc->account, who))) { |
7693 | 4933 gaim_blist_node_set_string((GaimBlistNode*)b, "servernick", utf8); |
4759 | 4934 } |
4820 | 4935 g_free(utf8); |
4759 | 4936 } |
4937 | |
4938 return 1; | |
4939 } | |
4940 | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4941 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
|
4942 { |
7032 | 4943 GaimConnection *gc = sess->aux_data; |
4944 gchar *text; | |
4945 va_list ap; | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4946 char *msg, *url; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4947 fu16_t wid, hei, delay; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4948 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4949 va_start(ap, fr); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4950 msg = va_arg(ap, char *); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4951 url = va_arg(ap, char *); |
4199 | 4952 wid = (fu16_t) va_arg(ap, int); |
4953 hei = (fu16_t) va_arg(ap, int); | |
4954 delay = (fu16_t) va_arg(ap, int); | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4955 va_end(ap); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4956 |
7032 | 4957 text = g_strdup_printf("%s<br><a href=\"%s\">%s</a>", msg, url, url); |
4958 gaim_notify_formatted(gc, NULL, _("Pop-Up Message"), NULL, text, NULL, NULL); | |
4959 g_free(text); | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4960 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4961 return 1; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4962 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4963 |
7032 | 4964 static int gaim_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...) |
4965 { | |
6873 | 4966 GaimConnection *gc = sess->aux_data; |
4967 gchar *secondary; | |
4968 GString *text; | |
4969 int i, num; | |
2086 | 4970 va_list ap; |
6873 | 4971 char *email, *SNs; |
2086 | 4972 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4973 va_start(ap, fr); |
6873 | 4974 email = va_arg(ap, char *); |
2086 | 4975 num = va_arg(ap, int); |
4976 SNs = va_arg(ap, char *); | |
4977 va_end(ap); | |
4978 | |
8152 | 4979 secondary = g_strdup_printf(_("The following screen names are associated with %s"), email); |
6873 | 4980 text = g_string_new(""); |
2086 | 4981 for (i = 0; i < num; i++) |
6873 | 4982 g_string_append_printf(text, "%s<br>", &SNs[i * (MAXSNLEN + 1)]); |
4983 gaim_notify_formatted(gc, NULL, _("Search Results"), secondary, text->str, NULL, NULL); | |
4984 | |
4985 g_free(secondary); | |
4986 g_string_free(text, TRUE); | |
2086 | 4987 |
4988 return 1; | |
4989 } | |
4990 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4991 static int gaim_parse_searcherror(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 4992 va_list ap; |
6873 | 4993 char *email; |
5420 | 4994 char *buf; |
2086 | 4995 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4996 va_start(ap, fr); |
6873 | 4997 email = va_arg(ap, char *); |
2086 | 4998 va_end(ap); |
4999 | |
6873 | 5000 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
|
5001 gaim_notify_error(sess->aux_data, NULL, buf, NULL); |
5420 | 5002 g_free(buf); |
2086 | 5003 |
5004 return 1; | |
5005 } | |
5006 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5007 static int gaim_account_confirm(aim_session_t *sess, aim_frame_t *fr, ...) { |
6873 | 5008 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5009 fu16_t status; |
2086 | 5010 va_list ap; |
5011 char msg[256]; | |
5012 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5013 va_start(ap, fr); |
4199 | 5014 status = (fu16_t) va_arg(ap, unsigned int); /* status code of confirmation request */ |
2086 | 5015 va_end(ap); |
5016 | |
8660 | 5017 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5018 "account confirmation returned status 0x%04x (%s)\n", status, |
3912 | 5019 status ? "unknown" : "email sent"); |
5020 if (!status) { | |
5302 | 5021 g_snprintf(msg, sizeof(msg), _("You should receive an email asking to confirm %s."), |
5575 | 5022 gaim_account_get_username(gaim_connection_get_account(gc))); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5023 gaim_notify_info(gc, NULL, _("Account Confirmation Requested"), msg); |
2086 | 5024 } |
5025 | |
5026 return 1; | |
5027 } | |
5028 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5029 static int gaim_info_change(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5030 GaimConnection *gc = sess->aux_data; |
2086 | 5031 va_list ap; |
3912 | 5032 fu16_t perms, err; |
5033 char *url, *sn, *email; | |
5034 int change; | |
2086 | 5035 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5036 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5037 change = va_arg(ap, int); |
4199 | 5038 perms = (fu16_t) va_arg(ap, unsigned int); |
5039 err = (fu16_t) va_arg(ap, unsigned int); | |
3912 | 5040 url = va_arg(ap, char *); |
5041 sn = va_arg(ap, char *); | |
5042 email = va_arg(ap, char *); | |
2086 | 5043 va_end(ap); |
5044 | |
8660 | 5045 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5046 "account info: because of %s, perms=0x%04x, err=0x%04x, url=%s, sn=%s, email=%s\n", |
3912 | 5047 change ? "change" : "request", perms, err, url, sn, email); |
5048 | |
5049 if (err && url) { | |
5050 char *dialog_msg; | |
5051 char *dialog_top = g_strdup_printf(_("Error Changing Account Info")); | |
5052 switch (err) { | |
5053 case 0x0001: { | |
5054 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name differs from the original."), err); | |
5055 } break; | |
5056 case 0x0006: { | |
5057 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name ends in a space."), err); | |
5058 } break; | |
5059 case 0x000b: { | |
5060 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name is too long."), err); | |
5061 } break; | |
5062 case 0x001d: { | |
5063 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); | |
5064 } break; | |
5065 case 0x0021: { | |
5066 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); | |
5067 } break; | |
5068 case 0x0023: { | |
5069 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because the given address is invalid."), err); | |
5070 } break; | |
5071 default: { | |
5072 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unknown error."), err); | |
5073 } break; | |
5074 } | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5075 gaim_notify_error(gc, NULL, dialog_top, dialog_msg); |
3912 | 5076 g_free(dialog_top); |
5077 g_free(dialog_msg); | |
5078 return 1; | |
5079 } | |
5080 | |
5081 if (sn) { | |
4585 | 5082 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
|
5083 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg); |
3912 | 5084 g_free(dialog_msg); |
5085 } | |
5086 | |
5087 if (email) { | |
5575 | 5088 char *dialog_msg = g_strdup_printf(_("The email address for %s is %s"), |
5089 gaim_account_get_username(gaim_connection_get_account(gc)), email); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5090 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg); |
3912 | 5091 g_free(dialog_msg); |
2086 | 5092 } |
5093 | |
5094 return 1; | |
5095 } | |
5096 | |
5575 | 5097 static void oscar_keepalive(GaimConnection *gc) { |
7283 | 5098 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 5099 aim_flap_nop(od->sess, od->conn); |
2086 | 5100 } |
5101 | |
6059 | 5102 static int oscar_send_typing(GaimConnection *gc, const char *name, int typing) { |
7283 | 5103 OscarData *od = (OscarData *)gc->proto_data; |
8971 | 5104 struct oscar_direct_im *dim = oscar_direct_im_find(od, name); |
5105 if (dim && dim->connected) | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
5106 if (typing == GAIM_TYPING) |
4870 | 5107 aim_odc_send_typing(od->sess, dim->conn, 0x0002); |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
5108 else if (typing == GAIM_TYPED) |
4870 | 5109 aim_odc_send_typing(od->sess, dim->conn, 0x0001); |
5110 else | |
5111 aim_odc_send_typing(od->sess, dim->conn, 0x0000); | |
3595 | 5112 else { |
5300 | 5113 /* Don't send if this turkey is in our deny list */ |
5114 GSList *list; | |
5115 for (list=gc->account->deny; (list && aim_sncmp(name, list->data)); list=list->next); | |
5116 if (!list) { | |
7261 | 5117 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name)); |
5300 | 5118 if (bi && bi->typingnot) { |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
5119 if (typing == GAIM_TYPING) |
5300 | 5120 aim_im_sendmtn(od->sess, 0x0001, name, 0x0002); |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
5121 else if (typing == GAIM_TYPED) |
5300 | 5122 aim_im_sendmtn(od->sess, 0x0001, name, 0x0001); |
5123 else | |
5124 aim_im_sendmtn(od->sess, 0x0001, name, 0x0000); | |
5125 } | |
3595 | 5126 } |
5127 } | |
2993 | 5128 return 0; |
5129 } | |
9030 | 5130 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5131 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
|
5132 |
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5133 static int oscar_send_im(GaimConnection *gc, const char *name, const char *message, GaimConvImFlags imflags) { |
7283 | 5134 OscarData *od = (OscarData *)gc->proto_data; |
8971 | 5135 struct oscar_direct_im *dim = oscar_direct_im_find(od, name); |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
5136 int ret = 0; |
3659 | 5137 GError *err = NULL; |
5575 | 5138 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); |
8800 | 5139 char *tmpmsg = NULL, *tmpmsg2 = NULL; |
3458 | 5140 |
4838 | 5141 if (dim && dim->connected) { |
5142 /* If we're directly connected, send a direct IM */ | |
6982 | 5143 ret = gaim_odc_send_im(od->sess, dim->conn, message, imflags); |
2086 | 5144 } else { |
4738 | 5145 struct buddyinfo *bi; |
3008 | 5146 struct aim_sendimext_args args; |
5147 struct stat st; | |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
5148 gsize len; |
8962 | 5149 GaimConversation *conv = gaim_find_conversation_with_account(name, gaim_connection_get_account(gc)); |
5150 | |
5151 if (strstr(message, "<IMG ")) | |
5152 gaim_conversation_write(conv, "", | |
5153 _("Your IM Image was not sent. " | |
5154 "You must be Direct Connected to send IM Images."), | |
5155 GAIM_MESSAGE_ERROR, time(NULL)); | |
4269 | 5156 |
7261 | 5157 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name)); |
4738 | 5158 if (!bi) { |
5159 bi = g_new0(struct buddyinfo, 1); | |
7261 | 5160 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, name)), bi); |
4738 | 5161 } |
5162 | |
3008 | 5163 args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES; |
4665 | 5164 if (od->icq) { |
5165 args.features = features_icq; | |
5166 args.featureslen = sizeof(features_icq); | |
3008 | 5167 args.flags |= AIM_IMFLAGS_OFFLINE; |
4665 | 5168 } else { |
5169 args.features = features_aim; | |
5170 args.featureslen = sizeof(features_aim); | |
4972 | 5171 |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
5172 if (imflags & GAIM_CONV_IM_AUTO_RESP) |
4972 | 5173 args.flags |= AIM_IMFLAGS_AWAY; |
4665 | 5174 } |
4269 | 5175 |
4738 | 5176 if (bi->ico_need) { |
8660 | 5177 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5178 "Sending buddy icon request with message\n"); |
3008 | 5179 args.flags |= AIM_IMFLAGS_BUDDYREQ; |
4738 | 5180 bi->ico_need = FALSE; |
3008 | 5181 } |
4269 | 5182 |
5575 | 5183 if (iconfile && !stat(iconfile, &st)) { |
8361 | 5184 FILE *file = fopen(iconfile, "rb"); |
3008 | 5185 if (file) { |
5186 char *buf = g_malloc(st.st_size); | |
5187 fread(buf, 1, st.st_size, file); | |
6039 | 5188 fclose(file); |
4269 | 5189 |
3008 | 5190 args.iconlen = st.st_size; |
4617 | 5191 args.iconsum = aimutil_iconsum(buf, st.st_size); |
3008 | 5192 args.iconstamp = st.st_mtime; |
5193 | |
7406 | 5194 if ((args.iconlen != bi->ico_me_len) || (args.iconsum != bi->ico_me_csum) || (args.iconstamp != bi->ico_me_time)) { |
4738 | 5195 bi->ico_informed = FALSE; |
7406 | 5196 bi->ico_sent = FALSE; |
5197 } | |
4738 | 5198 |
5199 if (!bi->ico_informed) { | |
8660 | 5200 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5201 "Claiming to have a buddy icon\n"); |
4738 | 5202 args.flags |= AIM_IMFLAGS_HASICON; |
5203 bi->ico_me_len = args.iconlen; | |
5204 bi->ico_me_csum = args.iconsum; | |
5205 bi->ico_me_time = args.iconstamp; | |
5206 bi->ico_informed = TRUE; | |
5207 } | |
5208 | |
3008 | 5209 g_free(buf); |
2086 | 5210 } |
5211 } | |
4269 | 5212 |
3008 | 5213 args.destsn = name; |
4269 | 5214 |
8985 | 5215 /* |
5216 * If we're IMing an ICQ user then send newlines as CR/LF and | |
5217 * strip all HTML | |
5218 */ | |
8995 | 5219 if (isdigit(name[0]) ) { |
5220 /* being sent to an ICQ user */ | |
5221 if (!isdigit(gaim_account_get_username(gc->account)[0])) { | |
5222 /* from an AIM user - ICQ receiving from AIM *expects the messsage to be HTML formatted* */ | |
5223 tmpmsg = gaim_str_add_cr(message); | |
5224 } else { | |
5225 /* from an ICQ user - do nothing */ | |
5226 tmpmsg = g_strdup(message); | |
5227 } | |
5228 } else { | |
5229 /* being sent to an AIM user */ | |
5230 if (isdigit(gaim_account_get_username(gc->account)[0])) { | |
5231 /* from an ICQ user */ | |
5232 tmpmsg2 = gaim_strdup_withhtml(message); | |
5233 tmpmsg = gaim_escape_html(tmpmsg2); | |
5234 g_free(tmpmsg2); | |
5235 } else | |
5236 tmpmsg = gaim_strdup_withhtml(message); | |
5237 } | |
6310 | 5238 len = strlen(tmpmsg); |
5239 | |
5240 args.flags |= oscar_encoding_check(tmpmsg); | |
3642 | 5241 if (args.flags & AIM_IMFLAGS_UNICODE) { |
8660 | 5242 gaim_debug_info("oscar", "Sending Unicode IM\n"); |
4662 | 5243 args.charset = 0x0002; |
4665 | 5244 args.charsubset = 0x0000; |
6310 | 5245 args.msg = g_convert(tmpmsg, len, "UCS-2BE", "UTF-8", NULL, &len, &err); |
3659 | 5246 if (err) { |
8660 | 5247 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5248 "Error converting a unicode message: %s\n", err->message); |
8660 | 5249 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5250 "This really shouldn't happen!\n"); |
3659 | 5251 /* We really shouldn't try to send the |
5252 * IM now, but I'm not sure what to do */ | |
4800 | 5253 g_error_free(err); |
3659 | 5254 } |
3850 | 5255 } else if (args.flags & AIM_IMFLAGS_ISO_8859_1) { |
8660 | 5256 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5257 "Sending ISO-8859-1 IM\n"); |
4662 | 5258 args.charset = 0x0003; |
4665 | 5259 args.charsubset = 0x0000; |
6310 | 5260 args.msg = g_convert(tmpmsg, len, "ISO-8859-1", "UTF-8", NULL, &len, &err); |
3659 | 5261 if (err) { |
8660 | 5262 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5263 "conversion error: %s\n", err->message); |
8660 | 5264 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5265 "Someone tell Ethan his 8859-1 detection is wrong\n"); |
3642 | 5266 args.flags ^= AIM_IMFLAGS_ISO_8859_1 | AIM_IMFLAGS_UNICODE; |
6310 | 5267 len = strlen(tmpmsg); |
4800 | 5268 g_error_free(err); |
6310 | 5269 args.msg = g_convert(tmpmsg, len, "UCS-2BE", "UTF8", NULL, &len, &err); |
3659 | 5270 if (err) { |
8660 | 5271 gaim_debug_error("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5272 "Error in unicode fallback: %s\n", err->message); |
4800 | 5273 g_error_free(err); |
3659 | 5274 } |
3642 | 5275 } |
5276 } else { | |
4662 | 5277 args.charset = 0x0000; |
5278 args.charsubset = 0x0000; | |
6310 | 5279 args.msg = tmpmsg; |
3642 | 5280 } |
5281 args.msglen = len; | |
4269 | 5282 |
4617 | 5283 ret = aim_im_sendch1_ext(od->sess, &args); |
2086 | 5284 } |
4838 | 5285 |
6310 | 5286 g_free(tmpmsg); |
5287 | |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
5288 if (ret >= 0) |
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
5289 return 1; |
6310 | 5290 |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
5291 return ret; |
2086 | 5292 } |
5293 | |
7011 | 5294 static void oscar_get_info(GaimConnection *gc, const char *name) { |
7283 | 5295 OscarData *od = (OscarData *)gc->proto_data; |
7011 | 5296 |
7173 | 5297 if (od->icq && isdigit(name[0])) |
4624 | 5298 aim_icq_getallinfo(od->sess, name); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
5299 else |
7235 | 5300 aim_locate_getinfoshort(od->sess, name, 0x00000003); |
7011 | 5301 } |
5302 | |
8950 | 5303 #if 0 |
7011 | 5304 static void oscar_set_dir(GaimConnection *gc, const char *first, const char *middle, const char *last, |
3466 | 5305 const char *maiden, const char *city, const char *state, const char *country, int web) { |
4617 | 5306 /* XXX - some of these things are wrong, but i'm lazy */ |
7283 | 5307 OscarData *od = (OscarData *)gc->proto_data; |
7011 | 5308 aim_locate_setdirinfo(od->sess, first, middle, last, |
2086 | 5309 maiden, NULL, NULL, city, state, NULL, 0, web); |
5310 } | |
8950 | 5311 #endif |
2086 | 5312 |
5575 | 5313 static void oscar_set_idle(GaimConnection *gc, int time) { |
7283 | 5314 OscarData *od = (OscarData *)gc->proto_data; |
7474 | 5315 aim_srv_setidle(od->sess, time); |
2086 | 5316 } |
5317 | |
5954 | 5318 static void oscar_set_info(GaimConnection *gc, const char *text) { |
7283 | 5319 OscarData *od = (OscarData *)gc->proto_data; |
5129 | 5320 fu32_t flags = 0; |
6019 | 5321 char *text_html = NULL; |
5129 | 5322 char *msg = NULL; |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
5323 gsize msglen = 0; |
2993 | 5324 |
4617 | 5325 if (od->rights.maxsiglen == 0) |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5326 gaim_notify_warning(gc, NULL, _("Unable to set AIM profile."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5327 _("You have probably requested to set your " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5328 "profile before the login procedure completed. " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5329 "Your profile remains unset; try setting it " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5330 "again when you are fully connected.")); |
4617 | 5331 |
7334 | 5332 if (!text) { |
5333 aim_locate_setprofile(od->sess, NULL, "", 0, NULL, NULL, 0); | |
5334 return; | |
5335 } | |
6019 | 5336 |
7334 | 5337 text_html = gaim_strdup_withhtml(text); |
5338 flags = oscar_encoding_check(text_html); | |
5339 if (flags & AIM_IMFLAGS_UNICODE) { | |
5340 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); | |
5341 aim_locate_setprofile(od->sess, "unicode-2-0", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); | |
5342 g_free(msg); | |
5343 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { | |
5344 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); | |
5345 aim_locate_setprofile(od->sess, "iso-8859-1", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); | |
5346 g_free(msg); | |
5347 } else { | |
5348 msglen = strlen(text_html); | |
5349 aim_locate_setprofile(od->sess, "us-ascii", text_html, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0); | |
5350 } | |
5351 | |
5352 if (msglen > od->rights.maxsiglen) { | |
5353 gchar *errstr; | |
5354 errstr = g_strdup_printf(ngettext("The maximum profile length of %d byte " | |
5355 "has been exceeded. Gaim has truncated it for you.", | |
5356 "The maximum profile length of %d bytes " | |
5357 "has been exceeded. Gaim has truncated it for you.", | |
5358 od->rights.maxsiglen), od->rights.maxsiglen); | |
5359 gaim_notify_warning(gc, NULL, _("Profile too long."), errstr); | |
5360 g_free(errstr); | |
5361 } | |
5362 | |
5363 g_free(text_html); | |
2993 | 5364 |
5365 return; | |
2086 | 5366 } |
5367 | |
8257 | 5368 static void oscar_set_away_aim(GaimConnection *gc, OscarData *od, const char *state, const char *text) |
2993 | 5369 { |
5129 | 5370 fu32_t flags = 0; |
6019 | 5371 gchar *text_html = NULL; |
5129 | 5372 char *msg = NULL; |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
5373 gsize msglen = 0; |
2993 | 5374 |
8257 | 5375 if (!strcmp(state, _("Visible"))) { |
5376 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); | |
5377 return; | |
5378 } else if (!strcmp(state, _("Invisible"))) { | |
5379 aim_setextstatus(od->sess, AIM_ICQ_STATE_INVISIBLE); | |
5380 return; | |
5381 } /* else... */ | |
5382 | |
8476 | 5383 if (!strcmp(state, _("Back"))) { |
5384 /* If this is our only online account then globally set Gaim not-away */ | |
5385 GList *gcs = gaim_connections_get_all(); | |
5386 if (gcs->next == NULL) | |
5387 do_im_back(NULL, NULL); | |
5388 } | |
5389 | |
8257 | 5390 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
5391 | |
2993 | 5392 if (od->rights.maxawaymsglen == 0) |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5393 gaim_notify_warning(gc, NULL, _("Unable to set AIM away message."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5394 _("You have probably requested to set your " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5395 "away message before the login procedure " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5396 "completed. You remain in a \"present\" " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5397 "state; try setting it again when you are " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5398 "fully connected.")); |
5129 | 5399 |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
5400 if (gc->away) { |
2993 | 5401 g_free(gc->away); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
5402 gc->away = NULL; |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
5403 } |
2993 | 5404 |
5129 | 5405 if (!text) { |
7334 | 5406 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5407 return; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5408 } |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5409 |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
5410 text_html = gaim_strdup_withhtml(text); |
6019 | 5411 flags = oscar_encoding_check(text_html); |
5129 | 5412 if (flags & AIM_IMFLAGS_UNICODE) { |
6019 | 5413 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); |
7011 | 5414 aim_locate_setprofile(od->sess, NULL, NULL, 0, "unicode-2-0", msg, |
7334 | 5415 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); |
5129 | 5416 g_free(msg); |
5417 gc->away = g_strndup(text, od->rights.maxawaymsglen/2); | |
5418 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { | |
6019 | 5419 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); |
7011 | 5420 aim_locate_setprofile(od->sess, NULL, NULL, 0, "iso-8859-1", msg, |
7334 | 5421 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); |
5129 | 5422 g_free(msg); |
6019 | 5423 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); |
5129 | 5424 } else { |
6019 | 5425 msglen = strlen(text_html); |
7011 | 5426 aim_locate_setprofile(od->sess, NULL, NULL, 0, "us-ascii", text_html, |
7334 | 5427 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen)); |
6019 | 5428 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); |
5129 | 5429 } |
5430 | |
5431 if (msglen > od->rights.maxawaymsglen) { | |
2993 | 5432 gchar *errstr; |
5433 | |
6308 | 5434 errstr = g_strdup_printf(ngettext("The maximum away message length of %d byte " |
5435 "has been exceeded. Gaim has truncated it for you.", | |
5436 "The maximum away message length of %d bytes " | |
5437 "has been exceeded. Gaim has truncated it for you.", | |
5438 od->rights.maxawaymsglen), od->rights.maxawaymsglen); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5439 gaim_notify_warning(gc, NULL, _("Away message too long."), errstr); |
2993 | 5440 g_free(errstr); |
5441 } | |
6019 | 5442 |
5443 g_free(text_html); | |
8257 | 5444 |
2993 | 5445 return; |
5446 } | |
5447 | |
7283 | 5448 static void oscar_set_away_icq(GaimConnection *gc, OscarData *od, const char *state, const char *message) |
2993 | 5449 { |
5575 | 5450 GaimAccount *account = gaim_connection_get_account(gc); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
5451 if (gc->away) { |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
5452 g_free(gc->away); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5453 gc->away = NULL; |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
5454 } |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5455 |
8265 | 5456 if (strcmp(state, _("Invisible"))) |
5575 | 5457 account->perm_deny = 4; |
8265 | 5458 else |
5575 | 5459 account->perm_deny = 3; |
8265 | 5460 if ((od->sess->ssi.received_data) && (aim_ssi_getpermdeny(od->sess->ssi.local) != account->perm_deny)) |
5461 aim_ssi_setpermdeny(od->sess, account->perm_deny, 0xffffffff); | |
4342 | 5462 |
5463 if (!strcmp(state, _("Online"))) | |
4901 | 5464 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
4342 | 5465 else if (!strcmp(state, _("Away"))) { |
4901 | 5466 aim_setextstatus(od->sess, AIM_ICQ_STATE_AWAY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
5467 gc->away = g_strdup(""); |
4342 | 5468 } else if (!strcmp(state, _("Do Not Disturb"))) { |
4901 | 5469 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
|
5470 gc->away = g_strdup(""); |
4342 | 5471 } else if (!strcmp(state, _("Not Available"))) { |
4901 | 5472 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
|
5473 gc->away = g_strdup(""); |
4342 | 5474 } else if (!strcmp(state, _("Occupied"))) { |
4901 | 5475 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
|
5476 gc->away = g_strdup(""); |
4342 | 5477 } else if (!strcmp(state, _("Free For Chat"))) { |
4901 | 5478 aim_setextstatus(od->sess, AIM_ICQ_STATE_CHAT); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
5479 gc->away = g_strdup(""); |
4342 | 5480 } else if (!strcmp(state, _("Invisible"))) { |
4901 | 5481 aim_setextstatus(od->sess, AIM_ICQ_STATE_INVISIBLE); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
5482 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5483 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { |
2998 | 5484 if (message) { |
4901 | 5485 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
|
5486 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5487 } else { |
4901 | 5488 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
5489 } |
2086 | 5490 } |
2993 | 5491 |
5492 return; | |
5493 } | |
5494 | |
6059 | 5495 static void oscar_set_away(GaimConnection *gc, const char *state, const char *message) |
2993 | 5496 { |
7283 | 5497 OscarData *od = (OscarData *)gc->proto_data; |
2993 | 5498 |
5499 if (od->icq) | |
5500 oscar_set_away_icq(gc, od, state, message); | |
5501 else | |
8257 | 5502 oscar_set_away_aim(gc, od, state, message); |
2993 | 5503 |
5504 return; | |
2086 | 5505 } |
5506 | |
6059 | 5507 static void oscar_warn(GaimConnection *gc, const char *name, int anon) { |
7283 | 5508 OscarData *od = (OscarData *)gc->proto_data; |
4617 | 5509 aim_im_warn(od->sess, od->conn, name, anon ? AIM_WARN_ANON : 0); |
2086 | 5510 } |
5511 | |
9285 | 5512 static void oscar_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) { |
7283 | 5513 OscarData *od = (OscarData *)gc->proto_data; |
9285 | 5514 |
5515 if (!aim_snvalid(buddy->name)) { | |
8092 | 5516 gchar *buf; |
9285 | 5517 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."), buddy->name); |
8092 | 5518 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
5519 g_free(buf); | |
8150 | 5520 |
5521 /* Remove from local list */ | |
9285 | 5522 gaim_blist_remove_buddy(buddy); |
8150 | 5523 |
8092 | 5524 return; |
5525 } | |
5526 | |
4230 | 5527 #ifdef NOSSI |
9285 | 5528 aim_buddylist_addbuddy(od->sess, od->conn, buddy->name); |
4230 | 5529 #else |
9285 | 5530 if ((od->sess->ssi.received_data) && !(aim_ssi_itemlist_finditem(od->sess->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY))) { |
5531 if (buddy && group) { | |
8660 | 5532 gaim_debug_info("oscar", |
9285 | 5533 "ssi: adding buddy %s to group %s\n", buddy->name, group->name); |
5534 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 0); | |
4230 | 5535 } |
5536 } | |
5537 #endif | |
8150 | 5538 |
4759 | 5539 if (od->icq) |
9285 | 5540 aim_icq_getalias(od->sess, buddy->name); |
5541 } | |
5542 | |
5543 static void oscar_add_buddies(GaimConnection *gc, GList *buddies, GList *groups) { | |
7283 | 5544 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 5545 #ifdef NOSSI |
5546 char buf[MSG_LEN]; | |
5547 int n=0; | |
9285 | 5548 |
4230 | 5549 while (buddies) { |
5550 if (n > MSG_LEN - 18) { | |
7285 | 5551 aim_buddylist_set(od->sess, od->conn, buf); |
4230 | 5552 n = 0; |
3092 | 5553 } |
8150 | 5554 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", (const char *)buddies->data); |
4230 | 5555 buddies = buddies->next; |
5556 } | |
7285 | 5557 aim_buddylist_set(od->sess, od->conn, buf); |
4230 | 5558 #else |
9285 | 5559 |
4230 | 5560 if (od->sess->ssi.received_data) { |
9285 | 5561 GList *curb = buddies; |
5562 GList *curg = groups; | |
5563 while ((curb != NULL) && (curg != NULL)) { | |
5564 GaimBuddy *buddy = curb->data; | |
5565 GaimGroup *group = curg->data; | |
5566 oscar_add_buddy(gc, buddy, group); | |
5567 curb = curb->next; | |
5568 curg = curg->next; | |
4230 | 5569 } |
5570 } | |
5571 #endif | |
5572 } | |
5573 | |
9285 | 5574 static void oscar_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) { |
7283 | 5575 OscarData *od = (OscarData *)gc->proto_data; |
9285 | 5576 |
4230 | 5577 #ifdef NOSSI |
9285 | 5578 aim_buddylist_removebuddy(od->sess, od->conn, buddy->name); |
4230 | 5579 #else |
5580 if (od->sess->ssi.received_data) { | |
8660 | 5581 gaim_debug_info("oscar", |
9285 | 5582 "ssi: deleting buddy %s from group %s\n", buddy->name, group->name); |
5583 aim_ssi_delbuddy(od->sess, buddy->name, group->name); | |
4230 | 5584 } |
5585 #endif | |
5586 } | |
5587 | |
9285 | 5588 static void oscar_remove_buddies(GaimConnection *gc, GList *buddies, GList *groups) { |
7283 | 5589 OscarData *od = (OscarData *)gc->proto_data; |
9285 | 5590 |
4230 | 5591 #ifdef NOSSI |
9285 | 5592 for (cur = buddies; cur != NULL; cur = cur->next) { |
5593 GaimBuddy *buddy = cur->data; | |
5594 aim_buddylist_removebuddy(od->sess, od->conn, buddy->name); | |
5595 } | |
4230 | 5596 #else |
5597 if (od->sess->ssi.received_data) { | |
9285 | 5598 GList *curb = buddies; |
5599 GList *curg = groups; | |
5600 while ((curb != NULL) && (curg != NULL)) { | |
5601 GaimBuddy *buddy = curb->data; | |
5602 GaimGroup *group = curg->data; | |
5603 oscar_remove_buddy(gc, buddy, group); | |
5604 curb = curb->next; | |
5605 curg = curg->next; | |
3092 | 5606 } |
4230 | 5607 } |
5608 #endif | |
5609 } | |
5610 | |
5611 #ifndef NOSSI | |
5575 | 5612 static void oscar_move_buddy(GaimConnection *gc, const char *name, const char *old_group, const char *new_group) { |
7283 | 5613 OscarData *od = (OscarData *)gc->proto_data; |
4303 | 5614 if (od->sess->ssi.received_data && strcmp(old_group, new_group)) { |
8660 | 5615 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5616 "ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group); |
4889 | 5617 aim_ssi_movebuddy(od->sess, old_group, new_group, name); |
4269 | 5618 } |
5619 } | |
5620 | |
5575 | 5621 static void oscar_alias_buddy(GaimConnection *gc, const char *name, const char *alias) { |
7283 | 5622 OscarData *od = (OscarData *)gc->proto_data; |
4269 | 5623 if (od->sess->ssi.received_data) { |
5624 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, name); | |
5625 if (gname) { | |
8660 | 5626 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5627 "ssi: changing the alias for buddy %s to %s\n", name, alias); |
4889 | 5628 aim_ssi_aliasbuddy(od->sess, gname, name, alias); |
4269 | 5629 } |
5630 } | |
5631 } | |
5632 | |
9285 | 5633 static void oscar_rename_group(GaimConnection *gc, const char *old_name, GaimGroup *group, GList *moved_buddies) { |
8341 | 5634 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 5635 |
5636 if (od->sess->ssi.received_data) { | |
9285 | 5637 if (aim_ssi_itemlist_finditem(od->sess->ssi.local, group->name, NULL, AIM_SSI_TYPE_GROUP)) { |
5638 GList *cur, *groups = NULL; | |
5639 | |
5640 /* Make a list of what the groups each buddy is in */ | |
5641 for (cur = moved_buddies; cur != NULL; cur = cur->next) { | |
5642 GaimBlistNode *node = cur->data; | |
5643 groups = g_list_append(groups, node->parent); | |
5644 } | |
5645 | |
5646 oscar_remove_buddies(gc, moved_buddies, groups); | |
5647 oscar_add_buddies(gc, moved_buddies, groups); | |
5648 g_list_free(groups); | |
8660 | 5649 gaim_debug_info("oscar", |
9285 | 5650 "ssi: moved all buddies from group %s to %s\n", old_name, group->name); |
4230 | 5651 } else { |
9285 | 5652 aim_ssi_rename_group(od->sess, old_name, group->name); |
8660 | 5653 gaim_debug_info("oscar", |
9285 | 5654 "ssi: renamed group %s to %s\n", old_name, group->name); |
2995 | 5655 } |
5656 } | |
5657 } | |
5658 | |
5968 | 5659 static gboolean gaim_ssi_rerequestdata(gpointer data) { |
5660 aim_session_t *sess = data; | |
6350 | 5661 aim_ssi_reqdata(sess); |
5968 | 5662 return FALSE; |
5663 } | |
5664 | |
4642 | 5665 static int gaim_ssi_parseerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5666 GaimConnection *gc = sess->aux_data; |
7283 | 5667 OscarData *od = gc->proto_data; |
4642 | 5668 va_list ap; |
5669 fu16_t reason; | |
5670 | |
5671 va_start(ap, fr); | |
5672 reason = (fu16_t)va_arg(ap, unsigned int); | |
5673 va_end(ap); | |
5674 | |
8660 | 5675 gaim_debug_error("oscar", "ssi: SNAC error %hu\n", reason); |
4642 | 5676 |
5677 if (reason == 0x0005) { | |
5892 | 5678 gaim_notify_error(gc, NULL, _("Unable To Retrieve Buddy List"), |
5828 | 5679 _("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.")); |
8273
f24172f53650
[gaim-migrate @ 8997]
Christian Hammond <chipx86@chipx86.com>
parents:
8266
diff
changeset
|
5680 od->getblisttimer = gaim_timeout_add(300000, gaim_ssi_rerequestdata, od->sess); |
4642 | 5681 } |
5682 | |
5683 /* Activate SSI */ | |
5684 /* Sending the enable causes other people to be able to see you, and you to see them */ | |
5685 /* Make sure your privacy setting/invisibility is set how you want it before this! */ | |
8660 | 5686 gaim_debug_info("oscar", "ssi: activating server-stored buddy list\n"); |
4642 | 5687 aim_ssi_enable(od->sess); |
5688 | |
5689 return 1; | |
5690 } | |
5691 | |
2991 | 5692 static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5693 GaimConnection *gc = sess->aux_data; |
7283 | 5694 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 5695 int numtypes, i; |
5696 fu16_t *maxitems; | |
2991 | 5697 va_list ap; |
5698 | |
5699 va_start(ap, fr); | |
4230 | 5700 numtypes = va_arg(ap, int); |
5701 maxitems = va_arg(ap, fu16_t *); | |
2991 | 5702 va_end(ap); |
5703 | |
8660 | 5704 gaim_debug_misc("oscar", "ssi rights:"); |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
5705 |
4230 | 5706 for (i=0; i<numtypes; i++) |
8660 | 5707 gaim_debug_misc(NULL, " max type 0x%04x=%hd,", |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
5708 i, maxitems[i]); |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
5709 |
8660 | 5710 gaim_debug_misc(NULL, "\n"); |
4230 | 5711 |
5712 if (numtypes >= 0) | |
5713 od->rights.maxbuddies = maxitems[0]; | |
5714 if (numtypes >= 1) | |
5715 od->rights.maxgroups = maxitems[1]; | |
5716 if (numtypes >= 2) | |
5717 od->rights.maxpermits = maxitems[2]; | |
5718 if (numtypes >= 3) | |
5719 od->rights.maxdenies = maxitems[3]; | |
2991 | 5720 |
5721 return 1; | |
5722 } | |
5723 | |
5724 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5725 GaimConnection *gc = sess->aux_data; |
5726 GaimAccount *account = gaim_connection_get_account(gc); | |
7283 | 5727 OscarData *od = (OscarData *)gc->proto_data; |
8150 | 5728 GaimGroup *g; |
5729 GaimBuddy *b; | |
2995 | 5730 struct aim_ssi_item *curitem; |
2991 | 5731 int tmp; |
4230 | 5732 va_list ap; |
8219 | 5733 fu16_t fmtver, numitems; |
5734 struct aim_ssi_item *items; | |
5735 fu32_t timestamp; | |
4230 | 5736 |
5737 va_start(ap, fr); | |
5738 fmtver = (fu16_t)va_arg(ap, int); | |
5739 numitems = (fu16_t)va_arg(ap, int); | |
8219 | 5740 items = va_arg(ap, struct aim_ssi_item *); |
4230 | 5741 timestamp = va_arg(ap, fu32_t); |
8219 | 5742 va_end(ap); |
2991 | 5743 |
8660 | 5744 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5745 "ssi: syncing local list and server list\n"); |
2991 | 5746 |
8219 | 5747 if ((timestamp == 0) || (numitems == 0)) { |
8660 | 5748 gaim_debug_info("oscar", "Got AIM SSI with a 0 timestamp or 0 numitems--not syncing. This probably means your buddy list is empty.", NULL); |
8219 | 5749 return 1; |
5750 } | |
5751 | |
2991 | 5752 /* Clean the buddy list */ |
4889 | 5753 aim_ssi_cleanlist(sess); |
2991 | 5754 |
8150 | 5755 { /* If not in server list then prune from local list */ |
5756 GaimBlistNode *gnode, *cnode, *bnode; | |
5757 GaimBuddyList *blist; | |
5758 GSList *cur; | |
5759 | |
5760 /* Buddies */ | |
5761 cur = NULL; | |
5762 if ((blist = gaim_get_blist()) != NULL) { | |
5763 for (gnode = blist->root; gnode; gnode = gnode->next) { | |
5764 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | |
5765 continue; | |
5766 g = (GaimGroup *)gnode; | |
5767 for (cnode = gnode->child; cnode; cnode = cnode->next) { | |
5768 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
5769 continue; | |
5770 for (bnode = cnode->child; bnode; bnode = bnode->next) { | |
5771 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
5772 continue; | |
5773 b = (GaimBuddy *)bnode; | |
5774 if (b->account == gc->account) { | |
5775 if (aim_ssi_itemlist_exists(sess->ssi.local, b->name)) { | |
5776 /* If the buddy is an ICQ user then load his nickname */ | |
5777 const char *servernick = gaim_blist_node_get_string((GaimBlistNode*)b, "servernick"); | |
8214 | 5778 char *alias; |
8150 | 5779 if (servernick) |
5780 serv_got_alias(gc, b->name, servernick); | |
5781 | |
5782 /* Store local alias on server */ | |
8214 | 5783 alias = aim_ssi_getalias(sess->ssi.local, g->name, b->name); |
8150 | 5784 if (!alias && b->alias && strlen(b->alias)) |
5785 aim_ssi_aliasbuddy(sess, g->name, b->name, b->alias); | |
5786 free(alias); | |
5787 } else { | |
8660 | 5788 gaim_debug_info("oscar", |
8150 | 5789 "ssi: removing buddy %s from local list\n", b->name); |
5790 /* We can't actually remove now because it will screw up our looping */ | |
5791 cur = g_slist_prepend(cur, b); | |
5792 } | |
5793 } | |
5794 } | |
5795 } | |
5796 } | |
5797 } | |
8175 | 5798 |
8150 | 5799 while (cur != NULL) { |
5800 b = cur->data; | |
5801 cur = g_slist_remove(cur, b); | |
5802 gaim_blist_remove_buddy(b); | |
5803 } | |
5804 | |
5805 /* Permit list */ | |
5806 if (gc->account->permit) { | |
5807 for (cur=gc->account->permit; cur; cur=cur->next) | |
5808 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) { | |
8660 | 5809 gaim_debug_info("oscar", |
8150 | 5810 "ssi: removing permit %s from local list\n", (const char *)cur->data); |
5811 gaim_privacy_permit_remove(account, cur->data, TRUE); | |
5812 cur = gc->account->permit; | |
5813 } | |
5814 } | |
5815 | |
5816 /* Deny list */ | |
5817 if (gc->account->deny) { | |
5818 for (cur=gc->account->deny; cur; cur=cur->next) | |
5819 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_DENY)) { | |
8660 | 5820 gaim_debug_info("oscar", |
8150 | 5821 "ssi: removing deny %s from local list\n", (const char *)cur->data); |
5822 gaim_privacy_deny_remove(account, cur->data, TRUE); | |
5823 cur = gc->account->deny; | |
5824 } | |
5825 } | |
5826 /* Presence settings (idle time visibility) */ | |
5827 if ((tmp = aim_ssi_getpresence(sess->ssi.local)) != 0xFFFFFFFF) | |
5828 if (!(tmp & 0x400)) | |
5829 aim_ssi_setpresence(sess, tmp | 0x400); | |
5830 } /* end pruning buddies from local list */ | |
5831 | |
2991 | 5832 /* Add from server list to local list */ |
4230 | 5833 for (curitem=sess->ssi.local; curitem; curitem=curitem->next) { |
7328 | 5834 if ((curitem->name == NULL) || (g_utf8_validate(curitem->name, -1, NULL))) |
2991 | 5835 switch (curitem->type) { |
4230 | 5836 case 0x0000: { /* Buddy */ |
4251 | 5837 if (curitem->name) { |
4292 | 5838 char *gname = aim_ssi_itemlist_findparentname(sess->ssi.local, curitem->name); |
7166 | 5839 char *gname_utf8 = gname ? gaim_utf8_try_convert(gname) : NULL; |
4282 | 5840 char *alias = aim_ssi_getalias(sess->ssi.local, gname, curitem->name); |
7166 | 5841 char *alias_utf8 = alias ? gaim_utf8_try_convert(alias) : NULL; |
8150 | 5842 b = gaim_find_buddy(gc->account, curitem->name); |
4458 | 5843 /* Should gname be freed here? -- elb */ |
4754 | 5844 /* Not with the current code, but that might be cleaner -- med */ |
4458 | 5845 free(alias); |
8150 | 5846 if (b) { |
4292 | 5847 /* Get server stored alias */ |
4705 | 5848 if (alias_utf8) { |
8150 | 5849 g_free(b->alias); |
5850 b->alias = g_strdup(alias_utf8); | |
4705 | 5851 } |
4282 | 5852 } else { |
8150 | 5853 b = gaim_buddy_new(gc->account, curitem->name, alias_utf8); |
5146 | 5854 |
4754 | 5855 if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { |
4687 | 5856 g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); |
4754 | 5857 gaim_blist_add_group(g, NULL); |
5858 } | |
5146 | 5859 |
8660 | 5860 gaim_debug_info("oscar", |
9285 | 5861 "ssi: adding buddy %s to group %s to local list\n", curitem->name, gname_utf8 ? gname_utf8 : _("Orphans")); |
8150 | 5862 gaim_blist_add_buddy(b, NULL, g, NULL); |
4251 | 5863 } |
8341 | 5864 if (!aim_sncmp(curitem->name, account->username)) { |
5865 char *comment = aim_ssi_getcomment(sess->ssi.local, gname, curitem->name); | |
5866 gaim_check_comment(od, comment); | |
5867 free(comment); | |
5868 } | |
7162 | 5869 g_free(gname_utf8); |
5870 g_free(alias_utf8); | |
2991 | 5871 } |
4230 | 5872 } break; |
5873 | |
5874 case 0x0001: { /* Group */ | |
4282 | 5875 /* Shouldn't add empty groups */ |
4230 | 5876 } break; |
5877 | |
5878 case 0x0002: { /* Permit buddy */ | |
2991 | 5879 if (curitem->name) { |
4230 | 5880 /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */ |
2991 | 5881 GSList *list; |
5575 | 5882 for (list=account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
2991 | 5883 if (!list) { |
8660 | 5884 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5885 "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
|
5886 gaim_privacy_permit_add(account, curitem->name, TRUE); |
2991 | 5887 } |
5888 } | |
4230 | 5889 } break; |
5890 | |
5891 case 0x0003: { /* Deny buddy */ | |
2991 | 5892 if (curitem->name) { |
5893 GSList *list; | |
5575 | 5894 for (list=account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
2991 | 5895 if (!list) { |
8660 | 5896 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5897 "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
|
5898 gaim_privacy_deny_add(account, curitem->name, TRUE); |
2991 | 5899 } |
5900 } | |
4230 | 5901 } break; |
5902 | |
5903 case 0x0004: { /* Permit/deny setting */ | |
2991 | 5904 if (curitem->data) { |
5905 fu8_t permdeny; | |
5575 | 5906 if ((permdeny = aim_ssi_getpermdeny(sess->ssi.local)) && (permdeny != account->perm_deny)) { |
8660 | 5907 gaim_debug_info("oscar", |
5575 | 5908 "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, permdeny); |
5909 account->perm_deny = permdeny; | |
5910 if (od->icq && account->perm_deny == 0x03) { | |
4342 | 5911 serv_set_away(gc, "Invisible", ""); |
5912 } | |
2991 | 5913 } |
5914 } | |
4230 | 5915 } break; |
5916 | |
5917 case 0x0005: { /* Presence setting */ | |
3109 | 5918 /* We don't want to change Gaim's setting because it applies to all accounts */ |
4230 | 5919 } break; |
2991 | 5920 } /* End of switch on curitem->type */ |
5921 } /* End of for loop */ | |
4230 | 5922 |
4901 | 5923 /* Set our ICQ status */ |
8257 | 5924 if (!gc->away) { |
4901 | 5925 aim_setextstatus(sess, AIM_ICQ_STATE_NORMAL); |
5926 } | |
5927 | |
4342 | 5928 /* Activate SSI */ |
5929 /* Sending the enable causes other people to be able to see you, and you to see them */ | |
5930 /* Make sure your privacy setting/invisibility is set how you want it before this! */ | |
8660 | 5931 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5932 "ssi: activating server-stored buddy list\n"); |
4642 | 5933 aim_ssi_enable(sess); |
4342 | 5934 |
2991 | 5935 return 1; |
2086 | 5936 } |
4230 | 5937 |
5938 static int gaim_ssi_parseack(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5939 GaimConnection *gc = sess->aux_data; |
4230 | 5940 va_list ap; |
5941 struct aim_ssi_tmp *retval; | |
5942 | |
5943 va_start(ap, fr); | |
5944 retval = va_arg(ap, struct aim_ssi_tmp *); | |
5945 va_end(ap); | |
5946 | |
5947 while (retval) { | |
8660 | 5948 gaim_debug_misc("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5949 "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 | 5950 |
5951 if (retval->ack != 0xffff) | |
5952 switch (retval->ack) { | |
5953 case 0x0000: { /* added successfully */ | |
5954 } break; | |
5955 | |
4829 | 5956 case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */ |
5957 gchar *buf; | |
5958 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
|
5959 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
4829 | 5960 g_free(buf); |
5961 } | |
5962 | |
7023 | 5963 case 0x000e: { /* buddy requires authorization */ |
4828 | 5964 if ((retval->action == AIM_CB_SSI_ADD) && (retval->name)) |
4269 | 5965 gaim_auth_sendrequest(gc, retval->name); |
4230 | 5966 } break; |
5967 | |
5968 default: { /* La la la */ | |
5197 | 5969 gchar *buf; |
8660 | 5970 gaim_debug_error("oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack); |
5402 | 5971 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
|
5972 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
5197 | 5973 g_free(buf); |
4230 | 5974 } break; |
5975 } | |
5976 | |
5977 retval = retval->next; | |
5978 } | |
5979 | |
5980 return 1; | |
5981 } | |
5982 | |
8227 | 5983 static int gaim_ssi_parseadd(aim_session_t *sess, aim_frame_t *fr, ...) { |
5984 GaimConnection *gc = sess->aux_data; | |
5985 char *gname, *gname_utf8, *alias, *alias_utf8; | |
5986 GaimBuddy *b; | |
5987 GaimGroup *g; | |
5988 va_list ap; | |
5989 fu16_t type; | |
5990 const char *name; | |
5991 | |
5992 va_start(ap, fr); | |
5993 type = (fu16_t)va_arg(ap, int); | |
5994 name = va_arg(ap, char *); | |
5995 va_end(ap); | |
5996 | |
5997 if ((type != 0x0000) || (name == NULL)) | |
5998 return 1; | |
5999 | |
6000 gname = aim_ssi_itemlist_findparentname(sess->ssi.local, name); | |
6001 gname_utf8 = gname ? gaim_utf8_try_convert(gname) : NULL; | |
6002 alias = aim_ssi_getalias(sess->ssi.local, gname, name); | |
6003 alias_utf8 = alias ? gaim_utf8_try_convert(alias) : NULL; | |
6004 b = gaim_find_buddy(gc->account, name); | |
6005 free(alias); | |
6006 | |
6007 if (b) { | |
6008 /* Get server stored alias */ | |
6009 if (alias_utf8) { | |
6010 g_free(b->alias); | |
6011 b->alias = g_strdup(alias_utf8); | |
6012 } | |
6013 } else { | |
6014 b = gaim_buddy_new(gc->account, name, alias_utf8); | |
6015 | |
6016 if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { | |
6017 g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); | |
6018 gaim_blist_add_group(g, NULL); | |
6019 } | |
6020 | |
8660 | 6021 gaim_debug_info("oscar", |
9285 | 6022 "ssi: adding buddy %s to group %s to local list\n", name, gname_utf8 ? gname_utf8 : _("Orphans")); |
8227 | 6023 gaim_blist_add_buddy(b, NULL, g, NULL); |
6024 } | |
6025 g_free(gname_utf8); | |
6026 g_free(alias_utf8); | |
6027 | |
6028 return 1; | |
6029 } | |
6030 | |
4230 | 6031 static int gaim_ssi_authgiven(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 6032 GaimConnection *gc = sess->aux_data; |
4230 | 6033 va_list ap; |
6034 char *sn, *msg; | |
4236 | 6035 gchar *dialog_msg, *nombre; |
4230 | 6036 struct name_data *data; |
6695 | 6037 GaimBuddy *buddy; |
4230 | 6038 |
6039 va_start(ap, fr); | |
6040 sn = va_arg(ap, char *); | |
6041 msg = va_arg(ap, char *); | |
6042 va_end(ap); | |
6043 | |
8660 | 6044 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6045 "ssi: %s has given you permission to add him to your buddy list\n", sn); |
4230 | 6046 |
4687 | 6047 buddy = gaim_find_buddy(gc->account, sn); |
6048 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
6049 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 6050 else |
6051 nombre = g_strdup(sn); | |
6052 | |
6053 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 | 6054 data = g_new(struct name_data, 1); |
6055 data->gc = gc; | |
6056 data->name = g_strdup(sn); | |
6057 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6058 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6059 gaim_request_yes_no(gc, NULL, _("Authorization Given"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6060 0, data, |
7023 | 6061 G_CALLBACK(gaim_icq_buddyadd), |
5836 | 6062 G_CALLBACK(oscar_free_name_data)); |
4236 | 6063 |
4230 | 6064 g_free(dialog_msg); |
4236 | 6065 g_free(nombre); |
4230 | 6066 |
6067 return 1; | |
6068 } | |
6069 | |
6070 static int gaim_ssi_authrequest(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 6071 GaimConnection *gc = sess->aux_data; |
4230 | 6072 va_list ap; |
6073 char *sn, *msg; | |
4236 | 6074 gchar *dialog_msg, *nombre; |
4230 | 6075 struct name_data *data; |
6695 | 6076 GaimBuddy *buddy; |
4230 | 6077 |
6078 va_start(ap, fr); | |
6079 sn = va_arg(ap, char *); | |
6080 msg = va_arg(ap, char *); | |
6081 va_end(ap); | |
6082 | |
8660 | 6083 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6084 "ssi: received authorization request from %s\n", sn); |
4230 | 6085 |
4687 | 6086 buddy = gaim_find_buddy(gc->account, sn); |
6087 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
6088 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 6089 else |
6090 nombre = g_strdup(sn); | |
6091 | |
4337 | 6092 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 | 6093 data = g_new(struct name_data, 1); |
6094 data->gc = gc; | |
6095 data->name = g_strdup(sn); | |
6096 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6097 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6098 gaim_request_action(gc, NULL, _("Authorization Request"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6099 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6100 _("Authorize"), G_CALLBACK(gaim_auth_grant), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
6101 _("Deny"), G_CALLBACK(gaim_auth_dontgrant_msgprompt)); |
4236 | 6102 |
4230 | 6103 g_free(dialog_msg); |
4236 | 6104 g_free(nombre); |
4230 | 6105 |
6106 return 1; | |
6107 } | |
6108 | |
6109 static int gaim_ssi_authreply(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 6110 GaimConnection *gc = sess->aux_data; |
4230 | 6111 va_list ap; |
6112 char *sn, *msg; | |
4236 | 6113 gchar *dialog_msg, *nombre; |
4230 | 6114 fu8_t reply; |
6695 | 6115 GaimBuddy *buddy; |
4230 | 6116 |
6117 va_start(ap, fr); | |
6118 sn = va_arg(ap, char *); | |
6119 reply = (fu8_t)va_arg(ap, int); | |
6120 msg = va_arg(ap, char *); | |
6121 va_end(ap); | |
6122 | |
8660 | 6123 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6124 "ssi: received authorization reply from %s. Reply is 0x%04hhx\n", sn, reply); |
4236 | 6125 |
4687 | 6126 buddy = gaim_find_buddy(gc->account, sn); |
6127 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
6128 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 6129 else |
6130 nombre = g_strdup(sn); | |
6131 | |
4230 | 6132 if (reply) { |
6133 /* Granted */ | |
7023 | 6134 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
|
6135 gaim_notify_info(gc, NULL, _("Authorization Granted"), dialog_msg); |
4230 | 6136 } else { |
6137 /* Denied */ | |
7023 | 6138 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
|
6139 gaim_notify_info(gc, NULL, _("Authorization Denied"), dialog_msg); |
4230 | 6140 } |
6141 g_free(dialog_msg); | |
4236 | 6142 g_free(nombre); |
4230 | 6143 |
6144 return 1; | |
6145 } | |
6146 | |
6147 static int gaim_ssi_gotadded(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 6148 GaimConnection *gc = sess->aux_data; |
4230 | 6149 va_list ap; |
6150 char *sn; | |
6695 | 6151 GaimBuddy *buddy; |
4230 | 6152 |
6153 va_start(ap, fr); | |
6154 sn = va_arg(ap, char *); | |
6155 va_end(ap); | |
6156 | |
4687 | 6157 buddy = gaim_find_buddy(gc->account, sn); |
8660 | 6158 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6159 "ssi: %s added you to their buddy list\n", sn); |
7015
dece74f05509
[gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents:
7011
diff
changeset
|
6160 gaim_account_notify_added(gc->account, NULL, sn, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); |
4230 | 6161 |
6162 return 1; | |
6163 } | |
4269 | 6164 #endif |
2086 | 6165 |
5575 | 6166 static GList *oscar_chat_info(GaimConnection *gc) { |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
6167 GList *m = NULL; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
6168 struct proto_chat_entry *pce; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
6169 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
6170 pce = g_new0(struct proto_chat_entry, 1); |
7841 | 6171 pce->label = _("_Group:"); |
5234 | 6172 pce->identifier = "room"; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
6173 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
6174 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
6175 pce = g_new0(struct proto_chat_entry, 1); |
7841 | 6176 pce->label = _("_Exchange:"); |
5234 | 6177 pce->identifier = "exchange"; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
6178 pce->is_int = TRUE; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
6179 pce->min = 4; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
6180 pce->max = 20; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
6181 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
6182 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
6183 return m; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
6184 } |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
6185 |
8308 | 6186 static void oscar_join_chat(GaimConnection *gc, GHashTable *data) { |
6187 OscarData *od = (OscarData *)gc->proto_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6188 aim_conn_t *cur; |
5234 | 6189 char *name, *exchange; |
6190 | |
6191 name = g_hash_table_lookup(data, "room"); | |
6192 exchange = g_hash_table_lookup(data, "exchange"); | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
6193 |
8660 | 6194 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6195 "Attempting to join chat room %s.\n", name); |
8308 | 6196 |
6197 if ((name == NULL) || (*name == '\0')) { | |
6198 gaim_notify_error(gc, NULL, _("Invalid chat name specified."), NULL); | |
6199 return; | |
6200 } | |
6201 | |
4617 | 6202 if ((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) { |
8660 | 6203 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6204 "chatnav exists, creating room\n"); |
5234 | 6205 aim_chatnav_createroom(od->sess, cur, name, atoi(exchange)); |
2086 | 6206 } else { |
6207 /* this gets tricky */ | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
6208 struct create_room *cr = g_new0(struct create_room, 1); |
8660 | 6209 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6210 "chatnav does not exist, opening chatnav\n"); |
5234 | 6211 cr->exchange = atoi(exchange); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
6212 cr->name = g_strdup(name); |
4617 | 6213 od->create_rooms = g_slist_append(od->create_rooms, cr); |
6214 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV); | |
2086 | 6215 } |
6216 } | |
6217 | |
8308 | 6218 static void oscar_chat_invite(GaimConnection *gc, int id, const char *message, const char *name) { |
6219 OscarData *od = (OscarData *)gc->proto_data; | |
6220 struct chat_connection *ccon = find_oscar_chat(gc, id); | |
2086 | 6221 |
6222 if (!ccon) | |
6223 return; | |
6224 | |
8225 | 6225 aim_im_sendch2_chatinvite(od->sess, name, message ? message : "", |
2086 | 6226 ccon->exchange, ccon->name, 0x0); |
6227 } | |
6228 | |
8308 | 6229 static void oscar_chat_leave(GaimConnection *gc, int id) { |
6230 OscarData *od = gc ? (OscarData *)gc->proto_data : NULL; | |
6231 GSList *bcs = gc->buddy_chats; | |
5679 | 6232 GaimConversation *b = NULL; |
2086 | 6233 struct chat_connection *c = NULL; |
6234 int count = 0; | |
6235 | |
6236 while (bcs) { | |
6237 count++; | |
5679 | 6238 b = (GaimConversation *)bcs->data; |
7118
bf630f7dfdcd
[gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents:
7111
diff
changeset
|
6239 if (id == gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))) |
2086 | 6240 break; |
6241 bcs = bcs->next; | |
6242 b = NULL; | |
6243 } | |
6244 | |
6245 if (!b) | |
6246 return; | |
6247 | |
8660 | 6248 gaim_debug_info("oscar", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6249 "Attempting to leave room %s (currently in %d rooms)\n", b->name, count); |
2086 | 6250 |
8308 | 6251 c = find_oscar_chat(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))); |
2086 | 6252 if (c != NULL) { |
4617 | 6253 if (od) |
6254 od->oscar_chats = g_slist_remove(od->oscar_chats, c); | |
2086 | 6255 if (c->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
6256 gaim_input_remove(c->inpa); |
8308 | 6257 if (gc && od->sess) |
4617 | 6258 aim_conn_kill(od->sess, &c->conn); |
2086 | 6259 g_free(c->name); |
6260 g_free(c->show); | |
6261 g_free(c); | |
6262 } | |
6263 /* we do this because with Oscar it doesn't tell us we left */ | |
8308 | 6264 serv_got_chat_left(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(b))); |
2086 | 6265 } |
6266 | |
8219 | 6267 static int oscar_send_chat(GaimConnection *gc, int id, const char *message) { |
6268 OscarData *od = (OscarData *)gc->proto_data; | |
6269 GError *err = NULL; | |
6270 GaimConversation *conv = NULL; | |
2086 | 6271 struct chat_connection *c = NULL; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
6272 char *buf, *buf2; |
8219 | 6273 char *charset = NULL; |
6274 int encoding; | |
8907 | 6275 gsize len; |
8219 | 6276 |
6277 if (!(conv = gaim_find_chat(gc, id))) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
6278 return -EINVAL; |
2086 | 6279 |
8219 | 6280 if (!(c = find_oscar_chat_by_conv(gc, conv))) |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
6281 return -EINVAL; |
2086 | 6282 |
8219 | 6283 buf = gaim_strdup_withhtml(message); |
6284 len = strlen(buf); | |
6285 | |
8962 | 6286 if (strstr(buf, "<IMG ")) |
6287 gaim_conversation_write(conv, "", | |
6288 _("Your IM Image was not sent. " | |
6289 "You cannot send IM Images in AIM chats."), | |
6290 GAIM_MESSAGE_ERROR, time(NULL)); | |
6291 | |
8219 | 6292 encoding = oscar_encoding_check(buf); |
8233 | 6293 if (encoding & AIM_IMFLAGS_UNICODE) { |
8660 | 6294 gaim_debug_info("oscar", "Sending Unicode chat\n"); |
8219 | 6295 charset = "unicode-2-0"; |
6296 buf2 = g_convert(buf, len, "UCS-2BE", "UTF-8", NULL, &len, &err); | |
6297 if (err) { | |
8660 | 6298 gaim_debug_error("oscar", |
8359 | 6299 "Error converting to unicode-2-0: %s\n", err->message); |
6300 g_error_free(err); | |
6301 } | |
8219 | 6302 } else if (encoding & AIM_IMFLAGS_ISO_8859_1) { |
8660 | 6303 gaim_debug_info("oscar", "Sending ISO-8859-1 chat\n"); |
8219 | 6304 charset = "iso-8859-1"; |
6305 buf2 = g_convert(buf, len, "ISO-8859-1", "UTF-8", NULL, &len, &err); | |
6306 if (err) { | |
8660 | 6307 gaim_debug_error("oscar", |
8359 | 6308 "Error converting to iso-8859-1: %s\n", err->message); |
8219 | 6309 g_error_free(err); |
8359 | 6310 err = NULL; |
6311 | |
8660 | 6312 gaim_debug_info("oscar", "Falling back to Unicode\n"); |
8359 | 6313 charset = "unicode-2-0"; |
6314 buf2 = g_convert(buf, len, "UCS-2BE", "UTF-8", NULL, &len, &err); | |
8219 | 6315 if (err) { |
8660 | 6316 gaim_debug_error("oscar", |
8359 | 6317 "Error converting to unicode-2-0: %s\n", |
6318 err->message); | |
8219 | 6319 g_error_free(err); |
6320 } | |
2086 | 6321 } |
8219 | 6322 } else { |
6323 charset = "us-ascii"; | |
6324 buf2 = g_strdup(buf); | |
6325 } | |
8359 | 6326 g_free(buf); |
6327 | |
6328 if ((len > c->maxlen) || (len > c->maxvis)) { | |
6329 g_free(buf2); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
6330 return -E2BIG; |
8359 | 6331 } |
6332 | |
6333 aim_chat_send_im(od->sess, c->conn, 0, buf2, len, charset, "en"); | |
8219 | 6334 g_free(buf2); |
8359 | 6335 |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
6336 return 0; |
2086 | 6337 } |
6338 | |
6695 | 6339 static const char *oscar_list_icon(GaimAccount *a, GaimBuddy *b) { |
4766 | 6340 if (!b || (b && b->name && b->name[0] == '+')) { |
5646
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
6341 if (a != NULL && isdigit(*gaim_account_get_username(a))) |
4687 | 6342 return "icq"; |
6343 else | |
6344 return "aim"; | |
6345 } | |
5646
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
6346 |
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
6347 if (b != NULL && isdigit(b->name[0])) |
4687 | 6348 return "icq"; |
6349 return "aim"; | |
6350 } | |
6351 | |
6695 | 6352 static void oscar_list_emblems(GaimBuddy *b, char **se, char **sw, char **nw, char **ne) |
4687 | 6353 { |
7334 | 6354 GaimAccount *account = NULL; |
6355 GaimConnection *gc = NULL; | |
6356 OscarData *od = NULL; | |
4687 | 6357 char *emblems[4] = {NULL,NULL,NULL,NULL}; |
6358 int i = 0; | |
7334 | 6359 aim_userinfo_t *userinfo = NULL; |
6360 | |
6361 if (b != NULL) | |
6362 account = b->account; | |
6363 if (account != NULL) | |
6364 gc = account->gc; | |
6365 if (gc != NULL) | |
6366 od = gc->proto_data; | |
7945 | 6367 if (od != NULL) |
6368 userinfo = aim_locate_finduserinfo(od->sess, b->name); | |
4687 | 6369 |
5131 | 6370 if (!GAIM_BUDDY_IS_ONLINE(b)) { |
6371 char *gname; | |
7334 | 6372 if ((b->name) && (od) && (od->sess->ssi.received_data) && |
5131 | 6373 (gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name)) && |
6374 (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name))) { | |
6375 emblems[i++] = "notauthorized"; | |
6376 } else { | |
6377 emblems[i++] = "offline"; | |
6378 } | |
6379 } | |
4916 | 6380 |
4766 | 6381 if (b->name && (b->uc & 0xffff0000) && isdigit(b->name[0])) { |
4960 | 6382 int uc = b->uc >> 16; |
4766 | 6383 if (uc & AIM_ICQ_STATE_INVISIBLE) |
4960 | 6384 emblems[i++] = "invisible"; |
4766 | 6385 else if (uc & AIM_ICQ_STATE_CHAT) |
4960 | 6386 emblems[i++] = "freeforchat"; |
4766 | 6387 else if (uc & AIM_ICQ_STATE_DND) |
4960 | 6388 emblems[i++] = "dnd"; |
4766 | 6389 else if (uc & AIM_ICQ_STATE_OUT) |
4960 | 6390 emblems[i++] = "na"; |
4766 | 6391 else if (uc & AIM_ICQ_STATE_BUSY) |
4960 | 6392 emblems[i++] = "occupied"; |
4766 | 6393 else if (uc & AIM_ICQ_STATE_AWAY) |
6394 emblems[i++] = "away"; | |
6395 } else { | |
6396 if (b->uc & UC_UNAVAILABLE) | |
6397 emblems[i++] = "away"; | |
6398 } | |
4687 | 6399 if (b->uc & UC_WIRELESS) |
6400 emblems[i++] = "wireless"; | |
6401 if (b->uc & UC_AOL) | |
6402 emblems[i++] = "aol"; | |
6403 if (b->uc & UC_ADMIN) | |
6404 emblems[i++] = "admin"; | |
6405 if (b->uc & UC_AB && i < 4) | |
6406 emblems[i++] = "activebuddy"; | |
4766 | 6407 /* if (b->uc & UC_UNCONFIRMED && i < 4) |
6408 emblems[i++] = "unconfirmed"; */ | |
7334 | 6409 |
7945 | 6410 if ((i < 4) && (userinfo != NULL) && (userinfo->capabilities & AIM_CAPS_HIPTOP)) |
6411 emblems[i++] = "hiptop"; | |
6412 | |
6413 if ((i < 4) && (userinfo != NULL) && (userinfo->capabilities & AIM_CAPS_SECUREIM)) | |
7334 | 6414 emblems[i++] = "secure"; |
6415 | |
4687 | 6416 *se = emblems[0]; |
6417 *sw = emblems[1]; | |
6418 *nw = emblems[2]; | |
6419 *ne = emblems[3]; | |
6420 } | |
6421 | |
6695 | 6422 static char *oscar_tooltip_text(GaimBuddy *b) { |
5575 | 6423 GaimConnection *gc = b->account->gc; |
7283 | 6424 OscarData *od = gc->proto_data; |
7045 | 6425 aim_userinfo_t *userinfo = aim_locate_finduserinfo(od->sess, b->name); |
8701 | 6426 GString *str = g_string_new(""); |
5131 | 6427 |
6428 if (GAIM_BUDDY_IS_ONLINE(b)) { | |
8701 | 6429 oscar_string_append_info(gc, str, "\n", b, userinfo); |
7011 | 6430 |
6431 if ((userinfo != NULL) && (userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) { | |
8225 | 6432 gchar *charset = oscar_encoding_extract(userinfo->away_encoding); |
8392 | 6433 gchar *away_utf8 = oscar_encoding_to_utf8(charset, userinfo->away, userinfo->away_len); |
8225 | 6434 g_free(charset); |
7011 | 6435 if (away_utf8 != NULL) { |
7091 | 6436 gchar *tmp1, *tmp2; |
8341 | 6437 tmp1 = gaim_strcasereplace(away_utf8, "<BR>", "\n"); |
6438 g_free(away_utf8); | |
7095
c8bf2da398e3
[gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents:
7093
diff
changeset
|
6439 tmp2 = gaim_markup_strip_html(tmp1); |
7091 | 6440 g_free(tmp1); |
8571 | 6441 tmp1 = gaim_escape_html(tmp2); |
7091 | 6442 g_free(tmp2); |
8700 | 6443 tmp2 = gaim_str_sub_away_formatters(tmp1, gaim_account_get_username(gaim_connection_get_account(gc))); |
8461 | 6444 g_free(tmp1); |
8701 | 6445 g_string_append_printf(str, "\n<b>%s:</b> %s", _("Away Message"), tmp2); |
8700 | 6446 g_free(tmp2); |
5836 | 6447 } |
5131 | 6448 } |
8701 | 6449 } |
6450 | |
6451 return g_string_free(str, FALSE); | |
5131 | 6452 } |
6453 | |
6695 | 6454 static char *oscar_status_text(GaimBuddy *b) { |
5575 | 6455 GaimConnection *gc = b->account->gc; |
7283 | 6456 OscarData *od = gc->proto_data; |
5167 | 6457 gchar *ret = NULL; |
6458 | |
6459 if ((b->uc & UC_UNAVAILABLE) || (((b->uc & 0xffff0000) >> 16) & AIM_ICQ_STATE_CHAT)) { | |
6460 if (isdigit(b->name[0])) | |
8701 | 6461 ret = oscar_icqstatus((b->uc & 0xffff0000) >> 16); |
7038 | 6462 else |
6463 ret = g_strdup(_("Away")); | |
5836 | 6464 } else if (GAIM_BUDDY_IS_ONLINE(b)) { |
7261 | 6465 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->account, b->name)); |
6292 | 6466 if (bi->availmsg) |
6467 ret = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg)); | |
5836 | 6468 } else { |
5167 | 6469 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); |
6470 if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) | |
6471 ret = g_strdup(_("Not Authorized")); | |
6472 else | |
6473 ret = g_strdup(_("Offline")); | |
6474 } | |
6475 | |
6476 return ret; | |
6477 } | |
6478 | |
5842 | 6479 |
5844 | 6480 static int oscar_icon_req(aim_session_t *sess, aim_frame_t *fr, ...) { |
5842 | 6481 GaimConnection *gc = sess->aux_data; |
7283 | 6482 OscarData *od = gc->proto_data; |
5892 | 6483 va_list ap; |
5842 | 6484 fu16_t type; |
5892 | 6485 fu8_t flags = 0, length = 0; |
6486 char *md5 = NULL; | |
6487 | |
7334 | 6488 |
5842 | 6489 va_start(ap, fr); |
6490 type = va_arg(ap, int); | |
5892 | 6491 |
6492 switch(type) { | |
6493 case 0x0000: | |
6494 case 0x0001: { | |
6495 flags = va_arg(ap, int); | |
6496 length = va_arg(ap, int); | |
6497 md5 = va_arg(ap, char *); | |
6498 | |
6499 if (flags == 0x41) { | |
6500 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON) && !od->iconconnecting) { | |
6501 od->iconconnecting = TRUE; | |
6502 od->set_icon = TRUE; | |
6503 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); | |
6504 } else { | |
6039 | 6505 struct stat st; |
6506 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); | |
6507 if (iconfile == NULL) { | |
8363 | 6508 aim_ssi_delicon(od->sess); |
6039 | 6509 } else if (!stat(iconfile, &st)) { |
6510 char *buf = g_malloc(st.st_size); | |
6511 FILE *file = fopen(iconfile, "rb"); | |
6512 if (file) { | |
6513 fread(buf, 1, st.st_size, file); | |
6514 fclose(file); | |
8660 | 6515 gaim_debug_info("oscar", |
6039 | 6516 "Uploading icon to icon server\n"); |
6879 | 6517 aim_bart_upload(od->sess, buf, st.st_size); |
5892 | 6518 } else |
8660 | 6519 gaim_debug_error("oscar", |
6039 | 6520 "Can't open buddy icon file!\n"); |
6521 g_free(buf); | |
6522 } else { | |
8660 | 6523 gaim_debug_error("oscar", |
6039 | 6524 "Can't stat buddy icon file!\n"); |
5892 | 6525 } |
6526 } | |
8363 | 6527 } else if (flags == 0x81) { |
6528 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); | |
6529 if (iconfile == NULL) | |
6530 aim_ssi_delicon(od->sess); | |
6531 else | |
6532 aim_ssi_seticon(od->sess, md5, length); | |
6533 } | |
5892 | 6534 } break; |
6535 | |
6536 case 0x0002: { /* We just set an "available" message? */ | |
6537 } break; | |
6538 } | |
6539 | |
5842 | 6540 va_end(ap); |
5844 | 6541 |
6542 return 0; | |
5842 | 6543 } |
5892 | 6544 |
5575 | 6545 static void oscar_set_permit_deny(GaimConnection *gc) { |
6546 GaimAccount *account = gaim_connection_get_account(gc); | |
7283 | 6547 OscarData *od = (OscarData *)gc->proto_data; |
4230 | 6548 #ifdef NOSSI |
8143 | 6549 GSList *list; |
4230 | 6550 char buf[MAXMSGLEN]; |
6551 int at; | |
6552 | |
5575 | 6553 switch(account->perm_deny) { |
8175 | 6554 case GAIM_PRIVACY_ALLOW_ALL: |
5575 | 6555 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gaim_account_get_username(account)); |
4230 | 6556 break; |
8175 | 6557 case GAIM_PRIVACY_DENY_ALL: |
5575 | 6558 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gaim_account_get_username(account)); |
4230 | 6559 break; |
8175 | 6560 case GAIM_PRIVACY_ALLOW_USERS: |
5575 | 6561 list = account->permit; |
4230 | 6562 at = 0; |
6563 while (list) { | |
6564 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
6565 list = list->next; | |
6566 } | |
6567 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); | |
6568 break; | |
8175 | 6569 case GAIM_PRIVACY_DENY_USERS: |
5575 | 6570 list = account->deny; |
4230 | 6571 at = 0; |
6572 while (list) { | |
6573 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
6574 list = list->next; | |
6575 } | |
6576 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf); | |
6577 break; | |
6578 default: | |
6579 break; | |
2086 | 6580 } |
4230 | 6581 #else |
8175 | 6582 if (od->sess->ssi.received_data) { |
6583 switch (account->perm_deny) { | |
6584 case GAIM_PRIVACY_ALLOW_ALL: | |
6585 aim_ssi_setpermdeny(od->sess, 0x01, 0xffffffff); | |
6586 break; | |
6587 case GAIM_PRIVACY_ALLOW_BUDDYLIST: | |
6588 aim_ssi_setpermdeny(od->sess, 0x05, 0xffffffff); | |
6589 break; | |
6590 case GAIM_PRIVACY_ALLOW_USERS: | |
6591 aim_ssi_setpermdeny(od->sess, 0x03, 0xffffffff); | |
6592 break; | |
6593 case GAIM_PRIVACY_DENY_ALL: | |
6594 aim_ssi_setpermdeny(od->sess, 0x02, 0xffffffff); | |
6595 break; | |
6596 case GAIM_PRIVACY_DENY_USERS: | |
6597 aim_ssi_setpermdeny(od->sess, 0x04, 0xffffffff); | |
6598 break; | |
6599 default: | |
6600 aim_ssi_setpermdeny(od->sess, 0x01, 0xffffffff); | |
6601 break; | |
6602 } | |
6603 } | |
4230 | 6604 #endif |
2086 | 6605 } |
6606 | |
5575 | 6607 static void oscar_add_permit(GaimConnection *gc, const char *who) { |
4269 | 6608 #ifdef NOSSI |
8143 | 6609 if (gc->account->perm_deny == 3) |
4269 | 6610 oscar_set_permit_deny(gc); |
6611 #else | |
7283 | 6612 OscarData *od = (OscarData *)gc->proto_data; |
8660 | 6613 gaim_debug_info("oscar", "ssi: About to add a permit\n"); |
4230 | 6614 if (od->sess->ssi.received_data) |
4889 | 6615 aim_ssi_addpermit(od->sess, who); |
4230 | 6616 #endif |
2086 | 6617 } |
6618 | |
5575 | 6619 static void oscar_add_deny(GaimConnection *gc, const char *who) { |
4269 | 6620 #ifdef NOSSI |
8143 | 6621 if (gc->account->perm_deny == 4) |
4269 | 6622 oscar_set_permit_deny(gc); |
6623 #else | |
7283 | 6624 OscarData *od = (OscarData *)gc->proto_data; |
8660 | 6625 gaim_debug_info("oscar", "ssi: About to add a deny\n"); |
4230 | 6626 if (od->sess->ssi.received_data) |
4889 | 6627 aim_ssi_adddeny(od->sess, who); |
4230 | 6628 #endif |
2086 | 6629 } |
6630 | |
5575 | 6631 static void oscar_rem_permit(GaimConnection *gc, const char *who) { |
4269 | 6632 #ifdef NOSSI |
8143 | 6633 if (gc->account->perm_deny == 3) |
4269 | 6634 oscar_set_permit_deny(gc); |
6635 #else | |
7283 | 6636 OscarData *od = (OscarData *)gc->proto_data; |
8660 | 6637 gaim_debug_info("oscar", "ssi: About to delete a permit\n"); |
4230 | 6638 if (od->sess->ssi.received_data) |
4889 | 6639 aim_ssi_delpermit(od->sess, who); |
4230 | 6640 #endif |
2086 | 6641 } |
6642 | |
5575 | 6643 static void oscar_rem_deny(GaimConnection *gc, const char *who) { |
4269 | 6644 #ifdef NOSSI |
8143 | 6645 if (gc->account->perm_deny == 4) |
4269 | 6646 oscar_set_permit_deny(gc); |
6647 #else | |
7283 | 6648 OscarData *od = (OscarData *)gc->proto_data; |
8660 | 6649 gaim_debug_info("oscar", "ssi: About to delete a deny\n"); |
4230 | 6650 if (od->sess->ssi.received_data) |
4889 | 6651 aim_ssi_deldeny(od->sess, who); |
4230 | 6652 #endif |
2086 | 6653 } |
6654 | |
5575 | 6655 static GList *oscar_away_states(GaimConnection *gc) |
2086 | 6656 { |
7283 | 6657 OscarData *od = gc->proto_data; |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6658 GList *m = NULL; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6659 |
8257 | 6660 if (od->icq) { |
6661 m = g_list_append(m, _("Online")); | |
6662 m = g_list_append(m, _("Away")); | |
6663 m = g_list_append(m, _("Do Not Disturb")); | |
6664 m = g_list_append(m, _("Not Available")); | |
6665 m = g_list_append(m, _("Occupied")); | |
6666 m = g_list_append(m, _("Free For Chat")); | |
6667 m = g_list_append(m, _("Invisible")); | |
6668 } else { | |
6669 m = g_list_append(m, GAIM_AWAY_CUSTOM); | |
8476 | 6670 m = g_list_append(m, _("Back")); |
8257 | 6671 m = g_list_append(m, _("Visible")); |
6672 m = g_list_append(m, _("Invisible")); | |
6673 } | |
4333 | 6674 |
6675 return m; | |
6676 } | |
6677 | |
7172 | 6678 static void oscar_ssi_editcomment(struct name_data *data, const char *text) { |
8341 | 6679 GaimConnection *gc = data->gc; |
6680 OscarData *od = gc->proto_data; | |
7172 | 6681 GaimBuddy *b; |
6682 GaimGroup *g; | |
6683 | |
6684 if (!(b = gaim_find_buddy(gaim_connection_get_account(data->gc), data->name))) { | |
6685 oscar_free_name_data(data); | |
6686 return; | |
6687 } | |
6688 | |
6689 if (!(g = gaim_find_buddys_group(b))) { | |
6690 oscar_free_name_data(data); | |
6691 return; | |
6692 } | |
6693 | |
6694 aim_ssi_editcomment(od->sess, g->name, data->name, text); | |
8341 | 6695 |
6696 if (!aim_sncmp(data->name, gc->account->username)) | |
6697 gaim_check_comment(od, text); | |
6698 | |
7172 | 6699 oscar_free_name_data(data); |
6700 } | |
6701 | |
9030 | 6702 static void oscar_buddycb_edit_comment(GaimBlistNode *node, gpointer ignore) { |
6703 | |
6704 GaimBuddy *buddy; | |
6705 GaimConnection *gc; | |
6706 OscarData *od; | |
6707 struct name_data *data; | |
7172 | 6708 GaimGroup *g; |
6709 char *comment; | |
6710 gchar *comment_utf8; | |
6711 | |
9030 | 6712 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node)); |
6713 | |
6714 buddy = (GaimBuddy *) node; | |
6715 gc = gaim_account_get_connection(buddy->account); | |
6716 od = gc->proto_data; | |
6717 | |
6718 data = g_new(struct name_data, 1); | |
6719 | |
6720 if (!(g = gaim_find_buddys_group(buddy))) | |
7172 | 6721 return; |
9030 | 6722 comment = aim_ssi_getcomment(od->sess->ssi.local, g->name, buddy->name); |
7172 | 6723 comment_utf8 = comment ? gaim_utf8_try_convert(comment) : NULL; |
6724 | |
6725 data->gc = gc; | |
9030 | 6726 data->name = g_strdup(buddy->name); |
7172 | 6727 data->nick = NULL; |
6728 | |
6729 gaim_request_input(gc, NULL, _("Buddy Comment:"), NULL, | |
8697 | 6730 comment_utf8, TRUE, FALSE, NULL, |
7172 | 6731 _("OK"), G_CALLBACK(oscar_ssi_editcomment), |
6732 _("Cancel"), G_CALLBACK(oscar_free_name_data), | |
6733 data); | |
6734 | |
6735 free(comment); | |
6736 g_free(comment_utf8); | |
6737 } | |
6738 | |
9030 | 6739 static GList *oscar_buddy_menu(GaimBuddy *buddy) { |
6740 | |
6741 GaimConnection *gc = gaim_account_get_connection(buddy->account); | |
7283 | 6742 OscarData *od = gc->proto_data; |
9030 | 6743 |
4333 | 6744 GList *m = NULL; |
9030 | 6745 GaimBlistNodeAction *act; |
6746 | |
6747 act = gaim_blist_node_action_new(_("Edit Buddy Comment"), | |
6748 oscar_buddycb_edit_comment, NULL); | |
6749 m = g_list_append(m, act); | |
7172 | 6750 |
4333 | 6751 if (od->icq) { |
4624 | 6752 #if 0 |
9030 | 6753 act = gaim_blist_node_action_new(_("Get Status Msg"), |
6754 oscar_get_icqstatusmsg, NULL); | |
6755 m = g_list_append(m, act); | |
4624 | 6756 #endif |
4333 | 6757 } else { |
7011 | 6758 aim_userinfo_t *userinfo; |
9030 | 6759 userinfo = aim_locate_finduserinfo(od->sess, buddy->name); |
6760 | |
6761 if (userinfo && aim_sncmp(gaim_account_get_username(buddy->account), buddy->name) && | |
6762 GAIM_BUDDY_IS_ONLINE(buddy)) { | |
6763 | |
7011 | 6764 if (userinfo->capabilities & AIM_CAPS_DIRECTIM) { |
9030 | 6765 act = gaim_blist_node_action_new(_("Direct IM"), |
6766 oscar_ask_direct_im, NULL); | |
6767 m = g_list_append(m, act); | |
5917 | 6768 } |
7650 | 6769 |
6770 if (userinfo->capabilities & AIM_CAPS_SENDFILE) { | |
9030 | 6771 act = gaim_blist_node_action_new(_("Send File"), |
6772 oscar_ask_sendfile, NULL); | |
6773 m = g_list_append(m, act); | |
7650 | 6774 } |
4826 | 6775 #if 0 |
7011 | 6776 if (userinfo->capabilities & AIM_CAPS_GETFILE) { |
9030 | 6777 act = gaim_blist_node_action_new(_("Get File"), |
6778 oscar_ask_getfile, NULL); | |
6779 m = g_list_append(m, act); | |
5917 | 6780 } |
4826 | 6781 #endif |
4333 | 6782 } |
5131 | 6783 } |
5197 | 6784 |
5131 | 6785 if (od->sess->ssi.received_data) { |
9030 | 6786 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, buddy->name); |
6787 if (gname && aim_ssi_waitingforauth(od->sess->ssi.local, gname, buddy->name)) { | |
6788 act = gaim_blist_node_action_new(_("Re-request Authorization"), | |
6789 gaim_auth_sendrequest_menu, NULL); | |
6790 m = g_list_append(m, act); | |
4333 | 6791 } |
4916 | 6792 } |
6793 | |
4333 | 6794 return m; |
6795 } | |
6796 | |
9030 | 6797 |
6798 static GList *oscar_blist_node_menu(GaimBlistNode *node) { | |
6799 if(GAIM_BLIST_NODE_IS_BUDDY(node)) { | |
6800 return oscar_buddy_menu((GaimBuddy *) node); | |
6801 } else { | |
6802 return NULL; | |
6803 } | |
6804 } | |
6805 | |
6806 | |
5575 | 6807 static void oscar_format_screenname(GaimConnection *gc, const char *nick) { |
7283 | 6808 OscarData *od = gc->proto_data; |
5575 | 6809 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), nick)) { |
4333 | 6810 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { |
6811 od->setnick = TRUE; | |
6812 od->newsn = g_strdup(nick); | |
6813 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6814 } else { | |
6815 aim_admin_setnick(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH), nick); | |
6816 } | |
6817 } else { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
6818 gaim_notify_error(gc, NULL, _("The new formatting is invalid."), |
8152 | 6819 _("Screen name formatting can change only capitalization and whitespace.")); |
4333 | 6820 } |
6821 } | |
6822 | |
9015 | 6823 static void oscar_show_format_screenname(GaimPluginAction *action) |
4333 | 6824 { |
9015 | 6825 GaimConnection *gc = (GaimConnection *) action->context; |
8152 | 6826 gaim_request_input(gc, NULL, _("New screen name formatting:"), NULL, |
8697 | 6827 gaim_connection_get_display_name(gc), FALSE, FALSE, NULL, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6828 _("OK"), G_CALLBACK(oscar_format_screenname), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6829 _("Cancel"), NULL, |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6830 gc); |
4333 | 6831 } |
6832 | |
9015 | 6833 static void oscar_confirm_account(GaimPluginAction *action) |
4333 | 6834 { |
9015 | 6835 GaimConnection *gc = (GaimConnection *) action->context; |
7283 | 6836 OscarData *od = gc->proto_data; |
4333 | 6837 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6838 | |
6839 if (conn) { | |
6840 aim_admin_reqconfirm(od->sess, conn); | |
6841 } else { | |
6842 od->conf = TRUE; | |
6843 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6844 } | |
6845 } | |
6846 | |
9015 | 6847 static void oscar_show_email(GaimPluginAction *action) |
4333 | 6848 { |
9015 | 6849 GaimConnection *gc = (GaimConnection *) action->context; |
7283 | 6850 OscarData *od = gc->proto_data; |
4333 | 6851 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6852 | |
6853 if (conn) { | |
6854 aim_admin_getinfo(od->sess, conn, 0x11); | |
6855 } else { | |
6856 od->reqemail = TRUE; | |
6857 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6858 } | |
6859 } | |
6860 | |
5575 | 6861 static void oscar_change_email(GaimConnection *gc, const char *email) |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6862 { |
7283 | 6863 OscarData *od = gc->proto_data; |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6864 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
|
6865 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6866 if (conn) { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6867 aim_admin_setemail(od->sess, conn, email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6868 } else { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6869 od->setemail = TRUE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6870 od->email = g_strdup(email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6871 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6872 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6873 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6874 |
9015 | 6875 static void oscar_show_change_email(GaimPluginAction *action) |
4333 | 6876 { |
9015 | 6877 GaimConnection *gc = (GaimConnection *) action->context; |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
6878 gaim_request_input(gc, NULL, _("Change Address To:"), NULL, NULL, |
8697 | 6879 FALSE, FALSE, NULL, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6880 _("OK"), G_CALLBACK(oscar_change_email), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6881 _("Cancel"), NULL, |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6882 gc); |
4333 | 6883 } |
6884 | |
9015 | 6885 static void oscar_show_awaitingauth(GaimPluginAction *action) |
4333 | 6886 { |
9015 | 6887 GaimConnection *gc = (GaimConnection *) action->context; |
7283 | 6888 OscarData *od = gc->proto_data; |
4333 | 6889 gchar *nombre, *text, *tmp; |
6695 | 6890 GaimBlistNode *gnode, *cnode, *bnode; |
4333 | 6891 int num=0; |
6892 | |
6873 | 6893 text = g_strdup(""); |
4333 | 6894 |
4785 | 6895 for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
6695 | 6896 GaimGroup *group = (GaimGroup *)gnode; |
4785 | 6897 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) |
6898 continue; | |
6695 | 6899 for (cnode = gnode->child; cnode; cnode = cnode->next) { |
6900 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 6901 continue; |
6695 | 6902 for (bnode = cnode->child; bnode; bnode = bnode->next) { |
6903 GaimBuddy *buddy = (GaimBuddy *)bnode; | |
6904 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
6905 continue; | |
6906 if (buddy->account == gc->account && aim_ssi_waitingforauth(od->sess->ssi.local, group->name, buddy->name)) { | |
6907 if (gaim_get_buddy_alias_only(buddy)) | |
6908 nombre = g_strdup_printf(" %s (%s)", buddy->name, gaim_get_buddy_alias_only(buddy)); | |
6909 else | |
6910 nombre = g_strdup_printf(" %s", buddy->name); | |
6873 | 6911 tmp = g_strdup_printf("%s%s<br>", text, nombre); |
6695 | 6912 g_free(text); |
6913 text = tmp; | |
6914 g_free(nombre); | |
6915 num++; | |
6916 } | |
4333 | 6917 } |
2979 | 6918 } |
4333 | 6919 } |
6920 | |
6921 if (!num) { | |
6922 g_free(text); | |
6873 | 6923 text = g_strdup(_("<i>you are not waiting for authorization</i>")); |
6924 } | |
6925 | |
6926 gaim_notify_formatted(gc, NULL, _("You are awaiting authorization from " | |
6927 "the following buddies"), _("You can re-request " | |
6928 "authorization from these buddies by " | |
6929 "right-clicking on them and selecting " | |
6930 "\"Re-request Authorization.\""), text, NULL, NULL); | |
4333 | 6931 g_free(text); |
2979 | 6932 } |
6933 | |
7080
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6934 static void search_by_email_cb(GaimConnection *gc, const char *email) |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6935 { |
8950 | 6936 OscarData *od = (OscarData *)gc->proto_data; |
6937 | |
6938 aim_search_address(od->sess, od->conn, email); | |
7080
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6939 } |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6940 |
9015 | 6941 static void oscar_show_find_email(GaimPluginAction *action) |
7080
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6942 { |
9015 | 6943 GaimConnection *gc = (GaimConnection *) action->context; |
7080
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6944 gaim_request_input(gc, _("Find Buddy by E-mail"), |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6945 _("Search for a buddy by e-mail address"), |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6946 _("Type the e-mail address of the buddy you are " |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6947 "searching for."), |
8697 | 6948 NULL, FALSE, FALSE, NULL, |
7080
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6949 _("Search"), G_CALLBACK(search_by_email_cb), |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6950 _("Cancel"), NULL, gc); |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6951 } |
fc9c74cfb306
[gaim-migrate @ 7645]
Christian Hammond <chipx86@chipx86.com>
parents:
7067
diff
changeset
|
6952 |
7366 | 6953 #if 0 |
5917 | 6954 static void oscar_setavailmsg(GaimConnection *gc, char *text) { |
7283 | 6955 OscarData *od = (OscarData *)gc->proto_data; |
5917 | 6956 |
7334 | 6957 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0); |
5917 | 6958 aim_srv_setavailmsg(od->sess, text); |
6959 } | |
6960 | |
6961 static void oscar_show_setavailmsg(GaimConnection *gc) | |
6962 { | |
7313 | 6963 gaim_request_input(gc, NULL, _("Available Message:"), NULL, |
6964 _("I'm doing work and hoping for a distraction--IM me!"), | |
8697 | 6965 TRUE, FALSE, NULL, |
5917 | 6966 _("OK"), G_CALLBACK(oscar_setavailmsg), |
6967 _("Cancel"), NULL, | |
6968 gc); | |
6969 } | |
7366 | 6970 #endif |
5917 | 6971 |
9015 | 6972 static void oscar_show_set_info(GaimPluginAction *action) |
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6973 { |
9015 | 6974 GaimConnection *gc = (GaimConnection *) action->context; |
7067
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6975 gaim_account_request_change_user_info(gaim_connection_get_account(gc)); |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6976 } |
71e0da45abe6
[gaim-migrate @ 7631]
Christian Hammond <chipx86@chipx86.com>
parents:
7063
diff
changeset
|
6977 |
9015 | 6978 static void oscar_show_set_info_icqurl(GaimPluginAction *action) |
8576 | 6979 { |
9015 | 6980 GaimConnection *gc = (GaimConnection *) action->context; |
8576 | 6981 gaim_notify_uri(gc, "http://web.icq.com/whitepages/login/1,,,00.html"); |
6982 } | |
6983 | |
9015 | 6984 static void oscar_change_pass(GaimPluginAction *action) |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6985 { |
9015 | 6986 GaimConnection *gc = (GaimConnection *) action->context; |
7063
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6987 gaim_account_request_change_password(gaim_connection_get_account(gc)); |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6988 } |
7fdac700deb1
[gaim-migrate @ 7627]
Christian Hammond <chipx86@chipx86.com>
parents:
7060
diff
changeset
|
6989 |
9015 | 6990 static void oscar_show_chpassurl(GaimPluginAction *action) |
4333 | 6991 { |
9015 | 6992 GaimConnection *gc = (GaimConnection *) action->context; |
7283 | 6993 OscarData *od = gc->proto_data; |
5575 | 6994 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
|
6995 gaim_notify_uri(gc, substituted); |
5517 | 6996 g_free(substituted); |
4333 | 6997 } |
6998 | |
9015 | 6999 static void oscar_show_imforwardingurl(GaimPluginAction *action) |
7026 | 7000 { |
9015 | 7001 GaimConnection *gc = (GaimConnection *) action->context; |
7026 | 7002 gaim_notify_uri(gc, "http://mymobile.aol.com/dbreg/register?action=imf&clientID=1"); |
7003 } | |
7004 | |
5842 | 7005 static void oscar_set_icon(GaimConnection *gc, const char *iconfile) |
7006 { | |
7283 | 7007 OscarData *od = gc->proto_data; |
5844 | 7008 aim_session_t *sess = od->sess; |
5842 | 7009 FILE *file; |
7010 struct stat st; | |
5844 | 7011 |
6039 | 7012 if (iconfile == NULL) { |
8363 | 7013 aim_ssi_delicon(od->sess); |
6039 | 7014 } else if (!stat(iconfile, &st)) { |
5842 | 7015 char *buf = g_malloc(st.st_size); |
7016 file = fopen(iconfile, "rb"); | |
7017 if (file) { | |
6052 | 7018 md5_state_t *state; |
6039 | 7019 char md5[16]; |
5842 | 7020 int len = fread(buf, 1, st.st_size, file); |
6039 | 7021 fclose(file); |
6052 | 7022 state = g_malloc(sizeof(md5_state_t)); |
5842 | 7023 md5_init(state); |
7024 md5_append(state, buf, len); | |
7025 md5_finish(state, md5); | |
7026 g_free(state); | |
7027 aim_ssi_seticon(sess, md5, 16); | |
7028 } else | |
8660 | 7029 gaim_debug_error("oscar", |
5842 | 7030 "Can't open buddy icon file!\n"); |
7031 g_free(buf); | |
7032 } else | |
8660 | 7033 gaim_debug_error("oscar", |
5842 | 7034 "Can't stat buddy icon file!\n"); |
7035 } | |
7036 | |
7037 | |
9015 | 7038 static GList *oscar_actions(GaimPlugin *plugin, gpointer context) |
2086 | 7039 { |
9015 | 7040 GaimConnection *gc = (GaimConnection *) context; |
7283 | 7041 OscarData *od = gc->proto_data; |
4333 | 7042 GList *m = NULL; |
9015 | 7043 GaimPluginAction *act; |
7044 | |
7045 act = gaim_plugin_action_new(_("Set User Info..."), | |
7046 oscar_show_set_info); | |
7047 m = g_list_append(m, act); | |
4333 | 7048 |
8576 | 7049 if (od->icq) { |
9015 | 7050 act = gaim_plugin_action_new(_("Set User Info (URL)..."), |
7051 oscar_show_set_info_icqurl); | |
7052 m = g_list_append(m, act); | |
8576 | 7053 } |
7054 | |
7366 | 7055 #if 0 |
9015 | 7056 act = gaim_plugin_action_new(_("Set Available Message..."), |
7057 oscar_show_setavailmsg); | |
7058 m = g_list_append(m, act); | |
7366 | 7059 #endif |
5917 | 7060 |
9015 | 7061 act = gaim_plugin_action_new(_("Change Password..."), |
7062 oscar_change_pass); | |
7063 m = g_list_append(m, act); | |
4617 | 7064 |
7065 if (od->sess->authinfo->chpassurl) { | |
9015 | 7066 act = gaim_plugin_action_new(_("Change Password (URL)"), |
7067 oscar_show_chpassurl); | |
7068 m = g_list_append(m, act); | |
7069 | |
7070 act = gaim_plugin_action_new(_("Configure IM Forwarding (URL)"), | |
7071 oscar_show_imforwardingurl); | |
7072 m = g_list_append(m, act); | |
7026 | 7073 } |
7074 | |
5238 | 7075 if (!od->icq) { |
4617 | 7076 /* AIM actions */ |
7077 m = g_list_append(m, NULL); | |
4333 | 7078 |
9015 | 7079 act = gaim_plugin_action_new(_("Format Screen Name..."), |
7080 oscar_show_format_screenname); | |
7081 m = g_list_append(m, act); | |
7082 | |
7083 act = gaim_plugin_action_new(_("Confirm Account"), | |
7084 oscar_confirm_account); | |
7085 m = g_list_append(m, act); | |
7086 | |
7087 act = gaim_plugin_action_new(_("Display Currently Registered Address"), | |
7088 oscar_show_email); | |
7089 m = g_list_append(m, act); | |
7090 | |
7091 act = gaim_plugin_action_new(_("Change Currently Registered Address..."), | |
7092 oscar_show_change_email); | |
7093 m = g_list_append(m, act); | |
2086 | 7094 } |
4333 | 7095 |
7096 m = g_list_append(m, NULL); | |
7097 | |
9015 | 7098 act = gaim_plugin_action_new(_("Show Buddies Awaiting Authorization"), |
7099 oscar_show_awaitingauth); | |
7100 m = g_list_append(m, act); | |
4333 | 7101 |
2086 | 7102 m = g_list_append(m, NULL); |
4333 | 7103 |
9015 | 7104 act = gaim_plugin_action_new(_("Search for Buddy by Email..."), |
7105 oscar_show_find_email); | |
7106 m = g_list_append(m, act); | |
4333 | 7107 |
8591 | 7108 #if 0 |
9015 | 7109 act = gaim_plugin_action_new(_("Search for Buddy by Information"), |
7110 show_find_info); | |
7111 m = g_list_append(m, act); | |
8591 | 7112 #endif |
2086 | 7113 |
7114 return m; | |
7115 } | |
7116 | |
5575 | 7117 static void oscar_change_passwd(GaimConnection *gc, const char *old, const char *new) |
2086 | 7118 { |
7283 | 7119 OscarData *od = gc->proto_data; |
4617 | 7120 |
7121 if (od->icq) { | |
7122 aim_icq_changepasswd(od->sess, new); | |
2086 | 7123 } else { |
4617 | 7124 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
7125 if (conn) { | |
7126 aim_admin_changepasswd(od->sess, conn, new, old); | |
7127 } else { | |
7128 od->chpass = TRUE; | |
7129 od->oldp = g_strdup(old); | |
7130 od->newp = g_strdup(new); | |
7131 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
7132 } | |
2086 | 7133 } |
7134 } | |
7135 | |
6059 | 7136 static void oscar_convo_closed(GaimConnection *gc, const char *who) |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
7137 { |
7283 | 7138 OscarData *od = gc->proto_data; |
8971 | 7139 struct oscar_direct_im *dim = oscar_direct_im_find(od, who); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
7140 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
7141 if (!dim) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
7142 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
7143 |
8971 | 7144 oscar_direct_im_destroy(od, dim); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
7145 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
7146 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7147 static GaimPluginProtocolInfo prpl_info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7148 { |
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
7149 GAIM_PRPL_API_VERSION, |
9308 | 7150 OPT_PROTO_MAIL_CHECK | OPT_PROTO_IM_IMAGE, |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7151 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7152 NULL, |
9318 | 7153 {"jpeg,gif,bmp,ico", 48, 48, 50, 50, GAIM_ICON_SCALE_DISPLAY}, |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7154 oscar_list_icon, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7155 oscar_list_emblems, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7156 oscar_status_text, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7157 oscar_tooltip_text, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7158 oscar_away_states, |
9030 | 7159 oscar_blist_node_menu, |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7160 oscar_chat_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7161 oscar_login, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7162 oscar_close, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7163 oscar_send_im, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7164 oscar_set_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7165 oscar_send_typing, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7166 oscar_get_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7167 oscar_set_away, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7168 oscar_set_idle, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7169 oscar_change_passwd, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7170 oscar_add_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7171 oscar_add_buddies, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7172 oscar_remove_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7173 oscar_remove_buddies, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7174 oscar_add_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7175 oscar_add_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7176 oscar_rem_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7177 oscar_rem_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7178 oscar_set_permit_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7179 oscar_warn, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7180 oscar_join_chat, |
8562 | 7181 NULL, /* reject chat invite */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7182 oscar_chat_invite, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7183 oscar_chat_leave, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7184 NULL, |
8219 | 7185 oscar_send_chat, |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7186 oscar_keepalive, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7187 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7188 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7189 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7190 #ifndef NOSSI |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7191 oscar_alias_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7192 oscar_move_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7193 oscar_rename_group, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7194 #else |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7195 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7196 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7197 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7198 #endif |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7199 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7200 oscar_convo_closed, |
5842 | 7201 NULL, |
8586 | 7202 oscar_set_icon, |
8589 | 7203 NULL, |
7204 NULL, | |
7205 NULL, | |
7206 NULL, | |
7207 NULL, | |
7208 NULL, | |
7209 NULL | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7210 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7211 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7212 static GaimPluginInfo info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7213 { |
8749
d7b8eb1f0a18
[gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents:
8735
diff
changeset
|
7214 GAIM_PLUGIN_API_VERSION, /**< api_version */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7215 GAIM_PLUGIN_PROTOCOL, /**< type */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7216 NULL, /**< ui_requirement */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7217 0, /**< flags */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7218 NULL, /**< dependencies */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7219 GAIM_PRIORITY_DEFAULT, /**< priority */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7220 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7221 "prpl-oscar", /**< id */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7222 "AIM/ICQ", /**< name */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7223 VERSION, /**< version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7224 /** summary */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7225 N_("AIM/ICQ Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7226 /** description */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7227 N_("AIM/ICQ Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7228 NULL, /**< author */ |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6350
diff
changeset
|
7229 GAIM_WEBSITE, /**< homepage */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7230 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7231 NULL, /**< load */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7232 NULL, /**< unload */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7233 NULL, /**< destroy */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7234 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7235 NULL, /**< ui_info */ |
8993 | 7236 &prpl_info, /**< extra_info */ |
7237 NULL, | |
9015 | 7238 oscar_actions |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7239 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7240 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7241 static void |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5917
diff
changeset
|
7242 init_plugin(GaimPlugin *plugin) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7243 { |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
7244 GaimAccountOption *option; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
7245 |
5685
43ea75092684
[gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
7246 option = gaim_account_option_string_new(_("Auth host"), "server", |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
7247 "login.oscar.aol.com"); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
7248 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
7249 option); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
7250 |
5685
43ea75092684
[gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
7251 option = gaim_account_option_int_new(_("Auth port"), "port", 5190); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
7252 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
7253 option); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7254 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
7255 my_protocol = plugin; |
2086 | 7256 } |
7257 | |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5917
diff
changeset
|
7258 GAIM_INIT_PLUGIN(oscar, init_plugin, info); |