Mercurial > pidgin.yaz
annotate src/protocols/oscar/oscar.c @ 7011:4375bf2d9020
[gaim-migrate @ 7574]
The user-visible changes? Gaim now shows peep's away messages in their
tooltip for AIM over oscar.
Things to do:
-Make sure this doesn't screw up with huge buddy lists
-Replace %n with your screen name, etc. in the tooltip
-Leave in b, i, u tags in the tooltip
-Fix the 2 8 byte memleaks in locate.c
Client authors that aren't me will want to read the following pretty
closely...
I made some internal libfaim changes. I desire to make libfaim cleaner.
I don't know if this really helps or not. Here's what I've done:
Changed all the SNAC-sending functions in info.c to NOT take a conn
argument. The connection is looked up from the session. I'm trying
to make oscar.c less-aware of connections.
Added aim_locate_finduserinfo() - Use for getting the aim_userinfo_t for the
given screenname.
Added aim_locate_getinfoshort() - Use this to request that the servers send
you profile info, away message, caps, or a combination of the above. It's
like aim_locate_getinfo() but less rate limited.
Renamed aim_bos_reqlocaterights() to aim_locate_reqrights()
Renamed aim_getinfo() to aim_locate_getinfo()
Renamed aim_setdirectoryinfo() to aim_locate_setdirinfo()
Renamed aim_0002_000b() to aim_locate_000b()
Renamed aim_setuserinterests() to aim_locate_setinterests()
Removed aim_userinfo_sn()
Removed aim_userinfo_flags()
Removed aim_userinfo_idle()
Removed aim_userinfo_warnlevel()
Removed aim_userinfo_createtime()
Removed aim_userinfo_membersince()
Removed aim_userinfo_onlinesince()
Removed aim_userinfo_sessionlen()
Removed aim_userinfo_hascap()
Renamed info.c to locate.c
Made locate.c keep a static, linked list of nodes of sn, away message,
available message, user info. This list is maintained by libfaim
automatically. Now clients don't have to keep track of all this stuff
themselves, and users won't have to wait for away message/info retrieval
if the person is in your buddy list. libfaim uses the iChat way of
retrieving stuff, which is not nearly as rate limited as the old way.
I actually have a feeling WinAIM uses the same SNAC now (although I
didn't check), but I like pluggin iChat because it's innovative.
Moved sess->emailinfo to a static variable inside email.c.
Removed evilhack from oscar.c
I think that's about everything...
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 29 Sep 2003 12:30:03 +0000 |
parents | 083d1e4a9c78 |
children | dece74f05509 |
rev | line source |
---|---|
2086 | 1 /* |
2 * gaim | |
3 * | |
4 * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
6302 | 5 * Some code copyright (C) 1999-2001, Eric Warmenhoven |
6 * Some code copyright (C) 2001-2003, Sean Egan | |
7 * Some code copyright (C) 2001-2003, Mark Doliner <thekingant@users.sourceforge.net> | |
8 * | |
9 * Most libfaim code copyright (C) 1998-2001 Adam Fritzler <afritz@auk.cx> | |
10 * Some libfaim code copyright (C) 2001-2003 Mark Doliner <thekingant@users.sourceforge.net> | |
2086 | 11 * |
12 * This program is free software; you can redistribute it and/or modify | |
13 * it under the terms of the GNU General Public License as published by | |
14 * the Free Software Foundation; either version 2 of the License, or | |
15 * (at your option) any later version. | |
16 * | |
17 * This program is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 * GNU General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU General Public License | |
23 * along with this program; if not, write to the Free Software | |
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
25 * | |
26 */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
27 #include "internal.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
28 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
29 #include "account.h" |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
30 #include "accountopt.h" |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
31 #include "buddyicon.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
32 #include "conversation.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
33 #include "debug.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
34 #include "ft.h" |
6982 | 35 #include "imgstore.h" |
2086 | 36 #include "multi.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
37 #include "notify.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
38 #include "privacy.h" |
2086 | 39 #include "prpl.h" |
4889 | 40 #include "proxy.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
41 #include "request.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
42 #include "util.h" |
6115
11bedb793a44
[gaim-migrate @ 6578]
Christian Hammond <chipx86@chipx86.com>
parents:
6113
diff
changeset
|
43 #include "html.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
44 |
2086 | 45 #include "aim.h" |
5842 | 46 #include "md5.h" |
2086 | 47 |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6350
diff
changeset
|
48 /* XXX CORE/UI */ |
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6350
diff
changeset
|
49 #include "gtkinternal.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
50 #include "gaim.h" |
3630 | 51 |
2086 | 52 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
53 #define UC_AOL 0x02 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
54 #define UC_ADMIN 0x04 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
55 #define UC_UNCONFIRMED 0x08 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
56 #define UC_NORMAL 0x10 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
57 #define UC_AB 0x20 |
3079 | 58 #define UC_WIRELESS 0x40 |
6318 | 59 #define UC_HIPTOP 0x80 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
60 |
2086 | 61 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" |
62 | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
63 static GaimPlugin *my_protocol = NULL; |
4249 | 64 |
6871 | 65 static int caps_aim = AIM_CAPS_CHAT | AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_INTEROPERATE; |
66 static int caps_icq = AIM_CAPS_BUDDYICON | AIM_CAPS_DIRECTIM | AIM_CAPS_SENDFILE | AIM_CAPS_ICQUTF8 | AIM_CAPS_INTEROPERATE; | |
3458 | 67 |
4665 | 68 static fu8_t features_aim[] = {0x01, 0x01, 0x01, 0x02}; |
69 static fu8_t features_icq[] = {0x01, 0x06}; | |
2086 | 70 |
71 struct oscar_data { | |
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; |
2993 | 105 |
106 struct { | |
4230 | 107 guint maxwatchers; /* max users who can watch you */ |
2993 | 108 guint maxbuddies; /* max users you can watch */ |
4230 | 109 guint maxgroups; /* max groups in server list */ |
2993 | 110 guint maxpermits; /* max users on permit list */ |
111 guint maxdenies; /* max users on deny list */ | |
112 guint maxsiglen; /* max size (bytes) of profile */ | |
113 guint maxawaymsglen; /* max size (bytes) of posted away message */ | |
114 } rights; | |
2086 | 115 }; |
116 | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
117 struct create_room { |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
118 char *name; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
119 int exchange; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
120 }; |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
121 |
2086 | 122 struct chat_connection { |
123 char *name; | |
124 char *show; /* AOL did something funny to us */ | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
125 fu16_t exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
126 fu16_t instance; |
2086 | 127 int fd; /* this is redundant since we have the conn below */ |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
128 aim_conn_t *conn; |
2086 | 129 int inpa; |
130 int id; | |
5575 | 131 GaimConnection *gc; /* i hate this. */ |
5679 | 132 GaimConversation *cnv; /* bah. */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
133 int maxlen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
134 int maxvis; |
2086 | 135 }; |
136 | |
137 struct direct_im { | |
5575 | 138 GaimConnection *gc; |
2086 | 139 char name[80]; |
140 int watcher; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
141 aim_conn_t *conn; |
3008 | 142 gboolean connected; |
2086 | 143 }; |
144 | |
145 struct ask_direct { | |
5575 | 146 GaimConnection *gc; |
2086 | 147 char *sn; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
148 char ip[64]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
149 fu8_t cookie[8]; |
2086 | 150 }; |
151 | |
7011 | 152 /* |
153 * Various PRPL-specific buddy info that we want to keep track of | |
154 * Some other info is maintained by locate.c, and I'd like to move | |
155 * the rest of this to libfaim, mostly im.c | |
156 */ | |
4738 | 157 struct buddyinfo { |
158 gboolean typingnot; | |
6292 | 159 gchar *availmsg; |
6857 | 160 fu32_t ipaddr; |
5836 | 161 |
162 unsigned long ico_me_len; | |
163 unsigned long ico_me_csum; | |
164 time_t ico_me_time; | |
165 gboolean ico_informed; | |
4738 | 166 |
167 unsigned long ico_len; | |
168 unsigned long ico_csum; | |
169 time_t ico_time; | |
170 gboolean ico_need; | |
2086 | 171 }; |
172 | |
4230 | 173 struct name_data { |
5575 | 174 GaimConnection *gc; |
4230 | 175 gchar *name; |
3453 | 176 gchar *nick; |
3141 | 177 }; |
178 | |
5129 | 179 static char *msgerrreason[] = { |
180 N_("Invalid error"), | |
181 N_("Invalid SNAC"), | |
182 N_("Rate to host"), | |
183 N_("Rate to client"), | |
184 N_("Not logged in"), | |
185 N_("Service unavailable"), | |
186 N_("Service not defined"), | |
187 N_("Obsolete SNAC"), | |
188 N_("Not supported by host"), | |
189 N_("Not supported by client"), | |
190 N_("Refused by client"), | |
191 N_("Reply too big"), | |
192 N_("Responses lost"), | |
193 N_("Request denied"), | |
194 N_("Busted SNAC payload"), | |
195 N_("Insufficient rights"), | |
196 N_("In local permit/deny"), | |
197 N_("Too evil (sender)"), | |
198 N_("Too evil (receiver)"), | |
199 N_("User temporarily unavailable"), | |
200 N_("No match"), | |
201 N_("List overflow"), | |
202 N_("Request ambiguous"), | |
203 N_("Queue full"), | |
204 N_("Not while on AOL") | |
205 }; | |
206 static int msgerrreasonlen = 25; | |
207 | |
208 /* All the libfaim->gaim callback functions */ | |
209 static int gaim_parse_auth_resp (aim_session_t *, aim_frame_t *, ...); | |
210 static int gaim_parse_login (aim_session_t *, aim_frame_t *, ...); | |
211 static int gaim_handle_redirect (aim_session_t *, aim_frame_t *, ...); | |
212 static int gaim_info_change (aim_session_t *, aim_frame_t *, ...); | |
213 static int gaim_account_confirm (aim_session_t *, aim_frame_t *, ...); | |
214 static int gaim_parse_oncoming (aim_session_t *, aim_frame_t *, ...); | |
215 static int gaim_parse_offgoing (aim_session_t *, aim_frame_t *, ...); | |
216 static int gaim_parse_incoming_im(aim_session_t *, aim_frame_t *, ...); | |
217 static int gaim_parse_misses (aim_session_t *, aim_frame_t *, ...); | |
218 static int gaim_parse_clientauto (aim_session_t *, aim_frame_t *, ...); | |
7011 | 219 static int gaim_parse_userinfo (aim_session_t *, aim_frame_t *, ...); |
5129 | 220 static int gaim_parse_motd (aim_session_t *, aim_frame_t *, ...); |
221 static int gaim_chatnav_info (aim_session_t *, aim_frame_t *, ...); | |
222 static int gaim_chat_join (aim_session_t *, aim_frame_t *, ...); | |
223 static int gaim_chat_leave (aim_session_t *, aim_frame_t *, ...); | |
224 static int gaim_chat_info_update (aim_session_t *, aim_frame_t *, ...); | |
225 static int gaim_chat_incoming_msg(aim_session_t *, aim_frame_t *, ...); | |
226 static int gaim_email_parseupdate(aim_session_t *, aim_frame_t *, ...); | |
227 static int gaim_icon_error (aim_session_t *, aim_frame_t *, ...); | |
228 static int gaim_icon_parseicon (aim_session_t *, aim_frame_t *, ...); | |
5844 | 229 static int oscar_icon_req (aim_session_t *, aim_frame_t *, ...); |
5129 | 230 static int gaim_parse_msgack (aim_session_t *, aim_frame_t *, ...); |
231 static int gaim_parse_ratechange (aim_session_t *, aim_frame_t *, ...); | |
232 static int gaim_parse_evilnotify (aim_session_t *, aim_frame_t *, ...); | |
233 static int gaim_parse_searcherror(aim_session_t *, aim_frame_t *, ...); | |
234 static int gaim_parse_searchreply(aim_session_t *, aim_frame_t *, ...); | |
235 static int gaim_bosrights (aim_session_t *, aim_frame_t *, ...); | |
236 static int gaim_connerr (aim_session_t *, aim_frame_t *, ...); | |
237 static int conninitdone_admin (aim_session_t *, aim_frame_t *, ...); | |
238 static int conninitdone_bos (aim_session_t *, aim_frame_t *, ...); | |
239 static int conninitdone_chatnav (aim_session_t *, aim_frame_t *, ...); | |
240 static int conninitdone_chat (aim_session_t *, aim_frame_t *, ...); | |
241 static int conninitdone_email (aim_session_t *, aim_frame_t *, ...); | |
242 static int conninitdone_icon (aim_session_t *, aim_frame_t *, ...); | |
243 static int gaim_parse_msgerr (aim_session_t *, aim_frame_t *, ...); | |
244 static int gaim_parse_mtn (aim_session_t *, aim_frame_t *, ...); | |
245 static int gaim_parse_locaterights(aim_session_t *, aim_frame_t *, ...); | |
246 static int gaim_parse_buddyrights(aim_session_t *, aim_frame_t *, ...); | |
247 static int gaim_parse_locerr (aim_session_t *, aim_frame_t *, ...); | |
248 static int gaim_icbm_param_info (aim_session_t *, aim_frame_t *, ...); | |
249 static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...); | |
250 static int gaim_memrequest (aim_session_t *, aim_frame_t *, ...); | |
251 static int gaim_selfinfo (aim_session_t *, aim_frame_t *, ...); | |
252 static int gaim_offlinemsg (aim_session_t *, aim_frame_t *, ...); | |
253 static int gaim_offlinemsgdone (aim_session_t *, aim_frame_t *, ...); | |
254 static int gaim_icqalias (aim_session_t *, aim_frame_t *, ...); | |
255 static int gaim_icqinfo (aim_session_t *, aim_frame_t *, ...); | |
256 static int gaim_popup (aim_session_t *, aim_frame_t *, ...); | |
257 #ifndef NOSSI | |
258 static int gaim_ssi_parseerr (aim_session_t *, aim_frame_t *, ...); | |
259 static int gaim_ssi_parserights (aim_session_t *, aim_frame_t *, ...); | |
260 static int gaim_ssi_parselist (aim_session_t *, aim_frame_t *, ...); | |
261 static int gaim_ssi_parseack (aim_session_t *, aim_frame_t *, ...); | |
262 static int gaim_ssi_authgiven (aim_session_t *, aim_frame_t *, ...); | |
263 static int gaim_ssi_authrequest (aim_session_t *, aim_frame_t *, ...); | |
264 static int gaim_ssi_authreply (aim_session_t *, aim_frame_t *, ...); | |
265 static int gaim_ssi_gotadded (aim_session_t *, aim_frame_t *, ...); | |
266 #endif | |
267 | |
268 /* for DirectIM/image transfer */ | |
269 static int gaim_odc_initiate (aim_session_t *, aim_frame_t *, ...); | |
270 static int gaim_odc_incoming (aim_session_t *, aim_frame_t *, ...); | |
271 static int gaim_odc_typing (aim_session_t *, aim_frame_t *, ...); | |
6982 | 272 static int gaim_odc_update_ui (aim_session_t *, aim_frame_t *, ...); |
5129 | 273 |
274 /* for file transfer */ | |
275 static int oscar_sendfile_estblsh(aim_session_t *, aim_frame_t *, ...); | |
276 static int oscar_sendfile_prompt (aim_session_t *, aim_frame_t *, ...); | |
277 static int oscar_sendfile_ack (aim_session_t *, aim_frame_t *, ...); | |
278 static int oscar_sendfile_done (aim_session_t *, aim_frame_t *, ...); | |
279 | |
280 /* for icons */ | |
281 static gboolean gaim_icon_timerfunc(gpointer data); | |
282 | |
5306 | 283 /* prpl actions - remove this at some point */ |
5954 | 284 static void oscar_set_info(GaimConnection *gc, const char *text); |
5306 | 285 |
5836 | 286 static void oscar_free_name_data(struct name_data *data) { |
4230 | 287 g_free(data->name); |
288 g_free(data->nick); | |
289 g_free(data); | |
290 } | |
291 | |
5836 | 292 static void oscar_free_buddyinfo(void *data) { |
293 struct buddyinfo *bi = data; | |
6292 | 294 g_free(bi->availmsg); |
5836 | 295 g_free(bi); |
296 } | |
297 | |
5129 | 298 static fu32_t oscar_encoding_check(const char *utf8) |
299 { | |
300 int i = 0; | |
301 fu32_t encodingflag = 0; | |
302 | |
303 /* Determine how we can send this message. Per the warnings elsewhere | |
304 * in this file, these little checks determine the simplest encoding | |
305 * we can use for a given message send using it. */ | |
306 while (utf8[i]) { | |
307 if ((unsigned char)utf8[i] > 0x7f) { | |
308 /* not ASCII! */ | |
309 encodingflag = AIM_IMFLAGS_ISO_8859_1; | |
310 break; | |
311 } | |
312 i++; | |
313 } | |
314 while (utf8[i]) { | |
315 /* ISO-8859-1 is 0x00-0xbf in the first byte | |
316 * followed by 0xc0-0xc3 in the second */ | |
317 if ((unsigned char)utf8[i] < 0x80) { | |
318 i++; | |
319 continue; | |
320 } else if (((unsigned char)utf8[i] & 0xfc) == 0xc0 && | |
321 ((unsigned char)utf8[i + 1] & 0xc0) == 0x80) { | |
322 i += 2; | |
323 continue; | |
324 } | |
325 encodingflag = AIM_IMFLAGS_UNICODE; | |
326 break; | |
327 } | |
328 | |
329 return encodingflag; | |
330 } | |
331 | |
332 static fu32_t oscar_encoding_parse(const char *enc) | |
333 { | |
334 char *charset; | |
335 | |
336 /* If anything goes wrong, fall back on ASCII and print a message */ | |
337 if (enc == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
338 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
339 "Encoding was null, that's odd\n"); |
5129 | 340 return 0; |
341 } | |
342 charset = strstr(enc, "charset="); | |
343 if (charset == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
344 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
345 "No charset specified for info, assuming ASCII\n"); |
5129 | 346 return 0; |
347 } | |
348 charset += 8; | |
349 if (!strcmp(charset, "\"us-ascii\"") || !strcmp(charset, "\"utf-8\"")) { | |
350 /* UTF-8 is our native charset, ASCII is a proper subset */ | |
351 return 0; | |
352 } else if (!strcmp(charset, "\"iso-8859-1\"")) { | |
353 return AIM_IMFLAGS_ISO_8859_1; | |
354 } else if (!strcmp(charset, "\"unicode-2-0\"")) { | |
355 return AIM_IMFLAGS_UNICODE; | |
356 } else { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
357 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
358 "Unrecognized character set '%s', using ASCII\n", charset); |
5129 | 359 return 0; |
360 } | |
361 } | |
362 | |
363 gchar *oscar_encoding_to_utf8(const char *encoding, char *text, int textlen) | |
364 { | |
365 gchar *utf8 = NULL; | |
366 int flags = oscar_encoding_parse(encoding); | |
367 | |
368 switch (flags) { | |
369 case 0: | |
370 utf8 = g_strndup(text, textlen); | |
371 break; | |
372 case AIM_IMFLAGS_ISO_8859_1: | |
373 utf8 = g_convert(text, textlen, "UTF-8", "ISO-8859-1", NULL, NULL, NULL); | |
374 break; | |
375 case AIM_IMFLAGS_UNICODE: | |
376 utf8 = g_convert(text, textlen, "UTF-8", "UCS-2BE", NULL, NULL, NULL); | |
377 break; | |
378 } | |
379 | |
380 return utf8; | |
381 } | |
382 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
383 static struct direct_im *find_direct_im(struct oscar_data *od, const char *who) { |
2086 | 384 GSList *d = od->direct_ims; |
385 struct direct_im *m = NULL; | |
386 | |
387 while (d) { | |
388 m = (struct direct_im *)d->data; | |
4355 | 389 if (!aim_sncmp(who, m->name)) |
4269 | 390 return m; |
2086 | 391 d = d->next; |
392 } | |
393 | |
4269 | 394 return NULL; |
2086 | 395 } |
396 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
397 static char *extract_name(const char *name) { |
4121 | 398 char *tmp, *x; |
2086 | 399 int i, j; |
4120 | 400 |
401 if (!name) | |
4121 | 402 return NULL; |
403 | |
4120 | 404 x = strchr(name, '-'); |
4121 | 405 |
2086 | 406 if (!x) return NULL; |
407 x = strchr(++x, '-'); | |
408 if (!x) return NULL; | |
409 tmp = g_strdup(++x); | |
410 | |
411 for (i = 0, j = 0; x[i]; i++) { | |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
412 char hex[3]; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
413 if (x[i] != '%') { |
2086 | 414 tmp[j++] = x[i]; |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
415 continue; |
2086 | 416 } |
2361
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
417 strncpy(hex, x + ++i, 2); hex[2] = 0; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
418 i++; |
554b001d7d98
[gaim-migrate @ 2374]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2357
diff
changeset
|
419 tmp[j++] = strtol(hex, NULL, 16); |
2086 | 420 } |
421 | |
422 tmp[j] = 0; | |
423 return tmp; | |
424 } | |
425 | |
5575 | 426 static struct chat_connection *find_oscar_chat(GaimConnection *gc, int id) { |
2086 | 427 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; |
428 struct chat_connection *c = NULL; | |
429 | |
430 while (g) { | |
431 c = (struct chat_connection *)g->data; | |
432 if (c->id == id) | |
433 break; | |
434 g = g->next; | |
435 c = NULL; | |
436 } | |
437 | |
438 return c; | |
439 } | |
440 | |
5575 | 441 static struct chat_connection *find_oscar_chat_by_conn(GaimConnection *gc, |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
442 aim_conn_t *conn) { |
2086 | 443 GSList *g = ((struct oscar_data *)gc->proto_data)->oscar_chats; |
444 struct chat_connection *c = NULL; | |
445 | |
446 while (g) { | |
447 c = (struct chat_connection *)g->data; | |
448 if (c->conn == conn) | |
449 break; | |
450 g = g->next; | |
451 c = NULL; | |
452 } | |
453 | |
454 return c; | |
455 } | |
456 | |
4617 | 457 static void gaim_odc_disconnect(aim_session_t *sess, aim_conn_t *conn) { |
5575 | 458 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
459 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5679 | 460 GaimConversation *cnv; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
461 struct direct_im *dim; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
462 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
463 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
464 |
4617 | 465 sn = g_strdup(aim_odc_getsn(conn)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
466 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
467 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
468 "%s disconnected Direct IM.\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
469 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
470 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
471 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
472 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
473 |
3008 | 474 if (dim->connected) |
475 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn); | |
476 else | |
477 g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), sn); | |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
478 |
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
479 cnv = gaim_find_conversation_with_account(sn, gaim_connection_get_account(gc)); |
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
480 if (cnv) |
6982 | 481 gaim_conversation_write(cnv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
482 |
5579 | 483 gaim_conversation_update_progress(cnv, 0); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
484 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
485 g_free(dim); /* I guess? I don't see it anywhere else... -- mid */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
486 g_free(sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
487 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
488 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
489 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
490 |
4617 | 491 static void oscar_callback(gpointer data, gint source, GaimInputCondition condition) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
492 aim_conn_t *conn = (aim_conn_t *)data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
493 aim_session_t *sess = aim_conn_getsess(conn); |
5575 | 494 GaimConnection *gc = sess ? sess->aux_data : NULL; |
4617 | 495 struct oscar_data *od; |
2086 | 496 |
497 if (!gc) { | |
498 /* gc is null. we return, else we seg SIGSEG on next line. */ | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
499 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
500 "oscar callback for closed connection (1).\n"); |
2086 | 501 return; |
502 } | |
503 | |
4617 | 504 od = (struct oscar_data *)gc->proto_data; |
2086 | 505 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
506 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 507 /* oh boy. this is probably bad. i guess the only thing we |
508 * can really do is return? */ | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
509 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
510 "oscar callback for closed connection (2).\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
511 gaim_debug(GAIM_DEBUG_MISC, "oscar", "gc = %p\n", gc); |
2086 | 512 return; |
513 } | |
514 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
515 if (condition & GAIM_INPUT_READ) { |
4617 | 516 if (conn->type == AIM_CONN_TYPE_LISTENER) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
517 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
518 "got information on rendezvous listener\n"); |
4617 | 519 if (aim_handlerendconnect(od->sess, conn) < 0) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
520 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
521 "connection error (rendezvous listener)\n"); |
4617 | 522 aim_conn_kill(od->sess, &conn); |
2086 | 523 } |
524 } else { | |
4617 | 525 if (aim_get_command(od->sess, conn) >= 0) { |
526 aim_rxdispatch(od->sess); | |
6029 | 527 if (od->killme) { |
528 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "Waiting to be destroyed\n"); | |
529 return; | |
530 } | |
2086 | 531 } else { |
532 if ((conn->type == AIM_CONN_TYPE_BOS) || | |
4617 | 533 !(aim_getconn_type(od->sess, AIM_CONN_TYPE_BOS))) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
534 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
535 "major connection error\n"); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
536 gaim_connection_error(gc, _("Disconnected.")); |
2086 | 537 } else if (conn->type == AIM_CONN_TYPE_CHAT) { |
538 struct chat_connection *c = find_oscar_chat_by_conn(gc, conn); | |
5420 | 539 char *buf; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
540 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
541 "disconnected from chat room %s\n", c->name); |
2086 | 542 c->conn = NULL; |
543 if (c->inpa > 0) | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
544 gaim_input_remove(c->inpa); |
2086 | 545 c->inpa = 0; |
546 c->fd = -1; | |
4617 | 547 aim_conn_kill(od->sess, &conn); |
5420 | 548 buf = g_strdup_printf(_("You have been disconnected from chat room %s."), c->name); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
549 gaim_notify_error(gc, NULL, buf, NULL); |
5420 | 550 g_free(buf); |
2086 | 551 } else if (conn->type == AIM_CONN_TYPE_CHATNAV) { |
4617 | 552 if (od->cnpa > 0) |
553 gaim_input_remove(od->cnpa); | |
554 od->cnpa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
555 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
556 "removing chatnav input watcher\n"); |
4617 | 557 while (od->create_rooms) { |
558 struct create_room *cr = od->create_rooms->data; | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
559 g_free(cr->name); |
4617 | 560 od->create_rooms = |
561 g_slist_remove(od->create_rooms, cr); | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
562 g_free(cr); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
563 gaim_notify_error(gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
564 _("Chat is currently unavailable"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
565 NULL); |
2086 | 566 } |
4617 | 567 aim_conn_kill(od->sess, &conn); |
2086 | 568 } else if (conn->type == AIM_CONN_TYPE_AUTH) { |
4617 | 569 if (od->paspa > 0) |
570 gaim_input_remove(od->paspa); | |
571 od->paspa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
572 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
573 "removing authconn input watcher\n"); |
4617 | 574 aim_conn_kill(od->sess, &conn); |
3694 | 575 } else if (conn->type == AIM_CONN_TYPE_EMAIL) { |
4617 | 576 if (od->emlpa > 0) |
577 gaim_input_remove(od->emlpa); | |
578 od->emlpa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
579 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
580 "removing email input watcher\n"); |
4617 | 581 aim_conn_kill(od->sess, &conn); |
4804 | 582 } else if (conn->type == AIM_CONN_TYPE_ICON) { |
583 if (od->icopa > 0) | |
584 gaim_input_remove(od->icopa); | |
585 od->icopa = 0; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
586 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
587 "removing icon input watcher\n"); |
4804 | 588 aim_conn_kill(od->sess, &conn); |
2086 | 589 } else if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
590 if (conn->subtype == AIM_CONN_SUBTYPE_OFT_DIRECTIM) |
4617 | 591 gaim_odc_disconnect(od->sess, conn); |
592 aim_conn_kill(od->sess, &conn); | |
2086 | 593 } else { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
594 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
595 "holy crap! generic connection error! %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
596 conn->type); |
4617 | 597 aim_conn_kill(od->sess, &conn); |
2086 | 598 } |
599 } | |
600 } | |
601 } | |
602 } | |
603 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
604 static void oscar_debug(aim_session_t *sess, int level, const char *format, va_list va) { |
2086 | 605 char *s = g_strdup_vprintf(format, va); |
606 char buf[256]; | |
607 char *t; | |
5575 | 608 GaimConnection *gc = sess->aux_data; |
609 | |
610 g_snprintf(buf, sizeof(buf), "%s %d: ", gaim_account_get_username(gaim_connection_get_account(gc)), level); | |
2086 | 611 t = g_strconcat(buf, s, NULL); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
612 gaim_debug(GAIM_DEBUG_INFO, "oscar", t); |
2086 | 613 if (t[strlen(t)-1] != '\n') |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
614 gaim_debug(GAIM_DEBUG_INFO, NULL, "\n"); |
2086 | 615 g_free(t); |
616 g_free(s); | |
617 } | |
618 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
619 static void oscar_login_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 620 { |
5575 | 621 GaimConnection *gc = data; |
4617 | 622 struct oscar_data *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
623 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
624 aim_conn_t *conn; |
2086 | 625 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
626 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 627 close(source); |
628 return; | |
629 } | |
630 | |
4617 | 631 od = gc->proto_data; |
632 sess = od->sess; | |
2086 | 633 conn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); |
4366 | 634 |
635 conn->fd = source; | |
2086 | 636 |
637 if (source < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
638 gaim_connection_error(gc, _("Couldn't connect to host")); |
2086 | 639 return; |
640 } | |
641 | |
642 aim_conn_completeconnect(sess, conn); | |
4617 | 643 gc->inpa = gaim_input_add(conn->fd, GAIM_INPUT_READ, oscar_callback, conn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
644 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
645 "Password sent, waiting for response\n"); |
2086 | 646 } |
647 | |
5575 | 648 static void oscar_login(GaimAccount *account) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
649 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
650 aim_conn_t *conn; |
2086 | 651 char buf[256]; |
5575 | 652 GaimConnection *gc = gaim_account_get_connection(account); |
4617 | 653 struct oscar_data *od = gc->proto_data = g_new0(struct oscar_data, 1); |
2086 | 654 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
655 gaim_debug(GAIM_DEBUG_MISC, "oscar", "oscar_login: gc = %p\n", gc); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
656 |
5575 | 657 if (isdigit(*(gaim_account_get_username(account)))) { |
4617 | 658 od->icq = TRUE; |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
659 } else { |
6622 | 660 gc->flags |= GAIM_CONNECTION_HTML; |
661 gc->flags |= GAIM_CONNECTION_AUTO_RESP; | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
662 } |
5836 | 663 od->buddyinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, oscar_free_buddyinfo); |
2086 | 664 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
665 sess = g_new0(aim_session_t, 1); |
2086 | 666 |
667 aim_session_init(sess, AIM_SESS_FLAGS_NONBLOCKCONNECT, 0); | |
668 aim_setdebuggingcb(sess, oscar_debug); | |
669 | |
670 /* we need an immediate queue because we don't use a while-loop to | |
671 * see if things need to be sent. */ | |
672 aim_tx_setenqueue(sess, AIM_TX_IMMEDIATE, NULL); | |
4617 | 673 od->sess = sess; |
2086 | 674 sess->aux_data = gc; |
675 | |
676 conn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); | |
677 if (conn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
678 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
679 "internal connection error\n"); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
680 gaim_connection_error(gc, _("Unable to login to AIM")); |
2086 | 681 return; |
682 } | |
683 | |
5575 | 684 g_snprintf(buf, sizeof(buf), _("Signon: %s"), gaim_account_get_username(account)); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
685 gaim_connection_update_progress(gc, buf, 2, 5); |
2086 | 686 |
4649 | 687 aim_conn_addhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2086 | 688 aim_conn_addhandler(sess, conn, 0x0017, 0x0007, gaim_parse_login, 0); |
689 aim_conn_addhandler(sess, conn, 0x0017, 0x0003, gaim_parse_auth_resp, 0); | |
690 | |
691 conn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
692 if (gaim_proxy_connect(account, gaim_account_get_string(account, "server", FAIM_LOGIN_SERVER), |
5575 | 693 gaim_account_get_int(account, "port", FAIM_LOGIN_PORT), |
694 oscar_login_connect, gc) < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
695 gaim_connection_error(gc, _("Couldn't connect to host")); |
2086 | 696 return; |
697 } | |
5575 | 698 aim_request_login(sess, conn, gaim_account_get_username(account)); |
699 } | |
700 | |
701 static void oscar_close(GaimConnection *gc) { | |
4617 | 702 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
703 | |
704 while (od->oscar_chats) { | |
705 struct chat_connection *n = od->oscar_chats->data; | |
2086 | 706 if (n->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
707 gaim_input_remove(n->inpa); |
2086 | 708 g_free(n->name); |
709 g_free(n->show); | |
4617 | 710 od->oscar_chats = g_slist_remove(od->oscar_chats, n); |
2086 | 711 g_free(n); |
712 } | |
4617 | 713 while (od->direct_ims) { |
714 struct direct_im *n = od->direct_ims->data; | |
2086 | 715 if (n->watcher > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
716 gaim_input_remove(n->watcher); |
4617 | 717 od->direct_ims = g_slist_remove(od->direct_ims, n); |
2086 | 718 g_free(n); |
719 } | |
4617 | 720 /* BBB */ |
721 while (od->file_transfers) { | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
722 GaimXfer *xfer; |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
723 xfer = (GaimXfer *)od->file_transfers->data; |
4617 | 724 gaim_xfer_destroy(xfer); |
3630 | 725 } |
4804 | 726 while (od->requesticon) { |
727 char *sn = od->requesticon->data; | |
728 od->requesticon = g_slist_remove(od->requesticon, sn); | |
729 free(sn); | |
730 } | |
4738 | 731 g_hash_table_destroy(od->buddyinfo); |
4617 | 732 while (od->create_rooms) { |
733 struct create_room *cr = od->create_rooms->data; | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
734 g_free(cr->name); |
4617 | 735 od->create_rooms = g_slist_remove(od->create_rooms, cr); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
736 g_free(cr); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
737 } |
4617 | 738 if (od->email) |
739 g_free(od->email); | |
740 if (od->newp) | |
741 g_free(od->newp); | |
742 if (od->oldp) | |
743 g_free(od->oldp); | |
2086 | 744 if (gc->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
745 gaim_input_remove(gc->inpa); |
4617 | 746 if (od->cnpa > 0) |
747 gaim_input_remove(od->cnpa); | |
748 if (od->paspa > 0) | |
749 gaim_input_remove(od->paspa); | |
750 if (od->emlpa > 0) | |
751 gaim_input_remove(od->emlpa); | |
4804 | 752 if (od->icopa > 0) |
753 gaim_input_remove(od->icopa); | |
6907 | 754 if (od->icontimer > 0) |
4832 | 755 g_source_remove(od->icontimer); |
5968 | 756 if (od->getblisttimer) |
757 g_source_remove(od->getblisttimer); | |
4617 | 758 aim_session_kill(od->sess); |
759 g_free(od->sess); | |
760 od->sess = NULL; | |
2086 | 761 g_free(gc->proto_data); |
762 gc->proto_data = NULL; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
763 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Signed off.\n"); |
2086 | 764 } |
765 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
766 static void oscar_bos_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 767 GaimConnection *gc = data; |
4617 | 768 struct oscar_data *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
769 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
770 aim_conn_t *bosconn; |
2086 | 771 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
772 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 773 close(source); |
774 return; | |
775 } | |
776 | |
4617 | 777 od = gc->proto_data; |
778 sess = od->sess; | |
779 bosconn = od->conn; | |
4366 | 780 bosconn->fd = source; |
2086 | 781 |
782 if (source < 0) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
783 gaim_connection_error(gc, _("Could Not Connect")); |
2086 | 784 return; |
785 } | |
786 | |
787 aim_conn_completeconnect(sess, bosconn); | |
4617 | 788 gc->inpa = gaim_input_add(bosconn->fd, GAIM_INPUT_READ, oscar_callback, bosconn); |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
789 gaim_connection_update_progress(gc, |
5577
7ed9999926af
[gaim-migrate @ 5981]
Christian Hammond <chipx86@chipx86.com>
parents:
5576
diff
changeset
|
790 _("Connection established, cookie sent"), 4, 5); |
2086 | 791 } |
792 | |
4617 | 793 /* BBB */ |
4656 | 794 /* |
795 * This little area in oscar.c is the nexus of file transfer code, | |
796 * so I wrote a little explanation of what happens. I am such a | |
797 * ninja. | |
798 * | |
799 * The series of events for a file send is: | |
800 * -Create xfer and call gaim_xfer_request (this happens in oscar_ask_sendfile) | |
801 * -User chooses a file and oscar_xfer_init is called. It establishs a | |
802 * listening socket, then asks the remote user to connect to us (and | |
803 * gives them the file name, port, IP, etc.) | |
804 * -They connect to us and we send them an AIM_CB_OFT_PROMPT (this happens | |
805 * in oscar_sendfile_estblsh) | |
806 * -They send us an AIM_CB_OFT_ACK and then we start sending data | |
807 * -When we finish, they send us an AIM_CB_OFT_DONE and they close the | |
808 * connection. | |
809 * -We get drunk because file transfer kicks ass. | |
810 * | |
811 * The series of events for a file receive is: | |
812 * -Create xfer and call gaim_xfer request (this happens in incomingim_chan2) | |
813 * -Gaim user selects file to name and location to save file to and | |
814 * oscar_xfer_init is called | |
815 * -It connects to the remote user using the IP they gave us earlier | |
816 * -After connecting, they send us an AIM_CB_OFT_PROMPT. In reply, we send | |
817 * them an AIM_CB_OFT_ACK. | |
818 * -They begin to send us lots of raw data. | |
819 * -When they finish sending data we send an AIM_CB_OFT_DONE and then close | |
820 * the connectionn. | |
821 */ | |
822 static void oscar_sendfile_connected(gpointer data, gint source, GaimInputCondition condition); | |
823 | |
824 /* XXX - This function is pretty ugly */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
825 static void oscar_xfer_init(GaimXfer *xfer) |
4656 | 826 { |
5146 | 827 struct aim_oft_info *oft_info = xfer->data; |
5575 | 828 GaimConnection *gc = oft_info->sess->aux_data; |
5146 | 829 struct oscar_data *od = gc->proto_data; |
4656 | 830 |
831 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { | |
832 int i; | |
833 | |
834 xfer->filename = g_path_get_basename(xfer->local_filename); | |
5146 | 835 strncpy(oft_info->fh.name, xfer->filename, 64); |
836 oft_info->fh.totsize = gaim_xfer_get_size(xfer); | |
837 oft_info->fh.size = gaim_xfer_get_size(xfer); | |
838 oft_info->fh.checksum = aim_oft_checksum_file(xfer->local_filename); | |
4656 | 839 |
840 /* | |
5146 | 841 * First try the port specified earlier (5190). If that fails, |
842 * increment by 1 and try again. | |
4656 | 843 */ |
5146 | 844 aim_sendfile_listen(od->sess, oft_info); |
845 for (i=0; (i<5 && !oft_info->conn); i++) { | |
846 xfer->local_port = oft_info->port = oft_info->port + 1; | |
847 aim_sendfile_listen(od->sess, oft_info); | |
4656 | 848 } |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
849 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
850 "port is %d, ip is %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
851 xfer->local_port, oft_info->clientip); |
5146 | 852 if (oft_info->conn) { |
853 xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
854 aim_im_sendch2_sendfile_ask(od->sess, oft_info); | |
855 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ESTABLISHED, oscar_sendfile_estblsh, 0); | |
4656 | 856 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
857 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
858 _("Unable to establish listener socket.")); |
4656 | 859 /* XXX - The below line causes a crash because the transfer is canceled before the "Ok" callback on the file selection thing exists, I think */ |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
860 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 861 } |
862 } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
5146 | 863 oft_info->conn = aim_newconn(od->sess, AIM_CONN_TYPE_RENDEZVOUS, NULL); |
864 if (oft_info->conn) { | |
865 oft_info->conn->subtype = AIM_CONN_SUBTYPE_OFT_SENDFILE; | |
866 aim_conn_addhandler(od->sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_PROMPT, oscar_sendfile_prompt, 0); | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
867 oft_info->conn->fd = xfer->fd = gaim_proxy_connect(gaim_connection_get_account(gc), xfer->remote_ip, xfer->remote_port, |
5575 | 868 oscar_sendfile_connected, xfer); |
4656 | 869 if (xfer->fd == -1) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
870 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
871 _("Unable to establish file descriptor.")); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
872 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 873 } |
874 } else { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
875 gaim_notify_error(gc, NULL, _("File Transfer Aborted"), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
876 _("Unable to create new connection.")); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
877 /* gaim_xfer_cancel_remote(xfer); */ |
4656 | 878 /* Try a different port? Ask them to connect to us? */ |
879 } | |
880 | |
881 } | |
882 } | |
883 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
884 static void oscar_xfer_start(GaimXfer *xfer) |
4656 | 885 { |
5146 | 886 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
887 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_start\n"); |
4656 | 888 /* I'm pretty sure we don't need to do jack here. Nor Jill. */ |
889 } | |
890 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
891 static void oscar_xfer_end(GaimXfer *xfer) |
4656 | 892 { |
5146 | 893 struct aim_oft_info *oft_info = xfer->data; |
5575 | 894 GaimConnection *gc = oft_info->sess->aux_data; |
5146 | 895 struct oscar_data *od = gc->proto_data; |
4656 | 896 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
897 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_xfer_end\n"); |
5146 | 898 |
899 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
900 oft_info->fh.nrecvd = gaim_xfer_get_bytes_sent(xfer); | |
901 aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_DONE, oft_info); | |
902 } | |
903 | |
904 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
905 aim_oft_destroyinfo(oft_info); | |
4656 | 906 xfer->data = NULL; |
5146 | 907 od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
4656 | 908 } |
909 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
910 static void oscar_xfer_cancel_send(GaimXfer *xfer) |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
911 { |
5146 | 912 struct aim_oft_info *oft_info = xfer->data; |
5575 | 913 GaimConnection *gc = oft_info->sess->aux_data; |
5146 | 914 struct oscar_data *od = gc->proto_data; |
4763 | 915 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
916 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
917 "AAA - in oscar_xfer_cancel_send\n"); |
5146 | 918 |
919 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); | |
920 | |
921 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
922 aim_oft_destroyinfo(oft_info); | |
4763 | 923 xfer->data = NULL; |
5146 | 924 od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
925 } |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
926 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
927 static void oscar_xfer_cancel_recv(GaimXfer *xfer) |
4656 | 928 { |
5146 | 929 struct aim_oft_info *oft_info = xfer->data; |
5575 | 930 GaimConnection *gc = oft_info->sess->aux_data; |
5146 | 931 struct oscar_data *od = gc->proto_data; |
4656 | 932 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
933 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
934 "AAA - in oscar_xfer_cancel_recv\n"); |
5146 | 935 |
936 aim_im_sendch2_sendfile_cancel(oft_info->sess, oft_info); | |
937 | |
938 aim_conn_kill(oft_info->sess, &oft_info->conn); | |
939 aim_oft_destroyinfo(oft_info); | |
4656 | 940 xfer->data = NULL; |
5146 | 941 od->file_transfers = g_slist_remove(od->file_transfers, xfer); |
4656 | 942 } |
943 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
944 static void oscar_xfer_ack(GaimXfer *xfer, const char *buffer, size_t size) |
4656 | 945 { |
5146 | 946 struct aim_oft_info *oft_info = xfer->data; |
4656 | 947 |
948 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) { | |
949 /* | |
950 * If we're done sending, intercept the socket from the core ft code | |
951 * and wait for the other guy to send the "done" OFT packet. | |
952 */ | |
953 if (gaim_xfer_get_bytes_remaining(xfer) <= 0) { | |
954 gaim_input_remove(xfer->watcher); | |
5146 | 955 xfer->watcher = gaim_input_add(xfer->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); |
4656 | 956 xfer->fd = 0; |
957 gaim_xfer_set_completed(xfer, TRUE); | |
958 } | |
959 } else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
5146 | 960 /* Update our rolling checksum. Like Walmart, yo. */ |
961 oft_info->fh.recvcsum = aim_oft_checksum_chunk(buffer, size, oft_info->fh.recvcsum); | |
4656 | 962 } |
963 } | |
964 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
965 static GaimXfer *oscar_find_xfer_by_cookie(GSList *fts, const char *ck) |
4656 | 966 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
967 GaimXfer *xfer; |
5146 | 968 struct aim_oft_info *oft_info; |
4656 | 969 |
970 while (fts) { | |
971 xfer = fts->data; | |
5146 | 972 oft_info = xfer->data; |
973 | |
974 if (oft_info && !strcmp(ck, oft_info->cookie)) | |
4656 | 975 return xfer; |
976 | |
977 fts = g_slist_next(fts); | |
978 } | |
979 | |
980 return NULL; | |
981 } | |
982 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
983 static GaimXfer *oscar_find_xfer_by_conn(GSList *fts, aim_conn_t *conn) |
4656 | 984 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
985 GaimXfer *xfer; |
5146 | 986 struct aim_oft_info *oft_info; |
4656 | 987 |
988 while (fts) { | |
989 xfer = fts->data; | |
5146 | 990 oft_info = xfer->data; |
991 | |
992 if (oft_info && (conn == oft_info->conn)) | |
4656 | 993 return xfer; |
994 | |
995 fts = g_slist_next(fts); | |
996 } | |
997 | |
998 return NULL; | |
999 } | |
1000 | |
5575 | 1001 static void oscar_ask_sendfile(GaimConnection *gc, const char *destsn) { |
3630 | 1002 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1003 GaimXfer *xfer; |
5146 | 1004 struct aim_oft_info *oft_info; |
3752 | 1005 |
4617 | 1006 /* You want to send a file to someone else, you're so generous */ |
1007 | |
1008 /* Build the file transfer handle */ | |
5575 | 1009 xfer = gaim_xfer_new(gaim_connection_get_account(gc), GAIM_XFER_SEND, destsn); |
4617 | 1010 xfer->local_port = 5190; |
1011 | |
5146 | 1012 /* Create the oscar-specific data */ |
1013 oft_info = aim_oft_createinfo(od->sess, NULL, destsn, xfer->local_ip, xfer->local_port, 0, 0, NULL); | |
1014 xfer->data = oft_info; | |
1015 | |
4617 | 1016 /* Setup our I/O op functions */ |
1017 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init); | |
1018 gaim_xfer_set_start_fnc(xfer, oscar_xfer_start); | |
1019 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
1020 gaim_xfer_set_cancel_send_fnc(xfer, oscar_xfer_cancel_send); |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
1021 gaim_xfer_set_cancel_recv_fnc(xfer, oscar_xfer_cancel_recv); |
4656 | 1022 gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack); |
4617 | 1023 |
1024 /* Keep track of this transfer for later */ | |
1025 od->file_transfers = g_slist_append(od->file_transfers, xfer); | |
1026 | |
1027 /* Now perform the request */ | |
1028 gaim_xfer_request(xfer); | |
3630 | 1029 } |
1030 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1031 static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) { |
6029 | 1032 GaimConnection *gc = sess->aux_data; |
1033 struct oscar_data *od = gc->proto_data; | |
1034 GaimAccount *account = gc->account; | |
1035 aim_conn_t *bosconn; | |
1036 char *host; int port; | |
1037 int i, rc; | |
2086 | 1038 va_list ap; |
2704 | 1039 struct aim_authresp_info *info; |
6029 | 1040 |
5575 | 1041 port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); |
2086 | 1042 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1043 va_start(ap, fr); |
2704 | 1044 info = va_arg(ap, struct aim_authresp_info *); |
2086 | 1045 va_end(ap); |
1046 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1047 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1048 "inside auth_resp (Screen name: %s)\n", info->sn); |
2704 | 1049 |
4293 | 1050 if (info->errorcode || !info->bosip || !info->cookielen || !info->cookie) { |
4056 | 1051 char buf[256]; |
2704 | 1052 switch (info->errorcode) { |
2086 | 1053 case 0x05: |
1054 /* Incorrect nick/password */ | |
6498 | 1055 gc->wants_to_die = TRUE; |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1056 gaim_connection_error(gc, _("Incorrect nickname or password.")); |
2086 | 1057 break; |
1058 case 0x11: | |
1059 /* Suspended account */ | |
6498 | 1060 gc->wants_to_die = TRUE; |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1061 gaim_connection_error(gc, _("Your account is currently suspended.")); |
2086 | 1062 break; |
3498 | 1063 case 0x14: |
1064 /* service temporarily unavailable */ | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1065 gaim_connection_error(gc, _("The AOL Instant Messenger service is temporarily unavailable.")); |
3498 | 1066 break; |
2086 | 1067 case 0x18: |
1068 /* connecting too frequently */ | |
6498 | 1069 gc->wants_to_die = TRUE; |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1070 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 | 1071 break; |
1072 case 0x1c: | |
1073 /* client too old */ | |
6498 | 1074 gc->wants_to_die = TRUE; |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6350
diff
changeset
|
1075 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
|
1076 gaim_connection_error(gc, buf); |
2086 | 1077 break; |
1078 default: | |
6623 | 1079 gaim_connection_error(gc, _("Authentication failed")); |
2086 | 1080 break; |
1081 } | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1082 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1083 "Login Error Code 0x%04hx\n", info->errorcode); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1084 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1085 "Error URL: %s\n", info->errorurl); |
2086 | 1086 od->killme = TRUE; |
1087 return 1; | |
1088 } | |
1089 | |
1090 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1091 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1092 "Reg status: %hu\n", info->regstatus); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1093 |
2704 | 1094 if (info->email) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1095 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Email: %s\n", info->email); |
2086 | 1096 } else { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1097 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Email is NULL\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1098 } |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1099 |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1100 gaim_debug(GAIM_DEBUG_MISC, "oscar", "BOSIP: %s\n", info->bosip); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1101 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1102 "Closing auth connection...\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1103 aim_conn_kill(sess, &fr->conn); |
2086 | 1104 |
1105 bosconn = aim_newconn(sess, AIM_CONN_TYPE_BOS, NULL); | |
1106 if (bosconn == NULL) { | |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1107 gaim_connection_error(gc, _("Internal Error")); |
2086 | 1108 od->killme = TRUE; |
1109 return 0; | |
1110 } | |
1111 | |
4649 | 1112 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1113 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_bos, 0); |
2086 | 1114 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0003, gaim_bosrights, 0); |
1115 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ACK, AIM_CB_ACK_ACK, NULL, 0); | |
1116 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_REDIRECT, gaim_handle_redirect, 0); | |
2993 | 1117 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_RIGHTSINFO, gaim_parse_locaterights, 0); |
2086 | 1118 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_RIGHTSINFO, gaim_parse_buddyrights, 0); |
1119 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_ONCOMING, gaim_parse_oncoming, 0); | |
1120 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING, gaim_parse_offgoing, 0); | |
1121 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_INCOMING, gaim_parse_incoming_im, 0); | |
1122 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_ERROR, gaim_parse_locerr, 0); | |
1123 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MISSEDCALL, gaim_parse_misses, 0); | |
3212 | 1124 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_CLIENTAUTORESP, gaim_parse_clientauto, 0); |
2086 | 1125 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_RATECHANGE, gaim_parse_ratechange, 0); |
1126 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_GEN, AIM_CB_GEN_EVIL, gaim_parse_evilnotify, 0); | |
1127 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, AIM_CB_LOK_ERROR, gaim_parse_searcherror, 0); | |
1128 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOK, 0x0003, gaim_parse_searchreply, 0); | |
1129 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ERROR, gaim_parse_msgerr, 0); | |
3595 | 1130 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_MTN, gaim_parse_mtn, 0); |
7011 | 1131 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_LOC, AIM_CB_LOC_USERINFO, gaim_parse_userinfo, 0); |
2086 | 1132 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_MSG, AIM_CB_MSG_ACK, gaim_parse_msgack, 0); |
1133 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
|
1134 aim_conn_addhandler(sess, bosconn, 0x0004, 0x0005, gaim_icbm_param_info, 0); |
2086 | 1135 aim_conn_addhandler(sess, bosconn, 0x0001, 0x0001, gaim_parse_genericerr, 0); |
1136 aim_conn_addhandler(sess, bosconn, 0x0003, 0x0001, gaim_parse_genericerr, 0); | |
1137 aim_conn_addhandler(sess, bosconn, 0x0009, 0x0001, gaim_parse_genericerr, 0); | |
1138 aim_conn_addhandler(sess, bosconn, 0x0001, 0x001f, gaim_memrequest, 0); | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
1139 aim_conn_addhandler(sess, bosconn, 0x0001, 0x000f, gaim_selfinfo, 0); |
5844 | 1140 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
|
1141 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
|
1142 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
|
1143 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_POP, 0x0002, gaim_popup, 0); |
4759 | 1144 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_ALIAS, gaim_icqalias, 0); |
4624 | 1145 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_INFO, gaim_icqinfo, 0); |
4230 | 1146 #ifndef NOSSI |
4642 | 1147 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ERROR, gaim_ssi_parseerr, 0); |
2991 | 1148 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RIGHTSINFO, gaim_ssi_parserights, 0); |
1149 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_LIST, gaim_ssi_parselist, 0); | |
1150 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_NOLIST, gaim_ssi_parselist, 0); | |
4230 | 1151 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_SRVACK, gaim_ssi_parseack, 0); |
1152 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTH, gaim_ssi_authgiven, 0); | |
1153 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREQ, gaim_ssi_authrequest, 0); | |
1154 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_RECVAUTHREP, gaim_ssi_authreply, 0); | |
1155 aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SSI, AIM_CB_SSI_ADDED, gaim_ssi_gotadded, 0); | |
1156 #endif | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
1157 |
2086 | 1158 ((struct oscar_data *)gc->proto_data)->conn = bosconn; |
2704 | 1159 for (i = 0; i < (int)strlen(info->bosip); i++) { |
1160 if (info->bosip[i] == ':') { | |
1161 port = atoi(&(info->bosip[i+1])); | |
2086 | 1162 break; |
1163 } | |
1164 } | |
2704 | 1165 host = g_strndup(info->bosip, i); |
2086 | 1166 bosconn->status |= AIM_CONN_STATUS_INPROGRESS; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1167 rc = gaim_proxy_connect(gc->account, host, port, oscar_bos_connect, gc); |
2086 | 1168 g_free(host); |
4366 | 1169 if (rc < 0) { |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
1170 gaim_connection_error(gc, _("Could Not Connect")); |
2086 | 1171 od->killme = TRUE; |
1172 return 0; | |
1173 } | |
4293 | 1174 aim_sendcookie(sess, bosconn, info->cookielen, info->cookie); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1175 gaim_input_remove(gc->inpa); |
2704 | 1176 |
2086 | 1177 return 1; |
1178 } | |
1179 | |
1180 struct pieceofcrap { | |
5575 | 1181 GaimConnection *gc; |
2086 | 1182 unsigned long offset; |
1183 unsigned long len; | |
1184 char *modname; | |
1185 int fd; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1186 aim_conn_t *conn; |
2086 | 1187 unsigned int inpa; |
1188 }; | |
1189 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1190 static void damn_you(gpointer data, gint source, GaimInputCondition c) |
2086 | 1191 { |
1192 struct pieceofcrap *pos = data; | |
1193 struct oscar_data *od = pos->gc->proto_data; | |
1194 char in = '\0'; | |
1195 int x = 0; | |
1196 unsigned char m[17]; | |
1197 | |
1198 while (read(pos->fd, &in, 1) == 1) { | |
1199 if (in == '\n') | |
1200 x++; | |
1201 else if (in != '\r') | |
1202 x = 0; | |
1203 if (x == 2) | |
1204 break; | |
1205 in = '\0'; | |
1206 } | |
1207 if (in != '\n') { | |
4056 | 1208 char buf[256]; |
1209 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
|
1210 "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1211 gaim_notify_warning(pos->gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1212 _("Gaim was Unable to get a valid AIM login hash."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1213 buf); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1214 gaim_input_remove(pos->inpa); |
2086 | 1215 close(pos->fd); |
1216 g_free(pos); | |
1217 return; | |
1218 } | |
1219 read(pos->fd, m, 16); | |
1220 m[16] = '\0'; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1221 gaim_debug(GAIM_DEBUG_MISC, "oscar", "Sending hash: "); |
2086 | 1222 for (x = 0; x < 16; x++) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1223 gaim_debug(GAIM_DEBUG_MISC, NULL, "%02hhx ", (unsigned char)m[x]); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1224 |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1225 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n"); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1226 gaim_input_remove(pos->inpa); |
2086 | 1227 close(pos->fd); |
1228 aim_sendmemblock(od->sess, pos->conn, 0, 16, m, AIM_SENDMEMBLOCK_FLAG_ISHASH); | |
1229 g_free(pos); | |
1230 } | |
1231 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1232 static void straight_to_hell(gpointer data, gint source, GaimInputCondition cond) { |
2086 | 1233 struct pieceofcrap *pos = data; |
5420 | 1234 gchar *buf; |
2086 | 1235 |
4366 | 1236 pos->fd = source; |
1237 | |
2086 | 1238 if (source < 0) { |
5420 | 1239 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
|
1240 "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1241 gaim_notify_warning(pos->gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1242 _("Gaim was Unable to get a valid AIM login hash."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1243 buf); |
5420 | 1244 g_free(buf); |
2086 | 1245 if (pos->modname) |
1246 g_free(pos->modname); | |
1247 g_free(pos); | |
1248 return; | |
1249 } | |
1250 | |
5420 | 1251 buf = g_strdup_printf("GET " AIMHASHDATA "?offset=%ld&len=%ld&modname=%s HTTP/1.0\n\n", |
2086 | 1252 pos->offset, pos->len, pos->modname ? pos->modname : ""); |
1253 write(pos->fd, buf, strlen(buf)); | |
5420 | 1254 g_free(buf); |
2086 | 1255 if (pos->modname) |
1256 g_free(pos->modname); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1257 pos->inpa = gaim_input_add(pos->fd, GAIM_INPUT_READ, damn_you, pos); |
2086 | 1258 return; |
1259 } | |
1260 | |
1261 /* size of icbmui.ocm, the largest module in AIM 3.5 */ | |
1262 #define AIM_MAX_FILE_SIZE 98304 | |
1263 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1264 int gaim_memrequest(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 1265 va_list ap; |
1266 struct pieceofcrap *pos; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1267 fu32_t offset, len; |
2086 | 1268 char *modname; |
1269 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1270 va_start(ap, fr); |
4200 | 1271 offset = va_arg(ap, fu32_t); |
1272 len = va_arg(ap, fu32_t); | |
2086 | 1273 modname = va_arg(ap, char *); |
1274 va_end(ap); | |
1275 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1276 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
5556 | 1277 "offset: %u, len: %u, file: %s\n", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1278 offset, len, (modname ? modname : "aim.exe")); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1279 |
2086 | 1280 if (len == 0) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1281 gaim_debug(GAIM_DEBUG_MISC, "oscar", "len is 0, hashing NULL\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1282 aim_sendmemblock(sess, fr->conn, offset, len, NULL, |
2086 | 1283 AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
1284 return 1; | |
1285 } | |
1286 /* uncomment this when you're convinced it's right. remember, it's been wrong before. | |
1287 if (offset > AIM_MAX_FILE_SIZE || len > AIM_MAX_FILE_SIZE) { | |
1288 char *buf; | |
1289 int i = 8; | |
1290 if (modname) | |
1291 i += strlen(modname); | |
1292 buf = g_malloc(i); | |
1293 i = 0; | |
1294 if (modname) { | |
1295 memcpy(buf, modname, strlen(modname)); | |
1296 i += strlen(modname); | |
1297 } | |
1298 buf[i++] = offset & 0xff; | |
1299 buf[i++] = (offset >> 8) & 0xff; | |
1300 buf[i++] = (offset >> 16) & 0xff; | |
1301 buf[i++] = (offset >> 24) & 0xff; | |
1302 buf[i++] = len & 0xff; | |
1303 buf[i++] = (len >> 8) & 0xff; | |
1304 buf[i++] = (len >> 16) & 0xff; | |
1305 buf[i++] = (len >> 24) & 0xff; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1306 gaim_debug(GAIM_DEBUG_MISC, "oscar", "len + offset is invalid, " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1307 "hashing request\n"); |
2086 | 1308 aim_sendmemblock(sess, command->conn, offset, i, buf, AIM_SENDMEMBLOCK_FLAG_ISREQUEST); |
1309 g_free(buf); | |
1310 return 1; | |
1311 } | |
1312 */ | |
1313 | |
1314 pos = g_new0(struct pieceofcrap, 1); | |
1315 pos->gc = sess->aux_data; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1316 pos->conn = fr->conn; |
2086 | 1317 |
1318 pos->offset = offset; | |
1319 pos->len = len; | |
1320 pos->modname = modname ? g_strdup(modname) : NULL; | |
1321 | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1322 if (gaim_proxy_connect(pos->gc->account, "gaim.sourceforge.net", 80, straight_to_hell, pos) != 0) { |
4056 | 1323 char buf[256]; |
2086 | 1324 if (pos->modname) |
1325 g_free(pos->modname); | |
1326 g_free(pos); | |
4056 | 1327 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
|
1328 "this is fixed. Check %s for updates."), GAIM_WEBSITE); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1329 gaim_notify_warning(pos->gc, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1330 _("Gaim was Unable to get a valid login hash."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
1331 buf); |
2086 | 1332 } |
1333 | |
1334 return 1; | |
1335 } | |
1336 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1337 static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1338 GaimConnection *gc = sess->aux_data; |
5591
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1339 GaimAccount *account = gaim_connection_get_account(gc); |
5575 | 1340 GaimAccount *ac = gaim_connection_get_account(gc); |
4617 | 1341 struct oscar_data *od = gc->proto_data; |
7011 | 1342 va_list ap; |
1343 char *key; | |
2086 | 1344 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1345 va_start(ap, fr); |
2086 | 1346 key = va_arg(ap, char *); |
1347 va_end(ap); | |
1348 | |
4617 | 1349 if (od->icq) { |
3458 | 1350 struct client_info_s info = CLIENTINFO_ICQ_KNOWNGOOD; |
5591
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1351 aim_send_login(sess, fr->conn, gaim_account_get_username(ac), |
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1352 gaim_account_get_password(account), &info, key); |
3458 | 1353 } else { |
1354 #if 0 | |
1355 struct client_info_s info = {"gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b}; | |
1356 #endif | |
1357 struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD; | |
5591
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1358 aim_send_login(sess, fr->conn, gaim_account_get_username(ac), |
74a0e79ad627
[gaim-migrate @ 5995]
Christian Hammond <chipx86@chipx86.com>
parents:
5580
diff
changeset
|
1359 gaim_account_get_password(account), &info, key); |
3458 | 1360 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1361 |
2086 | 1362 return 1; |
1363 } | |
1364 | |
2675 | 1365 static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1366 GaimConnection *gc = sess->aux_data; |
2647 | 1367 struct chat_connection *chatcon; |
1368 static int id = 1; | |
1369 | |
6905 | 1370 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, 0x0001, gaim_parse_genericerr, 0); |
2675 | 1371 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERJOIN, gaim_chat_join, 0); |
1372 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_USERLEAVE, gaim_chat_leave, 0); | |
1373 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_ROOMINFOUPDATE, gaim_chat_info_update, 0); | |
1374 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CHT, AIM_CB_CHT_INCOMINGMSG, gaim_chat_incoming_msg, 0); | |
1375 | |
2672 | 1376 aim_clientready(sess, fr->conn); |
2675 | 1377 |
2647 | 1378 chatcon = find_oscar_chat_by_conn(gc, fr->conn); |
1379 chatcon->id = id; | |
1380 chatcon->cnv = serv_got_joined_chat(gc, id++, chatcon->show); | |
1381 | |
1382 return 1; | |
1383 } | |
1384 | |
2675 | 1385 static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...) { |
1386 | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1387 aim_conn_addhandler(sess, fr->conn, 0x000d, 0x0001, gaim_parse_genericerr, 0); |
2647 | 1388 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_INFO, gaim_chatnav_info, 0); |
2675 | 1389 |
1390 aim_clientready(sess, fr->conn); | |
1391 | |
1392 aim_chatnav_reqrights(sess, fr->conn); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1393 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1394 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1395 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1396 |
3694 | 1397 static int conninitdone_email(aim_session_t *sess, aim_frame_t *fr, ...) { |
1398 | |
1399 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); | |
1400 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_EML, AIM_CB_EML_MAILSTATUS, gaim_email_parseupdate, 0); | |
1401 | |
1402 aim_email_sendcookies(sess, fr->conn); | |
1403 aim_email_activate(sess, fr->conn); | |
1404 aim_clientready(sess, fr->conn); | |
1405 | |
1406 return 1; | |
1407 } | |
1408 | |
4804 | 1409 static int conninitdone_icon(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1410 GaimConnection *gc = sess->aux_data; |
4804 | 1411 struct oscar_data *od = gc->proto_data; |
1412 | |
1413 aim_conn_addhandler(sess, fr->conn, 0x0018, 0x0001, gaim_parse_genericerr, 0); | |
1414 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_ERROR, gaim_icon_error, 0); | |
1415 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ICO, AIM_CB_ICO_RESPONSE, gaim_icon_parseicon, 0); | |
1416 | |
1417 aim_clientready(sess, fr->conn); | |
1418 | |
4823 | 1419 od->iconconnecting = FALSE; |
1420 | |
4804 | 1421 if (od->icontimer) |
1422 g_source_remove(od->icontimer); | |
1423 od->icontimer = g_timeout_add(100, gaim_icon_timerfunc, gc); | |
1424 | |
1425 return 1; | |
1426 } | |
1427 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1428 static void oscar_chatnav_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1429 GaimConnection *gc = data; |
4617 | 1430 struct oscar_data *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1431 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1432 aim_conn_t *tstconn; |
2086 | 1433 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1434 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1435 close(source); |
1436 return; | |
1437 } | |
1438 | |
4617 | 1439 od = gc->proto_data; |
1440 sess = od->sess; | |
2086 | 1441 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_CHATNAV); |
4366 | 1442 tstconn->fd = source; |
2086 | 1443 |
1444 if (source < 0) { | |
1445 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1446 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1447 "unable to connect to chatnav server\n"); |
2086 | 1448 return; |
1449 } | |
1450 | |
1451 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1452 od->cnpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1453 gaim_debug(GAIM_DEBUG_INFO, "oscar", "chatnav: connected\n"); |
2086 | 1454 } |
1455 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1456 static void oscar_auth_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 1457 { |
5575 | 1458 GaimConnection *gc = data; |
4617 | 1459 struct oscar_data *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1460 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1461 aim_conn_t *tstconn; |
2086 | 1462 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1463 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1464 close(source); |
1465 return; | |
1466 } | |
1467 | |
4617 | 1468 od = gc->proto_data; |
1469 sess = od->sess; | |
2086 | 1470 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_AUTH); |
4366 | 1471 tstconn->fd = source; |
2086 | 1472 |
1473 if (source < 0) { | |
1474 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1475 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1476 "unable to connect to authorizer\n"); |
2086 | 1477 return; |
1478 } | |
1479 | |
1480 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1481 od->paspa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
6905 | 1482 gaim_debug(GAIM_DEBUG_INFO, "oscar", "admin: connected\n"); |
2086 | 1483 } |
1484 | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
1485 static void oscar_chat_connect(gpointer data, gint source, GaimInputCondition cond) |
2086 | 1486 { |
1487 struct chat_connection *ccon = data; | |
5575 | 1488 GaimConnection *gc = ccon->gc; |
4617 | 1489 struct oscar_data *od; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1490 aim_session_t *sess; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1491 aim_conn_t *tstconn; |
2086 | 1492 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1493 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1494 close(source); |
1495 g_free(ccon->show); | |
1496 g_free(ccon->name); | |
1497 g_free(ccon); | |
1498 return; | |
1499 } | |
1500 | |
4617 | 1501 od = gc->proto_data; |
1502 sess = od->sess; | |
2086 | 1503 tstconn = ccon->conn; |
4366 | 1504 tstconn->fd = source; |
2086 | 1505 |
1506 if (source < 0) { | |
1507 aim_conn_kill(sess, &tstconn); | |
1508 g_free(ccon->show); | |
1509 g_free(ccon->name); | |
1510 g_free(ccon); | |
1511 return; | |
1512 } | |
1513 | |
1514 aim_conn_completeconnect(sess, ccon->conn); | |
4617 | 1515 ccon->inpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
1516 od->oscar_chats = g_slist_append(od->oscar_chats, ccon); | |
2086 | 1517 } |
1518 | |
3694 | 1519 static void oscar_email_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1520 GaimConnection *gc = data; |
4617 | 1521 struct oscar_data *od; |
3694 | 1522 aim_session_t *sess; |
1523 aim_conn_t *tstconn; | |
1524 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1525 if (!g_list_find(gaim_connections_get_all(), gc)) { |
3694 | 1526 close(source); |
1527 return; | |
1528 } | |
1529 | |
4617 | 1530 od = gc->proto_data; |
1531 sess = od->sess; | |
3694 | 1532 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_EMAIL); |
4366 | 1533 tstconn->fd = source; |
3694 | 1534 |
1535 if (source < 0) { | |
1536 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1537 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1538 "unable to connect to email server\n"); |
3694 | 1539 return; |
1540 } | |
1541 | |
1542 aim_conn_completeconnect(sess, tstconn); | |
4617 | 1543 od->emlpa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1544 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1545 "email: connected\n"); |
3694 | 1546 } |
1547 | |
4804 | 1548 static void oscar_icon_connect(gpointer data, gint source, GaimInputCondition cond) { |
5575 | 1549 GaimConnection *gc = data; |
4804 | 1550 struct oscar_data *od; |
1551 aim_session_t *sess; | |
1552 aim_conn_t *tstconn; | |
1553 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1554 if (!g_list_find(gaim_connections_get_all(), gc)) { |
4804 | 1555 close(source); |
1556 return; | |
1557 } | |
1558 | |
1559 od = gc->proto_data; | |
1560 sess = od->sess; | |
1561 tstconn = aim_getconn_type_all(sess, AIM_CONN_TYPE_ICON); | |
1562 tstconn->fd = source; | |
1563 | |
1564 if (source < 0) { | |
1565 aim_conn_kill(sess, &tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1566 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1567 "unable to connect to icon server\n"); |
4804 | 1568 return; |
1569 } | |
1570 | |
1571 aim_conn_completeconnect(sess, tstconn); | |
1572 od->icopa = gaim_input_add(tstconn->fd, GAIM_INPUT_READ, oscar_callback, tstconn); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1573 gaim_debug(GAIM_DEBUG_INFO, "oscar", "icon: connected\n"); |
4804 | 1574 } |
1575 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1576 /* 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
|
1577 static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1578 GaimConnection *gc = sess->aux_data; |
1579 GaimAccount *account = gaim_connection_get_account(gc); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1580 aim_conn_t *tstconn; |
4452 | 1581 int i; |
2086 | 1582 char *host; |
1583 int port; | |
4821 | 1584 va_list ap; |
1585 struct aim_redirect_data *redir; | |
2086 | 1586 |
5575 | 1587 port = gaim_account_get_int(account, "port", FAIM_LOGIN_PORT); |
2086 | 1588 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1589 va_start(ap, fr); |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1590 redir = va_arg(ap, struct aim_redirect_data *); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1591 va_end(ap); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1592 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1593 for (i = 0; i < (int)strlen(redir->ip); i++) { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1594 if (redir->ip[i] == ':') { |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1595 port = atoi(&(redir->ip[i+1])); |
2086 | 1596 break; |
1597 } | |
1598 } | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1599 host = g_strndup(redir->ip, i); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1600 |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1601 switch(redir->group) { |
2086 | 1602 case 0x7: /* Authorizer */ |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1603 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1604 "Reconnecting with authorizor...\n"); |
2086 | 1605 tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL); |
1606 if (tstconn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1607 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1608 "unable to reconnect with authorizer\n"); |
2086 | 1609 g_free(host); |
1610 return 1; | |
1611 } | |
4649 | 1612 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1613 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_admin, 0); |
2086 | 1614 |
1615 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1616 if (gaim_proxy_connect(account, host, port, oscar_auth_connect, gc) != 0) { |
2086 | 1617 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1618 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1619 "unable to reconnect with authorizer\n"); |
2086 | 1620 g_free(host); |
1621 return 1; | |
1622 } | |
4293 | 1623 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
4194 | 1624 break; |
1625 | |
2086 | 1626 case 0xd: /* ChatNav */ |
1627 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHATNAV, NULL); | |
1628 if (tstconn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1629 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1630 "unable to connect to chatnav server\n"); |
2086 | 1631 g_free(host); |
1632 return 1; | |
1633 } | |
4649 | 1634 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1635 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chatnav, 0); |
2086 | 1636 |
1637 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1638 if (gaim_proxy_connect(account, host, port, oscar_chatnav_connect, gc) != 0) { |
2086 | 1639 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1640 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1641 "unable to connect to chatnav server\n"); |
2086 | 1642 g_free(host); |
1643 return 1; | |
1644 } | |
4293 | 1645 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
4194 | 1646 break; |
1647 | |
1648 case 0xe: { /* Chat */ | |
2086 | 1649 struct chat_connection *ccon; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1650 |
2086 | 1651 tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, NULL); |
1652 if (tstconn == NULL) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1653 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1654 "unable to connect to chat server\n"); |
2086 | 1655 g_free(host); |
1656 return 1; | |
1657 } | |
1658 | |
4649 | 1659 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
2675 | 1660 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chat, 0); |
1661 | |
2086 | 1662 ccon = g_new0(struct chat_connection, 1); |
1663 ccon->conn = tstconn; | |
1664 ccon->gc = gc; | |
1665 ccon->fd = -1; | |
2821
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1666 ccon->name = g_strdup(redir->chat.room); |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1667 ccon->exchange = redir->chat.exchange; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1668 ccon->instance = redir->chat.instance; |
9467e4ee81be
[gaim-migrate @ 2834]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2820
diff
changeset
|
1669 ccon->show = extract_name(redir->chat.room); |
4634 | 1670 |
2086 | 1671 ccon->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1672 if (gaim_proxy_connect(account, host, port, oscar_chat_connect, ccon) != 0) { |
2086 | 1673 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1674 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1675 "unable to connect to chat server\n"); |
2086 | 1676 g_free(host); |
1677 g_free(ccon->show); | |
1678 g_free(ccon->name); | |
1679 g_free(ccon); | |
1680 return 1; | |
1681 } | |
4293 | 1682 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1683 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1684 "Connected to chat room %s exchange %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1685 ccon->name, ccon->exchange); |
4194 | 1686 } break; |
3694 | 1687 |
4804 | 1688 case 0x0010: { /* icon */ |
1689 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_ICON, NULL))) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1690 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1691 "unable to connect to icon server\n"); |
4804 | 1692 g_free(host); |
1693 return 1; | |
1694 } | |
1695 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); | |
1696 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_icon, 0); | |
1697 | |
1698 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1699 if (gaim_proxy_connect(account, host, port, oscar_icon_connect, gc) != 0) { |
4804 | 1700 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1701 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1702 "unable to connect to icon server\n"); |
4804 | 1703 g_free(host); |
1704 return 1; | |
1705 } | |
1706 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); | |
1707 } break; | |
1708 | |
3694 | 1709 case 0x0018: { /* email */ |
1710 if (!(tstconn = aim_newconn(sess, AIM_CONN_TYPE_EMAIL, NULL))) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1711 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1712 "unable to connect to email server\n"); |
3694 | 1713 g_free(host); |
1714 return 1; | |
1715 } | |
4649 | 1716 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_connerr, 0); |
3694 | 1717 aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_email, 0); |
1718 | |
1719 tstconn->status |= AIM_CONN_STATUS_INPROGRESS; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1720 if (gaim_proxy_connect(account, host, port, oscar_email_connect, gc) != 0) { |
3694 | 1721 aim_conn_kill(sess, &tstconn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1722 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1723 "unable to connect to email server\n"); |
3694 | 1724 g_free(host); |
1725 return 1; | |
1726 } | |
4293 | 1727 aim_sendcookie(sess, tstconn, redir->cookielen, redir->cookie); |
3694 | 1728 } break; |
1729 | |
2086 | 1730 default: /* huh? */ |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1731 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1732 "got redirect for unknown service 0x%04hx\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1733 redir->group); |
2086 | 1734 break; |
1735 } | |
1736 | |
1737 g_free(host); | |
1738 return 1; | |
1739 } | |
1740 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1741 static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1742 GaimConnection *gc = sess->aux_data; |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1743 struct oscar_data *od = gc->proto_data; |
4738 | 1744 struct buddyinfo *bi; |
2993 | 1745 time_t time_idle = 0, signon = 0; |
1746 int type = 0; | |
1747 int caps = 0; | |
2086 | 1748 va_list ap; |
4738 | 1749 aim_userinfo_t *info; |
4194 | 1750 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1751 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1752 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1753 va_end(ap); |
1754 | |
2993 | 1755 if (info->present & AIM_USERINFO_PRESENT_CAPABILITIES) |
1756 caps = info->capabilities; | |
3267 | 1757 if (info->flags & AIM_FLAG_ACTIVEBUDDY) |
1758 type |= UC_AB; | |
6318 | 1759 if (caps & AIM_CAPS_HIPTOP) |
1760 type |= UC_HIPTOP; | |
3267 | 1761 |
4766 | 1762 if (info->present & AIM_USERINFO_PRESENT_FLAGS) { |
1763 if (info->flags & AIM_FLAG_UNCONFIRMED) | |
1764 type |= UC_UNCONFIRMED; | |
1765 if (info->flags & AIM_FLAG_ADMINISTRATOR) | |
1766 type |= UC_ADMIN; | |
1767 if (info->flags & AIM_FLAG_AOL) | |
1768 type |= UC_AOL; | |
1769 if (info->flags & AIM_FLAG_FREE) | |
1770 type |= UC_NORMAL; | |
1771 if (info->flags & AIM_FLAG_AWAY) | |
1772 type |= UC_UNAVAILABLE; | |
1773 if (info->flags & AIM_FLAG_WIRELESS) | |
1774 type |= UC_WIRELESS; | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
1775 } |
2993 | 1776 if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) { |
3595 | 1777 type = (info->icqinfo.status << 16); |
3013 | 1778 if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) && |
1779 (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) { | |
2993 | 1780 type |= UC_UNAVAILABLE; |
3013 | 1781 } |
2993 | 1782 } |
1783 | |
1784 if (caps & AIM_CAPS_ICQ) | |
1785 caps ^= AIM_CAPS_ICQ; | |
1786 | |
1787 if (info->present & AIM_USERINFO_PRESENT_IDLE) { | |
2086 | 1788 time(&time_idle); |
1789 time_idle -= info->idletime*60; | |
2993 | 1790 } |
1791 | |
5836 | 1792 if (info->present & AIM_USERINFO_PRESENT_ONLINESINCE) |
1793 signon = info->onlinesince; | |
1794 else if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) | |
2993 | 1795 signon = time(NULL) - info->sessionlen; |
2086 | 1796 |
5575 | 1797 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), info->sn)) |
1798 gaim_connection_set_display_name(gc, info->sn); | |
2305
0371b905baef
[gaim-migrate @ 2315]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2303
diff
changeset
|
1799 |
4738 | 1800 bi = g_hash_table_lookup(od->buddyinfo, normalize(info->sn)); |
1801 if (!bi) { | |
1802 bi = g_new0(struct buddyinfo, 1); | |
1803 g_hash_table_insert(od->buddyinfo, g_strdup(normalize(info->sn)), bi); | |
1804 } | |
4739 | 1805 bi->typingnot = FALSE; |
1806 bi->ico_informed = FALSE; | |
6857 | 1807 bi->ipaddr = info->icqinfo.ipaddr; |
1808 | |
1809 /* Available message stuff */ | |
6292 | 1810 free(bi->availmsg); |
7011 | 1811 if (info->avail != NULL) |
1812 if (info->avail_encoding) { | |
1813 gchar *enc = g_strdup_printf("charset=\"%s\"", info->avail_encoding); | |
1814 bi->availmsg = oscar_encoding_to_utf8(enc, info->avail, info->avail_len); | |
6292 | 1815 g_free(enc); |
1816 } else { | |
1817 /* No explicit encoding means utf8. Yay. */ | |
7011 | 1818 bi->availmsg = g_strdup(info->avail); |
6292 | 1819 } |
5837 | 1820 else |
6292 | 1821 bi->availmsg = NULL; |
4732 | 1822 |
4804 | 1823 /* Server stored icon stuff */ |
4853 | 1824 if (info->iconcsumlen) { |
1825 char *b16, *saved_b16; | |
6695 | 1826 GaimBuddy *b; |
4853 | 1827 |
7011 | 1828 b16 = tobase16(info->iconcsum, info->iconcsumlen); |
4853 | 1829 b = gaim_find_buddy(gc->account, info->sn); |
1830 saved_b16 = gaim_buddy_get_setting(b, "icon_checksum"); | |
1831 if (!b16 || !saved_b16 || strcmp(b16, saved_b16)) { | |
1832 GSList *cur = od->requesticon; | |
1833 while (cur && aim_sncmp((char *)cur->data, info->sn)) | |
1834 cur = cur->next; | |
1835 if (!cur) { | |
1836 od->requesticon = g_slist_append(od->requesticon, strdup(normalize(info->sn))); | |
1837 if (od->icontimer) | |
1838 g_source_remove(od->icontimer); | |
1839 od->icontimer = g_timeout_add(500, gaim_icon_timerfunc, gc); | |
1840 } | |
1841 } | |
6053 | 1842 g_free(saved_b16); |
1843 g_free(b16); | |
4853 | 1844 } |
1845 | |
5628 | 1846 serv_got_update(gc, info->sn, 1, (info->warnlevel/10.0) + 0.5, signon, time_idle, type); |
2086 | 1847 |
1848 return 1; | |
1849 } | |
1850 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1851 static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1852 GaimConnection *gc = sess->aux_data; |
5837 | 1853 struct oscar_data *od = gc->proto_data; |
2086 | 1854 va_list ap; |
4739 | 1855 aim_userinfo_t *info; |
2086 | 1856 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
1857 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
1858 info = va_arg(ap, aim_userinfo_t *); |
2086 | 1859 va_end(ap); |
1860 | |
4732 | 1861 serv_got_update(gc, info->sn, 0, 0, 0, 0, 0); |
2086 | 1862 |
5837 | 1863 g_hash_table_remove(od->buddyinfo, normalize(info->sn)); |
1864 | |
2086 | 1865 return 1; |
1866 } | |
1867 | |
3730 | 1868 static void cancel_direct_im(struct ask_direct *d) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1869 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Freeing DirectIM prompts.\n"); |
2086 | 1870 |
1871 g_free(d->sn); | |
1872 g_free(d); | |
1873 } | |
1874 | |
4617 | 1875 static void oscar_odc_callback(gpointer data, gint source, GaimInputCondition condition) { |
2086 | 1876 struct direct_im *dim = data; |
5575 | 1877 GaimConnection *gc = dim->gc; |
2086 | 1878 struct oscar_data *od = gc->proto_data; |
5679 | 1879 GaimConversation *cnv; |
2086 | 1880 char buf[256]; |
3008 | 1881 struct sockaddr name; |
1882 socklen_t name_len = 1; | |
1883 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
1884 if (!g_list_find(gaim_connections_get_all(), gc)) { |
2086 | 1885 g_free(dim); |
1886 return; | |
1887 } | |
1888 | |
1889 if (source < 0) { | |
1890 g_free(dim); | |
1891 return; | |
1892 } | |
1893 | |
4366 | 1894 dim->conn->fd = source; |
2086 | 1895 aim_conn_completeconnect(od->sess, dim->conn); |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
1896 cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, dim->name); |
3008 | 1897 |
1898 /* This is the best way to see if we're connected or not */ | |
1899 if (getpeername(source, &name, &name_len) == 0) { | |
1900 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name); | |
1901 dim->connected = TRUE; | |
6982 | 1902 gaim_conversation_write(cnv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
3008 | 1903 } |
2086 | 1904 od->direct_ims = g_slist_append(od->direct_ims, dim); |
3008 | 1905 |
4617 | 1906 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); |
2086 | 1907 } |
1908 | |
4617 | 1909 /* BBB */ |
3952 | 1910 /* |
4617 | 1911 * This is called after a remote AIM user has connected to us. We |
1912 * want to do some voodoo with the socket file descriptors, add a | |
1913 * callback or two, and then send the AIM_CB_OFT_PROMPT. | |
3952 | 1914 */ |
4656 | 1915 static int oscar_sendfile_estblsh(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1916 GaimConnection *gc = sess->aux_data; |
3630 | 1917 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1918 GaimXfer *xfer; |
5146 | 1919 struct aim_oft_info *oft_info; |
3630 | 1920 va_list ap; |
1921 aim_conn_t *conn, *listenerconn; | |
4656 | 1922 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1923 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1924 "AAA - in oscar_sendfile_estblsh\n"); |
3630 | 1925 va_start(ap, fr); |
1926 conn = va_arg(ap, aim_conn_t *); | |
1927 listenerconn = va_arg(ap, aim_conn_t *); | |
1928 va_end(ap); | |
1929 | |
4617 | 1930 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, listenerconn))) |
1931 return 1; | |
1932 | |
5146 | 1933 if (!(oft_info = xfer->data)) |
4617 | 1934 return 1; |
1935 | |
3630 | 1936 /* Stop watching listener conn; watch transfer conn instead */ |
4617 | 1937 gaim_input_remove(xfer->watcher); |
3630 | 1938 aim_conn_kill(sess, &listenerconn); |
1939 | |
5146 | 1940 oft_info->conn = conn; |
1941 xfer->fd = oft_info->conn->fd; | |
1942 | |
1943 aim_conn_addhandler(sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_ACK, oscar_sendfile_ack, 0); | |
1944 aim_conn_addhandler(sess, oft_info->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DONE, oscar_sendfile_done, 0); | |
1945 xfer->watcher = gaim_input_add(oft_info->conn->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
4617 | 1946 |
1947 /* Inform the other user that we are connected and ready to transfer */ | |
5146 | 1948 aim_oft_sendheader(sess, AIM_CB_OFT_PROMPT, oft_info); |
3630 | 1949 |
1950 return 0; | |
1951 } | |
1952 | |
3952 | 1953 /* |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
1954 * This is the gaim callback passed to gaim_proxy_connect when connecting to another AIM |
4617 | 1955 * user in order to transfer a file. |
3952 | 1956 */ |
4617 | 1957 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
|
1958 GaimXfer *xfer; |
5146 | 1959 struct aim_oft_info *oft_info; |
4656 | 1960 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1961 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1962 "AAA - in oscar_sendfile_connected\n"); |
4617 | 1963 if (!(xfer = data)) |
1964 return; | |
5146 | 1965 if (!(oft_info = xfer->data)) |
3630 | 1966 return; |
4617 | 1967 if (source < 0) |
1968 return; | |
1969 | |
1970 xfer->fd = source; | |
5146 | 1971 oft_info->conn->fd = source; |
1972 | |
1973 aim_conn_completeconnect(oft_info->sess, oft_info->conn); | |
1974 xfer->watcher = gaim_input_add(xfer->fd, GAIM_INPUT_READ, oscar_callback, oft_info->conn); | |
4617 | 1975 |
1976 /* Inform the other user that we are connected and ready to transfer */ | |
5146 | 1977 aim_im_sendch2_sendfile_accept(oft_info->sess, oft_info); |
4617 | 1978 |
1979 return; | |
3630 | 1980 } |
1981 | |
3952 | 1982 /* |
4617 | 1983 * This is called when a buddy sends us some file info. This happens when they |
1984 * are sending a file to you, and you have just established a connection to them. | |
4650 | 1985 * You should send them the exact same info except use the real cookie. We also |
4617 | 1986 * get like totally ready to like, receive the file, kay? |
3952 | 1987 */ |
4617 | 1988 static int oscar_sendfile_prompt(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 1989 GaimConnection *gc = sess->aux_data; |
4617 | 1990 struct oscar_data *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
1991 GaimXfer *xfer; |
5146 | 1992 struct aim_oft_info *oft_info; |
4617 | 1993 va_list ap; |
1994 aim_conn_t *conn; | |
1995 fu8_t *cookie; | |
1996 struct aim_fileheader_t *fh; | |
4656 | 1997 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1998 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
1999 "AAA - in oscar_sendfile_prompt\n"); |
4617 | 2000 va_start(ap, fr); |
2001 conn = va_arg(ap, aim_conn_t *); | |
2002 cookie = va_arg(ap, fu8_t *); | |
2003 fh = va_arg(ap, struct aim_fileheader_t *); | |
2004 va_end(ap); | |
2005 | |
2006 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, conn))) | |
2007 return 1; | |
2008 | |
5146 | 2009 if (!(oft_info = xfer->data)) |
4617 | 2010 return 1; |
2011 | |
2012 /* We want to stop listening with a normal thingy */ | |
2013 gaim_input_remove(xfer->watcher); | |
2014 xfer->watcher = 0; | |
2015 | |
5146 | 2016 /* They sent us some information about the file they're sending */ |
2017 memcpy(&oft_info->fh, fh, sizeof(*fh)); | |
2018 | |
2019 /* Fill in the cookie */ | |
2020 memcpy(&oft_info->fh.bcookie, oft_info->cookie, 8); | |
2021 | |
4617 | 2022 /* XXX - convert the name from UTF-8 to UCS-2 if necessary, and pass the encoding to the call below */ |
5146 | 2023 aim_oft_sendheader(oft_info->sess, AIM_CB_OFT_ACK, oft_info); |
4617 | 2024 gaim_xfer_start(xfer, xfer->fd, NULL, 0); |
2025 | |
2026 return 0; | |
3630 | 2027 } |
2028 | |
3952 | 2029 /* |
4657 | 2030 * We are sending a file to someone else. They have just acknowledged our |
4617 | 2031 * prompt, so we want to start sending data like there's no tomorrow. |
3952 | 2032 */ |
4617 | 2033 static int oscar_sendfile_ack(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2034 GaimConnection *gc = sess->aux_data; |
4617 | 2035 struct oscar_data *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2036 GaimXfer *xfer; |
4617 | 2037 va_list ap; |
2038 aim_conn_t *conn; | |
2039 fu8_t *cookie; | |
2040 struct aim_fileheader_t *fh; | |
4656 | 2041 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2042 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_sendfile_ack\n"); |
4617 | 2043 va_start(ap, fr); |
2044 conn = va_arg(ap, aim_conn_t *); | |
2045 cookie = va_arg(ap, fu8_t *); | |
2046 fh = va_arg(ap, struct aim_fileheader_t *); | |
2047 va_end(ap); | |
2048 | |
2049 if (!(xfer = oscar_find_xfer_by_cookie(od->file_transfers, cookie))) | |
2050 return 1; | |
2051 | |
4656 | 2052 /* We want to stop listening with a normal thingy */ |
2053 gaim_input_remove(xfer->watcher); | |
2054 xfer->watcher = 0; | |
2055 | |
4617 | 2056 gaim_xfer_start(xfer, xfer->fd, NULL, 0); |
2057 | |
2058 return 0; | |
3630 | 2059 } |
4617 | 2060 |
2061 /* | |
2062 * We just sent a file to someone. They said they got it and everything, | |
2063 * so we can close our direct connection and what not. | |
2064 */ | |
2065 static int oscar_sendfile_done(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 2066 GaimConnection *gc = sess->aux_data; |
4617 | 2067 struct oscar_data *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2068 GaimXfer *xfer; |
4617 | 2069 va_list ap; |
2070 aim_conn_t *conn; | |
2071 fu8_t *cookie; | |
2072 struct aim_fileheader_t *fh; | |
4656 | 2073 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2074 gaim_debug(GAIM_DEBUG_INFO, "oscar", "AAA - in oscar_sendfile_done\n"); |
4617 | 2075 va_start(ap, fr); |
2076 conn = va_arg(ap, aim_conn_t *); | |
2077 cookie = va_arg(ap, fu8_t *); | |
2078 fh = va_arg(ap, struct aim_fileheader_t *); | |
2079 va_end(ap); | |
2080 | |
2081 if (!(xfer = oscar_find_xfer_by_conn(od->file_transfers, conn))) | |
2082 return 1; | |
2083 | |
4656 | 2084 xfer->fd = conn->fd; |
4617 | 2085 gaim_xfer_end(xfer); |
2086 | |
2087 return 0; | |
2088 } | |
3630 | 2089 |
4244 | 2090 static void accept_direct_im(struct ask_direct *d) { |
5575 | 2091 GaimConnection *gc = d->gc; |
4244 | 2092 struct oscar_data *od; |
2086 | 2093 struct direct_im *dim; |
2945 | 2094 char *host; int port = 4443; |
4366 | 2095 int i, rc; |
2086 | 2096 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2097 if (!g_list_find(gaim_connections_get_all(), gc)) { |
4244 | 2098 cancel_direct_im(d); |
2099 return; | |
2100 } | |
2101 | |
2102 od = (struct oscar_data *)gc->proto_data; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2103 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Accepted DirectIM.\n"); |
2086 | 2104 |
2105 dim = find_direct_im(od, d->sn); | |
2106 if (dim) { | |
3730 | 2107 cancel_direct_im(d); /* 40 */ |
4244 | 2108 return; |
2086 | 2109 } |
2110 dim = g_new0(struct direct_im, 1); | |
2111 dim->gc = d->gc; | |
2112 g_snprintf(dim->name, sizeof dim->name, "%s", d->sn); | |
2113 | |
4617 | 2114 dim->conn = aim_odc_connect(od->sess, d->sn, NULL, d->cookie); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2115 if (!dim->conn) { |
2086 | 2116 g_free(dim); |
3730 | 2117 cancel_direct_im(d); |
4244 | 2118 return; |
2086 | 2119 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2120 |
2086 | 2121 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, |
4617 | 2122 gaim_odc_incoming, 0); |
2086 | 2123 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, |
4617 | 2124 gaim_odc_typing, 0); |
3033 | 2125 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, |
6982 | 2126 gaim_odc_update_ui, 0); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2127 for (i = 0; i < (int)strlen(d->ip); i++) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2128 if (d->ip[i] == ':') { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2129 port = atoi(&(d->ip[i+1])); |
2086 | 2130 break; |
2131 } | |
2132 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2133 host = g_strndup(d->ip, i); |
2086 | 2134 dim->conn->status |= AIM_CONN_STATUS_INPROGRESS; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5679
diff
changeset
|
2135 rc = gaim_proxy_connect(gc->account, host, port, oscar_odc_callback, dim); |
2086 | 2136 g_free(host); |
4366 | 2137 if (rc < 0) { |
2086 | 2138 aim_conn_kill(od->sess, &dim->conn); |
2139 g_free(dim); | |
3730 | 2140 cancel_direct_im(d); |
4244 | 2141 return; |
2086 | 2142 } |
2143 | |
3730 | 2144 cancel_direct_im(d); |
2086 | 2145 |
4244 | 2146 return; |
2086 | 2147 } |
2148 | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2149 static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) { |
5575 | 2150 GaimConnection *gc = sess->aux_data; |
3600 | 2151 struct oscar_data *od = gc->proto_data; |
4738 | 2152 char *tmp; |
6622 | 2153 GaimImFlags flags = 0; |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
2154 gsize convlen; |
3659 | 2155 GError *err = NULL; |
4738 | 2156 struct buddyinfo *bi; |
5575 | 2157 const char *iconfile; |
4738 | 2158 |
2159 bi = g_hash_table_lookup(od->buddyinfo, normalize(userinfo->sn)); | |
2160 if (!bi) { | |
2161 bi = g_new0(struct buddyinfo, 1); | |
2162 g_hash_table_insert(od->buddyinfo, g_strdup(normalize(userinfo->sn)), bi); | |
2163 } | |
2273
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2164 |
0b5c3338fa3d
[gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2249
diff
changeset
|
2165 if (args->icbmflags & AIM_IMFLAGS_AWAY) |
6622 | 2166 flags |= GAIM_IM_AUTO_RESP; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2167 |
4738 | 2168 if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT) |
2169 bi->typingnot = TRUE; | |
2170 else | |
2171 bi->typingnot = FALSE; | |
2172 | |
4380 | 2173 if ((args->icbmflags & AIM_IMFLAGS_HASICON) && (args->iconlen) && (args->iconsum) && (args->iconstamp)) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2174 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2175 "%s has an icon\n", userinfo->sn); |
4738 | 2176 if ((args->iconlen != bi->ico_len) || (args->iconsum != bi->ico_csum) || (args->iconstamp != bi->ico_time)) { |
2177 bi->ico_need = TRUE; | |
2178 bi->ico_len = args->iconlen; | |
2179 bi->ico_csum = args->iconsum; | |
2180 bi->ico_time = args->iconstamp; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2181 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2182 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2183 |
5575 | 2184 if ((iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc))) && |
2185 (args->icbmflags & AIM_IMFLAGS_BUDDYREQ)) { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2186 FILE *file; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2187 struct stat st; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2188 |
5575 | 2189 if (!stat(iconfile, &st)) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2190 char *buf = g_malloc(st.st_size); |
5575 | 2191 file = fopen(iconfile, "rb"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2192 if (file) { |
2603
24664768a739
[gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2597
diff
changeset
|
2193 int len = fread(buf, 1, st.st_size, file); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2194 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2195 "Sending buddy icon to %s (%d bytes, " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2196 "%lu reported)\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2197 userinfo->sn, len, st.st_size); |
4617 | 2198 aim_im_sendch2_icon(sess, userinfo->sn, buf, st.st_size, |
2199 st.st_mtime, aimutil_iconsum(buf, st.st_size)); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2200 fclose(file); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
2201 } else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2202 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2203 "Can't open buddy icon file!\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2204 g_free(buf); |
2336
c6c5eaf69188
[gaim-migrate @ 2349]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2315
diff
changeset
|
2205 } else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2206 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2207 "Can't stat buddy icon file!\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2208 } |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2209 |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2210 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2211 "Character set is %hu %hu\n", args->charset, args->charsubset); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2212 if (args->icbmflags & AIM_IMFLAGS_UNICODE) { |
3722 | 2213 /* This message is marked as UNICODE, so we have to |
2214 * convert it to utf-8 before handing it to the gaim core. | |
2215 * This conversion should *never* fail, if it does it | |
2216 * means that either the incoming ICBM is corrupted or | |
4662 | 2217 * there is something we don't understand about it. |
2218 * For the record, AIM Unicode is big-endian UCS-2 */ | |
2219 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2220 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Received UNICODE IM\n"); |
4121 | 2221 |
2222 if (!args->msg || !args->msglen) | |
2223 return 1; | |
4641 | 2224 |
3659 | 2225 tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err); |
2226 if (err) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2227 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2228 "Unicode IM conversion: %s\n", err->message); |
3659 | 2229 tmp = strdup(_("(There was an error receiving this message)")); |
4800 | 2230 g_error_free(err); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2231 } |
3722 | 2232 } else { |
3850 | 2233 /* This will get executed for both AIM_IMFLAGS_ISO_8859_1 and |
3722 | 2234 * unflagged messages, which are ASCII. That's OK because |
2235 * ASCII is a strict subset of ISO-8859-1; this should | |
2236 * help with compatibility with old, broken versions of | |
2237 * gaim (everything before 0.60) and other broken clients | |
2238 * that will happily send ISO-8859-1 without marking it as | |
2239 * such */ | |
4662 | 2240 if (args->icbmflags & AIM_IMFLAGS_ISO_8859_1) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2241 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2242 "Received ISO-8859-1 IM\n"); |
4121 | 2243 |
2244 if (!args->msg || !args->msglen) | |
2245 return 1; | |
2246 | |
3659 | 2247 tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &convlen, &err); |
2248 if (err) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2249 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2250 "ISO-8859-1 IM conversion: %s\n", err->message); |
3659 | 2251 tmp = strdup(_("(There was an error receiving this message)")); |
4800 | 2252 g_error_free(err); |
3659 | 2253 } |
3642 | 2254 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2255 |
4333 | 2256 /* strip_linefeed(tmp); */ |
6982 | 2257 serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2258 g_free(tmp); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2259 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2260 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2261 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2262 |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2263 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { |
5575 | 2264 GaimConnection *gc = sess->aux_data; |
4617 | 2265 struct oscar_data *od = gc->proto_data; |
5575 | 2266 const char *username = gaim_account_get_username(gaim_connection_get_account(gc)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2267 |
4121 | 2268 if (!args) |
2269 return 0; | |
4194 | 2270 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2271 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2272 "rendezvous with %s, status is %hu\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2273 userinfo->sn, args->status); |
2869 | 2274 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2275 if (args->reqclass & AIM_CAPS_CHAT) { |
4121 | 2276 char *name; |
5234 | 2277 GHashTable *components; |
2278 | |
4121 | 2279 if (!args->info.chat.roominfo.name || !args->info.chat.roominfo.exchange || !args->msg) |
2280 return 1; | |
5234 | 2281 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
2282 g_free); | |
4121 | 2283 name = extract_name(args->info.chat.roominfo.name); |
5234 | 2284 g_hash_table_replace(components, g_strdup("room"), g_strdup(name ? name : args->info.chat.roominfo.name)); |
2285 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
|
2286 serv_got_chat_invite(gc, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2287 name ? name : args->info.chat.roominfo.name, |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2288 userinfo->sn, |
6059 | 2289 args->msg, |
5234 | 2290 components); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2291 if (name) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2292 g_free(name); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2293 } else if (args->reqclass & AIM_CAPS_SENDFILE) { |
4617 | 2294 /* BBB */ |
2295 if (args->status == AIM_RENDEZVOUS_PROPOSE) { | |
2296 /* Someone wants to send a file (or files) to us */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2297 GaimXfer *xfer; |
5146 | 2298 struct aim_oft_info *oft_info; |
2299 | |
2300 if (!args->cookie || !args->port || !args->verifiedip || | |
2301 !args->info.sendfile.filename || !args->info.sendfile.totsize || | |
4656 | 2302 !args->info.sendfile.totfiles || !args->reqclass) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2303 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2304 "%s tried to send you a file with incomplete " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2305 "information.\n", userinfo->sn); |
5146 | 2306 if (args->proxyip) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2307 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2308 "IP for a proxy server was given. Gaim " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2309 "does not support this yet.\n"); |
4617 | 2310 return 1; |
4656 | 2311 } |
4617 | 2312 |
2313 if (args->info.sendfile.subtype == AIM_OFT_SUBTYPE_SEND_DIR) { | |
2314 /* last char of the ft req is a star, they are sending us a | |
2315 * directory -- remove the star and trailing slash so we dont save | |
2316 * directories that look like 'dirname\*' -- arl */ | |
2317 char *tmp = strrchr(args->info.sendfile.filename, '\\'); | |
2318 if (tmp && (tmp[1] == '*')) { | |
2319 tmp[0] = '\0'; | |
2320 } | |
2321 } | |
2322 | |
2323 /* Build the file transfer handle */ | |
2324 xfer = gaim_xfer_new(gc->account, GAIM_XFER_RECEIVE, userinfo->sn); | |
5163 | 2325 xfer->remote_ip = g_strdup(args->verifiedip); |
5146 | 2326 xfer->remote_port = args->port; |
4617 | 2327 gaim_xfer_set_filename(xfer, args->info.sendfile.filename); |
2328 gaim_xfer_set_size(xfer, args->info.sendfile.totsize); | |
5146 | 2329 |
2330 /* Create the oscar-specific data */ | |
5163 | 2331 oft_info = aim_oft_createinfo(od->sess, args->cookie, userinfo->sn, args->clientip, xfer->remote_port, 0, 0, NULL); |
4898 | 2332 if (args->proxyip) |
5146 | 2333 oft_info->proxyip = g_strdup(args->proxyip); |
4898 | 2334 if (args->verifiedip) |
5146 | 2335 oft_info->verifiedip = g_strdup(args->verifiedip); |
2336 xfer->data = oft_info; | |
4617 | 2337 |
2338 /* Setup our I/O op functions */ | |
2339 gaim_xfer_set_init_fnc(xfer, oscar_xfer_init); | |
2340 gaim_xfer_set_start_fnc(xfer, oscar_xfer_start); | |
2341 gaim_xfer_set_end_fnc(xfer, oscar_xfer_end); | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2342 gaim_xfer_set_cancel_send_fnc(xfer, oscar_xfer_cancel_send); |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4666
diff
changeset
|
2343 gaim_xfer_set_cancel_recv_fnc(xfer, oscar_xfer_cancel_recv); |
4617 | 2344 gaim_xfer_set_ack_fnc(xfer, oscar_xfer_ack); |
2345 | |
2346 /* | |
2347 * XXX - Should do something with args->msg, args->encoding, and args->language | |
2348 * probably make it apply to all ch2 messages. | |
3752 | 2349 */ |
4617 | 2350 |
2351 /* Keep track of this transfer for later */ | |
2352 od->file_transfers = g_slist_append(od->file_transfers, xfer); | |
2353 | |
2354 /* Now perform the request */ | |
2355 gaim_xfer_request(xfer); | |
2356 } else if (args->status == AIM_RENDEZVOUS_CANCEL) { | |
2357 /* The other user wants to cancel a file transfer */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2358 GaimXfer *xfer; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2359 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2360 "AAA - File transfer canceled by remote user\n"); |
4617 | 2361 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
|
2362 gaim_xfer_cancel_remote(xfer); |
4617 | 2363 } else if (args->status == AIM_RENDEZVOUS_ACCEPT) { |
2364 /* | |
2365 * This gets sent by the receiver of a file | |
2366 * as they connect directly to us. If we don't | |
2367 * get this, then maybe a third party connected | |
2368 * to us, and we shouldn't send them anything. | |
2369 */ | |
2370 } else { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2371 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2372 "unknown rendezvous status!\n"); |
3630 | 2373 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2374 } else if (args->reqclass & AIM_CAPS_GETFILE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2375 } else if (args->reqclass & AIM_CAPS_VOICE) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2376 } else if (args->reqclass & AIM_CAPS_BUDDYICON) { |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
2377 gaim_buddy_icons_set_for_user(gaim_connection_get_account(gc), |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
2378 userinfo->sn, args->info.icon.icon, |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
2379 args->info.icon.length); |
6871 | 2380 } else if (args->reqclass & AIM_CAPS_DIRECTIM) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2381 struct ask_direct *d = g_new0(struct ask_direct, 1); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2382 char buf[256]; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2383 |
4212 | 2384 if (!args->verifiedip) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2385 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2386 "directim kill blocked (%s)\n", userinfo->sn); |
4650 | 2387 return 1; |
4212 | 2388 } |
2389 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2390 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2391 "%s received direct im request from %s (%s)\n", |
5575 | 2392 username, userinfo->sn, args->verifiedip); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2393 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2394 d->gc = gc; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2395 d->sn = g_strdup(userinfo->sn); |
2869 | 2396 strncpy(d->ip, args->verifiedip, sizeof(d->ip)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2397 memcpy(d->cookie, args->cookie, 8); |
5575 | 2398 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
|
2399 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2400 gaim_request_action(gc, NULL, buf, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2401 _("This requires a direct connection between " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2402 "the two computers and is necessary for IM " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2403 "Images. Because your IP address will be " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2404 "revealed, this may be considered a privacy " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2405 "risk."), 0, d, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2406 _("Connect"), G_CALLBACK(accept_direct_im), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2407 _("Cancel"), G_CALLBACK(cancel_direct_im)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2408 } else { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2409 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2410 "Unknown reqclass %hu\n", args->reqclass); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2411 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2412 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2413 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2414 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2415 |
3453 | 2416 /* |
4230 | 2417 * Authorization Functions |
2418 * Most of these are callbacks from dialogs. They're used by both | |
2419 * methods of authorization (SSI and old-school channel 4 ICBM) | |
3453 | 2420 */ |
4269 | 2421 /* When you ask other people for authorization */ |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2422 static void gaim_auth_request(struct name_data *data, char *msg) { |
5575 | 2423 GaimConnection *gc = data->gc; |
4244 | 2424 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2425 if (g_list_find(gaim_connections_get_all(), gc)) { |
4244 | 2426 struct oscar_data *od = gc->proto_data; |
6695 | 2427 GaimBuddy *buddy = gaim_find_buddy(gc->account, data->name); |
2428 GaimGroup *group = gaim_find_buddys_group(buddy); | |
4244 | 2429 if (buddy && group) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2430 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2431 "ssi: adding buddy %s to group %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2432 buddy->name, group->name); |
4889 | 2433 aim_ssi_sendauthrequest(od->sess, data->name, msg ? msg : _("Please authorize me so I can add you to my buddy list.")); |
4269 | 2434 if (!aim_ssi_itemlist_finditem(od->sess->ssi.local, group->name, buddy->name, AIM_SSI_TYPE_BUDDY)) |
4889 | 2435 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 1); |
4244 | 2436 } |
4230 | 2437 } |
4337 | 2438 } |
2439 | |
2440 static void gaim_auth_request_msgprompt(struct name_data *data) { | |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2441 gaim_request_input(data->gc, NULL, _("Authorization Request Message:"), |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
2442 NULL, _("Please authorize me!"), TRUE, FALSE, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2443 _("OK"), G_CALLBACK(gaim_auth_request), |
5836 | 2444 _("Cancel"), G_CALLBACK(oscar_free_name_data), |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2445 data); |
4230 | 2446 } |
2447 | |
2448 static void gaim_auth_dontrequest(struct name_data *data) { | |
5575 | 2449 GaimConnection *gc = data->gc; |
4244 | 2450 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2451 if (g_list_find(gaim_connections_get_all(), gc)) { |
4244 | 2452 /* struct oscar_data *od = gc->proto_data; */ |
2453 /* XXX - Take the buddy out of our buddy list */ | |
2454 } | |
2455 | |
5836 | 2456 oscar_free_name_data(data); |
4230 | 2457 } |
2458 | |
5575 | 2459 static void gaim_auth_sendrequest(GaimConnection *gc, const char *name) { |
4269 | 2460 struct name_data *data = g_new(struct name_data, 1); |
6695 | 2461 GaimBuddy *buddy; |
4269 | 2462 gchar *dialog_msg, *nombre; |
2463 | |
4687 | 2464 buddy = gaim_find_buddy(gc->account, name); |
2465 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
2466 nombre = g_strdup_printf("%s (%s)", name, gaim_get_buddy_alias_only(buddy)); | |
4269 | 2467 else |
4830 | 2468 nombre = NULL; |
2469 | |
2470 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 | 2471 data->gc = gc; |
2472 data->name = g_strdup(name); | |
2473 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2474 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2475 gaim_request_action(gc, NULL, _("Request Authorization"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2476 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2477 _("Request Authorization"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2478 G_CALLBACK(gaim_auth_request_msgprompt), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2479 _("Cancel"), G_CALLBACK(gaim_auth_dontrequest)); |
4269 | 2480 |
2481 g_free(dialog_msg); | |
2482 g_free(nombre); | |
2483 } | |
2484 | |
4230 | 2485 /* When other people ask you for authorization */ |
2486 static void gaim_auth_grant(struct name_data *data) { | |
5575 | 2487 GaimConnection *gc = data->gc; |
4244 | 2488 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2489 if (g_list_find(gaim_connections_get_all(), gc)) { |
4244 | 2490 struct oscar_data *od = gc->proto_data; |
4236 | 2491 #ifdef NOSSI |
6695 | 2492 GaimBuddy *buddy; |
4244 | 2493 gchar message; |
2494 message = 0; | |
4687 | 2495 buddy = gaim_find_buddy(gc->account, data->name); |
4617 | 2496 aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHGRANTED, &message); |
4687 | 2497 show_got_added(gc, NULL, data->name, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); |
4230 | 2498 #else |
4889 | 2499 aim_ssi_sendauthreply(od->sess, data->name, 0x01, NULL); |
4230 | 2500 #endif |
4244 | 2501 } |
2502 | |
5836 | 2503 oscar_free_name_data(data); |
3141 | 2504 } |
2505 | |
4230 | 2506 /* When other people ask you for authorization */ |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2507 static void gaim_auth_dontgrant(struct name_data *data, char *msg) { |
5575 | 2508 GaimConnection *gc = data->gc; |
4244 | 2509 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2510 if (g_list_find(gaim_connections_get_all(), gc)) { |
4244 | 2511 struct oscar_data *od = gc->proto_data; |
4230 | 2512 #ifdef NOSSI |
4617 | 2513 aim_im_sendch4(od->sess, data->name, AIM_ICQMSG_AUTHDENIED, msg ? msg : _("No reason given.")); |
4230 | 2514 #else |
4889 | 2515 aim_ssi_sendauthreply(od->sess, data->name, 0x00, msg ? msg : _("No reason given.")); |
4230 | 2516 #endif |
4244 | 2517 } |
4337 | 2518 } |
2519 | |
2520 static void gaim_auth_dontgrant_msgprompt(struct name_data *data) { | |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2521 gaim_request_input(data->gc, NULL, _("Authorization Denied Message:"), |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
2522 NULL, _("No reason given."), TRUE, FALSE, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2523 _("OK"), G_CALLBACK(gaim_auth_dontgrant), |
5836 | 2524 _("Cancel"), G_CALLBACK(oscar_free_name_data), |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
2525 data); |
3141 | 2526 } |
2527 | |
4230 | 2528 /* When someone sends you contacts */ |
2529 static void gaim_icq_contactadd(struct name_data *data) { | |
5575 | 2530 GaimConnection *gc = data->gc; |
4244 | 2531 |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
2532 if (g_list_find(gaim_connections_get_all(), gc)) { |
4244 | 2533 show_add_buddy(gc, data->name, NULL, data->nick); |
2534 } | |
2535 | |
5836 | 2536 oscar_free_name_data(data); |
3453 | 2537 } |
2538 | |
4075 | 2539 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 | 2540 GaimConnection *gc = sess->aux_data; |
4076 | 2541 gchar **msg1, **msg2; |
2542 GError *err = NULL; | |
6051 | 2543 int i, numtoks; |
4076 | 2544 |
4121 | 2545 if (!args->type || !args->msg || !args->uin) |
2546 return 1; | |
4194 | 2547 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2548 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2549 "Received a channel 4 message of type 0x%02hhx.\n", args->type); |
4076 | 2550 |
2551 /* Split up the message at the delimeter character, then convert each string to UTF-8 */ | |
4173 | 2552 msg1 = g_strsplit(args->msg, "\376", 0); |
6051 | 2553 for (numtoks=0; msg1[numtoks]; numtoks++); |
2554 msg2 = (gchar **)g_malloc((numtoks+1)*sizeof(gchar *)); | |
4076 | 2555 for (i=0; msg1[i]; i++) { |
2556 strip_linefeed(msg1[i]); | |
2557 msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err); | |
4800 | 2558 if (err) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2559 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2560 "Error converting a string from ISO-8859-1 to " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2561 "UTF-8 in oscar ICBM channel 4 parsing\n"); |
4800 | 2562 g_error_free(err); |
2563 } | |
4076 | 2564 } |
2565 msg2[i] = NULL; | |
2566 | |
3952 | 2567 switch (args->type) { |
4173 | 2568 case 0x01: { /* MacICQ message or basic offline message */ |
4076 | 2569 if (i >= 1) { |
5556 | 2570 gchar *uin = g_strdup_printf("%u", args->uin); |
4076 | 2571 if (t) { /* This is an offline message */ |
2572 /* I think this timestamp is in UTC, or something */ | |
6982 | 2573 serv_got_im(gc, uin, msg2[0], 0, t); |
4076 | 2574 } else { /* This is a message from MacICQ/Miranda */ |
6982 | 2575 serv_got_im(gc, uin, msg2[0], 0, time(NULL)); |
4076 | 2576 } |
2577 g_free(uin); | |
4075 | 2578 } |
3316 | 2579 } break; |
2580 | |
4173 | 2581 case 0x04: { /* Someone sent you a URL */ |
4076 | 2582 if (i >= 2) { |
5556 | 2583 gchar *uin = g_strdup_printf("%u", args->uin); |
4076 | 2584 gchar *message = g_strdup_printf("<A HREF=\"%s\">%s</A>", msg2[1], msg2[0]); |
6982 | 2585 serv_got_im(gc, uin, message, 0, time(NULL)); |
3453 | 2586 g_free(uin); |
2587 g_free(message); | |
2588 } | |
2589 } break; | |
2590 | |
4173 | 2591 case 0x06: { /* Someone requested authorization */ |
4076 | 2592 if (i >= 6) { |
4230 | 2593 struct name_data *data = g_new(struct name_data, 1); |
5556 | 2594 gchar *dialog_msg = g_strdup_printf(_("The user %u wants to add you to their buddy list for the following reason:\n%s"), args->uin, msg2[5] ? msg2[5] : _("No reason given.")); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2595 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
5556 | 2596 "Received an authorization request from UIN %u\n", |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2597 args->uin); |
4076 | 2598 data->gc = gc; |
5556 | 2599 data->name = g_strdup_printf("%u", args->uin); |
4230 | 2600 data->nick = NULL; |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2601 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2602 gaim_request_action(gc, NULL, _("Authorization Request"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2603 dialog_msg, 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2604 _("Authorize"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2605 G_CALLBACK(gaim_auth_grant), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2606 _("Deny"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2607 G_CALLBACK(gaim_auth_dontgrant_msgprompt)); |
4076 | 2608 g_free(dialog_msg); |
2609 } | |
3141 | 2610 } break; |
2611 | |
4173 | 2612 case 0x07: { /* Someone has denied you authorization */ |
4076 | 2613 if (i >= 1) { |
5556 | 2614 gchar *dialog_msg = g_strdup_printf(_("The user %u has denied your request to add them to your contact list for the following reason:\n%s"), args->uin, msg2[0] ? msg2[0] : _("No reason given.")); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2615 gaim_notify_info(gc, NULL, _("ICQ authorization denied."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2616 dialog_msg); |
4076 | 2617 g_free(dialog_msg); |
2618 } | |
3141 | 2619 } break; |
2620 | |
4173 | 2621 case 0x08: { /* Someone has granted you authorization */ |
5556 | 2622 gchar *dialog_msg = g_strdup_printf(_("The user %u has granted your request to add them to your contact list."), args->uin); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2623 gaim_notify_info(gc, NULL, "ICQ authorization accepted.", |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2624 dialog_msg); |
3141 | 2625 g_free(dialog_msg); |
2626 } break; | |
2627 | |
4333 | 2628 case 0x09: { /* Message from the Godly ICQ server itself, I think */ |
2629 if (i >= 5) { | |
2630 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
|
2631 gaim_notify_info(gc, NULL, "ICQ Server Message", dialog_msg); |
4333 | 2632 g_free(dialog_msg); |
2633 } | |
2634 } break; | |
2635 | |
4173 | 2636 case 0x0d: { /* Someone has sent you a pager message from http://www.icq.com/your_uin */ |
4076 | 2637 if (i >= 6) { |
4194 | 2638 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
|
2639 gaim_notify_info(gc, NULL, "ICQ Page", dialog_msg); |
4076 | 2640 g_free(dialog_msg); |
2641 } | |
4075 | 2642 } break; |
2643 | |
4173 | 2644 case 0x0e: { /* Someone has emailed you at your_uin@pager.icq.com */ |
4076 | 2645 if (i >= 6) { |
4308 | 2646 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
|
2647 gaim_notify_info(gc, NULL, "ICQ Email", dialog_msg); |
4076 | 2648 g_free(dialog_msg); |
2649 } | |
4075 | 2650 } break; |
2651 | |
4173 | 2652 case 0x12: { |
3141 | 2653 /* Ack for authorizing/denying someone. Or possibly an ack for sending any system notice */ |
4173 | 2654 /* Someone added you to their contact list? */ |
3141 | 2655 } break; |
2656 | |
4173 | 2657 case 0x13: { /* Someone has sent you some ICQ contacts */ |
3453 | 2658 int i, num; |
2659 gchar **text; | |
4173 | 2660 text = g_strsplit(args->msg, "\376", 0); |
3453 | 2661 if (text) { |
2662 num = 0; | |
2663 for (i=0; i<strlen(text[0]); i++) | |
2664 num = num*10 + text[0][i]-48; | |
2665 for (i=0; i<num; i++) { | |
4230 | 2666 struct name_data *data = g_new(struct name_data, 1); |
5556 | 2667 gchar *message = g_strdup_printf(_("ICQ user %u has sent you a contact: %s (%s)"), args->uin, text[i*2+2], text[i*2+1]); |
3453 | 2668 data->gc = gc; |
4790 | 2669 data->name = g_strdup(text[i*2+1]); |
2670 data->nick = g_strdup(text[i*2+2]); | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2671 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2672 gaim_request_action(gc, NULL, message, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2673 _("Do you want to add this contact " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2674 "to your Buddy List?"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2675 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
2676 _("Add"), G_CALLBACK(gaim_icq_contactadd), |
5836 | 2677 _("Decline"), G_CALLBACK(oscar_free_name_data)); |
3453 | 2678 g_free(message); |
2679 } | |
2680 g_strfreev(text); | |
2681 } | |
2682 } break; | |
2683 | |
4173 | 2684 case 0x1a: { /* Someone has sent you a greeting card or requested contacts? */ |
3453 | 2685 /* This is boring and silly. */ |
2686 } break; | |
2687 | |
3141 | 2688 default: { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2689 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2690 "Received a channel 4 message of unknown type " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2691 "(type 0x%02hhx).\n", args->type); |
3141 | 2692 } break; |
2693 } | |
2694 | |
4076 | 2695 g_strfreev(msg1); |
2696 g_strfreev(msg2); | |
2697 | |
3141 | 2698 return 1; |
2699 } | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2700 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2701 static int gaim_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...) { |
4200 | 2702 fu16_t channel; |
2703 int ret = 0; | |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2704 aim_userinfo_t *userinfo; |
2086 | 2705 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2706 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2707 va_start(ap, fr); |
4200 | 2708 channel = (fu16_t)va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2709 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 2710 |
3141 | 2711 switch (channel) { |
2712 case 1: { /* standard message */ | |
2713 struct aim_incomingim_ch1_args *args; | |
2714 args = va_arg(ap, struct aim_incomingim_ch1_args *); | |
2715 ret = incomingim_chan1(sess, fr->conn, userinfo, args); | |
2716 } break; | |
2717 | |
2718 case 2: { /* rendevous */ | |
2719 struct aim_incomingim_ch2_args *args; | |
2720 args = va_arg(ap, struct aim_incomingim_ch2_args *); | |
2721 ret = incomingim_chan2(sess, fr->conn, userinfo, args); | |
2722 } break; | |
2723 | |
2724 case 4: { /* ICQ */ | |
2725 struct aim_incomingim_ch4_args *args; | |
2726 args = va_arg(ap, struct aim_incomingim_ch4_args *); | |
4075 | 2727 ret = incomingim_chan4(sess, fr->conn, userinfo, args, 0); |
3141 | 2728 } break; |
2729 | |
2730 default: { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2731 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2732 "ICBM received on unsupported channel (channel " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2733 "0x%04hx).", channel); |
3141 | 2734 } break; |
2086 | 2735 } |
2736 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2737 va_end(ap); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2738 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2739 return ret; |
2086 | 2740 } |
2741 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2742 static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) { |
5420 | 2743 char *buf; |
2086 | 2744 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2745 fu16_t chan, nummissed, reason; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
2746 aim_userinfo_t *userinfo; |
2086 | 2747 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2748 va_start(ap, fr); |
4200 | 2749 chan = (fu16_t)va_arg(ap, unsigned int); |
2750 userinfo = va_arg(ap, aim_userinfo_t *); | |
2751 nummissed = (fu16_t)va_arg(ap, unsigned int); | |
2752 reason = (fu16_t)va_arg(ap, unsigned int); | |
2086 | 2753 va_end(ap); |
2754 | |
2755 switch(reason) { | |
5420 | 2756 case 0: /* Invalid (0) */ |
2757 buf = g_strdup_printf( | |
2758 ngettext( | |
4276 | 2759 "You missed %hu message from %s because it was invalid.", |
2760 "You missed %hu messages from %s because they were invalid.", | |
2761 nummissed), | |
4282 | 2762 nummissed, |
2763 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2764 break; |
5420 | 2765 case 1: /* Message too large */ |
2766 buf = g_strdup_printf( | |
2767 ngettext( | |
4276 | 2768 "You missed %hu message from %s because it was too large.", |
2769 "You missed %hu messages from %s because they were too large.", | |
2770 nummissed), | |
4282 | 2771 nummissed, |
2772 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2773 break; |
5420 | 2774 case 2: /* Rate exceeded */ |
2775 buf = g_strdup_printf( | |
2776 ngettext( | |
4276 | 2777 "You missed %hu message from %s because the rate limit has been exceeded.", |
2778 "You missed %hu messages from %s because the rate limit has been exceeded.", | |
2779 nummissed), | |
4282 | 2780 nummissed, |
2781 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2782 break; |
5420 | 2783 case 3: /* Evil Sender */ |
2784 buf = g_strdup_printf( | |
2785 ngettext( | |
4276 | 2786 "You missed %hu message from %s because he/she was too evil.", |
2787 "You missed %hu messages from %s because he/she was too evil.", | |
2788 nummissed), | |
4282 | 2789 nummissed, |
2790 userinfo->sn); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
2791 break; |
5420 | 2792 case 4: /* Evil Receiver */ |
2793 buf = g_strdup_printf( | |
2794 ngettext( | |
4276 | 2795 "You missed %hu message from %s because you are too evil.", |
2796 "You missed %hu messages from %s because you are too evil.", | |
2797 nummissed), | |
4282 | 2798 nummissed, |
2799 userinfo->sn); | |
2086 | 2800 break; |
2801 default: | |
5420 | 2802 buf = g_strdup_printf( |
2803 ngettext( | |
4276 | 2804 "You missed %hu message from %s for an unknown reason.", |
2805 "You missed %hu messages from %s for an unknown reason.", | |
2806 nummissed), | |
4282 | 2807 nummissed, |
2808 userinfo->sn); | |
2086 | 2809 break; |
2810 } | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2811 gaim_notify_error(sess->aux_data, NULL, buf, NULL); |
5420 | 2812 g_free(buf); |
2086 | 2813 |
2814 return 1; | |
2815 } | |
2816 | |
3212 | 2817 static char *gaim_icq_status(int state) { |
2818 /* Make a cute little string that shows the status of the dude or dudet */ | |
2819 if (state & AIM_ICQ_STATE_CHAT) | |
4342 | 2820 return g_strdup_printf(_("Free For Chat")); |
3212 | 2821 else if (state & AIM_ICQ_STATE_DND) |
4342 | 2822 return g_strdup_printf(_("Do Not Disturb")); |
3212 | 2823 else if (state & AIM_ICQ_STATE_OUT) |
4342 | 2824 return g_strdup_printf(_("Not Available")); |
3212 | 2825 else if (state & AIM_ICQ_STATE_BUSY) |
4342 | 2826 return g_strdup_printf(_("Occupied")); |
3212 | 2827 else if (state & AIM_ICQ_STATE_AWAY) |
4342 | 2828 return g_strdup_printf(_("Away")); |
3212 | 2829 else if (state & AIM_ICQ_STATE_WEBAWARE) |
4342 | 2830 return g_strdup_printf(_("Web Aware")); |
3212 | 2831 else if (state & AIM_ICQ_STATE_INVISIBLE) |
4342 | 2832 return g_strdup_printf(_("Invisible")); |
3212 | 2833 else |
4342 | 2834 return g_strdup_printf(_("Online")); |
3212 | 2835 } |
2836 | |
4194 | 2837 static int gaim_parse_clientauto_ch2(aim_session_t *sess, const char *who, fu16_t reason, const char *cookie) { |
5575 | 2838 GaimConnection *gc = sess->aux_data; |
4617 | 2839 struct oscar_data *od = gc->proto_data; |
2840 | |
2841 /* BBB */ | |
3630 | 2842 switch (reason) { |
4151 | 2843 case 3: { /* Decline sendfile. */ |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2844 GaimXfer *xfer; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2845 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2846 "AAA - Other user declined file transfer\n"); |
4617 | 2847 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
|
2848 gaim_xfer_cancel_remote(xfer); |
4151 | 2849 } break; |
2850 | |
2851 default: { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2852 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2853 "Received an unknown rendezvous client auto-response " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2854 "from %s. Type 0x%04hx\n", who, reason); |
4151 | 2855 } |
3630 | 2856 |
2857 } | |
2858 | |
2859 return 0; | |
2860 } | |
2861 | |
4194 | 2862 static int gaim_parse_clientauto_ch4(aim_session_t *sess, char *who, fu16_t reason, fu32_t state, char *msg) { |
5575 | 2863 GaimConnection *gc = sess->aux_data; |
4151 | 2864 |
2865 switch(reason) { | |
2866 case 0x0003: { /* Reply from an ICQ status message request */ | |
2867 char *status_msg = gaim_icq_status(state); | |
2868 char *dialog_msg, **splitmsg; | |
2869 | |
2870 /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ | |
2871 splitmsg = g_strsplit(msg, "\r\n", 0); | |
2872 | |
7011 | 2873 dialog_msg = g_strdup_printf(_("<B>UIN:</B> %s<BR><B>Status:</B> %s<HR>%s"), who, status_msg, g_strjoinv("<BR>", splitmsg)); |
4151 | 2874 g_show_info_text(gc, who, 2, dialog_msg, NULL); |
2875 | |
2876 g_free(status_msg); | |
2877 g_free(dialog_msg); | |
2878 g_strfreev(splitmsg); | |
2879 } break; | |
2880 | |
2881 default: { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2882 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2883 "Received an unknown client auto-response from %s. " |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2884 "Type 0x%04hx\n", who, reason); |
4151 | 2885 } break; |
2886 } /* end of switch */ | |
2887 | |
2888 return 0; | |
2889 } | |
2890 | |
3212 | 2891 static int gaim_parse_clientauto(aim_session_t *sess, aim_frame_t *fr, ...) { |
2892 va_list ap; | |
2893 fu16_t chan, reason; | |
2894 char *who; | |
2895 | |
2896 va_start(ap, fr); | |
4200 | 2897 chan = (fu16_t)va_arg(ap, unsigned int); |
3212 | 2898 who = va_arg(ap, char *); |
4200 | 2899 reason = (fu16_t)va_arg(ap, unsigned int); |
3212 | 2900 |
3952 | 2901 if (chan == 0x0002) { /* File transfer declined */ |
3630 | 2902 char *cookie = va_arg(ap, char *); |
4151 | 2903 return gaim_parse_clientauto_ch2(sess, who, reason, cookie); |
3952 | 2904 } else if (chan == 0x0004) { /* ICQ message */ |
4200 | 2905 fu32_t state = 0; |
4151 | 2906 char *msg = NULL; |
2907 if (reason == 0x0003) { | |
4200 | 2908 state = va_arg(ap, fu32_t); |
4151 | 2909 msg = va_arg(ap, char *); |
2910 } | |
2911 return gaim_parse_clientauto_ch4(sess, who, reason, state, msg); | |
2912 } | |
3952 | 2913 |
3212 | 2914 va_end(ap); |
2915 | |
2916 return 1; | |
2917 } | |
2918 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2919 static int gaim_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 2920 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2921 fu16_t reason; |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2922 char *m; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2923 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2924 va_start(ap, fr); |
4199 | 2925 reason = (fu16_t) va_arg(ap, unsigned int); |
2086 | 2926 va_end(ap); |
2927 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2928 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2929 "snac threw error (reason 0x%04hx: %s)\n", reason, |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2930 (reason < msgerrreasonlen) ? msgerrreason[reason] : "unknown"); |
2086 | 2931 |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2932 m = g_strdup_printf(_("SNAC threw error: %s\n"), |
5411 | 2933 reason < msgerrreasonlen ? _(msgerrreason[reason]) : _("Unknown error")); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2934 gaim_notify_error(sess->aux_data, NULL, m, NULL); |
2865
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2935 g_free(m); |
88dc3623a2ae
[gaim-migrate @ 2878]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2864
diff
changeset
|
2936 |
2086 | 2937 return 1; |
2938 } | |
2939 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2940 static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
4617 | 2941 #if 0 |
5575 | 2942 GaimConnection *gc = sess->aux_data; |
4617 | 2943 struct oscar_data *od = gc->proto_data; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
6173
diff
changeset
|
2944 GaimXfer *xfer; |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2945 #endif |
4617 | 2946 va_list ap; |
2947 fu16_t reason; | |
2948 char *data, *buf; | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2949 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
2950 va_start(ap, fr); |
4617 | 2951 reason = (fu16_t)va_arg(ap, unsigned int); |
3752 | 2952 data = va_arg(ap, char *); |
2086 | 2953 va_end(ap); |
2954 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2955 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
2956 "Message error with data %s and reason %hu\n", data, reason); |
4617 | 2957 |
2958 /* BBB */ | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2959 #if 0 |
4617 | 2960 /* If this was a file transfer request, data is a cookie */ |
2961 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
|
2962 gaim_xfer_cancel_remote(xfer); |
3630 | 2963 return 1; |
2964 } | |
4508
4c40fccbd7c9
[gaim-migrate @ 4784]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
2965 #endif |
3630 | 2966 |
4617 | 2967 /* Data is assumed to be the destination sn */ |
2968 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
|
2969 gaim_notify_error(sess->aux_data, NULL, buf, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
2970 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); |
4617 | 2971 g_free(buf); |
2086 | 2972 |
2973 return 1; | |
2974 } | |
2975 | |
3595 | 2976 static int gaim_parse_mtn(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 2977 GaimConnection *gc = sess->aux_data; |
3595 | 2978 va_list ap; |
2979 fu16_t type1, type2; | |
2980 char *sn; | |
2981 | |
2982 va_start(ap, fr); | |
4199 | 2983 type1 = (fu16_t) va_arg(ap, unsigned int); |
3595 | 2984 sn = va_arg(ap, char *); |
4199 | 2985 type2 = (fu16_t) va_arg(ap, unsigned int); |
3595 | 2986 va_end(ap); |
2987 | |
2988 switch (type2) { | |
2989 case 0x0000: { /* Text has been cleared */ | |
2990 serv_got_typing_stopped(gc, sn); | |
2991 } break; | |
2992 | |
2993 case 0x0001: { /* Paused typing */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
2994 serv_got_typing(gc, sn, 0, GAIM_TYPED); |
3595 | 2995 } break; |
2996 | |
2997 case 0x0002: { /* Typing */ | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
2998 serv_got_typing(gc, sn, 0, GAIM_TYPING); |
3595 | 2999 } break; |
3000 | |
3001 default: { | |
5435 | 3002 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "Received unknown typing notification message from %s. Type1 is 0x%04x and type2 is 0x%04hx.\n", sn, type1, type2); |
3595 | 3003 } break; |
3004 } | |
3005 | |
3006 return 1; | |
3007 } | |
3008 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3009 static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
5420 | 3010 char *buf; |
2086 | 3011 va_list ap; |
5420 | 3012 fu16_t reason; |
2086 | 3013 char *destn; |
3014 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3015 va_start(ap, fr); |
4199 | 3016 reason = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3017 destn = va_arg(ap, char *); |
3018 va_end(ap); | |
3019 | |
5420 | 3020 buf = g_strdup_printf(_("User information for %s unavailable:"), destn); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3021 gaim_notify_error(sess->aux_data, NULL, buf, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3022 (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("No reason given.")); |
5420 | 3023 g_free(buf); |
2086 | 3024 |
3025 return 1; | |
3026 } | |
3027 | |
6982 | 3028 #if 0 |
2086 | 3029 static char *images(int flags) { |
3030 static char buf[1024]; | |
3101 | 3031 g_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s", |
2679 | 3032 (flags & AIM_FLAG_ACTIVEBUDDY) ? "<IMG SRC=\"ab_icon.gif\">" : "", |
2086 | 3033 (flags & AIM_FLAG_UNCONFIRMED) ? "<IMG SRC=\"dt_icon.gif\">" : "", |
3034 (flags & AIM_FLAG_AOL) ? "<IMG SRC=\"aol_icon.gif\">" : "", | |
3101 | 3035 (flags & AIM_FLAG_ICQ) ? "<IMG SRC=\"icq_icon.gif\">" : "", |
2086 | 3036 (flags & AIM_FLAG_ADMINISTRATOR) ? "<IMG SRC=\"admin_icon.gif\">" : "", |
3079 | 3037 (flags & AIM_FLAG_FREE) ? "<IMG SRC=\"free_icon.gif\">" : "", |
3038 (flags & AIM_FLAG_WIRELESS) ? "<IMG SRC=\"wireless_icon.gif\">" : ""); | |
2086 | 3039 return buf; |
3040 } | |
6982 | 3041 #endif |
3101 | 3042 |
2920 | 3043 static char *caps_string(guint caps) |
3044 { | |
3045 static char buf[512], *tmp; | |
3046 int count = 0, i = 0; | |
3047 guint bit = 1; | |
4742 | 3048 |
3049 if (!caps) { | |
4744 | 3050 return NULL; |
6318 | 3051 } else while (bit <= AIM_CAPS_LAST) { |
2920 | 3052 if (bit & caps) { |
3053 switch (bit) { | |
6871 | 3054 case AIM_CAPS_BUDDYICON: |
2920 | 3055 tmp = _("Buddy Icon"); |
3056 break; | |
6871 | 3057 case AIM_CAPS_VOICE: |
2920 | 3058 tmp = _("Voice"); |
3059 break; | |
6871 | 3060 case AIM_CAPS_DIRECTIM: |
4898 | 3061 tmp = _("Direct IM"); |
2920 | 3062 break; |
6871 | 3063 case AIM_CAPS_CHAT: |
2920 | 3064 tmp = _("Chat"); |
3065 break; | |
6871 | 3066 case AIM_CAPS_GETFILE: |
2920 | 3067 tmp = _("Get File"); |
3068 break; | |
6871 | 3069 case AIM_CAPS_SENDFILE: |
2920 | 3070 tmp = _("Send File"); |
3071 break; | |
6871 | 3072 case AIM_CAPS_GAMES: |
3073 case AIM_CAPS_GAMES2: | |
2920 | 3074 tmp = _("Games"); |
3075 break; | |
6871 | 3076 case AIM_CAPS_SAVESTOCKS: |
4898 | 3077 tmp = _("Add-Ins"); |
2920 | 3078 break; |
6871 | 3079 case AIM_CAPS_SENDBUDDYLIST: |
2920 | 3080 tmp = _("Send Buddy List"); |
3081 break; | |
6871 | 3082 case AIM_CAPS_ICQ: |
2920 | 3083 tmp = _("EveryBuddy Bug"); |
3084 break; | |
6871 | 3085 case AIM_CAPS_APINFO: |
2920 | 3086 tmp = _("AP User"); |
3087 break; | |
6871 | 3088 case AIM_CAPS_ICQRTF: |
2920 | 3089 tmp = _("ICQ RTF"); |
3090 break; | |
6871 | 3091 case AIM_CAPS_EMPTY: |
2920 | 3092 tmp = _("Nihilist"); |
3093 break; | |
6871 | 3094 case AIM_CAPS_ICQSERVERRELAY: |
2920 | 3095 tmp = _("ICQ Server Relay"); |
3096 break; | |
6871 | 3097 case AIM_CAPS_ICQUTF8OLD: |
3098 tmp = _("Old ICQ UTF8"); | |
2920 | 3099 break; |
6871 | 3100 case AIM_CAPS_TRILLIANCRYPT: |
2920 | 3101 tmp = _("Trillian Encryption"); |
3102 break; | |
6871 | 3103 case AIM_CAPS_ICQUTF8: |
4742 | 3104 tmp = _("ICQ UTF8"); |
3105 break; | |
6318 | 3106 case AIM_CAPS_HIPTOP: |
3107 tmp = _("Hiptop"); | |
3108 break; | |
6871 | 3109 case AIM_CAPS_SECUREIM: |
3110 tmp = _("Secure IM"); | |
3111 break; | |
2920 | 3112 default: |
3113 tmp = NULL; | |
3114 break; | |
3115 } | |
3116 if (tmp) | |
3117 i += g_snprintf(buf + i, sizeof(buf) - i, "%s%s", (count ? ", " : ""), | |
3118 tmp); | |
3119 count++; | |
3120 } | |
3121 bit <<= 1; | |
3122 } | |
4744 | 3123 return buf; |
2920 | 3124 } |
3125 | |
7011 | 3126 static int gaim_parse_userinfo(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3127 GaimConnection *gc = sess->aux_data; |
7011 | 3128 GString *text; |
3129 char *info_utf8 = NULL, *away_utf8 = NULL; | |
4791 | 3130 va_list ap; |
7011 | 3131 aim_userinfo_t *userinfo; |
2086 | 3132 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3133 va_start(ap, fr); |
7011 | 3134 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 3135 va_end(ap); |
3136 | |
7011 | 3137 text = g_string_new(""); |
3138 g_string_append_printf(text, _("Username: <b>%s</b><br>\n"), userinfo->sn); | |
3139 g_string_append_printf(text, _("Warning Level: <b>%d%%</b><br>\n"), (int)((userinfo->warnlevel/10.0) + 0.5)); | |
3140 | |
3141 if (userinfo->present & AIM_USERINFO_PRESENT_ONLINESINCE) | |
3142 g_string_append_printf(text, _("Online Since: <b>%s</b><br>\n"), | |
3143 asctime(localtime((time_t *)&userinfo->onlinesince))); | |
3144 | |
3145 if (userinfo->present & AIM_USERINFO_PRESENT_MEMBERSINCE) | |
3146 g_string_append_printf(text, _("Member Since: <b>%s</b><br>\n"), | |
3147 asctime(localtime((time_t *)&userinfo->membersince))); | |
3148 | |
3149 if (userinfo->present & AIM_USERINFO_PRESENT_IDLE) { | |
3150 gchar *itime = sec_to_text(userinfo->idletime*60); | |
3151 g_string_append_printf(text, _("Idle: <b>%s</b>"), itime); | |
4426 | 3152 g_free(itime); |
2993 | 3153 } else |
7011 | 3154 g_string_append_printf(text, _("Idle: <b>Active</b>")); |
3155 | |
3156 if ((userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) { | |
3157 away_utf8 = oscar_encoding_to_utf8(userinfo->away_encoding, userinfo->away, userinfo->away_len); | |
3158 if (away_utf8 != NULL) { | |
3159 g_string_append_printf(text, _("<hr>%s"), away_utf8); | |
3160 g_free(away_utf8); | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3161 } |
7011 | 3162 } |
3163 | |
3164 if ((userinfo->info_len > 0) && (userinfo->info != NULL) && (userinfo->info_encoding != NULL)) { | |
3165 info_utf8 = oscar_encoding_to_utf8(userinfo->info_encoding, userinfo->info, userinfo->info_len); | |
3166 if (info_utf8 != NULL) { | |
3167 g_string_append_printf(text, _("<hr>%s"), info_utf8); | |
3168 g_free(info_utf8); | |
2791
8f6365332a05
[gaim-migrate @ 2804]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2789
diff
changeset
|
3169 } |
7011 | 3170 } |
3171 | |
3172 gaim_notify_formatted(gc, NULL, _("Buddy Information"), NULL, text->str, NULL, NULL); | |
3173 g_string_free(text, TRUE); | |
4151 | 3174 |
2086 | 3175 return 1; |
3176 } | |
3177 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3178 static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3179 char *msg; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3180 fu16_t id; |
2086 | 3181 va_list ap; |
3182 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3183 va_start(ap, fr); |
4199 | 3184 id = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3185 msg = va_arg(ap, char *); |
3186 va_end(ap); | |
3187 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3188 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3189 "MOTD: %s (%hu)\n", msg ? msg : "Unknown", id); |
2092
59b0377d18aa
[gaim-migrate @ 2102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
3190 if (id < 4) |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3191 gaim_notify_warning(sess->aux_data, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3192 _("Your AIM connection may be lost."), NULL); |
2086 | 3193 |
3194 return 1; | |
3195 } | |
3196 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3197 static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3198 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3199 fu16_t type; |
5575 | 3200 GaimConnection *gc = sess->aux_data; |
4617 | 3201 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2086 | 3202 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3203 va_start(ap, fr); |
4199 | 3204 type = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3205 |
3206 switch(type) { | |
3207 case 0x0002: { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3208 fu8_t maxrooms; |
2086 | 3209 struct aim_chat_exchangeinfo *exchanges; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3210 int exchangecount, i; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3211 |
4199 | 3212 maxrooms = (fu8_t) va_arg(ap, unsigned int); |
2086 | 3213 exchangecount = va_arg(ap, int); |
3214 exchanges = va_arg(ap, struct aim_chat_exchangeinfo *); | |
3215 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3216 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3217 "chat info: Chat Rights:\n"); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3218 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3219 "chat info: \tMax Concurrent Rooms: %hhd\n", maxrooms); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3220 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3221 "chat info: \tExchange List: (%d total)\n", exchangecount); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3222 for (i = 0; i < exchangecount; i++) |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3223 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3224 "chat info: \t\t%hu %s\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3225 exchanges[i].number, exchanges[i].name ? exchanges[i].name : ""); |
4617 | 3226 while (od->create_rooms) { |
3227 struct create_room *cr = od->create_rooms->data; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3228 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3229 "creating room %s\n", cr->name); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3230 aim_chatnav_createroom(sess, fr->conn, cr->name, cr->exchange); |
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3231 g_free(cr->name); |
4617 | 3232 od->create_rooms = g_slist_remove(od->create_rooms, cr); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
3233 g_free(cr); |
2086 | 3234 } |
3235 } | |
3236 break; | |
3237 case 0x0008: { | |
3238 char *fqcn, *name, *ck; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3239 fu16_t instance, flags, maxmsglen, maxoccupancy, unknown, exchange; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3240 fu8_t createperms; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3241 fu32_t createtime; |
2086 | 3242 |
3243 fqcn = va_arg(ap, char *); | |
4200 | 3244 instance = (fu16_t)va_arg(ap, unsigned int); |
3245 exchange = (fu16_t)va_arg(ap, unsigned int); | |
3246 flags = (fu16_t)va_arg(ap, unsigned int); | |
3247 createtime = va_arg(ap, fu32_t); | |
3248 maxmsglen = (fu16_t)va_arg(ap, unsigned int); | |
3249 maxoccupancy = (fu16_t)va_arg(ap, unsigned int); | |
3250 createperms = (fu8_t)va_arg(ap, unsigned int); | |
3251 unknown = (fu16_t)va_arg(ap, unsigned int); | |
3252 name = va_arg(ap, char *); | |
3253 ck = va_arg(ap, char *); | |
4194 | 3254 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3255 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
5556 | 3256 "created room: %s %hu %hu %hu %u %hu %hu %hhu %hu %s %s\n", |
2086 | 3257 fqcn, |
3258 exchange, instance, flags, | |
3259 createtime, | |
3260 maxmsglen, maxoccupancy, createperms, unknown, | |
3261 name, ck); | |
4617 | 3262 aim_chat_join(od->sess, od->conn, exchange, ck, instance); |
2086 | 3263 } |
3264 break; | |
3265 default: | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3266 gaim_debug(GAIM_DEBUG_WARNING, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3267 "chatnav info: unknown type (%04hx)\n", type); |
2086 | 3268 break; |
3269 } | |
4194 | 3270 |
3271 va_end(ap); | |
3272 | |
2086 | 3273 return 1; |
3274 } | |
3275 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3276 static int gaim_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3277 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3278 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3279 aim_userinfo_t *info; |
5575 | 3280 GaimConnection *g = sess->aux_data; |
2086 | 3281 |
3282 struct chat_connection *c = NULL; | |
3283 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3284 va_start(ap, fr); |
2086 | 3285 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3286 info = va_arg(ap, aim_userinfo_t *); |
2086 | 3287 va_end(ap); |
3288 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3289 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 3290 if (!c) |
3291 return 1; | |
3292 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3293 for (i = 0; i < count; i++) |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
3294 gaim_chat_add_user(GAIM_CHAT(c->cnv), info[i].sn, NULL); |
2086 | 3295 |
3296 return 1; | |
3297 } | |
3298 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3299 static int gaim_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3300 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3301 int count, i; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3302 aim_userinfo_t *info; |
5575 | 3303 GaimConnection *g = sess->aux_data; |
2086 | 3304 |
3305 struct chat_connection *c = NULL; | |
3306 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3307 va_start(ap, fr); |
2086 | 3308 count = va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3309 info = va_arg(ap, aim_userinfo_t *); |
2086 | 3310 va_end(ap); |
3311 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3312 c = find_oscar_chat_by_conn(g, fr->conn); |
2086 | 3313 if (!c) |
3314 return 1; | |
3315 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3316 for (i = 0; i < count; i++) |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
3317 gaim_chat_remove_user(GAIM_CHAT(c->cnv), info[i].sn, NULL); |
2086 | 3318 |
3319 return 1; | |
3320 } | |
3321 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3322 static int gaim_chat_info_update(aim_session_t *sess, aim_frame_t *fr, ...) { |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3323 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3324 aim_userinfo_t *userinfo; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3325 struct aim_chat_roominfo *roominfo; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3326 char *roomname; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3327 int usercount; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3328 char *roomdesc; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3329 fu16_t unknown_c9, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3330 fu32_t creationtime; |
5575 | 3331 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3332 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
|
3333 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3334 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3335 roominfo = va_arg(ap, struct aim_chat_roominfo *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3336 roomname = va_arg(ap, char *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3337 usercount= va_arg(ap, int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3338 userinfo = va_arg(ap, aim_userinfo_t *); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3339 roomdesc = va_arg(ap, char *); |
4200 | 3340 unknown_c9 = (fu16_t)va_arg(ap, unsigned int); |
3341 creationtime = va_arg(ap, fu32_t); | |
3342 maxmsglen = (fu16_t)va_arg(ap, unsigned int); | |
3343 unknown_d2 = (fu16_t)va_arg(ap, unsigned int); | |
3344 unknown_d5 = (fu16_t)va_arg(ap, unsigned int); | |
3345 maxvisiblemsglen = (fu16_t)va_arg(ap, unsigned int); | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3346 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3347 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3348 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3349 "inside chat_info_update (maxmsglen = %hu, maxvislen = %hu)\n", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3350 maxmsglen, maxvisiblemsglen); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3351 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3352 ccon->maxlen = maxmsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3353 ccon->maxvis = maxvisiblemsglen; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3354 |
2086 | 3355 return 1; |
3356 } | |
3357 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3358 static int gaim_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3359 GaimConnection *gc = sess->aux_data; |
2086 | 3360 va_list ap; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3361 aim_userinfo_t *info; |
2086 | 3362 char *msg; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3363 struct chat_connection *ccon = find_oscar_chat_by_conn(gc, fr->conn); |
2086 | 3364 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3365 va_start(ap, fr); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3366 info = va_arg(ap, aim_userinfo_t *); |
4194 | 3367 msg = va_arg(ap, char *); |
3368 va_end(ap); | |
2086 | 3369 |
4269 | 3370 serv_got_chat_in(gc, ccon->id, info->sn, 0, msg, time((time_t)NULL)); |
2086 | 3371 |
3372 return 1; | |
3373 } | |
3374 | |
3694 | 3375 static int gaim_email_parseupdate(aim_session_t *sess, aim_frame_t *fr, ...) { |
3376 va_list ap; | |
5575 | 3377 GaimConnection *gc = sess->aux_data; |
3694 | 3378 struct aim_emailinfo *emailinfo; |
3725 | 3379 int havenewmail; |
3694 | 3380 |
3381 va_start(ap, fr); | |
3382 emailinfo = va_arg(ap, struct aim_emailinfo *); | |
3725 | 3383 havenewmail = va_arg(ap, int); |
3694 | 3384 va_end(ap); |
3385 | |
5628 | 3386 if (emailinfo && gaim_account_get_check_mail(gc->account)) { |
5575 | 3387 gchar *to = g_strdup_printf("%s@%s", gaim_account_get_username(gaim_connection_get_account(gc)), emailinfo->domain); |
5542 | 3388 if (emailinfo->unread && havenewmail) |
3389 gaim_notify_emails(gc, emailinfo->nummsgs, FALSE, NULL, NULL, (const char **)&to, (const char **)&emailinfo->url, NULL, NULL); | |
5537 | 3390 g_free(to); |
3694 | 3391 } |
3392 | |
3393 return 1; | |
3394 } | |
3395 | |
4804 | 3396 static int gaim_icon_error(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3397 GaimConnection *gc = sess->aux_data; |
4804 | 3398 struct oscar_data *od = gc->proto_data; |
3399 char *sn; | |
3400 | |
3401 sn = od->requesticon->data; | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3402 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3403 "removing %s from hash table\n", sn); |
4804 | 3404 od->requesticon = g_slist_remove(od->requesticon, sn); |
3405 free(sn); | |
3406 | |
3407 if (od->icontimer) | |
3408 g_source_remove(od->icontimer); | |
3409 od->icontimer = g_timeout_add(500, gaim_icon_timerfunc, gc); | |
3410 | |
3411 return 1; | |
3412 } | |
3413 | |
3414 static int gaim_icon_parseicon(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 3415 GaimConnection *gc = sess->aux_data; |
4804 | 3416 struct oscar_data *od = gc->proto_data; |
3417 GSList *cur; | |
3418 va_list ap; | |
3419 char *sn; | |
4853 | 3420 fu8_t *iconcsum, *icon; |
3421 fu16_t iconcsumlen, iconlen; | |
4804 | 3422 |
3423 va_start(ap, fr); | |
3424 sn = va_arg(ap, char *); | |
4853 | 3425 iconcsum = va_arg(ap, fu8_t *); |
3426 iconcsumlen = va_arg(ap, int); | |
4804 | 3427 icon = va_arg(ap, fu8_t *); |
3428 iconlen = va_arg(ap, int); | |
3429 va_end(ap); | |
3430 | |
4853 | 3431 if (iconlen > 0) { |
3432 char *b16; | |
6695 | 3433 GaimBuddy *b = gaim_find_buddy(gc->account, sn); |
6846
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
3434 gaim_buddy_icons_set_for_user(gaim_connection_get_account(gc), |
8ab95f4c9800
[gaim-migrate @ 7391]
Christian Hammond <chipx86@chipx86.com>
parents:
6787
diff
changeset
|
3435 sn, icon, iconlen); |
4853 | 3436 b16 = tobase16(iconcsum, iconcsumlen); |
5129 | 3437 if (b16) { |
3438 gaim_buddy_set_setting(b, "icon_checksum", b16); | |
3439 gaim_blist_save(); | |
5125 | 3440 free(b16); |
5129 | 3441 } |
4853 | 3442 } |
4804 | 3443 |
3444 cur = od->requesticon; | |
3445 while (cur) { | |
3446 char *cursn = cur->data; | |
3447 if (!aim_sncmp(cursn, sn)) { | |
3448 od->requesticon = g_slist_remove(od->requesticon, cursn); | |
3449 free(cursn); | |
3450 cur = od->requesticon; | |
3451 } else | |
3452 cur = cur->next; | |
3453 } | |
3454 | |
3455 if (od->icontimer) | |
3456 g_source_remove(od->icontimer); | |
3457 od->icontimer = g_timeout_add(250, gaim_icon_timerfunc, gc); | |
3458 | |
3459 return 1; | |
3460 } | |
3461 | |
3462 static gboolean gaim_icon_timerfunc(gpointer data) { | |
5575 | 3463 GaimConnection *gc = data; |
4804 | 3464 struct oscar_data *od = gc->proto_data; |
7011 | 3465 aim_userinfo_t *userinfo; |
4804 | 3466 aim_conn_t *conn; |
3467 | |
3468 conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON); | |
5892 | 3469 if (!conn) { |
3470 if (!od->iconconnecting) { | |
3471 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); | |
3472 od->iconconnecting = TRUE; | |
3473 } | |
4804 | 3474 return FALSE; |
3475 } | |
3476 | |
5842 | 3477 if (od->set_icon) { |
6039 | 3478 struct stat st; |
3479 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); | |
3480 if (iconfile == NULL) { | |
3481 /* Set an empty icon, or something */ | |
3482 } else if (!stat(iconfile, &st)) { | |
3483 char *buf = g_malloc(st.st_size); | |
3484 FILE *file = fopen(iconfile, "rb"); | |
3485 if (file) { | |
3486 fread(buf, 1, st.st_size, file); | |
3487 fclose(file); | |
3488 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
3489 "Uploading icon to icon server\n"); | |
6879 | 3490 aim_bart_upload(od->sess, buf, st.st_size); |
5842 | 3491 } else |
3492 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
6039 | 3493 "Can't open buddy icon file!\n"); |
3494 g_free(buf); | |
3495 } else { | |
3496 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
3497 "Can't stat buddy icon file!\n"); | |
5842 | 3498 } |
3499 od->set_icon = FALSE; | |
3500 } | |
3501 | |
3502 if (!od->requesticon) { | |
3503 gaim_debug(GAIM_DEBUG_MISC, "oscar", | |
3504 "no more icons to request\n"); | |
3505 return FALSE; | |
3506 } | |
3507 | |
7011 | 3508 userinfo = aim_locate_finduserinfo((char *)od->requesticon->data); |
3509 if ((userinfo != NULL) && (userinfo->iconcsumlen > 0)) { | |
3510 aim_bart_request(od->sess, od->requesticon->data, userinfo->iconcsum, userinfo->iconcsumlen); | |
4804 | 3511 return FALSE; |
3512 } else { | |
3513 char *sn = od->requesticon->data; | |
3514 od->requesticon = g_slist_remove(od->requesticon, sn); | |
3515 free(sn); | |
3516 } | |
3517 | |
3518 return TRUE; | |
3519 } | |
3520 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3521 /* |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3522 * 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
|
3523 */ |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3524 static int gaim_parse_msgack(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3525 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3526 fu16_t type; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3527 char *sn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3528 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3529 va_start(ap, fr); |
4199 | 3530 type = (fu16_t) va_arg(ap, unsigned int); |
2086 | 3531 sn = va_arg(ap, char *); |
3532 va_end(ap); | |
3533 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3534 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Sent message to %s.\n", sn); |
2086 | 3535 |
3536 return 1; | |
3537 } | |
3538 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3539 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
|
3540 static const char *codes[5] = { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3541 "invalid", |
4194 | 3542 "change", |
3543 "warning", | |
3544 "limit", | |
3545 "limit cleared", | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3546 }; |
2086 | 3547 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3548 fu16_t code, rateclass; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3549 fu32_t windowsize, clear, alert, limit, disconnect, currentavg, maxavg; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3550 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3551 va_start(ap, fr); |
4200 | 3552 code = (fu16_t)va_arg(ap, unsigned int); |
3553 rateclass= (fu16_t)va_arg(ap, unsigned int); | |
3554 windowsize = va_arg(ap, fu32_t); | |
3555 clear = va_arg(ap, fu32_t); | |
3556 alert = va_arg(ap, fu32_t); | |
3557 limit = va_arg(ap, fu32_t); | |
3558 disconnect = va_arg(ap, fu32_t); | |
3559 currentavg = va_arg(ap, fu32_t); | |
3560 maxavg = va_arg(ap, fu32_t); | |
2086 | 3561 va_end(ap); |
3562 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3563 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
5556 | 3564 "rate %s (param ID 0x%04hx): curavg = %u, maxavg = %u, alert at %u, " |
3565 "clear warning at %u, limit at %u, disconnect at %u (window size = %u)\n", | |
2086 | 3566 (code < 5) ? codes[code] : codes[0], |
3567 rateclass, | |
3568 currentavg, maxavg, | |
3569 alert, clear, | |
3570 limit, disconnect, | |
3571 windowsize); | |
3572 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3573 /* XXX fix these values */ |
2086 | 3574 if (code == AIM_RATE_CODE_CHANGE) { |
3575 if (currentavg >= clear) | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3576 aim_conn_setlatency(fr->conn, 0); |
2086 | 3577 } else if (code == AIM_RATE_CODE_WARNING) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3578 aim_conn_setlatency(fr->conn, windowsize/4); |
2909
48ec70928d7f
[gaim-migrate @ 2922]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2906
diff
changeset
|
3579 } else if (code == AIM_RATE_CODE_LIMIT) { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
3580 gaim_notify_error(sess->aux_data, NULL, _("Rate limiting error."), |
6040 | 3581 _("The last action you attempted could not be " |
3582 "performed because you are over the rate limit. " | |
3583 "Please wait 10 seconds and try again.")); | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3584 aim_conn_setlatency(fr->conn, windowsize/2); |
2086 | 3585 } else if (code == AIM_RATE_CODE_CLEARLIMIT) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3586 aim_conn_setlatency(fr->conn, 0); |
2086 | 3587 } |
3588 | |
3589 return 1; | |
3590 } | |
3591 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3592 static int gaim_parse_evilnotify(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 3593 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3594 fu16_t newevil; |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3595 aim_userinfo_t *userinfo; |
5575 | 3596 GaimConnection *gc = sess->aux_data; |
2086 | 3597 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3598 va_start(ap, fr); |
4199 | 3599 newevil = (fu16_t) va_arg(ap, unsigned int); |
2421
95b4ec08abec
[gaim-migrate @ 2434]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2411
diff
changeset
|
3600 userinfo = va_arg(ap, aim_userinfo_t *); |
2086 | 3601 va_end(ap); |
3602 | |
5628 | 3603 serv_got_eviled(gc, (userinfo && userinfo->sn[0]) ? userinfo->sn : NULL, (newevil/10.0) + 0.5); |
2086 | 3604 |
3605 return 1; | |
3606 } | |
3607 | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3608 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
|
3609 va_list ap; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3610 aim_userinfo_t *info; |
5575 | 3611 GaimConnection *gc = sess->aux_data; |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3612 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3613 va_start(ap, fr); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3614 info = va_arg(ap, aim_userinfo_t *); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3615 va_end(ap); |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3616 |
5628 | 3617 gc->evil = (info->warnlevel/10.0) + 0.5; |
4841 | 3618 |
3619 if (info->onlinesince) | |
3620 gc->login_time_official = info->onlinesince; | |
2507
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3621 |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3622 return 1; |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3623 } |
1069b0940237
[gaim-migrate @ 2520]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
3624 |
4649 | 3625 static int gaim_connerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3626 GaimConnection *gc = sess->aux_data; |
4666 | 3627 struct oscar_data *od = gc->proto_data; |
4649 | 3628 va_list ap; |
3629 fu16_t code; | |
3630 char *msg; | |
3631 | |
3632 va_start(ap, fr); | |
3633 code = (fu16_t)va_arg(ap, int); | |
3634 msg = va_arg(ap, char *); | |
3635 va_end(ap); | |
3636 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3637 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3638 "Disconnected. Code is 0x%04x and msg is %s\n", code, msg); |
4649 | 3639 if ((fr) && (fr->conn) && (fr->conn->type == AIM_CONN_TYPE_BOS)) { |
4651 | 3640 if (code == 0x0001) { |
6113 | 3641 gc->wants_to_die = TRUE; |
5579 | 3642 gaim_connection_error(gc, _("You have been disconnected because you have signed on with this screen name at another location.")); |
4651 | 3643 } else { |
5579 | 3644 gaim_connection_error(gc, _("You have been signed off for an unknown reason.")); |
4651 | 3645 } |
4666 | 3646 od->killme = TRUE; |
4649 | 3647 } |
3648 | |
3649 return 1; | |
3650 } | |
3651 | |
2675 | 3652 static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3653 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3654 aim_reqpersonalinfo(sess, fr->conn); |
4230 | 3655 |
3656 #ifndef NOSSI | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3657 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: requesting ssi list\n"); |
4889 | 3658 aim_ssi_reqrights(sess); |
6350 | 3659 aim_ssi_reqdata(sess); |
4230 | 3660 #endif |
3661 | |
7011 | 3662 aim_locate_reqrights(sess); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3663 aim_bos_reqbuddyrights(sess, fr->conn); |
4617 | 3664 aim_im_reqparams(sess); |
5948 | 3665 aim_bos_reqrights(sess, fr->conn); /* XXX - Don't call this with ssi? */ |
4230 | 3666 |
3667 #ifdef NOSSI | |
3668 aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS); | |
3669 aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE | AIM_PRIVFLAGS_ALLOWMEMBERSINCE); | |
3670 #endif | |
2086 | 3671 |
3672 return 1; | |
3673 } | |
3674 | |
2675 | 3675 static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 3676 GaimConnection *gc = sess->aux_data; |
2647 | 3677 struct oscar_data *od = gc->proto_data; |
3678 | |
6905 | 3679 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0003, gaim_info_change, 0); |
3680 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0005, gaim_info_change, 0); | |
3681 aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_ADM, 0x0007, gaim_account_confirm, 0); | |
3682 | |
2672 | 3683 aim_clientready(sess, fr->conn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3684 gaim_debug(GAIM_DEBUG_INFO, "oscar", "connected to admin\n"); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3685 |
2647 | 3686 if (od->chpass) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3687 gaim_debug(GAIM_DEBUG_INFO, "oscar", "changing password\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3688 aim_admin_changepasswd(sess, fr->conn, od->newp, od->oldp); |
2647 | 3689 g_free(od->oldp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3690 od->oldp = NULL; |
2647 | 3691 g_free(od->newp); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3692 od->newp = NULL; |
2647 | 3693 od->chpass = FALSE; |
3694 } | |
2979 | 3695 if (od->setnick) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3696 gaim_debug(GAIM_DEBUG_INFO, "oscar", "formatting screenname\n"); |
2979 | 3697 aim_admin_setnick(sess, fr->conn, od->newsn); |
3698 g_free(od->newsn); | |
3699 od->newsn = NULL; | |
3700 od->setnick = FALSE; | |
3701 } | |
2647 | 3702 if (od->conf) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3703 gaim_debug(GAIM_DEBUG_INFO, "oscar", "confirming account\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3704 aim_admin_reqconfirm(sess, fr->conn); |
2647 | 3705 od->conf = FALSE; |
3706 } | |
3707 if (od->reqemail) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3708 gaim_debug(GAIM_DEBUG_INFO, "oscar", "requesting email\n"); |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3709 aim_admin_getinfo(sess, fr->conn, 0x0011); |
2647 | 3710 od->reqemail = FALSE; |
3711 } | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3712 if (od->setemail) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3713 gaim_debug(GAIM_DEBUG_INFO, "oscar", "setting email\n"); |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3714 aim_admin_setemail(sess, fr->conn, od->email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3715 g_free(od->email); |
5497 | 3716 od->email = NULL; |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3717 od->setemail = FALSE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
3718 } |
2647 | 3719 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3720 return 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3721 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3722 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3723 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
|
3724 struct aim_icbmparameters *params; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3725 va_list ap; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3726 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3727 va_start(ap, fr); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3728 params = va_arg(ap, struct aim_icbmparameters *); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3729 va_end(ap); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3730 |
4194 | 3731 /* XXX - evidently this crashes on solaris. i have no clue why |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3732 gaim_debug(GAIM_DEBUG_MISC, "oscar", "ICBM Parameters: maxchannel = %hu, default flags = 0x%08lx, max msg len = %hu, " |
5556 | 3733 "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
|
3734 params->maxchan, params->flags, params->maxmsglen, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3735 ((float)params->maxsenderwarn)/10.0, ((float)params->maxrecverwarn)/10.0, |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3736 params->minmsginterval); |
2427
5bc3b39fc0a5
[gaim-migrate @ 2440]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2421
diff
changeset
|
3737 */ |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3738 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3739 /* Maybe senderwarn and recverwarn should be user preferences... */ |
3595 | 3740 params->flags = 0x0000000b; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3741 params->maxmsglen = 8000; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3742 params->minmsginterval = 0; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3743 |
4617 | 3744 aim_im_setparams(sess, params); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3745 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3746 return 1; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3747 } |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
3748 |
2993 | 3749 static int gaim_parse_locaterights(aim_session_t *sess, aim_frame_t *fr, ...) |
3750 { | |
5575 | 3751 GaimConnection *gc = sess->aux_data; |
4617 | 3752 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5306 | 3753 va_list ap; |
3754 fu16_t maxsiglen; | |
2993 | 3755 |
3756 va_start(ap, fr); | |
4199 | 3757 maxsiglen = (fu16_t) va_arg(ap, int); |
2993 | 3758 va_end(ap); |
3759 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3760 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3761 "locate rights: max sig len = %d\n", maxsiglen); |
2993 | 3762 |
4617 | 3763 od->rights.maxsiglen = od->rights.maxawaymsglen = (guint)maxsiglen; |
3764 | |
3765 if (od->icq) | |
7011 | 3766 aim_locate_setprofile(sess, NULL, NULL, 0, NULL, NULL, 0, caps_icq); |
5301 | 3767 else |
5954 | 3768 oscar_set_info(gc, gc->account->user_info); |
2993 | 3769 |
3770 return 1; | |
3771 } | |
3772 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3773 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
|
3774 va_list ap; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3775 fu16_t maxbuddies, maxwatchers; |
5575 | 3776 GaimConnection *gc = sess->aux_data; |
4617 | 3777 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3778 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3779 va_start(ap, fr); |
4199 | 3780 maxbuddies = (fu16_t) va_arg(ap, unsigned int); |
3781 maxwatchers = (fu16_t) va_arg(ap, unsigned int); | |
2086 | 3782 va_end(ap); |
3783 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3784 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3785 "buddy list rights: Max buddies = %hu / Max watchers = %hu\n", maxbuddies, maxwatchers); |
2086 | 3786 |
4617 | 3787 od->rights.maxbuddies = (guint)maxbuddies; |
3788 od->rights.maxwatchers = (guint)maxwatchers; | |
2993 | 3789 |
2086 | 3790 return 1; |
3791 } | |
3792 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3793 static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3794 fu16_t maxpermits, maxdenies; |
2086 | 3795 va_list ap; |
5575 | 3796 GaimConnection *gc = sess->aux_data; |
4617 | 3797 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2086 | 3798 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
3799 va_start(ap, fr); |
4199 | 3800 maxpermits = (fu16_t) va_arg(ap, unsigned int); |
3801 maxdenies = (fu16_t) va_arg(ap, unsigned int); | |
2086 | 3802 va_end(ap); |
3803 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3804 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3805 "BOS rights: Max permit = %hu / Max deny = %hu\n", maxpermits, maxdenies); |
2086 | 3806 |
4617 | 3807 od->rights.maxpermits = (guint)maxpermits; |
3808 od->rights.maxdenies = (guint)maxdenies; | |
2993 | 3809 |
5576
8c398efc88f2
[gaim-migrate @ 5980]
Christian Hammond <chipx86@chipx86.com>
parents:
5575
diff
changeset
|
3810 gaim_connection_set_state(gc, GAIM_CONNECTED); |
2993 | 3811 serv_finish_login(gc); |
3812 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3813 gaim_debug(GAIM_DEBUG_INFO, "oscar", "buddy list loaded\n"); |
2993 | 3814 |
2672 | 3815 aim_clientready(sess, fr->conn); |
5948 | 3816 aim_srv_setavailmsg(sess, NULL); |
5917 | 3817 aim_bos_setidle(sess, fr->conn, 0); |
4617 | 3818 |
4664 | 3819 if (od->icq) { |
3820 aim_icq_reqofflinemsgs(sess); | |
3821 aim_icq_hideip(sess); | |
3822 } | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3823 |
2703
441b84ab7f4e
[gaim-migrate @ 2716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2698
diff
changeset
|
3824 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_CHATNAV); |
4102 | 3825 if (sess->authinfo->email) |
3826 aim_reqservice(sess, fr->conn, AIM_CONN_TYPE_EMAIL); | |
2086 | 3827 |
3828 return 1; | |
3829 } | |
3830 | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3831 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
|
3832 va_list ap; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3833 struct aim_icq_offlinemsg *msg; |
4075 | 3834 struct aim_incomingim_ch4_args args; |
3835 time_t t; | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3836 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3837 va_start(ap, fr); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3838 msg = va_arg(ap, struct aim_icq_offlinemsg *); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3839 va_end(ap); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3840 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3841 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
3842 "Received offline message. Converting to channel 4 ICBM...\n"); |
4075 | 3843 args.uin = msg->sender; |
3844 args.type = msg->type; | |
4173 | 3845 args.flags = msg->flags; |
4076 | 3846 args.msglen = msg->msglen; |
4075 | 3847 args.msg = msg->msg; |
3848 t = get_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0); | |
3849 incomingim_chan4(sess, fr->conn, NULL, &args, t); | |
2706
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3850 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3851 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3852 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3853 |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3854 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
|
3855 { |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3856 aim_icq_ackofflinemsgs(sess); |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3857 return 1; |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3858 } |
e841b14b5b89
[gaim-migrate @ 2719]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2704
diff
changeset
|
3859 |
4624 | 3860 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
|
3861 { |
5575 | 3862 GaimConnection *gc = sess->aux_data; |
4819 | 3863 gchar *buf, *tmp, *utf8; |
4624 | 3864 gchar who[16]; |
6873 | 3865 GaimBuddy *buddy; |
3866 gchar *primary; | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3867 va_list ap; |
4151 | 3868 struct aim_icq_info *info; |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3869 |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3870 va_start(ap, fr); |
4151 | 3871 info = va_arg(ap, struct aim_icq_info *); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3872 va_end(ap); |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3873 |
4664 | 3874 if (!info->uin) |
3875 return 0; | |
3876 | |
5556 | 3877 g_snprintf(who, sizeof(who), "%u", info->uin); |
6623 | 3878 buf = g_strdup_printf("<b>%s:</b> %s", _("UIN"), who); |
4819 | 3879 if (info->nick && info->nick[0] && (utf8 = gaim_try_conv_to_utf8(info->nick))) { |
6623 | 3880 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Nick"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4819 | 3881 } |
3882 if (info->first && info->first[0] && (utf8 = gaim_try_conv_to_utf8(info->first))) { | |
6623 | 3883 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("First Name"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4819 | 3884 } |
3885 if (info->last && info->last[0] && (utf8 = gaim_try_conv_to_utf8(info->last))) { | |
6623 | 3886 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Last Name"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4819 | 3887 } |
3888 if (info->email && info->email[0] && (utf8 = gaim_try_conv_to_utf8(info->email))) { | |
6623 | 3889 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Email Address"), ":</b> <a href=\"mailto:", utf8, "\">", utf8, "</a>", NULL); g_free(tmp); g_free(utf8); |
4625 | 3890 } |
3891 if (info->numaddresses && info->email2) { | |
3892 int i; | |
3893 for (i = 0; i < info->numaddresses; i++) { | |
4819 | 3894 if (info->email2[i] && info->email2[i][0] && (utf8 = gaim_try_conv_to_utf8(info->email2[i]))) { |
6623 | 3895 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Email Address"), ":</b> <a href=\"mailto:", utf8, "\">", utf8, "</a>", NULL); g_free(tmp); g_free(utf8); |
4643 | 3896 } |
4625 | 3897 } |
4624 | 3898 } |
4819 | 3899 if (info->mobile && info->mobile[0] && (utf8 = gaim_try_conv_to_utf8(info->mobile))) { |
6623 | 3900 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Mobile Phone"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4625 | 3901 } |
3902 if (info->gender) { | |
6623 | 3903 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Gender"), ":</b> ", info->gender==1 ? _("Female") : _("Male"), NULL); g_free(tmp); |
4151 | 3904 } |
4624 | 3905 if (info->birthyear || info->birthmonth || info->birthday) { |
4627 | 3906 char date[30]; |
3907 struct tm tm; | |
3908 tm.tm_mday = (int)info->birthday; | |
3909 tm.tm_mon = (int)info->birthmonth-1; | |
3910 tm.tm_year = (int)info->birthyear-1900; | |
4628 | 3911 strftime(date, sizeof(date), "%x", &tm); |
6623 | 3912 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Birthday"), ":</b> ", date, NULL); g_free(tmp); |
4151 | 3913 } |
4624 | 3914 if (info->age) { |
3915 char age[5]; | |
3916 snprintf(age, sizeof(age), "%hhd", info->age); | |
6623 | 3917 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Age"), ":</b> ", age, NULL); g_free(tmp); |
4819 | 3918 } |
3919 if (info->personalwebpage && info->personalwebpage[0] && (utf8 = gaim_try_conv_to_utf8(info->personalwebpage))) { | |
6623 | 3920 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Personal Web Page"), ":</b> <a href=\"", utf8, "\">", utf8, "</a>", NULL); g_free(tmp); g_free(utf8); |
4819 | 3921 } |
3922 if (info->info && info->info[0] && (utf8 = gaim_try_conv_to_utf8(info->info))) { | |
6623 | 3923 tmp = buf; buf = g_strconcat(tmp, "<hr><b>", _("Additional Information"), ":</b><br>", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 3924 } |
3925 tmp = buf; buf = g_strconcat(tmp, "<hr>\n", NULL); g_free(tmp); | |
4641 | 3926 if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) { |
6623 | 3927 tmp = buf; buf = g_strconcat(tmp, "<b>", _("Home Address"), ":</b>", NULL); g_free(tmp); |
4819 | 3928 if (info->homeaddr && info->homeaddr[0] && (utf8 = gaim_try_conv_to_utf8(info->homeaddr))) { |
6623 | 3929 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Address"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 3930 } |
4819 | 3931 if (info->homecity && info->homecity[0] && (utf8 = gaim_try_conv_to_utf8(info->homecity))) { |
6623 | 3932 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("City"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 3933 } |
4819 | 3934 if (info->homestate && info->homestate[0] && (utf8 = gaim_try_conv_to_utf8(info->homestate))) { |
6623 | 3935 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("State"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 3936 } |
4819 | 3937 if (info->homezip && info->homezip[0] && (utf8 = gaim_try_conv_to_utf8(info->homezip))) { |
6623 | 3938 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Zip Code"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 3939 } |
3940 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); | |
4151 | 3941 } |
4641 | 3942 if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) { |
6623 | 3943 tmp = buf; buf = g_strconcat(tmp, "<b>", _("Work Address"), ":</b>", NULL); g_free(tmp); |
4819 | 3944 if (info->workaddr && info->workaddr[0] && (utf8 = gaim_try_conv_to_utf8(info->workaddr))) { |
6623 | 3945 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Address"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 3946 } |
4819 | 3947 if (info->workcity && info->workcity[0] && (utf8 = gaim_try_conv_to_utf8(info->workcity))) { |
6623 | 3948 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("City"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 3949 } |
4819 | 3950 if (info->workstate && info->workstate[0] && (utf8 = gaim_try_conv_to_utf8(info->workstate))) { |
6623 | 3951 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("State"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 3952 } |
4819 | 3953 if (info->workzip && info->workzip[0] && (utf8 = gaim_try_conv_to_utf8(info->workzip))) { |
6623 | 3954 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Zip Code"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 3955 } |
3956 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); | |
3957 } | |
4641 | 3958 if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) { |
6623 | 3959 tmp = buf; buf = g_strconcat(tmp, "<b>", _("Work Information"), ":</b>", NULL); g_free(tmp); |
4819 | 3960 if (info->workcompany && info->workcompany[0] && (utf8 = gaim_try_conv_to_utf8(info->workcompany))) { |
6623 | 3961 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Company"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 3962 } |
4819 | 3963 if (info->workdivision && info->workdivision[0] && (utf8 = gaim_try_conv_to_utf8(info->workdivision))) { |
6623 | 3964 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Division"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 3965 } |
4819 | 3966 if (info->workposition && info->workposition[0] && (utf8 = gaim_try_conv_to_utf8(info->workposition))) { |
6623 | 3967 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Position"), ":</b> ", utf8, NULL); g_free(tmp); g_free(utf8); |
4624 | 3968 } |
4819 | 3969 if (info->workwebpage && info->workwebpage[0] && (utf8 = gaim_try_conv_to_utf8(info->workwebpage))) { |
6623 | 3970 tmp = buf; buf = g_strconcat(tmp, "\n<br><b>", _("Web Page"), ":</b> <a href=\"", utf8, "\">", utf8, "</a>", NULL); g_free(tmp); g_free(utf8); |
4624 | 3971 } |
3972 tmp = buf; buf = g_strconcat(tmp, "\n<hr>\n", NULL); g_free(tmp); | |
4151 | 3973 } |
3974 | |
6873 | 3975 buddy = gaim_find_buddy(gaim_connection_get_account(gc), who); |
3976 primary = g_strdup_printf(_("ICQ Info for %s"), gaim_get_buddy_alias(buddy)); | |
3977 gaim_notify_formatted(gc, NULL, primary, NULL, buf, NULL, NULL); | |
3978 g_free(primary); | |
4151 | 3979 g_free(buf); |
3980 | |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3981 return 1; |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3982 } |
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
3983 |
4759 | 3984 static int gaim_icqalias(aim_session_t *sess, aim_frame_t *fr, ...) |
3985 { | |
5575 | 3986 GaimConnection *gc = sess->aux_data; |
4820 | 3987 gchar who[16], *utf8; |
6695 | 3988 GaimBuddy *b; |
4759 | 3989 va_list ap; |
3990 struct aim_icq_info *info; | |
3991 | |
3992 va_start(ap, fr); | |
3993 info = va_arg(ap, struct aim_icq_info *); | |
3994 va_end(ap); | |
3995 | |
4822 | 3996 if (info->uin && info->nick && info->nick[0] && (utf8 = gaim_try_conv_to_utf8(info->nick))) { |
5556 | 3997 g_snprintf(who, sizeof(who), "%u", info->uin); |
4820 | 3998 serv_got_alias(gc, who, utf8); |
4759 | 3999 if ((b = gaim_find_buddy(gc->account, who))) { |
4820 | 4000 gaim_buddy_set_setting(b, "servernick", utf8); |
4759 | 4001 gaim_blist_save(); |
4002 } | |
4820 | 4003 g_free(utf8); |
4759 | 4004 } |
4005 | |
4006 return 1; | |
4007 } | |
4008 | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4009 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
|
4010 { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4011 char *msg, *url; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4012 fu16_t wid, hei, delay; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4013 va_list ap; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4014 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4015 va_start(ap, fr); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4016 msg = va_arg(ap, char *); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4017 url = va_arg(ap, char *); |
4199 | 4018 wid = (fu16_t) va_arg(ap, int); |
4019 hei = (fu16_t) va_arg(ap, int); | |
4020 delay = (fu16_t) va_arg(ap, int); | |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4021 va_end(ap); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4022 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4023 serv_got_popup(msg, url, wid, hei); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4024 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4025 return 1; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4026 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
4027 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4028 static int gaim_parse_searchreply(aim_session_t *sess, aim_frame_t *fr, ...) { |
6873 | 4029 GaimConnection *gc = sess->aux_data; |
4030 gchar *secondary; | |
4031 GString *text; | |
4032 int i, num; | |
2086 | 4033 va_list ap; |
6873 | 4034 char *email, *SNs; |
2086 | 4035 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4036 va_start(ap, fr); |
6873 | 4037 email = va_arg(ap, char *); |
2086 | 4038 num = va_arg(ap, int); |
4039 SNs = va_arg(ap, char *); | |
4040 va_end(ap); | |
4041 | |
6873 | 4042 secondary = g_strdup_printf(_("The following screennames are associated with %s"), email); |
4043 text = g_string_new(""); | |
2086 | 4044 for (i = 0; i < num; i++) |
6873 | 4045 g_string_append_printf(text, "%s<br>", &SNs[i * (MAXSNLEN + 1)]); |
4046 gaim_notify_formatted(gc, NULL, _("Search Results"), secondary, text->str, NULL, NULL); | |
4047 | |
4048 g_free(secondary); | |
4049 g_string_free(text, TRUE); | |
2086 | 4050 |
4051 return 1; | |
4052 } | |
4053 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4054 static int gaim_parse_searcherror(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 4055 va_list ap; |
6873 | 4056 char *email; |
5420 | 4057 char *buf; |
2086 | 4058 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4059 va_start(ap, fr); |
6873 | 4060 email = va_arg(ap, char *); |
2086 | 4061 va_end(ap); |
4062 | |
6873 | 4063 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
|
4064 gaim_notify_error(sess->aux_data, NULL, buf, NULL); |
5420 | 4065 g_free(buf); |
2086 | 4066 |
4067 return 1; | |
4068 } | |
4069 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4070 static int gaim_account_confirm(aim_session_t *sess, aim_frame_t *fr, ...) { |
6873 | 4071 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4072 fu16_t status; |
2086 | 4073 va_list ap; |
4074 char msg[256]; | |
4075 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4076 va_start(ap, fr); |
4199 | 4077 status = (fu16_t) va_arg(ap, unsigned int); /* status code of confirmation request */ |
2086 | 4078 va_end(ap); |
4079 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4080 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4081 "account confirmation returned status 0x%04x (%s)\n", status, |
3912 | 4082 status ? "unknown" : "email sent"); |
4083 if (!status) { | |
5302 | 4084 g_snprintf(msg, sizeof(msg), _("You should receive an email asking to confirm %s."), |
5575 | 4085 gaim_account_get_username(gaim_connection_get_account(gc))); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4086 gaim_notify_info(gc, NULL, _("Account Confirmation Requested"), msg); |
2086 | 4087 } |
4088 | |
4089 return 1; | |
4090 } | |
4091 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4092 static int gaim_info_change(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4093 GaimConnection *gc = sess->aux_data; |
2086 | 4094 va_list ap; |
3912 | 4095 fu16_t perms, err; |
4096 char *url, *sn, *email; | |
4097 int change; | |
2086 | 4098 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4099 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
4100 change = va_arg(ap, int); |
4199 | 4101 perms = (fu16_t) va_arg(ap, unsigned int); |
4102 err = (fu16_t) va_arg(ap, unsigned int); | |
3912 | 4103 url = va_arg(ap, char *); |
4104 sn = va_arg(ap, char *); | |
4105 email = va_arg(ap, char *); | |
2086 | 4106 va_end(ap); |
4107 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4108 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4109 "account info: because of %s, perms=0x%04x, err=0x%04x, url=%s, sn=%s, email=%s\n", |
3912 | 4110 change ? "change" : "request", perms, err, url, sn, email); |
4111 | |
4112 if (err && url) { | |
4113 char *dialog_msg; | |
4114 char *dialog_top = g_strdup_printf(_("Error Changing Account Info")); | |
4115 switch (err) { | |
4116 case 0x0001: { | |
4117 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name differs from the original."), err); | |
4118 } break; | |
4119 case 0x0006: { | |
4120 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name ends in a space."), err); | |
4121 } break; | |
4122 case 0x000b: { | |
4123 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to format screen name because the requested screen name is too long."), err); | |
4124 } break; | |
4125 case 0x001d: { | |
4126 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); | |
4127 } break; | |
4128 case 0x0021: { | |
4129 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); | |
4130 } break; | |
4131 case 0x0023: { | |
4132 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unable to change email address because the given address is invalid."), err); | |
4133 } break; | |
4134 default: { | |
4135 dialog_msg = g_strdup_printf(_("Error 0x%04x: Unknown error."), err); | |
4136 } break; | |
4137 } | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4138 gaim_notify_error(gc, NULL, dialog_top, dialog_msg); |
3912 | 4139 g_free(dialog_top); |
4140 g_free(dialog_msg); | |
4141 return 1; | |
4142 } | |
4143 | |
4144 if (sn) { | |
4585 | 4145 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
|
4146 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg); |
3912 | 4147 g_free(dialog_msg); |
4148 } | |
4149 | |
4150 if (email) { | |
5575 | 4151 char *dialog_msg = g_strdup_printf(_("The email address for %s is %s"), |
4152 gaim_account_get_username(gaim_connection_get_account(gc)), email); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4153 gaim_notify_info(gc, NULL, _("Account Info"), dialog_msg); |
3912 | 4154 g_free(dialog_msg); |
2086 | 4155 } |
4156 | |
4157 return 1; | |
4158 } | |
4159 | |
5575 | 4160 static void oscar_keepalive(GaimConnection *gc) { |
4617 | 4161 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4162 aim_flap_nop(od->sess, od->conn); | |
2086 | 4163 } |
4164 | |
6059 | 4165 static int oscar_send_typing(GaimConnection *gc, const char *name, int typing) { |
4617 | 4166 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4167 struct direct_im *dim = find_direct_im(od, name); | |
3595 | 4168 if (dim) |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4169 if (typing == GAIM_TYPING) |
4870 | 4170 aim_odc_send_typing(od->sess, dim->conn, 0x0002); |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4171 else if (typing == GAIM_TYPED) |
4870 | 4172 aim_odc_send_typing(od->sess, dim->conn, 0x0001); |
4173 else | |
4174 aim_odc_send_typing(od->sess, dim->conn, 0x0000); | |
3595 | 4175 else { |
5300 | 4176 /* Don't send if this turkey is in our deny list */ |
4177 GSList *list; | |
4178 for (list=gc->account->deny; (list && aim_sncmp(name, list->data)); list=list->next); | |
4179 if (!list) { | |
4180 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(name)); | |
4181 if (bi && bi->typingnot) { | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4182 if (typing == GAIM_TYPING) |
5300 | 4183 aim_im_sendmtn(od->sess, 0x0001, name, 0x0002); |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
4184 else if (typing == GAIM_TYPED) |
5300 | 4185 aim_im_sendmtn(od->sess, 0x0001, name, 0x0001); |
4186 else | |
4187 aim_im_sendmtn(od->sess, 0x0001, name, 0x0000); | |
4188 } | |
3595 | 4189 } |
4190 } | |
2993 | 4191 return 0; |
4192 } | |
5575 | 4193 static void oscar_ask_direct_im(GaimConnection *gc, const char *name); |
6982 | 4194 static int gaim_odc_send_im(aim_session_t *, aim_conn_t *, const char *, GaimImFlags); |
4195 | |
4196 static int oscar_send_im(GaimConnection *gc, const char *name, const char *message, GaimImFlags imflags) { | |
4617 | 4197 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4198 struct direct_im *dim = find_direct_im(od, name); | |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4199 int ret = 0; |
3659 | 4200 GError *err = NULL; |
5575 | 4201 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6350
diff
changeset
|
4202 char *tmpmsg = NULL; |
3458 | 4203 |
4838 | 4204 if (dim && dim->connected) { |
4205 /* If we're directly connected, send a direct IM */ | |
6982 | 4206 ret = gaim_odc_send_im(od->sess, dim->conn, message, imflags); |
4207 } else if (imflags & GAIM_IM_IMAGES) { | |
3044 | 4208 /* Trying to send an IM image outside of a direct connection. */ |
4209 oscar_ask_direct_im(gc, name); | |
4838 | 4210 ret = -ENOTCONN; |
2086 | 4211 } else { |
4738 | 4212 struct buddyinfo *bi; |
3008 | 4213 struct aim_sendimext_args args; |
4214 struct stat st; | |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
4215 gsize len; |
4269 | 4216 |
4738 | 4217 bi = g_hash_table_lookup(od->buddyinfo, normalize(name)); |
4218 if (!bi) { | |
4219 bi = g_new0(struct buddyinfo, 1); | |
4220 g_hash_table_insert(od->buddyinfo, g_strdup(normalize(name)), bi); | |
4221 } | |
4222 | |
3008 | 4223 args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES; |
4665 | 4224 if (od->icq) { |
4225 args.features = features_icq; | |
4226 args.featureslen = sizeof(features_icq); | |
3008 | 4227 args.flags |= AIM_IMFLAGS_OFFLINE; |
4665 | 4228 } else { |
4229 args.features = features_aim; | |
4230 args.featureslen = sizeof(features_aim); | |
4972 | 4231 |
6622 | 4232 if (imflags & GAIM_IM_AUTO_RESP) |
4972 | 4233 args.flags |= AIM_IMFLAGS_AWAY; |
4665 | 4234 } |
4269 | 4235 |
4738 | 4236 if (bi->ico_need) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4237 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4238 "Sending buddy icon request with message\n"); |
3008 | 4239 args.flags |= AIM_IMFLAGS_BUDDYREQ; |
4738 | 4240 bi->ico_need = FALSE; |
3008 | 4241 } |
4269 | 4242 |
5575 | 4243 if (iconfile && !stat(iconfile, &st)) { |
4244 FILE *file = fopen(iconfile, "r"); | |
3008 | 4245 if (file) { |
4246 char *buf = g_malloc(st.st_size); | |
4247 fread(buf, 1, st.st_size, file); | |
6039 | 4248 fclose(file); |
4269 | 4249 |
3008 | 4250 args.iconlen = st.st_size; |
4617 | 4251 args.iconsum = aimutil_iconsum(buf, st.st_size); |
3008 | 4252 args.iconstamp = st.st_mtime; |
4253 | |
4738 | 4254 if ((args.iconlen != bi->ico_me_len) || (args.iconsum != bi->ico_me_csum) || (args.iconstamp != bi->ico_me_time)) |
4255 bi->ico_informed = FALSE; | |
4256 | |
4257 if (!bi->ico_informed) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4258 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4259 "Claiming to have a buddy icon\n"); |
4738 | 4260 args.flags |= AIM_IMFLAGS_HASICON; |
4261 bi->ico_me_len = args.iconlen; | |
4262 bi->ico_me_csum = args.iconsum; | |
4263 bi->ico_me_time = args.iconstamp; | |
4264 bi->ico_informed = TRUE; | |
4265 } | |
4266 | |
3008 | 4267 g_free(buf); |
2086 | 4268 } |
4269 } | |
4269 | 4270 |
3008 | 4271 args.destsn = name; |
4269 | 4272 |
6310 | 4273 /* For ICQ send newlines as CR/LF, for AIM send newlines as <BR> */ |
4274 if (isdigit(name[0])) | |
4275 tmpmsg = add_cr(message); | |
4276 else | |
4277 tmpmsg = strdup_withhtml(message); | |
4278 len = strlen(tmpmsg); | |
4279 | |
4280 args.flags |= oscar_encoding_check(tmpmsg); | |
3642 | 4281 if (args.flags & AIM_IMFLAGS_UNICODE) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4282 gaim_debug(GAIM_DEBUG_INFO, "oscar", "Sending Unicode IM\n"); |
4662 | 4283 args.charset = 0x0002; |
4665 | 4284 args.charsubset = 0x0000; |
6310 | 4285 args.msg = g_convert(tmpmsg, len, "UCS-2BE", "UTF-8", NULL, &len, &err); |
3659 | 4286 if (err) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4287 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4288 "Error converting a unicode message: %s\n", err->message); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4289 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4290 "This really shouldn't happen!\n"); |
3659 | 4291 /* We really shouldn't try to send the |
4292 * IM now, but I'm not sure what to do */ | |
4800 | 4293 g_error_free(err); |
3659 | 4294 } |
3850 | 4295 } else if (args.flags & AIM_IMFLAGS_ISO_8859_1) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4296 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4297 "Sending ISO-8859-1 IM\n"); |
4662 | 4298 args.charset = 0x0003; |
4665 | 4299 args.charsubset = 0x0000; |
6310 | 4300 args.msg = g_convert(tmpmsg, len, "ISO-8859-1", "UTF-8", NULL, &len, &err); |
3659 | 4301 if (err) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4302 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4303 "conversion error: %s\n", err->message); |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4304 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4305 "Someone tell Ethan his 8859-1 detection is wrong\n"); |
3642 | 4306 args.flags ^= AIM_IMFLAGS_ISO_8859_1 | AIM_IMFLAGS_UNICODE; |
6310 | 4307 len = strlen(tmpmsg); |
4800 | 4308 g_error_free(err); |
6310 | 4309 args.msg = g_convert(tmpmsg, len, "UCS-2BE", "UTF8", NULL, &len, &err); |
3659 | 4310 if (err) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4311 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4312 "Error in unicode fallback: %s\n", err->message); |
4800 | 4313 g_error_free(err); |
3659 | 4314 } |
3642 | 4315 } |
4316 } else { | |
4662 | 4317 args.charset = 0x0000; |
4318 args.charsubset = 0x0000; | |
6310 | 4319 args.msg = tmpmsg; |
3642 | 4320 } |
4321 args.msglen = len; | |
4269 | 4322 |
4617 | 4323 ret = aim_im_sendch1_ext(od->sess, &args); |
2086 | 4324 } |
4838 | 4325 |
6310 | 4326 g_free(tmpmsg); |
4327 | |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4328 if (ret >= 0) |
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4329 return 1; |
6310 | 4330 |
2303
f5bf315e6104
[gaim-migrate @ 2313]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2297
diff
changeset
|
4331 return ret; |
2086 | 4332 } |
4333 | |
7011 | 4334 static void oscar_get_info(GaimConnection *gc, const char *name) { |
4335 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4336 | |
4617 | 4337 if (od->icq) |
4624 | 4338 aim_icq_getallinfo(od->sess, name); |
2742
6f527cbd899d
[gaim-migrate @ 2755]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2734
diff
changeset
|
4339 else |
7011 | 4340 aim_locate_getinfoshort(od->sess, name, 0x00000007); |
4341 } | |
4342 | |
4343 static void oscar_get_away(GaimConnection *gc, const char *who) { | |
4344 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4617 | 4345 if (od->icq) { |
7011 | 4346 GaimBuddy *budlight = gaim_find_buddy(gc->account, who); |
3212 | 4347 if (budlight) |
3595 | 4348 if ((budlight->uc & 0xffff0000) >> 16) |
4687 | 4349 aim_im_sendch2_geticqaway(od->sess, who, (budlight->uc & 0xffff0000) >> 16); |
3212 | 4350 else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4351 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4352 "Error: The user %s has no status message, therefore not requesting.\n", who); |
3212 | 4353 else |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4354 gaim_debug(GAIM_DEBUG_ERROR, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4355 "Error: Could not find %s in local contact list, therefore unable to request status message.\n", who); |
3212 | 4356 } else |
7011 | 4357 aim_locate_getinfoshort(od->sess, who, 0x00000002); |
4358 } | |
4359 | |
4360 static void oscar_set_dir(GaimConnection *gc, const char *first, const char *middle, const char *last, | |
3466 | 4361 const char *maiden, const char *city, const char *state, const char *country, int web) { |
4617 | 4362 /* XXX - some of these things are wrong, but i'm lazy */ |
7011 | 4363 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4364 aim_locate_setdirinfo(od->sess, first, middle, last, | |
2086 | 4365 maiden, NULL, NULL, city, state, NULL, 0, web); |
4366 } | |
4367 | |
5575 | 4368 static void oscar_set_idle(GaimConnection *gc, int time) { |
5129 | 4369 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4617 | 4370 aim_bos_setidle(od->sess, od->conn, time); |
2086 | 4371 } |
4372 | |
5954 | 4373 static void oscar_set_info(GaimConnection *gc, const char *text) { |
5129 | 4374 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4375 fu32_t flags = 0; | |
6019 | 4376 char *text_html = NULL; |
5129 | 4377 char *msg = NULL; |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
4378 gsize msglen = 0; |
2993 | 4379 |
4617 | 4380 if (od->rights.maxsiglen == 0) |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4381 gaim_notify_warning(gc, NULL, _("Unable to set AIM profile."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4382 _("You have probably requested to set your " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4383 "profile before the login procedure completed. " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4384 "Your profile remains unset; try setting it " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4385 "again when you are fully connected.")); |
4617 | 4386 |
4387 if (od->icq) | |
7011 | 4388 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, NULL, 0, caps_icq); |
4151 | 4389 else { |
5129 | 4390 if (!text) { |
7011 | 4391 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, NULL, 0, caps_aim); |
5129 | 4392 return; |
4393 } | |
6019 | 4394 |
4395 text_html = strdup_withhtml(text); | |
4396 flags = oscar_encoding_check(text_html); | |
5129 | 4397 if (flags & AIM_IMFLAGS_UNICODE) { |
6019 | 4398 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); |
7011 | 4399 aim_locate_setprofile(od->sess, "unicode-2-0", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim); |
5129 | 4400 g_free(msg); |
4401 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { | |
6019 | 4402 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); |
7011 | 4403 aim_locate_setprofile(od->sess, "iso-8859-1", msg, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim); |
5129 | 4404 g_free(msg); |
4151 | 4405 } else { |
6019 | 4406 msglen = strlen(text_html); |
7011 | 4407 aim_locate_setprofile(od->sess, "us-ascii", text_html, (msglen > od->rights.maxsiglen ? od->rights.maxsiglen : msglen), NULL, NULL, 0, caps_aim); |
4151 | 4408 } |
5129 | 4409 |
4410 if (msglen > od->rights.maxsiglen) { | |
4411 gchar *errstr; | |
6308 | 4412 errstr = g_strdup_printf(ngettext("The maximum profile length of %d byte " |
4413 "has been exceeded. Gaim has truncated it for you.", | |
4414 "The maximum profile length of %d bytes " | |
4415 "has been exceeded. Gaim has truncated it for you.", | |
4416 od->rights.maxsiglen), od->rights.maxsiglen); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4417 gaim_notify_warning(gc, NULL, _("Profile too long."), errstr); |
5129 | 4418 g_free(errstr); |
4419 } | |
4420 | |
6019 | 4421 g_free(text_html); |
4422 | |
5129 | 4423 } |
2993 | 4424 |
4425 return; | |
2086 | 4426 } |
4427 | |
5575 | 4428 static void oscar_set_away_aim(GaimConnection *gc, struct oscar_data *od, const char *text) |
2993 | 4429 { |
5129 | 4430 fu32_t flags = 0; |
6019 | 4431 gchar *text_html = NULL; |
5129 | 4432 char *msg = NULL; |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6465
diff
changeset
|
4433 gsize msglen = 0; |
2993 | 4434 |
4435 if (od->rights.maxawaymsglen == 0) | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4436 gaim_notify_warning(gc, NULL, _("Unable to set AIM away message."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4437 _("You have probably requested to set your " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4438 "away message before the login procedure " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4439 "completed. You remain in a \"present\" " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4440 "state; try setting it again when you are " |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4441 "fully connected.")); |
5129 | 4442 |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4443 if (gc->away) { |
2993 | 4444 g_free(gc->away); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4445 gc->away = NULL; |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4446 } |
2993 | 4447 |
5129 | 4448 if (!text) { |
7011 | 4449 aim_locate_setprofile(od->sess, NULL, NULL, 0, NULL, "", 0, caps_aim); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4450 return; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4451 } |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4452 |
6037 | 4453 text_html = strdup_withhtml(text); |
6019 | 4454 flags = oscar_encoding_check(text_html); |
5129 | 4455 if (flags & AIM_IMFLAGS_UNICODE) { |
6019 | 4456 msg = g_convert(text_html, strlen(text_html), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); |
7011 | 4457 aim_locate_setprofile(od->sess, NULL, NULL, 0, "unicode-2-0", msg, |
5129 | 4458 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim); |
4459 g_free(msg); | |
4460 gc->away = g_strndup(text, od->rights.maxawaymsglen/2); | |
4461 } else if (flags & AIM_IMFLAGS_ISO_8859_1) { | |
6019 | 4462 msg = g_convert(text_html, strlen(text_html), "ISO-8859-1", "UTF-8", NULL, &msglen, NULL); |
7011 | 4463 aim_locate_setprofile(od->sess, NULL, NULL, 0, "iso-8859-1", msg, |
5129 | 4464 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim); |
4465 g_free(msg); | |
6019 | 4466 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); |
5129 | 4467 } else { |
6019 | 4468 msglen = strlen(text_html); |
7011 | 4469 aim_locate_setprofile(od->sess, NULL, NULL, 0, "us-ascii", text_html, |
5129 | 4470 (msglen > od->rights.maxawaymsglen ? od->rights.maxawaymsglen : msglen), caps_aim); |
6019 | 4471 gc->away = g_strndup(text_html, od->rights.maxawaymsglen); |
5129 | 4472 } |
4473 | |
4474 if (msglen > od->rights.maxawaymsglen) { | |
2993 | 4475 gchar *errstr; |
4476 | |
6308 | 4477 errstr = g_strdup_printf(ngettext("The maximum away message length of %d byte " |
4478 "has been exceeded. Gaim has truncated it for you.", | |
4479 "The maximum away message length of %d bytes " | |
4480 "has been exceeded. Gaim has truncated it for you.", | |
4481 od->rights.maxawaymsglen), od->rights.maxawaymsglen); | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
4482 gaim_notify_warning(gc, NULL, _("Away message too long."), errstr); |
2993 | 4483 g_free(errstr); |
4484 } | |
6019 | 4485 |
4486 g_free(text_html); | |
2993 | 4487 return; |
4488 } | |
4489 | |
5575 | 4490 static void oscar_set_away_icq(GaimConnection *gc, struct oscar_data *od, const char *state, const char *message) |
2993 | 4491 { |
5575 | 4492 GaimAccount *account = gaim_connection_get_account(gc); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4493 if (gc->away) { |
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4494 g_free(gc->away); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4495 gc->away = NULL; |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4496 } |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4497 |
4342 | 4498 if (strcmp(state, _("Invisible"))) { |
5575 | 4499 if ((od->sess->ssi.received_data) && (aim_ssi_getpermdeny(od->sess->ssi.local) != account->perm_deny)) |
4500 aim_ssi_setpermdeny(od->sess, account->perm_deny, 0xffffffff); | |
4501 account->perm_deny = 4; | |
4342 | 4502 } else { |
5542 | 4503 if ((od->sess->ssi.received_data) && (aim_ssi_getpermdeny(od->sess->ssi.local) != 0x03)) |
4889 | 4504 aim_ssi_setpermdeny(od->sess, 0x03, 0xffffffff); |
5575 | 4505 account->perm_deny = 3; |
4342 | 4506 } |
4507 | |
4508 if (!strcmp(state, _("Online"))) | |
4901 | 4509 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
4342 | 4510 else if (!strcmp(state, _("Away"))) { |
4901 | 4511 aim_setextstatus(od->sess, AIM_ICQ_STATE_AWAY); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4512 gc->away = g_strdup(""); |
4342 | 4513 } else if (!strcmp(state, _("Do Not Disturb"))) { |
4901 | 4514 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
|
4515 gc->away = g_strdup(""); |
4342 | 4516 } else if (!strcmp(state, _("Not Available"))) { |
4901 | 4517 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
|
4518 gc->away = g_strdup(""); |
4342 | 4519 } else if (!strcmp(state, _("Occupied"))) { |
4901 | 4520 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
|
4521 gc->away = g_strdup(""); |
4342 | 4522 } else if (!strcmp(state, _("Free For Chat"))) { |
4901 | 4523 aim_setextstatus(od->sess, AIM_ICQ_STATE_CHAT); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4524 gc->away = g_strdup(""); |
4342 | 4525 } else if (!strcmp(state, _("Invisible"))) { |
4901 | 4526 aim_setextstatus(od->sess, AIM_ICQ_STATE_INVISIBLE); |
4111
ee884f1d7ae3
[gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents:
4102
diff
changeset
|
4527 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4528 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { |
2998 | 4529 if (message) { |
4901 | 4530 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
|
4531 gc->away = g_strdup(""); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4532 } else { |
4901 | 4533 aim_setextstatus(od->sess, AIM_ICQ_STATE_NORMAL); |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
4534 } |
2086 | 4535 } |
2993 | 4536 |
4537 return; | |
4538 } | |
4539 | |
6059 | 4540 static void oscar_set_away(GaimConnection *gc, const char *state, const char *message) |
2993 | 4541 { |
4542 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
4543 | |
4544 if (od->icq) | |
4545 oscar_set_away_icq(gc, od, state, message); | |
4546 else | |
4547 oscar_set_away_aim(gc, od, message); | |
4548 | |
4549 return; | |
2086 | 4550 } |
4551 | |
6059 | 4552 static void oscar_warn(GaimConnection *gc, const char *name, int anon) { |
4617 | 4553 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4554 aim_im_warn(od->sess, od->conn, name, anon ? AIM_WARN_ANON : 0); | |
2086 | 4555 } |
4556 | |
5575 | 4557 static void oscar_dir_search(GaimConnection *gc, const char *first, const char *middle, const char *last, |
3466 | 4558 const char *maiden, const char *city, const char *state, const char *country, const char *email) { |
4617 | 4559 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2086 | 4560 if (strlen(email)) |
6879 | 4561 aim_search_address(od->sess, od->conn, email); |
2086 | 4562 } |
4563 | |
6787
faa491042c66
[gaim-migrate @ 7326]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
4564 static void oscar_add_buddy(GaimConnection *gc, const char *name, GaimGroup *g) { |
4230 | 4565 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4566 #ifdef NOSSI | |
4567 aim_add_buddy(od->sess, od->conn, name); | |
4568 #else | |
4569 if ((od->sess->ssi.received_data) && !(aim_ssi_itemlist_exists(od->sess->ssi.local, name))) { | |
6695 | 4570 GaimBuddy *buddy = gaim_find_buddy(gc->account, name); |
4571 GaimGroup *group = gaim_find_buddys_group(buddy); | |
4230 | 4572 if (buddy && group) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4573 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4574 "ssi: adding buddy %s to group %s\n", name, group->name); |
4889 | 4575 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 0); |
4230 | 4576 } |
4577 } | |
4578 #endif | |
4759 | 4579 if (od->icq) |
4580 aim_icq_getalias(od->sess, name); | |
4230 | 4581 } |
4582 | |
5575 | 4583 static void oscar_add_buddies(GaimConnection *gc, GList *buddies) { |
4230 | 4584 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4585 #ifdef NOSSI | |
4586 char buf[MSG_LEN]; | |
4587 int n=0; | |
4588 while (buddies) { | |
4589 if (n > MSG_LEN - 18) { | |
4590 aim_bos_setbuddylist(od->sess, od->conn, buf); | |
4591 n = 0; | |
3092 | 4592 } |
4230 | 4593 n += g_snprintf(buf + n, sizeof(buf) - n, "%s&", (char *)buddies->data); |
4594 buddies = buddies->next; | |
4595 } | |
4596 aim_bos_setbuddylist(od->sess, od->conn, buf); | |
4597 #else | |
4598 if (od->sess->ssi.received_data) { | |
4599 while (buddies) { | |
6695 | 4600 GaimBuddy *buddy = gaim_find_buddy(gc->account, (const char *)buddies->data); |
4601 GaimGroup *group = gaim_find_buddys_group(buddy); | |
4230 | 4602 if (buddy && group) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4603 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4604 "ssi: adding buddy %s to group %s\n", (const char *)buddies->data, group->name); |
4889 | 4605 aim_ssi_addbuddy(od->sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 0); |
4230 | 4606 } |
4607 buddies = buddies->next; | |
4608 } | |
4609 } | |
4610 #endif | |
4611 } | |
4612 | |
6059 | 4613 static void oscar_remove_buddy(GaimConnection *gc, const char *name, const char *group) { |
4230 | 4614 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4615 #ifdef NOSSI | |
4616 aim_remove_buddy(od->sess, od->conn, name); | |
4617 #else | |
4618 if (od->sess->ssi.received_data) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4619 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4620 "ssi: deleting buddy %s from group %s\n", name, group); |
4889 | 4621 aim_ssi_delbuddy(od->sess, name, group); |
4230 | 4622 } |
4623 #endif | |
4624 } | |
4625 | |
5575 | 4626 static void oscar_remove_buddies(GaimConnection *gc, GList *buddies, const char *group) { |
4230 | 4627 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4628 #ifdef NOSSI | |
4629 GList *cur; | |
4630 for (cur=buddies; cur; cur=cur->next) | |
4631 aim_remove_buddy(od->sess, od->conn, cur->data); | |
4632 #else | |
4633 if (od->sess->ssi.received_data) { | |
3092 | 4634 while (buddies) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4635 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4636 "ssi: deleting buddy %s from group %s\n", (char *)buddies->data, group); |
4889 | 4637 aim_ssi_delbuddy(od->sess, buddies->data, group); |
3092 | 4638 buddies = buddies->next; |
4639 } | |
4230 | 4640 } |
4641 #endif | |
4642 } | |
4643 | |
4644 #ifndef NOSSI | |
5575 | 4645 static void oscar_move_buddy(GaimConnection *gc, const char *name, const char *old_group, const char *new_group) { |
4269 | 4646 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4303 | 4647 if (od->sess->ssi.received_data && strcmp(old_group, new_group)) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4648 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4649 "ssi: moving buddy %s from group %s to group %s\n", name, old_group, new_group); |
4889 | 4650 aim_ssi_movebuddy(od->sess, old_group, new_group, name); |
4269 | 4651 } |
4652 } | |
4653 | |
5575 | 4654 static void oscar_alias_buddy(GaimConnection *gc, const char *name, const char *alias) { |
4269 | 4655 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4656 if (od->sess->ssi.received_data) { | |
4657 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, name); | |
4658 if (gname) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4659 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4660 "ssi: changing the alias for buddy %s to %s\n", name, alias); |
4889 | 4661 aim_ssi_aliasbuddy(od->sess, gname, name, alias); |
4269 | 4662 } |
4663 } | |
4664 } | |
4665 | |
5575 | 4666 static void oscar_rename_group(GaimConnection *g, const char *old_group, const char *new_group, GList *members) { |
4230 | 4667 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
4668 | |
4669 if (od->sess->ssi.received_data) { | |
4670 if (aim_ssi_itemlist_finditem(od->sess->ssi.local, new_group, NULL, AIM_SSI_TYPE_GROUP)) { | |
4671 oscar_remove_buddies(g, members, old_group); | |
4672 oscar_add_buddies(g, members); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4673 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4674 "ssi: moved all buddies from group %s to %s\n", old_group, new_group); |
4230 | 4675 } else { |
4889 | 4676 aim_ssi_rename_group(od->sess, old_group, new_group); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4677 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4678 "ssi: renamed group %s to %s\n", old_group, new_group); |
2995 | 4679 } |
4680 } | |
4681 } | |
4682 | |
5968 | 4683 static gboolean gaim_ssi_rerequestdata(gpointer data) { |
4684 aim_session_t *sess = data; | |
6350 | 4685 aim_ssi_reqdata(sess); |
5968 | 4686 return FALSE; |
4687 } | |
4688 | |
4642 | 4689 static int gaim_ssi_parseerr(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4690 GaimConnection *gc = sess->aux_data; |
4642 | 4691 struct oscar_data *od = gc->proto_data; |
4692 va_list ap; | |
4693 fu16_t reason; | |
4694 | |
4695 va_start(ap, fr); | |
4696 reason = (fu16_t)va_arg(ap, unsigned int); | |
4697 va_end(ap); | |
4698 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4699 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: SNAC error %hu\n", reason); |
4642 | 4700 |
4701 if (reason == 0x0005) { | |
5892 | 4702 gaim_notify_error(gc, NULL, _("Unable To Retrieve Buddy List"), |
5828 | 4703 _("Gaim was temporarily unable to retrieve your buddy list from the AIM servers. Your buddy list is not lost, and will probably become available in a few hours.")); |
5968 | 4704 od->getblisttimer = g_timeout_add(300000, gaim_ssi_rerequestdata, od->sess); |
4642 | 4705 } |
4706 | |
4707 /* Activate SSI */ | |
4708 /* Sending the enable causes other people to be able to see you, and you to see them */ | |
4709 /* Make sure your privacy setting/invisibility is set how you want it before this! */ | |
5968 | 4710 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: activating server-stored buddy list\n"); |
4642 | 4711 aim_ssi_enable(od->sess); |
4712 | |
4713 return 1; | |
4714 } | |
4715 | |
2991 | 4716 static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 4717 GaimConnection *gc = sess->aux_data; |
4230 | 4718 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4719 int numtypes, i; | |
4720 fu16_t *maxitems; | |
2991 | 4721 va_list ap; |
4722 | |
4723 va_start(ap, fr); | |
4230 | 4724 numtypes = va_arg(ap, int); |
4725 maxitems = va_arg(ap, fu16_t *); | |
2991 | 4726 va_end(ap); |
4727 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4728 gaim_debug(GAIM_DEBUG_MISC, "oscar", "ssi rights:"); |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4729 |
4230 | 4730 for (i=0; i<numtypes; i++) |
5211
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4731 gaim_debug(GAIM_DEBUG_MISC, NULL, " max type 0x%04x=%hd,", |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4732 i, maxitems[i]); |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4733 |
0241d6b6702d
[gaim-migrate @ 5581]
Christian Hammond <chipx86@chipx86.com>
parents:
5208
diff
changeset
|
4734 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n"); |
4230 | 4735 |
4736 if (numtypes >= 0) | |
4737 od->rights.maxbuddies = maxitems[0]; | |
4738 if (numtypes >= 1) | |
4739 od->rights.maxgroups = maxitems[1]; | |
4740 if (numtypes >= 2) | |
4741 od->rights.maxpermits = maxitems[2]; | |
4742 if (numtypes >= 3) | |
4743 od->rights.maxdenies = maxitems[3]; | |
2991 | 4744 |
4745 return 1; | |
4746 } | |
4747 | |
4748 static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 4749 GaimConnection *gc = sess->aux_data; |
4750 GaimAccount *account = gaim_connection_get_account(gc); | |
4230 | 4751 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
2995 | 4752 struct aim_ssi_item *curitem; |
2991 | 4753 int tmp; |
4778 | 4754 gboolean export = FALSE; |
4617 | 4755 /* XXX - use these? |
4230 | 4756 va_list ap; |
4757 | |
4758 va_start(ap, fr); | |
4759 fmtver = (fu16_t)va_arg(ap, int); | |
4760 numitems = (fu16_t)va_arg(ap, int); | |
4761 items = va_arg(ap, struct aim_ssi_item); | |
4762 timestamp = va_arg(ap, fu32_t); | |
4763 va_end(ap); */ | |
2991 | 4764 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4765 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4766 "ssi: syncing local list and server list\n"); |
2991 | 4767 |
4768 /* Clean the buddy list */ | |
4889 | 4769 aim_ssi_cleanlist(sess); |
2991 | 4770 |
4771 /* Add from server list to local list */ | |
4230 | 4772 for (curitem=sess->ssi.local; curitem; curitem=curitem->next) { |
2991 | 4773 switch (curitem->type) { |
4230 | 4774 case 0x0000: { /* Buddy */ |
4251 | 4775 if (curitem->name) { |
4292 | 4776 char *gname = aim_ssi_itemlist_findparentname(sess->ssi.local, curitem->name); |
4458 | 4777 char *gname_utf8 = gaim_try_conv_to_utf8(gname); |
4282 | 4778 char *alias = aim_ssi_getalias(sess->ssi.local, gname, curitem->name); |
4458 | 4779 char *alias_utf8 = gaim_try_conv_to_utf8(alias); |
6695 | 4780 GaimBuddy *buddy = gaim_find_buddy(gc->account, curitem->name); |
4458 | 4781 /* Should gname be freed here? -- elb */ |
4754 | 4782 /* Not with the current code, but that might be cleaner -- med */ |
4458 | 4783 free(alias); |
4282 | 4784 if (buddy) { |
4292 | 4785 /* Get server stored alias */ |
4705 | 4786 if (alias_utf8) { |
4787 g_free(buddy->alias); | |
4788 buddy->alias = g_strdup(alias_utf8); | |
4789 } | |
4282 | 4790 } else { |
6695 | 4791 GaimGroup *g; |
4687 | 4792 buddy = gaim_buddy_new(gc->account, curitem->name, alias_utf8); |
5146 | 4793 |
4754 | 4794 if (!(g = gaim_find_group(gname_utf8 ? gname_utf8 : _("Orphans")))) { |
4687 | 4795 g = gaim_group_new(gname_utf8 ? gname_utf8 : _("Orphans")); |
4754 | 4796 gaim_blist_add_group(g, NULL); |
4797 } | |
5146 | 4798 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4799 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4800 "ssi: adding buddy %s to group %s to local list\n", curitem->name, gname_utf8 ? gname_utf8 : _("Orphans")); |
6695 | 4801 gaim_blist_add_buddy(buddy, NULL, g, NULL); |
4778 | 4802 export = TRUE; |
4251 | 4803 } |
4458 | 4804 free(gname_utf8); |
4805 free(alias_utf8); | |
2991 | 4806 } |
4230 | 4807 } break; |
4808 | |
4809 case 0x0001: { /* Group */ | |
4282 | 4810 /* Shouldn't add empty groups */ |
4230 | 4811 } break; |
4812 | |
4813 case 0x0002: { /* Permit buddy */ | |
2991 | 4814 if (curitem->name) { |
4230 | 4815 /* if (!find_permdeny_by_name(gc->permit, curitem->name)) { AAA */ |
2991 | 4816 GSList *list; |
5575 | 4817 for (list=account->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
2991 | 4818 if (!list) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4819 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4820 "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
|
4821 gaim_privacy_permit_add(account, curitem->name, TRUE); |
4778 | 4822 export = TRUE; |
2991 | 4823 } |
4824 } | |
4230 | 4825 } break; |
4826 | |
4827 case 0x0003: { /* Deny buddy */ | |
2991 | 4828 if (curitem->name) { |
4829 GSList *list; | |
5575 | 4830 for (list=account->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next); |
2991 | 4831 if (!list) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4832 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4833 "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
|
4834 gaim_privacy_deny_add(account, curitem->name, TRUE); |
4778 | 4835 export = TRUE; |
2991 | 4836 } |
4837 } | |
4230 | 4838 } break; |
4839 | |
4840 case 0x0004: { /* Permit/deny setting */ | |
2991 | 4841 if (curitem->data) { |
4842 fu8_t permdeny; | |
5575 | 4843 if ((permdeny = aim_ssi_getpermdeny(sess->ssi.local)) && (permdeny != account->perm_deny)) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4844 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
5575 | 4845 "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, permdeny); |
4846 account->perm_deny = permdeny; | |
4847 if (od->icq && account->perm_deny == 0x03) { | |
4342 | 4848 serv_set_away(gc, "Invisible", ""); |
4849 } | |
4778 | 4850 export = TRUE; |
2991 | 4851 } |
4852 } | |
4230 | 4853 } break; |
4854 | |
4855 case 0x0005: { /* Presence setting */ | |
3109 | 4856 /* We don't want to change Gaim's setting because it applies to all accounts */ |
4230 | 4857 } break; |
2991 | 4858 } /* End of switch on curitem->type */ |
4859 } /* End of for loop */ | |
4230 | 4860 |
4861 /* If changes were made, then flush buddy list to file */ | |
4778 | 4862 if (export) |
4349 | 4863 gaim_blist_save(); |
2991 | 4864 |
4759 | 4865 { /* Add from local list to server list */ |
6695 | 4866 GaimBlistNode *gnode, *cnode, *bnode; |
4867 GaimGroup *group; | |
4868 GaimBuddy *buddy; | |
4759 | 4869 struct gaim_buddy_list *blist; |
3017 | 4870 GSList *cur; |
4871 | |
2991 | 4872 /* Buddies */ |
4759 | 4873 if ((blist = gaim_get_blist())) |
4874 for (gnode = blist->root; gnode; gnode = gnode->next) { | |
5234 | 4875 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) |
4876 continue; | |
6695 | 4877 group = (GaimGroup *)gnode; |
4878 for (cnode = gnode->child; cnode; cnode = cnode->next) { | |
4879 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
5234 | 4880 continue; |
6695 | 4881 for (bnode = cnode->child; bnode; bnode = bnode->next) { |
4882 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
4883 continue; | |
4884 buddy = (GaimBuddy *)bnode; | |
4885 if (buddy->account == gc->account) { | |
4886 gchar *servernick = gaim_buddy_get_setting(buddy, "servernick"); | |
4887 if (servernick) { | |
4888 serv_got_alias(gc, buddy->name, servernick); | |
4889 g_free(servernick); | |
4890 } | |
4891 if (aim_ssi_itemlist_exists(sess->ssi.local, buddy->name)) { | |
4892 /* Store local alias on server */ | |
4893 char *alias = aim_ssi_getalias(sess->ssi.local, group->name, buddy->name); | |
4894 if (!alias && buddy->alias && strlen(buddy->alias)) | |
4895 aim_ssi_aliasbuddy(sess, group->name, buddy->name, buddy->alias); | |
4896 free(alias); | |
4897 } else { | |
4898 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
4899 "ssi: adding buddy %s from local list to server list\n", buddy->name); | |
4900 aim_ssi_addbuddy(sess, buddy->name, group->name, gaim_get_buddy_alias_only(buddy), NULL, NULL, 0); | |
4901 } | |
4759 | 4902 } |
4349 | 4903 } |
4230 | 4904 } |
4292 | 4905 } |
6695 | 4906 |
2991 | 4907 /* Permit list */ |
4491 | 4908 if (gc->account->permit) { |
4909 for (cur=gc->account->permit; cur; cur=cur->next) | |
4230 | 4910 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_PERMIT)) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4911 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
6695 | 4912 "ssi: adding permit %s from local list to server list\n", (char *)cur->data); |
4889 | 4913 aim_ssi_addpermit(sess, cur->data); |
4230 | 4914 } |
2991 | 4915 } |
4916 | |
4917 /* Deny list */ | |
4491 | 4918 if (gc->account->deny) { |
4919 for (cur=gc->account->deny; cur; cur=cur->next) | |
4230 | 4920 if (!aim_ssi_itemlist_finditem(sess->ssi.local, NULL, cur->data, AIM_SSI_TYPE_DENY)) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4921 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
6695 | 4922 "ssi: adding deny %s from local list to server list\n", (char *)cur->data); |
4889 | 4923 aim_ssi_adddeny(sess, cur->data); |
4230 | 4924 } |
2991 | 4925 } |
3109 | 4926 /* Presence settings (idle time visibility) */ |
4230 | 4927 if ((tmp = aim_ssi_getpresence(sess->ssi.local)) != 0xFFFFFFFF) |
5631 | 4928 if (!(tmp & 0x400)) |
4889 | 4929 aim_ssi_setpresence(sess, tmp | 0x400); |
4778 | 4930 } /* end adding buddies from local list to server list */ |
4931 | |
4901 | 4932 /* Set our ICQ status */ |
4933 if (od->icq && !gc->away) { | |
4934 aim_setextstatus(sess, AIM_ICQ_STATE_NORMAL); | |
4935 } | |
4936 | |
4342 | 4937 /* Activate SSI */ |
4938 /* Sending the enable causes other people to be able to see you, and you to see them */ | |
4939 /* Make sure your privacy setting/invisibility is set how you want it before this! */ | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4940 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4941 "ssi: activating server-stored buddy list\n"); |
4642 | 4942 aim_ssi_enable(sess); |
4342 | 4943 |
2991 | 4944 return 1; |
2086 | 4945 } |
4230 | 4946 |
4947 static int gaim_ssi_parseack(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 4948 GaimConnection *gc = sess->aux_data; |
4230 | 4949 va_list ap; |
4950 struct aim_ssi_tmp *retval; | |
4951 | |
4952 va_start(ap, fr); | |
4953 retval = va_arg(ap, struct aim_ssi_tmp *); | |
4954 va_end(ap); | |
4955 | |
4956 while (retval) { | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4957 gaim_debug(GAIM_DEBUG_MISC, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
4958 "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 | 4959 |
4960 if (retval->ack != 0xffff) | |
4961 switch (retval->ack) { | |
4962 case 0x0000: { /* added successfully */ | |
4963 } break; | |
4964 | |
4829 | 4965 case 0x000c: { /* you are over the limit, the cheat is to the limit, come on fhqwhgads */ |
4966 gchar *buf; | |
4967 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
|
4968 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
4829 | 4969 g_free(buf); |
4970 } | |
4971 | |
4230 | 4972 case 0x000e: { /* contact requires authorization */ |
4828 | 4973 if ((retval->action == AIM_CB_SSI_ADD) && (retval->name)) |
4269 | 4974 gaim_auth_sendrequest(gc, retval->name); |
4230 | 4975 } break; |
4976 | |
4977 default: { /* La la la */ | |
5197 | 4978 gchar *buf; |
5402 | 4979 gaim_debug(GAIM_DEBUG_ERROR, "oscar", "ssi: Action 0x%04hx was unsuccessful with error 0x%04hx\n", retval->action, retval->ack); |
4980 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
|
4981 gaim_notify_error(gc, NULL, _("Unable To Add"), buf); |
5197 | 4982 g_free(buf); |
5402 | 4983 /* XXX - Should remove buddy from local list */ |
4230 | 4984 } break; |
4985 } | |
4986 | |
4987 retval = retval->next; | |
4988 } | |
4989 | |
4990 return 1; | |
4991 } | |
4992 | |
4993 static int gaim_ssi_authgiven(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 4994 GaimConnection *gc = sess->aux_data; |
4230 | 4995 va_list ap; |
4996 char *sn, *msg; | |
4236 | 4997 gchar *dialog_msg, *nombre; |
4230 | 4998 struct name_data *data; |
6695 | 4999 GaimBuddy *buddy; |
4230 | 5000 |
5001 va_start(ap, fr); | |
5002 sn = va_arg(ap, char *); | |
5003 msg = va_arg(ap, char *); | |
5004 va_end(ap); | |
5005 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5006 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5007 "ssi: %s has given you permission to add him to your buddy list\n", sn); |
4230 | 5008 |
4687 | 5009 buddy = gaim_find_buddy(gc->account, sn); |
5010 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5011 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5012 else |
5013 nombre = g_strdup(sn); | |
5014 | |
5015 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 | 5016 data = g_new(struct name_data, 1); |
5017 data->gc = gc; | |
5018 data->name = g_strdup(sn); | |
5019 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5020 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5021 gaim_request_yes_no(gc, NULL, _("Authorization Given"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5022 0, data, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5023 G_CALLBACK(gaim_icq_contactadd), |
5836 | 5024 G_CALLBACK(oscar_free_name_data)); |
4236 | 5025 |
4230 | 5026 g_free(dialog_msg); |
4236 | 5027 g_free(nombre); |
4230 | 5028 |
5029 return 1; | |
5030 } | |
5031 | |
5032 static int gaim_ssi_authrequest(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5033 GaimConnection *gc = sess->aux_data; |
4230 | 5034 va_list ap; |
5035 char *sn, *msg; | |
4236 | 5036 gchar *dialog_msg, *nombre; |
4230 | 5037 struct name_data *data; |
6695 | 5038 GaimBuddy *buddy; |
4230 | 5039 |
5040 va_start(ap, fr); | |
5041 sn = va_arg(ap, char *); | |
5042 msg = va_arg(ap, char *); | |
5043 va_end(ap); | |
5044 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5045 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5046 "ssi: received authorization request from %s\n", sn); |
4230 | 5047 |
4687 | 5048 buddy = gaim_find_buddy(gc->account, sn); |
5049 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5050 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5051 else |
5052 nombre = g_strdup(sn); | |
5053 | |
4337 | 5054 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 | 5055 data = g_new(struct name_data, 1); |
5056 data->gc = gc; | |
5057 data->name = g_strdup(sn); | |
5058 data->nick = NULL; | |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5059 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5060 gaim_request_action(gc, NULL, _("Authorization Request"), dialog_msg, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5061 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5062 _("Authorize"), G_CALLBACK(gaim_auth_grant), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5063 _("Deny"), G_CALLBACK(gaim_auth_dontgrant_msgprompt)); |
4236 | 5064 |
4230 | 5065 g_free(dialog_msg); |
4236 | 5066 g_free(nombre); |
4230 | 5067 |
5068 return 1; | |
5069 } | |
5070 | |
5071 static int gaim_ssi_authreply(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5072 GaimConnection *gc = sess->aux_data; |
4230 | 5073 va_list ap; |
5074 char *sn, *msg; | |
4236 | 5075 gchar *dialog_msg, *nombre; |
4230 | 5076 fu8_t reply; |
6695 | 5077 GaimBuddy *buddy; |
4230 | 5078 |
5079 va_start(ap, fr); | |
5080 sn = va_arg(ap, char *); | |
5081 reply = (fu8_t)va_arg(ap, int); | |
5082 msg = va_arg(ap, char *); | |
5083 va_end(ap); | |
5084 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5085 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5086 "ssi: received authorization reply from %s. Reply is 0x%04hhx\n", sn, reply); |
4236 | 5087 |
4687 | 5088 buddy = gaim_find_buddy(gc->account, sn); |
5089 if (buddy && (gaim_get_buddy_alias_only(buddy))) | |
5090 nombre = g_strdup_printf("%s (%s)", sn, gaim_get_buddy_alias_only(buddy)); | |
4236 | 5091 else |
5092 nombre = g_strdup(sn); | |
5093 | |
4230 | 5094 if (reply) { |
5095 /* Granted */ | |
4236 | 5096 dialog_msg = g_strdup_printf(_("The user %s has granted your request to add them to your contact list."), nombre); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5097 gaim_notify_info(gc, NULL, _("Authorization Granted"), dialog_msg); |
4230 | 5098 } else { |
5099 /* Denied */ | |
4236 | 5100 dialog_msg = g_strdup_printf(_("The user %s has denied your request to add them to your contact list for the following reason:\n%s"), nombre, msg ? msg : _("No reason given.")); |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5101 gaim_notify_info(gc, NULL, _("Authorization Denied"), dialog_msg); |
4230 | 5102 } |
5103 g_free(dialog_msg); | |
4236 | 5104 g_free(nombre); |
4230 | 5105 |
5106 return 1; | |
5107 } | |
5108 | |
5109 static int gaim_ssi_gotadded(aim_session_t *sess, aim_frame_t *fr, ...) { | |
5575 | 5110 GaimConnection *gc = sess->aux_data; |
4230 | 5111 va_list ap; |
5112 char *sn; | |
6695 | 5113 GaimBuddy *buddy; |
4230 | 5114 |
5115 va_start(ap, fr); | |
5116 sn = va_arg(ap, char *); | |
5117 va_end(ap); | |
5118 | |
4687 | 5119 buddy = gaim_find_buddy(gc->account, sn); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5120 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5121 "ssi: %s added you to their buddy list\n", sn); |
4687 | 5122 show_got_added(gc, NULL, sn, (buddy ? gaim_get_buddy_alias_only(buddy) : NULL), NULL); |
4230 | 5123 |
5124 return 1; | |
5125 } | |
4269 | 5126 #endif |
2086 | 5127 |
5575 | 5128 static GList *oscar_chat_info(GaimConnection *gc) { |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5129 GList *m = NULL; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5130 struct proto_chat_entry *pce; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5131 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5132 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5133 pce->label = _("Join what group:"); |
5234 | 5134 pce->identifier = "room"; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5135 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5136 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5137 pce = g_new0(struct proto_chat_entry, 1); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5138 pce->label = _("Exchange:"); |
5234 | 5139 pce->identifier = "exchange"; |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5140 pce->is_int = TRUE; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5141 pce->min = 4; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5142 pce->max = 20; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5143 m = g_list_append(m, pce); |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5144 |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5145 return m; |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5146 } |
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5147 |
5575 | 5148 static void oscar_join_chat(GaimConnection *g, GHashTable *data) { |
4617 | 5149 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5150 aim_conn_t *cur; |
5234 | 5151 char *name, *exchange; |
5152 | |
5153 name = g_hash_table_lookup(data, "room"); | |
5154 exchange = g_hash_table_lookup(data, "exchange"); | |
2205
cff4fbe01c7b
[gaim-migrate @ 2215]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2197
diff
changeset
|
5155 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5156 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5157 "Attempting to join chat room %s.\n", name); |
4617 | 5158 if ((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) { |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5159 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5160 "chatnav exists, creating room\n"); |
5234 | 5161 aim_chatnav_createroom(od->sess, cur, name, atoi(exchange)); |
2086 | 5162 } else { |
5163 /* this gets tricky */ | |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
5164 struct create_room *cr = g_new0(struct create_room, 1); |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5165 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5166 "chatnav does not exist, opening chatnav\n"); |
5234 | 5167 cr->exchange = atoi(exchange); |
2822
744df95bf123
[gaim-migrate @ 2835]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2821
diff
changeset
|
5168 cr->name = g_strdup(name); |
4617 | 5169 od->create_rooms = g_slist_append(od->create_rooms, cr); |
5170 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV); | |
2086 | 5171 } |
5172 } | |
5173 | |
5575 | 5174 static void oscar_chat_invite(GaimConnection *g, int id, const char *message, const char *name) { |
4617 | 5175 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
2086 | 5176 struct chat_connection *ccon = find_oscar_chat(g, id); |
5177 | |
5178 if (!ccon) | |
5179 return; | |
5180 | |
4617 | 5181 aim_chat_invite(od->sess, od->conn, name, message ? message : "", |
2086 | 5182 ccon->exchange, ccon->name, 0x0); |
5183 } | |
5184 | |
5575 | 5185 static void oscar_chat_leave(GaimConnection *g, int id) { |
4617 | 5186 struct oscar_data *od = g ? (struct oscar_data *)g->proto_data : NULL; |
2086 | 5187 GSList *bcs = g->buddy_chats; |
5679 | 5188 GaimConversation *b = NULL; |
2086 | 5189 struct chat_connection *c = NULL; |
5190 int count = 0; | |
5191 | |
5192 while (bcs) { | |
5193 count++; | |
5679 | 5194 b = (GaimConversation *)bcs->data; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5195 if (id == gaim_chat_get_id(GAIM_CHAT(b))) |
2086 | 5196 break; |
5197 bcs = bcs->next; | |
5198 b = NULL; | |
5199 } | |
5200 | |
5201 if (!b) | |
5202 return; | |
5203 | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5204 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5205 "Attempting to leave room %s (currently in %d rooms)\n", b->name, count); |
2086 | 5206 |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5207 c = find_oscar_chat(g, gaim_chat_get_id(GAIM_CHAT(b))); |
2086 | 5208 if (c != NULL) { |
4617 | 5209 if (od) |
5210 od->oscar_chats = g_slist_remove(od->oscar_chats, c); | |
2086 | 5211 if (c->inpa > 0) |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
5212 gaim_input_remove(c->inpa); |
4617 | 5213 if (g && od->sess) |
5214 aim_conn_kill(od->sess, &c->conn); | |
2086 | 5215 g_free(c->name); |
5216 g_free(c->show); | |
5217 g_free(c); | |
5218 } | |
5219 /* we do this because with Oscar it doesn't tell us we left */ | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5220 serv_got_chat_left(g, gaim_chat_get_id(GAIM_CHAT(b))); |
2086 | 5221 } |
5222 | |
6059 | 5223 static int oscar_chat_send(GaimConnection *g, int id, const char *message) { |
4617 | 5224 struct oscar_data *od = (struct oscar_data *)g->proto_data; |
2086 | 5225 GSList *bcs = g->buddy_chats; |
5679 | 5226 GaimConversation *b = NULL; |
2086 | 5227 struct chat_connection *c = NULL; |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5228 char *buf, *buf2; |
2086 | 5229 int i, j; |
5230 | |
5231 while (bcs) { | |
5679 | 5232 b = (GaimConversation *)bcs->data; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4358
diff
changeset
|
5233 if (id == gaim_chat_get_id(GAIM_CHAT(b))) |
2086 | 5234 break; |
5235 bcs = bcs->next; | |
5236 b = NULL; | |
5237 } | |
5238 if (!b) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5239 return -EINVAL; |
2086 | 5240 |
4617 | 5241 bcs = od->oscar_chats; |
2086 | 5242 while (bcs) { |
5243 c = (struct chat_connection *)bcs->data; | |
5244 if (b == c->cnv) | |
5245 break; | |
5246 bcs = bcs->next; | |
5247 c = NULL; | |
5248 } | |
5249 if (!c) | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5250 return -EINVAL; |
2086 | 5251 |
5252 buf = g_malloc(strlen(message) * 4 + 1); | |
5253 for (i = 0, j = 0; i < strlen(message); i++) { | |
5254 if (message[i] == '\n') { | |
5255 buf[j++] = '<'; | |
5256 buf[j++] = 'B'; | |
5257 buf[j++] = 'R'; | |
5258 buf[j++] = '>'; | |
5259 } else { | |
5260 buf[j++] = message[i]; | |
5261 } | |
5262 } | |
5263 buf[j] = '\0'; | |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5264 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5265 if (strlen(buf) > c->maxlen) |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5266 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5267 |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5268 buf2 = strip_html(buf); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5269 if (strlen(buf2) > c->maxvis) { |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5270 g_free(buf2); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5271 return -E2BIG; |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5272 } |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5273 g_free(buf2); |
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5274 |
4617 | 5275 aim_chat_send_im(od->sess, c->conn, 0, buf, strlen(buf)); |
2086 | 5276 g_free(buf); |
2167
edf8c5a70e5b
[gaim-migrate @ 2177]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2162
diff
changeset
|
5277 return 0; |
2086 | 5278 } |
5279 | |
6695 | 5280 static const char *oscar_list_icon(GaimAccount *a, GaimBuddy *b) { |
4766 | 5281 if (!b || (b && b->name && b->name[0] == '+')) { |
5646
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
5282 if (a != NULL && isdigit(*gaim_account_get_username(a))) |
4687 | 5283 return "icq"; |
5284 else | |
5285 return "aim"; | |
5286 } | |
5646
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
5287 |
48c63ee49961
[gaim-migrate @ 6060]
Christian Hammond <chipx86@chipx86.com>
parents:
5638
diff
changeset
|
5288 if (b != NULL && isdigit(b->name[0])) |
4687 | 5289 return "icq"; |
5290 return "aim"; | |
5291 } | |
5292 | |
6695 | 5293 static void oscar_list_emblems(GaimBuddy *b, char **se, char **sw, char **nw, char **ne) |
4687 | 5294 { |
5295 char *emblems[4] = {NULL,NULL,NULL,NULL}; | |
5296 int i = 0; | |
5297 | |
5131 | 5298 if (!GAIM_BUDDY_IS_ONLINE(b)) { |
5575 | 5299 GaimAccount *account; |
5300 GaimConnection *gc; | |
5131 | 5301 struct oscar_data *od; |
5302 char *gname; | |
5303 if ((b->name) && (account = b->account) && (gc = account->gc) && | |
5304 (od = gc->proto_data) && (od->sess->ssi.received_data) && | |
5305 (gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name)) && | |
5306 (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name))) { | |
5307 emblems[i++] = "notauthorized"; | |
5308 } else { | |
5309 emblems[i++] = "offline"; | |
5310 } | |
5311 } | |
4916 | 5312 |
4766 | 5313 if (b->name && (b->uc & 0xffff0000) && isdigit(b->name[0])) { |
4960 | 5314 int uc = b->uc >> 16; |
4766 | 5315 if (uc & AIM_ICQ_STATE_INVISIBLE) |
4960 | 5316 emblems[i++] = "invisible"; |
4766 | 5317 else if (uc & AIM_ICQ_STATE_CHAT) |
4960 | 5318 emblems[i++] = "freeforchat"; |
4766 | 5319 else if (uc & AIM_ICQ_STATE_DND) |
4960 | 5320 emblems[i++] = "dnd"; |
4766 | 5321 else if (uc & AIM_ICQ_STATE_OUT) |
4960 | 5322 emblems[i++] = "na"; |
4766 | 5323 else if (uc & AIM_ICQ_STATE_BUSY) |
4960 | 5324 emblems[i++] = "occupied"; |
4766 | 5325 else if (uc & AIM_ICQ_STATE_AWAY) |
5326 emblems[i++] = "away"; | |
5327 } else { | |
5328 if (b->uc & UC_UNAVAILABLE) | |
5329 emblems[i++] = "away"; | |
5330 } | |
4687 | 5331 if (b->uc & UC_WIRELESS) |
5332 emblems[i++] = "wireless"; | |
5333 if (b->uc & UC_AOL) | |
5334 emblems[i++] = "aol"; | |
5335 if (b->uc & UC_ADMIN) | |
5336 emblems[i++] = "admin"; | |
5337 if (b->uc & UC_AB && i < 4) | |
5338 emblems[i++] = "activebuddy"; | |
6318 | 5339 if (b->uc & UC_HIPTOP && i < 4) |
5340 emblems[i++] = "hiptop"; | |
4766 | 5341 /* if (b->uc & UC_UNCONFIRMED && i < 4) |
5342 emblems[i++] = "unconfirmed"; */ | |
4687 | 5343 *se = emblems[0]; |
5344 *sw = emblems[1]; | |
5345 *nw = emblems[2]; | |
5346 *ne = emblems[3]; | |
5347 } | |
5348 | |
6695 | 5349 static char *oscar_tooltip_text(GaimBuddy *b) { |
5575 | 5350 GaimConnection *gc = b->account->gc; |
5131 | 5351 struct oscar_data *od = gc->proto_data; |
5352 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name)); | |
7011 | 5353 aim_userinfo_t *userinfo = aim_locate_finduserinfo(b->name); |
5354 gchar *tmp = NULL, *ret = g_strdup(""); | |
5131 | 5355 |
5356 if (GAIM_BUDDY_IS_ONLINE(b)) { | |
5357 if (isdigit(b->name[0])) { | |
7011 | 5358 char *status; |
5131 | 5359 status = gaim_icq_status((b->uc & 0xffff0000) >> 16); |
7011 | 5360 tmp = ret; |
5361 ret = g_strconcat(tmp, _("<b>Status:</b> "), status, "\n", NULL); | |
5131 | 5362 g_free(tmp); |
5363 g_free(status); | |
5364 } | |
5365 | |
7011 | 5366 if (userinfo != NULL) { |
5367 char *tstr = sec_to_text(time(NULL) - userinfo->onlinesince + | |
5131 | 5368 (gc->login_time_official ? gc->login_time_official - gc->login_time : 0)); |
7011 | 5369 tmp = ret; |
5370 ret = g_strconcat(tmp, _("<b>Logged In:</b> "), tstr, "\n", NULL); | |
5371 free(tmp); | |
5372 free(tstr); | |
5373 } | |
5374 | |
5375 if ((bi != NULL) && (bi->ipaddr)) { | |
5376 char *tstr = g_strdup_printf("%hhd.%hhd.%hhd.%hhd", | |
5377 (bi->ipaddr & 0xff000000) >> 24, | |
5378 (bi->ipaddr & 0x00ff0000) >> 16, | |
5379 (bi->ipaddr & 0x0000ff00) >> 8, | |
5380 (bi->ipaddr & 0x000000ff)); | |
5381 tmp = ret; | |
5382 ret = g_strconcat(tmp, _("<b>IP Address:</b> "), tstr, "\n", NULL); | |
5131 | 5383 free(tmp); |
5384 free(tstr); | |
7011 | 5385 } |
5386 | |
5387 if ((userinfo != NULL) && (userinfo->capabilities)) { | |
5388 char *caps = caps_string(userinfo->capabilities); | |
5389 tmp = ret; | |
5390 ret = g_strconcat(tmp, _("<b>Capabilities:</b> "), caps, "\n", NULL); | |
5391 free(tmp); | |
5392 } | |
5393 | |
5394 if ((bi != NULL) && (bi->availmsg != NULL) && !(b->uc & UC_UNAVAILABLE)) { | |
5395 gchar *escaped = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg)); | |
5396 tmp = ret; | |
5397 ret = g_strconcat(tmp, _("<b>Available:</b> "), escaped, "\n", NULL); | |
5398 free(tmp); | |
5399 g_free(escaped); | |
5400 } | |
5401 | |
5402 if ((userinfo != NULL) && (userinfo->flags & AIM_FLAG_AWAY) && (userinfo->away_len > 0) && (userinfo->away != NULL) && (userinfo->away_encoding != NULL)) { | |
5403 gchar *away_utf8 = oscar_encoding_to_utf8(userinfo->away_encoding, userinfo->away, userinfo->away_len); | |
5404 if (away_utf8 != NULL) { | |
5405 gchar *withcr, *nohtml; | |
5406 withcr = gaim_strreplace(away_utf8, "<BR>", "\n"); | |
5407 nohtml = strip_html(withcr); | |
5408 g_free(withcr); | |
5409 tmp = ret; | |
5410 ret = g_strconcat(tmp, _("<b>Away Message:</b> "), nohtml, "\n", NULL); | |
6857 | 5411 free(tmp); |
7011 | 5412 g_free(nohtml); |
5413 g_free(away_utf8); | |
5836 | 5414 } |
5131 | 5415 } |
5416 } else { | |
5417 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); | |
5418 if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) { | |
7011 | 5419 tmp = ret; |
5420 ret = g_strconcat(tmp, _("<b>Status:</b> Not Authorized"), "\n", NULL); | |
5131 | 5421 g_free(tmp); |
5422 } else { | |
7011 | 5423 tmp = ret; |
5424 ret = g_strconcat(tmp, _("<b>Status:</b> Offline"), "\n", NULL); | |
5131 | 5425 g_free(tmp); |
5426 } | |
5427 } | |
5428 | |
5429 /* remove the trailing newline character */ | |
7011 | 5430 if (ret) |
5431 ret[strlen(ret)-1] = '\0'; | |
5432 return ret; | |
5131 | 5433 } |
5434 | |
6695 | 5435 static char *oscar_status_text(GaimBuddy *b) { |
5575 | 5436 GaimConnection *gc = b->account->gc; |
5167 | 5437 struct oscar_data *od = gc->proto_data; |
5438 gchar *ret = NULL; | |
5439 | |
5440 if ((b->uc & UC_UNAVAILABLE) || (((b->uc & 0xffff0000) >> 16) & AIM_ICQ_STATE_CHAT)) { | |
5441 if (isdigit(b->name[0])) | |
5442 ret = gaim_icq_status((b->uc & 0xffff0000) >> 16); | |
5443 else | |
5444 ret = g_strdup(_("Away")); | |
5836 | 5445 } else if (GAIM_BUDDY_IS_ONLINE(b)) { |
5446 struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name)); | |
6292 | 5447 if (bi->availmsg) |
5448 ret = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg)); | |
5836 | 5449 } else { |
5167 | 5450 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); |
5451 if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) | |
5452 ret = g_strdup(_("Not Authorized")); | |
5453 else | |
5454 ret = g_strdup(_("Offline")); | |
5455 } | |
5456 | |
5457 return ret; | |
5458 } | |
5459 | |
5842 | 5460 |
5844 | 5461 static int oscar_icon_req(aim_session_t *sess, aim_frame_t *fr, ...) { |
5842 | 5462 GaimConnection *gc = sess->aux_data; |
5463 struct oscar_data *od = gc->proto_data; | |
5892 | 5464 va_list ap; |
5842 | 5465 fu16_t type; |
5892 | 5466 fu8_t flags = 0, length = 0; |
5467 char *md5 = NULL; | |
5468 | |
5842 | 5469 va_start(ap, fr); |
5470 type = va_arg(ap, int); | |
5892 | 5471 |
5472 switch(type) { | |
5473 case 0x0000: | |
5474 case 0x0001: { | |
5475 flags = va_arg(ap, int); | |
5476 length = va_arg(ap, int); | |
5477 md5 = va_arg(ap, char *); | |
5478 | |
5479 if (flags == 0x41) { | |
5480 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_ICON) && !od->iconconnecting) { | |
5481 od->iconconnecting = TRUE; | |
5482 od->set_icon = TRUE; | |
5483 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_ICON); | |
5484 } else { | |
6039 | 5485 struct stat st; |
5486 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); | |
5487 if (iconfile == NULL) { | |
5488 /* Set an empty icon, or something */ | |
5489 } else if (!stat(iconfile, &st)) { | |
5490 char *buf = g_malloc(st.st_size); | |
5491 FILE *file = fopen(iconfile, "rb"); | |
5492 if (file) { | |
5493 fread(buf, 1, st.st_size, file); | |
5494 fclose(file); | |
5495 gaim_debug(GAIM_DEBUG_INFO, "oscar", | |
5496 "Uploading icon to icon server\n"); | |
6879 | 5497 aim_bart_upload(od->sess, buf, st.st_size); |
5892 | 5498 } else |
5499 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
6039 | 5500 "Can't open buddy icon file!\n"); |
5501 g_free(buf); | |
5502 } else { | |
5503 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
5504 "Can't stat buddy icon file!\n"); | |
5892 | 5505 } |
5506 } | |
5893 | 5507 } else if (flags == 0x81) |
5508 aim_ssi_seticon(od->sess, md5, length); | |
5892 | 5509 } break; |
5510 | |
5511 case 0x0002: { /* We just set an "available" message? */ | |
5512 } break; | |
5513 } | |
5514 | |
5842 | 5515 va_end(ap); |
5844 | 5516 |
5517 return 0; | |
5842 | 5518 } |
5892 | 5519 |
3952 | 5520 /* |
4617 | 5521 * We have just established a socket with the other dude, so set up some handlers. |
3952 | 5522 */ |
4617 | 5523 static int gaim_odc_initiate(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5524 GaimConnection *gc = sess->aux_data; |
2086 | 5525 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5679 | 5526 GaimConversation *cnv; |
2086 | 5527 struct direct_im *dim; |
5528 char buf[256]; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5529 char *sn; |
4617 | 5530 va_list ap; |
5531 aim_conn_t *newconn, *listenerconn; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5532 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5533 va_start(ap, fr); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5534 newconn = va_arg(ap, aim_conn_t *); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5535 listenerconn = va_arg(ap, aim_conn_t *); |
2086 | 5536 va_end(ap); |
5537 | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5538 aim_conn_close(listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5539 aim_conn_kill(sess, &listenerconn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5540 |
4617 | 5541 sn = g_strdup(aim_odc_getsn(newconn)); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5542 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5543 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5544 "DirectIM: initiate success to %s\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5545 dim = find_direct_im(od, sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5546 |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
5547 cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, sn); |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
5548 gaim_input_remove(dim->watcher); |
2086 | 5549 dim->conn = newconn; |
4617 | 5550 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn); |
3008 | 5551 dim->connected = TRUE; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5552 g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), sn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5553 g_free(sn); |
6982 | 5554 gaim_conversation_write(cnv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); |
2086 | 5555 |
4617 | 5556 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, gaim_odc_incoming, 0); |
5557 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMTYPING, gaim_odc_typing, 0); | |
6982 | 5558 aim_conn_addhandler(sess, newconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_IMAGETRANSFER, gaim_odc_update_ui, 0); |
4617 | 5559 |
2993 | 5560 return 1; |
5561 } | |
5562 | |
6982 | 5563 /* |
5564 * This is called when each chunk of an image is received. It can be used to | |
5565 * update a progress bar, or to eat lots of dry cat food. Wet cat food is | |
5566 * nasty, you sicko. | |
5567 */ | |
5568 static int gaim_odc_update_ui(aim_session_t *sess, aim_frame_t *fr, ...) { | |
2993 | 5569 va_list ap; |
5570 char *sn; | |
5571 double percent; | |
5575 | 5572 GaimConnection *gc = sess->aux_data; |
2993 | 5573 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5679 | 5574 GaimConversation *c; |
2993 | 5575 struct direct_im *dim; |
5576 | |
5577 va_start(ap, fr); | |
5578 sn = va_arg(ap, char *); | |
5579 percent = va_arg(ap, double); | |
5580 va_end(ap); | |
6873 | 5581 |
2994 | 5582 if (!(dim = find_direct_im(od, sn))) |
5583 return 1; | |
3059 | 5584 if (dim->watcher) { |
5585 gaim_input_remove(dim->watcher); /* Otherwise, the callback will callback */ | |
5586 dim->watcher = 0; | |
5587 } | |
6982 | 5588 /* XXX is this really necessary? */ |
3044 | 5589 while (gtk_events_pending()) |
5590 gtk_main_iteration(); | |
6640
314111e7b601
[gaim-migrate @ 7165]
Christian Hammond <chipx86@chipx86.com>
parents:
6623
diff
changeset
|
5591 |
6982 | 5592 c = gaim_find_conversation_with_account(sn, gaim_connection_get_account(gc)); |
6873 | 5593 if (c != NULL) |
5594 gaim_conversation_update_progress(c, percent); | |
2993 | 5595 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
5596 oscar_callback, dim->conn); | |
2086 | 5597 |
5598 return 1; | |
5599 } | |
5600 | |
6982 | 5601 /* |
5602 * This is called after a direct IM has been received in its entirety. This | |
5603 * function is passed a long chunk of data which contains the IM with any | |
5604 * data chunks (images) appended to it. | |
5605 * | |
5606 * This function rips out all the data chunks and creates an imgstore for | |
5607 * each one. In order to do this, it first goes through the IM and takes | |
5608 * out all the IMG tags. When doing so, it rewrites the original IMG tag | |
5609 * with one compatable with the imgstore Gaim core code. For each one, we | |
5610 * then read in chunks of data from the end of the message and actually | |
5611 * create the img store using the given data. | |
5612 * | |
5613 * For somewhat easy reference, here's a sample message | |
5614 * (without the whitespace and asterisks): | |
5615 * | |
5616 * <HTML><BODY BGCOLOR="#ffffff"> | |
5617 * <FONT LANG="0"> | |
5618 * This is a really stupid picture:<BR> | |
5619 * <IMG SRC="Sample.jpg" ID="1" WIDTH="283" HEIGHT="212" DATASIZE="9894"><BR> | |
5620 * Yeah it is<BR> | |
5621 * Here is another one:<BR> | |
5622 * <IMG SRC="Soap Bubbles.bmp" ID="2" WIDTH="256" HEIGHT="256" DATASIZE="65978"> | |
5623 * </FONT> | |
5624 * </BODY></HTML> | |
5625 * <BINARY> | |
5626 * <DATA ID="1" SIZE="9894">datadatadatadata</DATA> | |
5627 * <DATA ID="2" SIZE="65978">datadatadatadata</DATA> | |
5628 * </BINARY> | |
5629 */ | |
4617 | 5630 static int gaim_odc_incoming(aim_session_t *sess, aim_frame_t *fr, ...) { |
5575 | 5631 GaimConnection *gc = sess->aux_data; |
6622 | 5632 GaimImFlags imflags = 0; |
6982 | 5633 GString *newmsg = g_string_new(""); |
5634 GSList *images = NULL; | |
2086 | 5635 va_list ap; |
6982 | 5636 const char *sn, *msg, *msgend, *binary; |
5637 size_t len; | |
5638 int encoding, isawaymsg; | |
2086 | 5639 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5640 va_start(ap, fr); |
6982 | 5641 sn = va_arg(ap, const char *); |
5642 msg = va_arg(ap, const char *); | |
5643 len = va_arg(ap, size_t); | |
3952 | 5644 encoding = va_arg(ap, int); |
4870 | 5645 isawaymsg = va_arg(ap, int); |
2086 | 5646 va_end(ap); |
6982 | 5647 msgend = msg + len; |
2086 | 5648 |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5649 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5650 "Got DirectIM message from %s\n", sn); |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5651 |
4870 | 5652 if (isawaymsg) |
6622 | 5653 imflags |= GAIM_IM_AUTO_RESP; |
4870 | 5654 |
6982 | 5655 /* message has a binary trailer */ |
5656 if ((binary = gaim_strcasestr(msg, "<binary>"))) { | |
5657 GData *attribs; | |
5658 const char *tmp, *start, *end, *last = NULL; | |
5659 | |
5660 tmp = msg; | |
5661 | |
5662 /* for each valid image tag... */ | |
5663 while (gaim_markup_find_tag("img", tmp, &start, &end, &attribs)) { | |
5664 const char *id, *src, *datasize; | |
5665 const char *tag = NULL, *data = NULL; | |
5666 size_t size; | |
5667 int imgid = 0; | |
5668 | |
5669 /* update the location of the last img tag */ | |
5670 last = end; | |
5671 | |
5672 /* grab attributes */ | |
5673 id = g_datalist_get_data(&attribs, "id"); | |
5674 src = g_datalist_get_data(&attribs, "src"); | |
5675 datasize = g_datalist_get_data(&attribs, "datasize"); | |
5676 | |
5677 /* if we have id & datasize, build the data tag */ | |
5678 if (id && datasize) | |
5679 tag = g_strdup_printf("<data id=\"%s\" size=\"%s\">", id, datasize); | |
5680 | |
5681 /* if we have a tag, find the start of the data */ | |
5682 if (tag && (data = gaim_strcasestr(binary, tag))) | |
5683 data += strlen(tag); | |
5684 | |
5685 /* check the data is here and store it */ | |
5686 if (data + (size = atoi(datasize)) <= msgend) | |
5687 imgid = gaim_imgstore_add(data, size, src); | |
5688 | |
5689 /* if we have a stored image... */ | |
5690 if (imgid) { | |
5691 /* append the message up to the tag */ | |
5692 newmsg = g_string_append_len(newmsg, tmp, start - tmp); | |
5693 | |
5694 /* write the new image tag */ | |
5695 g_string_append_printf(newmsg, "<IMG ID=\"%d\">", imgid); | |
5696 | |
5697 /* and record the image number */ | |
5698 images = g_slist_append(images, GINT_TO_POINTER(imgid)); | |
5699 } else { | |
5700 /* otherwise, copy up to the end of the tag */ | |
5701 newmsg = g_string_append_len(newmsg, tmp, (end + 1) - tmp); | |
5702 } | |
5703 | |
5704 /* clear the attribute list */ | |
5705 g_datalist_clear(&attribs); | |
5706 | |
5707 /* continue from the end of the tag */ | |
5708 tmp = end + 1; | |
5709 } | |
5710 | |
5711 /* append any remaining message data (without the > :-) */ | |
5712 if (last++ && (last < binary)) | |
5713 newmsg = g_string_append_len(newmsg, last, binary - last); | |
5714 | |
5715 /* set the flag if we caught any images */ | |
5716 if (images) | |
5717 imflags |= GAIM_IM_IMAGES; | |
5718 } else { | |
5719 g_string_append_len(newmsg, msg, len); | |
5720 } | |
5721 | |
4617 | 5722 /* XXX - I imagine Paco-Paco will want to do some voodoo with the encoding here */ |
6982 | 5723 serv_got_im(gc, sn, newmsg->str, imflags, time(NULL)); |
5724 | |
5725 /* free up the message */ | |
5726 g_string_free(newmsg, TRUE); | |
5727 | |
5728 /* unref any images we allocated */ | |
5729 if (images) { | |
5730 GSList *tmp; | |
5731 int id; | |
5732 | |
5733 for (tmp = images; tmp != NULL; tmp = tmp->next) { | |
5734 id = GPOINTER_TO_INT(tmp->data); | |
5735 gaim_imgstore_unref(id); | |
5736 } | |
5737 | |
5738 g_slist_free(images); | |
5739 } | |
2086 | 5740 |
5741 return 1; | |
5742 } | |
5743 | |
4617 | 5744 static int gaim_odc_typing(aim_session_t *sess, aim_frame_t *fr, ...) { |
2086 | 5745 va_list ap; |
5746 char *sn; | |
2993 | 5747 int typing; |
5575 | 5748 GaimConnection *gc = sess->aux_data; |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5749 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
5750 va_start(ap, fr); |
2086 | 5751 sn = va_arg(ap, char *); |
2993 | 5752 typing = va_arg(ap, int); |
2086 | 5753 va_end(ap); |
5754 | |
4870 | 5755 if (typing == 0x0002) { |
2993 | 5756 /* I had to leave this. It's just too funny. It reminds me of my sister. */ |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5757 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5758 "ohmigod! %s has started typing (DirectIM). He's going to send you a message! *squeal*\n", sn); |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
5759 serv_got_typing(gc, sn, 0, GAIM_TYPING); |
4870 | 5760 } else if (typing == 0x0001) |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5868
diff
changeset
|
5761 serv_got_typing(gc, sn, 0, GAIM_TYPED); |
4870 | 5762 else |
4342 | 5763 serv_got_typing_stopped(gc, sn); |
2086 | 5764 return 1; |
5765 } | |
5766 | |
6982 | 5767 static int gaim_odc_send_im(aim_session_t *sess, aim_conn_t *conn, const char *message, GaimImFlags imflags) { |
5768 char *buf; | |
5769 size_t len; | |
5770 int ret; | |
5771 | |
5772 if (imflags & GAIM_IM_IMAGES) { | |
5773 GString *msg = g_string_new(""); | |
5774 GString *data = g_string_new("<BINARY>"); | |
5775 GData *attribs; | |
5776 const char *tmp, *start, *end, *last = NULL; | |
5777 int oscar_id = 0; | |
5778 | |
5779 tmp = message; | |
5780 | |
5781 /* for each valid IMG tag... */ | |
5782 while (gaim_markup_find_tag("img", tmp, &start, &end, &attribs)) { | |
5783 GaimStoredImage *image = NULL; | |
5784 const char *id; | |
5785 | |
5786 last = end; | |
5787 id = g_datalist_get_data(&attribs, "id"); | |
5788 | |
5789 /* ... if it refers to a valid gaim image ... */ | |
5790 if (id && (image = gaim_imgstore_get(atoi(id)))) { | |
5791 /* ... append the message from start to the tag ... */ | |
5792 msg = g_string_append_len(msg, tmp, start - tmp); | |
5793 oscar_id++; | |
5794 | |
5795 /* ... insert a new img tag with the oscar id ... */ | |
5796 if (image->filename) | |
5797 g_string_append_printf(msg, | |
5798 "<IMG SRC=\"file://%s\" ID=\"%d\" DATASIZE=\"%d\">", | |
5799 image->filename, oscar_id, image->size); | |
5800 else | |
5801 g_string_append_printf(msg, | |
5802 "<IMG ID=\"%d\" DATASIZE=\"%d\">", | |
5803 oscar_id, image->size); | |
5804 | |
5805 /* ... and append the data to the binary section ... */ | |
5806 g_string_append_printf(data, "<DATA ID=\"%d\" SIZE=\"%d\">", | |
5807 oscar_id, image->size); | |
5808 data = g_string_append_len(data, image->data, image->size); | |
5809 data = g_string_append(data, "</DATA>"); | |
5810 } else { | |
5811 /* ... otherwise, allow the possibly invalid img tag through. */ | |
5812 /* should we do something else? */ | |
5813 msg = g_string_append_len(msg, tmp, (end + 1) - tmp); | |
5814 } | |
5815 | |
5816 g_datalist_clear(&attribs); | |
5817 | |
5818 /* continue from the end of the tag */ | |
5819 tmp = end + 1; | |
5820 } | |
5821 | |
5822 /* append any remaining message data (without the > :-) */ | |
5823 if (last++ && *last) | |
5824 msg = g_string_append(msg, last); | |
5825 | |
5826 /* if we inserted any images in the binary section, append it */ | |
5827 if (oscar_id) { | |
5828 msg = g_string_append_len(msg, data->str, data->len); | |
5829 msg = g_string_append(msg, "</BINARY>"); | |
5830 } | |
5831 | |
5832 len = msg->len; | |
5833 buf = msg->str; | |
5834 g_string_free(msg, FALSE); | |
5835 g_string_free(data, TRUE); | |
5836 } else { | |
5837 len = strlen(message); | |
5838 buf = g_memdup(message, len+1); | |
5839 } | |
5840 | |
5841 /* XXX - The last parameter below is the encoding. Let Paco-Paco do something with it. */ | |
5842 if (imflags & GAIM_IM_AUTO_RESP) | |
5843 ret = aim_odc_send_im(sess, conn, buf, len, 0, 1); | |
5844 else | |
5845 ret = aim_odc_send_im(sess, conn, buf, len, 0, 0); | |
5846 | |
5847 g_free(buf); | |
5848 | |
5849 return ret; | |
5850 } | |
5851 | |
2086 | 5852 struct ask_do_dir_im { |
5853 char *who; | |
5575 | 5854 GaimConnection *gc; |
2086 | 5855 }; |
5856 | |
3730 | 5857 static void oscar_cancel_direct_im(struct ask_do_dir_im *data) { |
5136 | 5858 g_free(data->who); |
2086 | 5859 g_free(data); |
5860 } | |
5861 | |
3730 | 5862 static void oscar_direct_im(struct ask_do_dir_im *data) { |
5575 | 5863 GaimConnection *gc = data->gc; |
4244 | 5864 struct oscar_data *od; |
2086 | 5865 struct direct_im *dim; |
5866 | |
5580
86456ec3ca25
[gaim-migrate @ 5984]
Christian Hammond <chipx86@chipx86.com>
parents:
5579
diff
changeset
|
5867 if (!g_list_find(gaim_connections_get_all(), gc)) { |
5136 | 5868 g_free(data->who); |
4244 | 5869 g_free(data); |
5870 return; | |
5871 } | |
5872 | |
5873 od = (struct oscar_data *)gc->proto_data; | |
5874 | |
2086 | 5875 dim = find_direct_im(od, data->who); |
5876 if (dim) { | |
3008 | 5877 if (!(dim->connected)) { /* We'll free the old, unconnected dim, and start over */ |
5878 od->direct_ims = g_slist_remove(od->direct_ims, dim); | |
5879 gaim_input_remove(dim->watcher); | |
5880 g_free(dim); | |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5881 gaim_debug(GAIM_DEBUG_INFO, "oscar", |
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5882 "Gave up on old direct IM, trying again\n"); |
3008 | 5883 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5884 gaim_notify_error(gc, NULL, "DirectIM already open.", NULL); |
5136 | 5885 g_free(data->who); |
4244 | 5886 g_free(data); |
3008 | 5887 return; |
5888 } | |
2086 | 5889 } |
5890 dim = g_new0(struct direct_im, 1); | |
5891 dim->gc = gc; | |
5892 g_snprintf(dim->name, sizeof dim->name, "%s", data->who); | |
5893 | |
4617 | 5894 dim->conn = aim_odc_initiate(od->sess, data->who); |
2086 | 5895 if (dim->conn != NULL) { |
5896 od->direct_ims = g_slist_append(od->direct_ims, dim); | |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
5897 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, |
2086 | 5898 oscar_callback, dim->conn); |
4617 | 5899 aim_conn_addhandler(od->sess, dim->conn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIM_ESTABLISHED, |
5900 gaim_odc_initiate, 0); | |
2086 | 5901 } else { |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
5902 gaim_notify_error(gc, NULL, _("Unable to open Direct IM"), NULL); |
2086 | 5903 g_free(dim); |
5904 } | |
4244 | 5905 |
5136 | 5906 g_free(data->who); |
4244 | 5907 g_free(data); |
2086 | 5908 } |
5909 | |
5575 | 5910 static void oscar_ask_direct_im(GaimConnection *gc, const char *who) { |
5420 | 5911 gchar *buf; |
2086 | 5912 struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1); |
5136 | 5913 data->who = g_strdup(who); |
2170
c24595d3c364
[gaim-migrate @ 2180]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2167
diff
changeset
|
5914 data->gc = gc; |
5420 | 5915 buf = g_strdup_printf(_("You have selected to open a Direct IM connection with %s."), who); |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5916 |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5917 gaim_request_action(gc, NULL, buf, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5918 _("Because this reveals your IP address, it " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5919 "may be considered a privacy risk. Do you " |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5920 "wish to continue?"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5921 0, data, 2, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5922 _("Connect"), G_CALLBACK(oscar_direct_im), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5497
diff
changeset
|
5923 _("Cancel"), G_CALLBACK(oscar_cancel_direct_im)); |
5420 | 5924 g_free(buf); |
2086 | 5925 } |
5926 | |
5575 | 5927 static void oscar_set_permit_deny(GaimConnection *gc) { |
5928 GaimAccount *account = gaim_connection_get_account(gc); | |
2086 | 5929 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
4230 | 5930 #ifdef NOSSI |
4770 | 5931 GSList *list, *g = gaim_blist_groups(), *g1; |
4230 | 5932 char buf[MAXMSGLEN]; |
5933 int at; | |
5934 | |
5575 | 5935 switch(account->perm_deny) { |
4687 | 5936 case 1: |
5575 | 5937 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, gaim_account_get_username(account)); |
4230 | 5938 break; |
5939 case 2: | |
5575 | 5940 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, gaim_account_get_username(account)); |
4230 | 5941 break; |
5942 case 3: | |
5575 | 5943 list = account->permit; |
4230 | 5944 at = 0; |
5945 while (list) { | |
5946 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
5947 list = list->next; | |
5948 } | |
5949 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); | |
5950 break; | |
5951 case 4: | |
5575 | 5952 list = account->deny; |
4230 | 5953 at = 0; |
5954 while (list) { | |
5955 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", (char *)list->data); | |
5956 list = list->next; | |
5957 } | |
5958 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_DENYADD, buf); | |
5959 break; | |
5960 case 5: | |
4770 | 5961 g1 = g; |
4230 | 5962 at = 0; |
4770 | 5963 while (g1) { |
5964 list = gaim_blist_members((struct group *)g->data); | |
5965 GSList list1 = list; | |
5966 while (list1) { | |
5967 struct buddy *b = list1->data; | |
5575 | 5968 if(b->account == account) |
4349 | 5969 at += g_snprintf(buf + at, sizeof(buf) - at, "%s&", b->name); |
4770 | 5970 list1 = list1->next; |
2995 | 5971 } |
4770 | 5972 g_slist_free(list); |
5973 g1 = g1->next; | |
4349 | 5974 } |
4770 | 5975 g_slist_free(g); |
4230 | 5976 aim_bos_changevisibility(od->sess, od->conn, AIM_VISIBILITYCHANGE_PERMITADD, buf); |
5977 break; | |
5978 default: | |
5979 break; | |
2086 | 5980 } |
4230 | 5981 signoff_blocked(gc); |
5982 #else | |
5983 if (od->sess->ssi.received_data) | |
5575 | 5984 aim_ssi_setpermdeny(od->sess, account->perm_deny, 0xffffffff); |
4230 | 5985 #endif |
2086 | 5986 } |
5987 | |
5575 | 5988 static void oscar_add_permit(GaimConnection *gc, const char *who) { |
4269 | 5989 #ifdef NOSSI |
4491 | 5990 if (gc->account->permdeny == 3) |
4269 | 5991 oscar_set_permit_deny(gc); |
5992 #else | |
2991 | 5993 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
5994 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a permit\n"); |
4230 | 5995 if (od->sess->ssi.received_data) |
4889 | 5996 aim_ssi_addpermit(od->sess, who); |
4230 | 5997 #endif |
2086 | 5998 } |
5999 | |
5575 | 6000 static void oscar_add_deny(GaimConnection *gc, const char *who) { |
4269 | 6001 #ifdef NOSSI |
4491 | 6002 if (gc->account->permdeny == 4) |
4269 | 6003 oscar_set_permit_deny(gc); |
6004 #else | |
2991 | 6005 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6006 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to add a deny\n"); |
4230 | 6007 if (od->sess->ssi.received_data) |
4889 | 6008 aim_ssi_adddeny(od->sess, who); |
4230 | 6009 #endif |
2086 | 6010 } |
6011 | |
5575 | 6012 static void oscar_rem_permit(GaimConnection *gc, const char *who) { |
4269 | 6013 #ifdef NOSSI |
4491 | 6014 if (gc->account->permdeny == 3) |
4269 | 6015 oscar_set_permit_deny(gc); |
6016 #else | |
2991 | 6017 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6018 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a permit\n"); |
4230 | 6019 if (od->sess->ssi.received_data) |
4889 | 6020 aim_ssi_delpermit(od->sess, who); |
4230 | 6021 #endif |
2086 | 6022 } |
6023 | |
5575 | 6024 static void oscar_rem_deny(GaimConnection *gc, const char *who) { |
4269 | 6025 #ifdef NOSSI |
4491 | 6026 if (gc->account->permdeny == 4) |
4269 | 6027 oscar_set_permit_deny(gc); |
6028 #else | |
2991 | 6029 struct oscar_data *od = (struct oscar_data *)gc->proto_data; |
5219
e807abdcee83
[gaim-migrate @ 5589]
Christian Hammond <chipx86@chipx86.com>
parents:
5211
diff
changeset
|
6030 gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: About to delete a deny\n"); |
4230 | 6031 if (od->sess->ssi.received_data) |
4889 | 6032 aim_ssi_deldeny(od->sess, who); |
4230 | 6033 #endif |
2086 | 6034 } |
6035 | |
5575 | 6036 static GList *oscar_away_states(GaimConnection *gc) |
2086 | 6037 { |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6038 struct oscar_data *od = gc->proto_data; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6039 GList *m = NULL; |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6040 |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6041 if (!od->icq) |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6042 return g_list_append(m, GAIM_AWAY_CUSTOM); |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2432
diff
changeset
|
6043 |
4333 | 6044 m = g_list_append(m, _("Online")); |
6045 m = g_list_append(m, _("Away")); | |
6046 m = g_list_append(m, _("Do Not Disturb")); | |
6047 m = g_list_append(m, _("Not Available")); | |
6048 m = g_list_append(m, _("Occupied")); | |
6049 m = g_list_append(m, _("Free For Chat")); | |
6050 m = g_list_append(m, _("Invisible")); | |
6051 | |
6052 return m; | |
6053 } | |
6054 | |
5575 | 6055 static GList *oscar_buddy_menu(GaimConnection *gc, const char *who) { |
4333 | 6056 struct oscar_data *od = gc->proto_data; |
6057 GList *m = NULL; | |
6058 struct proto_buddy_menu *pbm; | |
6059 | |
6060 if (od->icq) { | |
4624 | 6061 #if 0 |
4333 | 6062 pbm = g_new0(struct proto_buddy_menu, 1); |
6063 pbm->label = _("Get Status Msg"); | |
4969 | 6064 pbm->callback = oscar_get_icqstatusmsg; |
4333 | 6065 pbm->gc = gc; |
6066 m = g_list_append(m, pbm); | |
4624 | 6067 #endif |
4333 | 6068 } else { |
6695 | 6069 GaimBuddy *b = gaim_find_buddy(gc->account, who); |
7011 | 6070 aim_userinfo_t *userinfo; |
5975 | 6071 |
6072 if (b) | |
7011 | 6073 userinfo = aim_locate_finduserinfo(b->name); |
6074 | |
6075 if (b && userinfo && aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), who) && GAIM_BUDDY_IS_ONLINE(b)) { | |
6076 if (userinfo->capabilities & AIM_CAPS_DIRECTIM) { | |
5917 | 6077 pbm = g_new0(struct proto_buddy_menu, 1); |
6078 pbm->label = _("Direct IM"); | |
6079 pbm->callback = oscar_ask_direct_im; | |
6080 pbm->gc = gc; | |
6081 m = g_list_append(m, pbm); | |
6082 } | |
6083 | |
7011 | 6084 if (userinfo->capabilities & AIM_CAPS_SENDFILE) { |
5917 | 6085 pbm = g_new0(struct proto_buddy_menu, 1); |
6086 pbm->label = _("Send File"); | |
6087 pbm->callback = oscar_ask_sendfile; | |
6088 pbm->gc = gc; | |
6089 m = g_list_append(m, pbm); | |
6090 } | |
4826 | 6091 #if 0 |
7011 | 6092 if (userinfo->capabilities & AIM_CAPS_GETFILE) { |
5917 | 6093 pbm = g_new0(struct proto_buddy_menu, 1); |
6094 pbm->label = _("Get File"); | |
6095 pbm->callback = oscar_ask_getfile; | |
6096 pbm->gc = gc; | |
6097 m = g_list_append(m, pbm); | |
6098 } | |
4826 | 6099 #endif |
4333 | 6100 } |
5131 | 6101 } |
5197 | 6102 |
5131 | 6103 if (od->sess->ssi.received_data) { |
6104 char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, who); | |
6105 if (gname && aim_ssi_waitingforauth(od->sess->ssi.local, gname, who)) { | |
6106 pbm = g_new0(struct proto_buddy_menu, 1); | |
6873 | 6107 pbm->label = _("Re-request Authorization"); |
5131 | 6108 pbm->callback = gaim_auth_sendrequest; |
6109 pbm->gc = gc; | |
6110 m = g_list_append(m, pbm); | |
4333 | 6111 } |
4916 | 6112 } |
6113 | |
4333 | 6114 return m; |
6115 } | |
6116 | |
5575 | 6117 static void oscar_format_screenname(GaimConnection *gc, const char *nick) { |
4333 | 6118 struct oscar_data *od = gc->proto_data; |
5575 | 6119 if (!aim_sncmp(gaim_account_get_username(gaim_connection_get_account(gc)), nick)) { |
4333 | 6120 if (!aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH)) { |
6121 od->setnick = TRUE; | |
6122 od->newsn = g_strdup(nick); | |
6123 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6124 } else { | |
6125 aim_admin_setnick(od->sess, aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH), nick); | |
6126 } | |
6127 } else { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
6128 gaim_notify_error(gc, NULL, _("The new formatting is invalid."), |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5435
diff
changeset
|
6129 _("Screenname formatting can change only capitalization and whitespace.")); |
4333 | 6130 } |
6131 } | |
6132 | |
5575 | 6133 static void oscar_show_format_screenname(GaimConnection *gc) |
4333 | 6134 { |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6135 gaim_request_input(gc, NULL, _("New screenname formatting:"), NULL, |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
6136 gaim_connection_get_display_name(gc), FALSE, FALSE, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6137 _("OK"), G_CALLBACK(oscar_format_screenname), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6138 _("Cancel"), NULL, |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6139 gc); |
4333 | 6140 } |
6141 | |
5575 | 6142 static void oscar_confirm_account(GaimConnection *gc) |
4333 | 6143 { |
6144 struct oscar_data *od = gc->proto_data; | |
6145 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); | |
6146 | |
6147 if (conn) { | |
6148 aim_admin_reqconfirm(od->sess, conn); | |
6149 } else { | |
6150 od->conf = TRUE; | |
6151 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6152 } | |
6153 } | |
6154 | |
5575 | 6155 static void oscar_show_email(GaimConnection *gc) |
4333 | 6156 { |
6157 struct oscar_data *od = gc->proto_data; | |
6158 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); | |
6159 | |
6160 if (conn) { | |
6161 aim_admin_getinfo(od->sess, conn, 0x11); | |
6162 } else { | |
6163 od->reqemail = TRUE; | |
6164 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6165 } | |
6166 } | |
6167 | |
5575 | 6168 static void oscar_change_email(GaimConnection *gc, const char *email) |
2768
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6169 { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6170 struct oscar_data *od = gc->proto_data; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6171 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
|
6172 |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6173 if (conn) { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6174 aim_admin_setemail(od->sess, conn, email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6175 } else { |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6176 od->setemail = TRUE; |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6177 od->email = g_strdup(email); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6178 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6179 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6180 } |
8a918df1a5ed
[gaim-migrate @ 2781]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2762
diff
changeset
|
6181 |
5575 | 6182 static void oscar_show_change_email(GaimConnection *gc) |
4333 | 6183 { |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
6184 gaim_request_input(gc, NULL, _("Change Address To:"), NULL, NULL, |
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
6185 FALSE, FALSE, |
5493
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6186 _("OK"), G_CALLBACK(oscar_change_email), |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6187 _("Cancel"), NULL, |
3e8487580024
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
6188 gc); |
4333 | 6189 } |
6190 | |
5575 | 6191 static void oscar_show_awaitingauth(GaimConnection *gc) |
4333 | 6192 { |
2979 | 6193 struct oscar_data *od = gc->proto_data; |
4333 | 6194 gchar *nombre, *text, *tmp; |
6695 | 6195 GaimBlistNode *gnode, *cnode, *bnode; |
4333 | 6196 int num=0; |
6197 | |
6873 | 6198 text = g_strdup(""); |
4333 | 6199 |
4785 | 6200 for (gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { |
6695 | 6201 GaimGroup *group = (GaimGroup *)gnode; |
4785 | 6202 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) |
6203 continue; | |
6695 | 6204 for (cnode = gnode->child; cnode; cnode = cnode->next) { |
6205 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | |
4785 | 6206 continue; |
6695 | 6207 for (bnode = cnode->child; bnode; bnode = bnode->next) { |
6208 GaimBuddy *buddy = (GaimBuddy *)bnode; | |
6209 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | |
6210 continue; | |
6211 if (buddy->account == gc->account && aim_ssi_waitingforauth(od->sess->ssi.local, group->name, buddy->name)) { | |
6212 if (gaim_get_buddy_alias_only(buddy)) | |
6213 nombre = g_strdup_printf(" %s (%s)", buddy->name, gaim_get_buddy_alias_only(buddy)); | |
6214 else | |
6215 nombre = g_strdup_printf(" %s", buddy->name); | |
6873 | 6216 tmp = g_strdup_printf("%s%s<br>", text, nombre); |
6695 | 6217 g_free(text); |
6218 text = tmp; | |
6219 g_free(nombre); | |
6220 num++; | |
6221 } | |
4333 | 6222 } |
2979 | 6223 } |
4333 | 6224 } |
6225 | |
6226 if (!num) { | |
6227 g_free(text); | |
6873 | 6228 text = g_strdup(_("<i>you are not waiting for authorization</i>")); |
6229 } | |
6230 | |
6231 gaim_notify_formatted(gc, NULL, _("You are awaiting authorization from " | |
6232 "the following buddies"), _("You can re-request " | |
6233 "authorization from these buddies by " | |
6234 "right-clicking on them and selecting " | |
6235 "\"Re-request Authorization.\""), text, NULL, NULL); | |
4333 | 6236 g_free(text); |
2979 | 6237 } |
6238 | |
5975 | 6239 #if 0 |
5917 | 6240 static void oscar_setavailmsg(GaimConnection *gc, char *text) { |
6241 struct oscar_data *od = (struct oscar_data *)gc->proto_data; | |
6242 | |
6243 aim_srv_setavailmsg(od->sess, text); | |
6244 } | |
6245 | |
6246 static void oscar_show_setavailmsg(GaimConnection *gc) | |
6247 { | |
6248 gaim_request_input(gc, NULL, _("Available Message:"), | |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
6029
diff
changeset
|
6249 NULL, _("Please talk to me, I'm lonely! (and single)"), TRUE, FALSE, |
5917 | 6250 _("OK"), G_CALLBACK(oscar_setavailmsg), |
6251 _("Cancel"), NULL, | |
6252 gc); | |
6253 } | |
5975 | 6254 #endif |
5917 | 6255 |
5575 | 6256 static void oscar_show_chpassurl(GaimConnection *gc) |
4333 | 6257 { |
6258 struct oscar_data *od = gc->proto_data; | |
5575 | 6259 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
|
6260 gaim_notify_uri(gc, substituted); |
5517 | 6261 g_free(substituted); |
4333 | 6262 } |
6263 | |
5842 | 6264 static void oscar_set_icon(GaimConnection *gc, const char *iconfile) |
6265 { | |
5844 | 6266 struct oscar_data *od = gc->proto_data; |
6267 aim_session_t *sess = od->sess; | |
5842 | 6268 FILE *file; |
6269 struct stat st; | |
5844 | 6270 |
6039 | 6271 if (iconfile == NULL) { |
6272 /* Set an empty icon, or something */ | |
6273 } else if (!stat(iconfile, &st)) { | |
5842 | 6274 char *buf = g_malloc(st.st_size); |
6275 file = fopen(iconfile, "rb"); | |
6276 if (file) { | |
6052 | 6277 md5_state_t *state; |
6039 | 6278 char md5[16]; |
5842 | 6279 int len = fread(buf, 1, st.st_size, file); |
6039 | 6280 fclose(file); |
6052 | 6281 state = g_malloc(sizeof(md5_state_t)); |
5842 | 6282 md5_init(state); |
6283 md5_append(state, buf, len); | |
6284 md5_finish(state, md5); | |
6285 g_free(state); | |
6286 aim_ssi_seticon(sess, md5, 16); | |
6287 } else | |
6288 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
6289 "Can't open buddy icon file!\n"); | |
6290 g_free(buf); | |
6291 } else | |
6292 gaim_debug(GAIM_DEBUG_ERROR, "oscar", | |
6293 "Can't stat buddy icon file!\n"); | |
6294 } | |
6295 | |
6296 | |
5575 | 6297 static GList *oscar_actions(GaimConnection *gc) |
2086 | 6298 { |
6299 struct oscar_data *od = gc->proto_data; | |
4333 | 6300 struct proto_actions_menu *pam; |
6301 GList *m = NULL; | |
6302 | |
6303 pam = g_new0(struct proto_actions_menu, 1); | |
6304 pam->label = _("Set User Info"); | |
6305 pam->callback = show_set_info; | |
6306 pam->gc = gc; | |
6307 m = g_list_append(m, pam); | |
6308 | |
5917 | 6309 #if 0 |
6310 pam = g_new0(struct proto_actions_menu, 1); | |
6311 pam->label = _("Set Available Message"); | |
6312 pam->callback = oscar_show_setavailmsg; | |
6313 pam->gc = gc; | |
6314 m = g_list_append(m, pam); | |
6315 #endif | |
6316 | |
5238 | 6317 pam = g_new0(struct proto_actions_menu, 1); |
6318 pam->label = _("Change Password"); | |
6319 pam->callback = show_change_passwd; | |
6320 pam->gc = gc; | |
6321 m = g_list_append(m, pam); | |
4617 | 6322 |
6323 if (od->sess->authinfo->chpassurl) { | |
6324 pam = g_new0(struct proto_actions_menu, 1); | |
6325 pam->label = _("Change Password (URL)"); | |
6326 pam->callback = oscar_show_chpassurl; | |
6327 pam->gc = gc; | |
6328 m = g_list_append(m, pam); | |
6329 } | |
6330 | |
5238 | 6331 if (!od->icq) { |
4617 | 6332 /* AIM actions */ |
6333 m = g_list_append(m, NULL); | |
4333 | 6334 |
5917 | 6335 pam = g_new0(struct proto_actions_menu, 1); |
4333 | 6336 pam->label = _("Format Screenname"); |
5844 | 6337 pam->callback = oscar_show_format_screenname; |
4333 | 6338 pam->gc = gc; |
6339 m = g_list_append(m, pam); | |
6340 | |
6341 pam = g_new0(struct proto_actions_menu, 1); | |
6342 pam->label = _("Confirm Account"); | |
6343 pam->callback = oscar_confirm_account; | |
6344 pam->gc = gc; | |
6345 m = g_list_append(m, pam); | |
6346 | |
6347 pam = g_new0(struct proto_actions_menu, 1); | |
6348 pam->label = _("Display Current Registered Address"); | |
6349 pam->callback = oscar_show_email; | |
6350 pam->gc = gc; | |
6351 m = g_list_append(m, pam); | |
6352 | |
6353 pam = g_new0(struct proto_actions_menu, 1); | |
6354 pam->label = _("Change Current Registered Address"); | |
6355 pam->callback = oscar_show_change_email; | |
6356 pam->gc = gc; | |
6357 m = g_list_append(m, pam); | |
2086 | 6358 } |
4333 | 6359 |
6360 m = g_list_append(m, NULL); | |
6361 | |
6362 pam = g_new0(struct proto_actions_menu, 1); | |
6363 pam->label = _("Show Buddies Awaiting Authorization"); | |
6364 pam->callback = oscar_show_awaitingauth; | |
6365 pam->gc = gc; | |
6366 m = g_list_append(m, pam); | |
6367 | |
2086 | 6368 m = g_list_append(m, NULL); |
4333 | 6369 |
6370 pam = g_new0(struct proto_actions_menu, 1); | |
6371 pam->label = _("Search for Buddy by Email"); | |
6372 pam->callback = show_find_email; | |
6373 pam->gc = gc; | |
6374 m = g_list_append(m, pam); | |
6375 | |
4336 | 6376 /* pam = g_new0(struct proto_actions_menu, 1); |
4333 | 6377 pam->label = _("Search for Buddy by Information"); |
6378 pam->callback = show_find_info; | |
6379 pam->gc = gc; | |
4336 | 6380 m = g_list_append(m, pam); */ |
2086 | 6381 |
6382 return m; | |
6383 } | |
6384 | |
5575 | 6385 static void oscar_change_passwd(GaimConnection *gc, const char *old, const char *new) |
2086 | 6386 { |
6387 struct oscar_data *od = gc->proto_data; | |
4617 | 6388 |
6389 if (od->icq) { | |
6390 aim_icq_changepasswd(od->sess, new); | |
2086 | 6391 } else { |
4617 | 6392 aim_conn_t *conn = aim_getconn_type(od->sess, AIM_CONN_TYPE_AUTH); |
6393 if (conn) { | |
6394 aim_admin_changepasswd(od->sess, conn, new, old); | |
6395 } else { | |
6396 od->chpass = TRUE; | |
6397 od->oldp = g_strdup(old); | |
6398 od->newp = g_strdup(new); | |
6399 aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_AUTH); | |
6400 } | |
2086 | 6401 } |
6402 } | |
6403 | |
6059 | 6404 static void oscar_convo_closed(GaimConnection *gc, const char *who) |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6405 { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6406 struct oscar_data *od = gc->proto_data; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6407 struct direct_im *dim = find_direct_im(od, who); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6408 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6409 if (!dim) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6410 return; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6411 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6412 od->direct_ims = g_slist_remove(od->direct_ims, dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6413 gaim_input_remove(dim->watcher); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6414 aim_conn_kill(od->sess, &dim->conn); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6415 g_free(dim); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6416 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2235
diff
changeset
|
6417 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6418 static GaimPluginProtocolInfo prpl_info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6419 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6420 GAIM_PROTO_OSCAR, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6421 OPT_PROTO_MAIL_CHECK | OPT_PROTO_BUDDY_ICON | OPT_PROTO_IM_IMAGE, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6422 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6423 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6424 oscar_list_icon, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6425 oscar_list_emblems, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6426 oscar_status_text, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6427 oscar_tooltip_text, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6428 oscar_away_states, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6429 oscar_actions, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6430 oscar_buddy_menu, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6431 oscar_chat_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6432 oscar_login, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6433 oscar_close, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6434 oscar_send_im, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6435 oscar_set_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6436 oscar_send_typing, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6437 oscar_get_info, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6438 oscar_set_away, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6439 oscar_get_away, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6440 oscar_set_dir, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6441 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6442 oscar_dir_search, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6443 oscar_set_idle, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6444 oscar_change_passwd, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6445 oscar_add_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6446 oscar_add_buddies, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6447 oscar_remove_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6448 oscar_remove_buddies, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6449 oscar_add_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6450 oscar_add_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6451 oscar_rem_permit, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6452 oscar_rem_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6453 oscar_set_permit_deny, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6454 oscar_warn, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6455 oscar_join_chat, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6456 oscar_chat_invite, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6457 oscar_chat_leave, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6458 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6459 oscar_chat_send, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6460 oscar_keepalive, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6461 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6462 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6463 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6464 #ifndef NOSSI |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6465 oscar_alias_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6466 oscar_move_buddy, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6467 oscar_rename_group, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6468 #else |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6469 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6470 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6471 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6472 #endif |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6473 NULL, |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6474 oscar_convo_closed, |
5842 | 6475 NULL, |
6476 oscar_set_icon | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6477 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6478 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6479 static GaimPluginInfo info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6480 { |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6481 2, /**< api_version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6482 GAIM_PLUGIN_PROTOCOL, /**< type */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6483 NULL, /**< ui_requirement */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6484 0, /**< flags */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6485 NULL, /**< dependencies */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6486 GAIM_PRIORITY_DEFAULT, /**< priority */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6487 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6488 "prpl-oscar", /**< id */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6489 "AIM/ICQ", /**< name */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6490 VERSION, /**< version */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6491 /** summary */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6492 N_("AIM/ICQ Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6493 /** description */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6494 N_("AIM/ICQ Protocol Plugin"), |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6495 NULL, /**< author */ |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6350
diff
changeset
|
6496 GAIM_WEBSITE, /**< homepage */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6497 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6498 NULL, /**< load */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6499 NULL, /**< unload */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6500 NULL, /**< destroy */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6501 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6502 NULL, /**< ui_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6503 &prpl_info /**< extra_info */ |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6504 }; |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6505 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6506 static void |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5917
diff
changeset
|
6507 init_plugin(GaimPlugin *plugin) |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6508 { |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6509 GaimAccountOption *option; |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6510 |
5685
43ea75092684
[gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
6511 option = gaim_account_option_string_new(_("Auth host"), "server", |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6512 "login.oscar.aol.com"); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6513 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6514 option); |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6515 |
5685
43ea75092684
[gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
6516 option = gaim_account_option_int_new(_("Auth port"), "port", 5190); |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6517 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
6518 option); |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6519 |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5197
diff
changeset
|
6520 my_protocol = plugin; |
2086 | 6521 } |
6522 | |
5920
7d385de2f9cd
[gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents:
5917
diff
changeset
|
6523 GAIM_INIT_PLUGIN(oscar, init_plugin, info); |