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