[5e53c4a] | 1 | /* |
---|
| 2 | * Main libfaim header. Must be included in client for prototypes/macros. |
---|
| 3 | * |
---|
| 4 | * "come on, i turned a chick lesbian; i think this is the hackish equivalent" |
---|
| 5 | * -- Josh Meyer |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #ifndef __AIM_H__ |
---|
| 10 | #define __AIM_H__ |
---|
| 11 | |
---|
| 12 | #define FAIM_VERSION_MAJOR 0 |
---|
| 13 | #define FAIM_VERSION_MINOR 99 |
---|
[862371b] | 14 | #define FAIM_VERSION_MINORMINOR 1 |
---|
[5e53c4a] | 15 | |
---|
| 16 | #include <faimconfig.h> |
---|
| 17 | #include <aim_cbtypes.h> |
---|
| 18 | |
---|
| 19 | #include <stdio.h> |
---|
| 20 | #include <string.h> |
---|
| 21 | #include <fcntl.h> |
---|
| 22 | #include <sys/types.h> |
---|
| 23 | #include <stdlib.h> |
---|
| 24 | #include <stdarg.h> |
---|
| 25 | #include <errno.h> |
---|
| 26 | #include <time.h> |
---|
| 27 | |
---|
[862371b] | 28 | #ifndef _WIN32 |
---|
[5e53c4a] | 29 | #include <sys/time.h> |
---|
| 30 | #include <unistd.h> |
---|
| 31 | #include <netinet/in.h> |
---|
| 32 | #include <sys/socket.h> |
---|
[862371b] | 33 | #else |
---|
| 34 | #include <winsock.h> |
---|
[5e53c4a] | 35 | #endif |
---|
| 36 | |
---|
| 37 | /* XXX adjust these based on autoconf-detected platform */ |
---|
| 38 | typedef unsigned char fu8_t; |
---|
| 39 | typedef unsigned short fu16_t; |
---|
| 40 | typedef unsigned long fu32_t; |
---|
| 41 | typedef fu32_t aim_snacid_t; |
---|
| 42 | typedef fu16_t flap_seqnum_t; |
---|
| 43 | |
---|
| 44 | #if defined(mach) && defined(__APPLE__) |
---|
| 45 | #define gethostbyname(x) gethostbyname2(x, AF_INET) |
---|
| 46 | #endif |
---|
| 47 | |
---|
| 48 | #if defined(_WIN32) || defined(STRICT_ANSI) |
---|
| 49 | #define faim_shortfunc |
---|
| 50 | #else |
---|
| 51 | #define faim_shortfunc inline |
---|
| 52 | #endif |
---|
| 53 | |
---|
| 54 | #if defined(_WIN32) && !defined(WIN32_STATIC) |
---|
| 55 | /* |
---|
| 56 | * For a win32 DLL, we define WIN32_INDLL if this file |
---|
| 57 | * is included while compiling the DLL. If its not |
---|
| 58 | * defined (its included in a client app), the symbols |
---|
| 59 | * will be imported instead of exported. |
---|
| 60 | */ |
---|
| 61 | #ifdef WIN32_INDLL |
---|
| 62 | #define faim_export __declspec(dllexport) |
---|
| 63 | #else |
---|
| 64 | #define faim_export __declspec(dllimport) |
---|
| 65 | #endif /* WIN32_INDLL */ |
---|
| 66 | #define faim_internal |
---|
| 67 | #else |
---|
| 68 | /* |
---|
| 69 | * Nothing normally needed for unix... |
---|
| 70 | */ |
---|
| 71 | #define faim_export |
---|
| 72 | #define faim_internal |
---|
| 73 | #endif |
---|
| 74 | |
---|
| 75 | /* |
---|
| 76 | * Current Maximum Length for Screen Names (not including NULL) |
---|
| 77 | * |
---|
| 78 | * Currently only names up to 16 characters can be registered |
---|
| 79 | * however it is aparently legal for them to be larger. |
---|
| 80 | */ |
---|
| 81 | #define MAXSNLEN 32 |
---|
| 82 | |
---|
| 83 | /* |
---|
| 84 | * Current Maximum Length for Instant Messages |
---|
| 85 | * |
---|
| 86 | * This was found basically by experiment, but not wholly |
---|
| 87 | * accurate experiment. It should not be regarded |
---|
| 88 | * as completely correct. But its a decent approximation. |
---|
| 89 | * |
---|
| 90 | * Note that although we can send this much, its impossible |
---|
| 91 | * for WinAIM clients (up through the latest (4.0.1957)) to |
---|
| 92 | * send any more than 1kb. Amaze all your windows friends |
---|
| 93 | * with utterly oversized instant messages! |
---|
| 94 | * |
---|
| 95 | * XXX: the real limit is the total SNAC size at 8192. Fix this. |
---|
| 96 | * |
---|
| 97 | */ |
---|
| 98 | #define MAXMSGLEN 7987 |
---|
| 99 | |
---|
| 100 | /* |
---|
| 101 | * Maximum size of a Buddy Icon. |
---|
| 102 | */ |
---|
| 103 | #define MAXICONLEN 7168 |
---|
| 104 | #define AIM_ICONIDENT "AVT1picture.id" |
---|
| 105 | |
---|
| 106 | /* |
---|
| 107 | * Current Maximum Length for Chat Room Messages |
---|
| 108 | * |
---|
| 109 | * This is actually defined by the protocol to be |
---|
| 110 | * dynamic, but I have yet to see due cause to |
---|
| 111 | * define it dynamically here. Maybe later. |
---|
| 112 | * |
---|
| 113 | */ |
---|
| 114 | #define MAXCHATMSGLEN 512 |
---|
| 115 | |
---|
| 116 | /* |
---|
| 117 | * Standard size of an AIM authorization cookie |
---|
| 118 | */ |
---|
| 119 | #define AIM_COOKIELEN 0x100 |
---|
| 120 | |
---|
| 121 | #define AIM_MD5_STRING "AOL Instant Messenger (SM)" |
---|
| 122 | |
---|
| 123 | /* |
---|
| 124 | * Client info. Filled in by the client and passed in to |
---|
| 125 | * aim_send_login(). The information ends up getting passed to OSCAR |
---|
| 126 | * through the initial login command. |
---|
| 127 | * |
---|
| 128 | */ |
---|
| 129 | struct client_info_s { |
---|
| 130 | const char *clientstring; |
---|
| 131 | fu16_t clientid; |
---|
| 132 | int major; |
---|
| 133 | int minor; |
---|
| 134 | int point; |
---|
| 135 | int build; |
---|
| 136 | const char *country; /* two-letter abbrev */ |
---|
| 137 | const char *lang; /* two-letter abbrev */ |
---|
| 138 | }; |
---|
| 139 | |
---|
[862371b] | 140 | #define CLIENTINFO_AIM_3_5_1670 { \ |
---|
[5e53c4a] | 141 | "AOL Instant Messenger (SM), version 3.5.1670/WIN32", \ |
---|
| 142 | 0x0004, \ |
---|
| 143 | 0x0003, \ |
---|
| 144 | 0x0005, \ |
---|
| 145 | 0x0000, \ |
---|
| 146 | 0x0686, \ |
---|
| 147 | "us", \ |
---|
| 148 | "en", \ |
---|
| 149 | } |
---|
| 150 | |
---|
[862371b] | 151 | #define CLIENTINFO_AIM_4_1_2010 { \ |
---|
[5e53c4a] | 152 | "AOL Instant Messenger (SM), version 4.1.2010/WIN32", \ |
---|
| 153 | 0x0004, \ |
---|
| 154 | 0x0004, \ |
---|
| 155 | 0x0001, \ |
---|
| 156 | 0x0000, \ |
---|
| 157 | 0x07da, \ |
---|
| 158 | "us", \ |
---|
| 159 | "en", \ |
---|
| 160 | } |
---|
| 161 | |
---|
[862371b] | 162 | #define CLIENTINFO_AIM_5_0_2938 { \ |
---|
| 163 | "AOL Instant Messenger, version 5.0.2938/WIN32", \ |
---|
| 164 | 0x0109, \ |
---|
| 165 | 0x0005, \ |
---|
| 166 | 0x0000, \ |
---|
| 167 | 0x0000, \ |
---|
| 168 | 0x0b7a, \ |
---|
| 169 | "us", \ |
---|
| 170 | "en", \ |
---|
| 171 | } |
---|
| 172 | |
---|
| 173 | #define CLIENTINFO_ICQ_4_65_3281 { \ |
---|
| 174 | "ICQ Inc. - Product of ICQ (TM) 2000b.4.65.1.3281.85", \ |
---|
| 175 | 0x010a, \ |
---|
| 176 | 0x0004, \ |
---|
| 177 | 0x0041, \ |
---|
| 178 | 0x0001, \ |
---|
| 179 | 0x0cd1, \ |
---|
| 180 | "us", \ |
---|
| 181 | "en", \ |
---|
| 182 | } |
---|
| 183 | |
---|
| 184 | #define CLIENTINFO_ICQ_5_34_3728 { \ |
---|
| 185 | "ICQ Inc. - Product of ICQ (TM).2002a.5.34.1.3728.85", \ |
---|
| 186 | 0x010a, \ |
---|
| 187 | 0x0005, \ |
---|
| 188 | 0x0022, \ |
---|
| 189 | 0x0001, \ |
---|
| 190 | 0x0e8f, \ |
---|
| 191 | "us", \ |
---|
| 192 | "en", \ |
---|
| 193 | } |
---|
| 194 | |
---|
[5e53c4a] | 195 | /* |
---|
| 196 | * I would make 4.1.2010 the default, but they seem to have found |
---|
| 197 | * an alternate way of breaking that one. |
---|
| 198 | * |
---|
| 199 | * 3.5.1670 should work fine, however, you will be subjected to the |
---|
[862371b] | 200 | * memory test, which may require you to have a WinAIM binary lying |
---|
[5e53c4a] | 201 | * around. (see login.c::memrequest()) |
---|
| 202 | */ |
---|
[862371b] | 203 | #define CLIENTINFO_AIM_KNOWNGOOD CLIENTINFO_AIM_3_5_1670 |
---|
| 204 | #define CLIENTINFO_ICQ_KNOWNGOOD CLIENTINFO_ICQ_4_65_3281 |
---|
[5e53c4a] | 205 | |
---|
| 206 | #ifndef TRUE |
---|
| 207 | #define TRUE 1 |
---|
| 208 | #define FALSE 0 |
---|
| 209 | #endif |
---|
| 210 | |
---|
| 211 | /* |
---|
| 212 | * These could be arbitrary, but its easier to use the actual AIM values |
---|
| 213 | */ |
---|
| 214 | #define AIM_CONN_TYPE_AUTH 0x0007 |
---|
| 215 | #define AIM_CONN_TYPE_ADS 0x0005 |
---|
| 216 | #define AIM_CONN_TYPE_BOS 0x0002 |
---|
| 217 | #define AIM_CONN_TYPE_CHAT 0x000e |
---|
| 218 | #define AIM_CONN_TYPE_CHATNAV 0x000d |
---|
[862371b] | 219 | #define AIM_CONN_TYPE_SEARCH 0x000f |
---|
| 220 | #define AIM_CONN_TYPE_EMAIL 0x0018 |
---|
[5e53c4a] | 221 | |
---|
| 222 | /* they start getting arbitrary in rendezvous stuff =) */ |
---|
| 223 | #define AIM_CONN_TYPE_RENDEZVOUS 0x0101 /* these do not speak FLAP! */ |
---|
| 224 | #define AIM_CONN_TYPE_RENDEZVOUS_OUT 0x0102 /* socket waiting for accept() */ |
---|
| 225 | |
---|
| 226 | /* |
---|
| 227 | * Subtypes, we need these for OFT stuff. |
---|
| 228 | */ |
---|
| 229 | #define AIM_CONN_SUBTYPE_OFT_DIRECTIM 0x0001 |
---|
| 230 | #define AIM_CONN_SUBTYPE_OFT_GETFILE 0x0002 |
---|
| 231 | #define AIM_CONN_SUBTYPE_OFT_SENDFILE 0x0003 |
---|
| 232 | #define AIM_CONN_SUBTYPE_OFT_BUDDYICON 0x0004 |
---|
| 233 | #define AIM_CONN_SUBTYPE_OFT_VOICE 0x0005 |
---|
| 234 | |
---|
| 235 | /* |
---|
| 236 | * Status values returned from aim_conn_new(). ORed together. |
---|
| 237 | */ |
---|
| 238 | #define AIM_CONN_STATUS_READY 0x0001 |
---|
| 239 | #define AIM_CONN_STATUS_INTERNALERR 0x0002 |
---|
| 240 | #define AIM_CONN_STATUS_RESOLVERR 0x0040 |
---|
| 241 | #define AIM_CONN_STATUS_CONNERR 0x0080 |
---|
| 242 | #define AIM_CONN_STATUS_INPROGRESS 0x0100 |
---|
| 243 | |
---|
| 244 | #define AIM_FRAMETYPE_FLAP 0x0000 |
---|
| 245 | #define AIM_FRAMETYPE_OFT 0x0001 |
---|
| 246 | |
---|
| 247 | typedef struct aim_conn_s { |
---|
| 248 | int fd; |
---|
| 249 | fu16_t type; |
---|
| 250 | fu16_t subtype; |
---|
| 251 | flap_seqnum_t seqnum; |
---|
| 252 | fu32_t status; |
---|
| 253 | void *priv; /* misc data the client may want to store */ |
---|
| 254 | void *internal; /* internal conn-specific libfaim data */ |
---|
| 255 | time_t lastactivity; /* time of last transmit */ |
---|
| 256 | int forcedlatency; |
---|
| 257 | void *handlerlist; |
---|
| 258 | void *sessv; /* pointer to parent session */ |
---|
| 259 | void *inside; /* only accessible from inside libfaim */ |
---|
| 260 | struct aim_conn_s *next; |
---|
| 261 | } aim_conn_t; |
---|
| 262 | |
---|
| 263 | /* |
---|
| 264 | * Byte Stream type. Sort of. |
---|
| 265 | * |
---|
| 266 | * Use of this type serves a couple purposes: |
---|
| 267 | * - Buffer/buflen pairs are passed all around everywhere. This turns |
---|
| 268 | * that into one value, as well as abstracting it slightly. |
---|
| 269 | * - Through the abstraction, it is possible to enable bounds checking |
---|
| 270 | * for robustness at the cost of performance. But a clean failure on |
---|
| 271 | * weird packets is much better than a segfault. |
---|
| 272 | * - I like having variables named "bs". |
---|
| 273 | * |
---|
| 274 | * Don't touch the insides of this struct. Or I'll have to kill you. |
---|
| 275 | * |
---|
| 276 | */ |
---|
| 277 | typedef struct aim_bstream_s { |
---|
| 278 | fu8_t *data; |
---|
[862371b] | 279 | fu32_t len; |
---|
| 280 | fu32_t offset; |
---|
[5e53c4a] | 281 | } aim_bstream_t; |
---|
| 282 | |
---|
| 283 | typedef struct aim_frame_s { |
---|
| 284 | fu8_t hdrtype; /* defines which piece of the union to use */ |
---|
| 285 | union { |
---|
| 286 | struct { |
---|
| 287 | fu8_t type; |
---|
| 288 | flap_seqnum_t seqnum; |
---|
| 289 | } flap; |
---|
| 290 | struct { |
---|
| 291 | fu8_t magic[4]; /* ODC2 OFT2 */ |
---|
[862371b] | 292 | fu16_t hdrlen; |
---|
| 293 | fu16_t type; |
---|
| 294 | } rend; |
---|
[5e53c4a] | 295 | } hdr; |
---|
| 296 | aim_bstream_t data; /* payload stream */ |
---|
| 297 | fu8_t handled; /* 0 = new, !0 = been handled */ |
---|
| 298 | fu8_t nofree; /* 0 = free data on purge, 1 = only unlink */ |
---|
| 299 | aim_conn_t *conn; /* the connection it came in on... */ |
---|
| 300 | struct aim_frame_s *next; |
---|
| 301 | } aim_frame_t; |
---|
| 302 | |
---|
| 303 | typedef struct aim_msgcookie_s { |
---|
| 304 | unsigned char cookie[8]; |
---|
| 305 | int type; |
---|
| 306 | void *data; |
---|
| 307 | time_t addtime; |
---|
| 308 | struct aim_msgcookie_s *next; |
---|
| 309 | } aim_msgcookie_t; |
---|
| 310 | |
---|
| 311 | /* |
---|
| 312 | * AIM Session: The main client-data interface. |
---|
| 313 | * |
---|
| 314 | */ |
---|
| 315 | typedef struct aim_session_s { |
---|
| 316 | |
---|
| 317 | /* ---- Client Accessible ------------------------ */ |
---|
| 318 | |
---|
| 319 | /* Our screen name. */ |
---|
| 320 | char sn[MAXSNLEN+1]; |
---|
| 321 | |
---|
| 322 | /* |
---|
| 323 | * Pointer to anything the client wants to |
---|
| 324 | * explicitly associate with this session. |
---|
| 325 | * |
---|
| 326 | * This is for use in the callbacks mainly. In any |
---|
| 327 | * callback, you can access this with sess->aux_data. |
---|
| 328 | * |
---|
| 329 | */ |
---|
| 330 | void *aux_data; |
---|
| 331 | |
---|
| 332 | /* ---- Internal Use Only ------------------------ */ |
---|
| 333 | |
---|
[862371b] | 334 | /* Server-stored information (ssi) */ |
---|
| 335 | struct { |
---|
| 336 | int received_data; |
---|
| 337 | fu16_t revision; |
---|
| 338 | struct aim_ssi_item *items; |
---|
| 339 | time_t timestamp; |
---|
| 340 | int waiting_for_ack; |
---|
| 341 | aim_frame_t *holding_queue; |
---|
| 342 | } ssi; |
---|
| 343 | |
---|
| 344 | struct aim_emailinfo *emailinfo; |
---|
| 345 | |
---|
[5e53c4a] | 346 | /* Connection information */ |
---|
| 347 | aim_conn_t *connlist; |
---|
| 348 | |
---|
| 349 | /* |
---|
| 350 | * Transmit/receive queues. |
---|
| 351 | * |
---|
| 352 | * These are only used when you don't use your own lowlevel |
---|
| 353 | * I/O. I don't suggest that you use libfaim's internal I/O. |
---|
| 354 | * Its really bad and the API/event model is quirky at best. |
---|
| 355 | * |
---|
| 356 | */ |
---|
| 357 | aim_frame_t *queue_outgoing; |
---|
| 358 | aim_frame_t *queue_incoming; |
---|
| 359 | |
---|
| 360 | /* |
---|
| 361 | * Tx Enqueuing function. |
---|
| 362 | * |
---|
| 363 | * This is how you override the transmit direction of libfaim's |
---|
| 364 | * internal I/O. This function will be called whenever it needs |
---|
| 365 | * to send something. |
---|
| 366 | * |
---|
| 367 | */ |
---|
| 368 | int (*tx_enqueue)(struct aim_session_s *, aim_frame_t *); |
---|
| 369 | |
---|
| 370 | /* |
---|
| 371 | * Outstanding snac handling |
---|
| 372 | * |
---|
| 373 | * XXX: Should these be per-connection? -mid |
---|
| 374 | */ |
---|
| 375 | void *snac_hash[FAIM_SNAC_HASH_SIZE]; |
---|
| 376 | aim_snacid_t snacid_next; |
---|
| 377 | |
---|
| 378 | struct { |
---|
| 379 | char server[128]; |
---|
| 380 | char username[128]; |
---|
| 381 | char password[128]; |
---|
| 382 | } socksproxy; |
---|
| 383 | |
---|
| 384 | fu32_t flags; /* AIM_SESS_FLAGS_ */ |
---|
| 385 | |
---|
| 386 | int debug; |
---|
| 387 | void (*debugcb)(struct aim_session_s *sess, int level, const char *format, va_list va); /* same as faim_debugging_callback_t */ |
---|
| 388 | |
---|
| 389 | aim_msgcookie_t *msgcookies; |
---|
| 390 | |
---|
| 391 | void *modlistv; |
---|
| 392 | } aim_session_t; |
---|
| 393 | |
---|
| 394 | /* Values for sess->flags */ |
---|
| 395 | #define AIM_SESS_FLAGS_SNACLOGIN 0x00000001 |
---|
| 396 | #define AIM_SESS_FLAGS_XORLOGIN 0x00000002 |
---|
| 397 | #define AIM_SESS_FLAGS_NONBLOCKCONNECT 0x00000004 |
---|
| 398 | #define AIM_SESS_FLAGS_DONTTIMEOUTONICBM 0x00000008 |
---|
| 399 | |
---|
| 400 | /* Valid for calling aim_icq_setstatus() and for aim_userinfo_t->icqinfo.status */ |
---|
| 401 | #define AIM_ICQ_STATE_NORMAL 0x00000000 |
---|
| 402 | #define AIM_ICQ_STATE_AWAY 0x00000001 |
---|
| 403 | #define AIM_ICQ_STATE_DND 0x00000002 |
---|
| 404 | #define AIM_ICQ_STATE_OUT 0x00000004 |
---|
| 405 | #define AIM_ICQ_STATE_BUSY 0x00000010 |
---|
| 406 | #define AIM_ICQ_STATE_CHAT 0x00000020 |
---|
| 407 | #define AIM_ICQ_STATE_INVISIBLE 0x00000100 |
---|
| 408 | #define AIM_ICQ_STATE_WEBAWARE 0x00010000 |
---|
| 409 | |
---|
| 410 | /* |
---|
| 411 | * AIM User Info, Standard Form. |
---|
| 412 | */ |
---|
| 413 | typedef struct { |
---|
| 414 | char sn[MAXSNLEN+1]; |
---|
| 415 | fu16_t warnlevel; /* evil percent * 10 (999 = 99.9%) */ |
---|
| 416 | fu16_t idletime; /* in seconds */ |
---|
| 417 | fu16_t flags; |
---|
| 418 | fu32_t createtime; /* time_t */ |
---|
| 419 | fu32_t membersince; /* time_t */ |
---|
| 420 | fu32_t onlinesince; /* time_t */ |
---|
[862371b] | 421 | fu32_t sessionlen; /* in seconds */ |
---|
[5e53c4a] | 422 | fu32_t capabilities; |
---|
| 423 | struct { |
---|
| 424 | fu32_t status; |
---|
| 425 | fu32_t ipaddr; |
---|
| 426 | fu8_t crap[0x25]; /* until we figure it out... */ |
---|
| 427 | } icqinfo; |
---|
| 428 | fu32_t present; |
---|
| 429 | } aim_userinfo_t; |
---|
| 430 | |
---|
| 431 | #define AIM_USERINFO_PRESENT_FLAGS 0x00000001 |
---|
| 432 | #define AIM_USERINFO_PRESENT_MEMBERSINCE 0x00000002 |
---|
| 433 | #define AIM_USERINFO_PRESENT_ONLINESINCE 0x00000004 |
---|
| 434 | #define AIM_USERINFO_PRESENT_IDLE 0x00000008 |
---|
| 435 | #define AIM_USERINFO_PRESENT_ICQEXTSTATUS 0x00000010 |
---|
| 436 | #define AIM_USERINFO_PRESENT_ICQIPADDR 0x00000020 |
---|
| 437 | #define AIM_USERINFO_PRESENT_ICQDATA 0x00000040 |
---|
| 438 | #define AIM_USERINFO_PRESENT_CAPABILITIES 0x00000080 |
---|
| 439 | #define AIM_USERINFO_PRESENT_SESSIONLEN 0x00000100 |
---|
| 440 | #define AIM_USERINFO_PRESENT_CREATETIME 0x00000200 |
---|
| 441 | |
---|
| 442 | faim_export const char *aim_userinfo_sn(aim_userinfo_t *ui); |
---|
| 443 | faim_export fu16_t aim_userinfo_flags(aim_userinfo_t *ui); |
---|
| 444 | faim_export fu16_t aim_userinfo_idle(aim_userinfo_t *ui); |
---|
| 445 | faim_export float aim_userinfo_warnlevel(aim_userinfo_t *ui); |
---|
| 446 | faim_export time_t aim_userinfo_createtime(aim_userinfo_t *ui); |
---|
| 447 | faim_export time_t aim_userinfo_membersince(aim_userinfo_t *ui); |
---|
| 448 | faim_export time_t aim_userinfo_onlinesince(aim_userinfo_t *ui); |
---|
| 449 | faim_export fu32_t aim_userinfo_sessionlen(aim_userinfo_t *ui); |
---|
| 450 | faim_export int aim_userinfo_hascap(aim_userinfo_t *ui, fu32_t cap); |
---|
| 451 | |
---|
| 452 | #define AIM_FLAG_UNCONFIRMED 0x0001 /* "damned transients" */ |
---|
| 453 | #define AIM_FLAG_ADMINISTRATOR 0x0002 |
---|
| 454 | #define AIM_FLAG_AOL 0x0004 |
---|
| 455 | #define AIM_FLAG_OSCAR_PAY 0x0008 |
---|
| 456 | #define AIM_FLAG_FREE 0x0010 |
---|
| 457 | #define AIM_FLAG_AWAY 0x0020 |
---|
| 458 | #define AIM_FLAG_ICQ 0x0040 |
---|
| 459 | #define AIM_FLAG_WIRELESS 0x0080 |
---|
| 460 | #define AIM_FLAG_UNKNOWN100 0x0100 |
---|
| 461 | #define AIM_FLAG_UNKNOWN200 0x0200 |
---|
| 462 | #define AIM_FLAG_ACTIVEBUDDY 0x0400 |
---|
| 463 | #define AIM_FLAG_UNKNOWN800 0x0800 |
---|
| 464 | #define AIM_FLAG_ABINTERNAL 0x1000 |
---|
| 465 | |
---|
| 466 | #define AIM_FLAG_ALLUSERS 0x001f |
---|
| 467 | |
---|
| 468 | |
---|
| 469 | #if defined(FAIM_INTERNAL) || defined(FAIM_NEED_TLV) |
---|
| 470 | /* |
---|
| 471 | * TLV handling |
---|
| 472 | */ |
---|
| 473 | |
---|
| 474 | /* Generic TLV structure. */ |
---|
| 475 | typedef struct aim_tlv_s { |
---|
| 476 | fu16_t type; |
---|
| 477 | fu16_t length; |
---|
| 478 | fu8_t *value; |
---|
| 479 | } aim_tlv_t; |
---|
| 480 | |
---|
| 481 | /* List of above. */ |
---|
| 482 | typedef struct aim_tlvlist_s { |
---|
| 483 | aim_tlv_t *tlv; |
---|
| 484 | struct aim_tlvlist_s *next; |
---|
| 485 | } aim_tlvlist_t; |
---|
| 486 | |
---|
| 487 | /* TLV-handling functions */ |
---|
| 488 | |
---|
| 489 | #if 0 |
---|
| 490 | /* Very, very raw TLV handling. */ |
---|
| 491 | faim_internal int aim_puttlv_8(fu8_t *buf, const fu16_t t, const fu8_t v); |
---|
| 492 | faim_internal int aim_puttlv_16(fu8_t *buf, const fu16_t t, const fu16_t v); |
---|
| 493 | faim_internal int aim_puttlv_32(fu8_t *buf, const fu16_t t, const fu32_t v); |
---|
| 494 | faim_internal int aim_puttlv_raw(fu8_t *buf, const fu16_t t, const fu16_t l, const fu8_t *v); |
---|
| 495 | #endif |
---|
| 496 | |
---|
| 497 | /* TLV list handling. */ |
---|
| 498 | faim_internal aim_tlvlist_t *aim_readtlvchain(aim_bstream_t *bs); |
---|
[862371b] | 499 | faim_internal aim_tlvlist_t *aim_readtlvchain_num(aim_bstream_t *bs, fu16_t num); |
---|
[5e53c4a] | 500 | faim_internal void aim_freetlvchain(aim_tlvlist_t **list); |
---|
| 501 | faim_internal aim_tlv_t *aim_gettlv(aim_tlvlist_t *, fu16_t t, const int n); |
---|
| 502 | faim_internal char *aim_gettlv_str(aim_tlvlist_t *, const fu16_t t, const int n); |
---|
| 503 | faim_internal fu8_t aim_gettlv8(aim_tlvlist_t *list, const fu16_t type, const int num); |
---|
| 504 | faim_internal fu16_t aim_gettlv16(aim_tlvlist_t *list, const fu16_t t, const int n); |
---|
| 505 | faim_internal fu32_t aim_gettlv32(aim_tlvlist_t *list, const fu16_t t, const int n); |
---|
| 506 | faim_internal int aim_writetlvchain(aim_bstream_t *bs, aim_tlvlist_t **list); |
---|
| 507 | faim_internal int aim_addtlvtochain8(aim_tlvlist_t **list, const fu16_t t, const fu8_t v); |
---|
| 508 | faim_internal int aim_addtlvtochain16(aim_tlvlist_t **list, const fu16_t t, const fu16_t v); |
---|
| 509 | faim_internal int aim_addtlvtochain32(aim_tlvlist_t **list, const fu16_t type, const fu32_t v); |
---|
| 510 | faim_internal int aim_addtlvtochain_raw(aim_tlvlist_t **list, const fu16_t t, const fu16_t l, const fu8_t *v); |
---|
| 511 | faim_internal int aim_addtlvtochain_caps(aim_tlvlist_t **list, const fu16_t t, const fu32_t caps); |
---|
| 512 | faim_internal int aim_addtlvtochain_noval(aim_tlvlist_t **list, const fu16_t type); |
---|
| 513 | faim_internal int aim_addtlvtochain_userinfo(aim_tlvlist_t **list, fu16_t type, aim_userinfo_t *ui); |
---|
| 514 | faim_internal int aim_addtlvtochain_frozentlvlist(aim_tlvlist_t **list, fu16_t type, aim_tlvlist_t **tl); |
---|
| 515 | faim_internal int aim_counttlvchain(aim_tlvlist_t **list); |
---|
| 516 | faim_internal int aim_sizetlvchain(aim_tlvlist_t **list); |
---|
| 517 | #endif /* FAIM_INTERNAL */ |
---|
| 518 | |
---|
| 519 | /* |
---|
| 520 | * Get command from connections |
---|
| 521 | * |
---|
| 522 | * aim_get_commmand() is the libfaim lowlevel I/O in the receive direction. |
---|
| 523 | * XXX Make this easily overridable. |
---|
| 524 | * |
---|
| 525 | */ |
---|
| 526 | faim_export int aim_get_command(aim_session_t *, aim_conn_t *); |
---|
| 527 | |
---|
| 528 | /* |
---|
| 529 | * Dispatch commands that are in the rx queue. |
---|
| 530 | */ |
---|
| 531 | faim_export void aim_rxdispatch(aim_session_t *); |
---|
| 532 | |
---|
| 533 | faim_export int aim_debugconn_sendconnect(aim_session_t *sess, aim_conn_t *conn); |
---|
| 534 | |
---|
| 535 | faim_export int aim_logoff(aim_session_t *); |
---|
| 536 | |
---|
| 537 | #if !defined(FAIM_INTERNAL) || defined(FAIM_INTERNAL_INSANE) |
---|
| 538 | /* the library should never call aim_conn_kill */ |
---|
| 539 | faim_export void aim_conn_kill(aim_session_t *sess, aim_conn_t **deadconn); |
---|
| 540 | #endif |
---|
| 541 | |
---|
| 542 | typedef int (*aim_rxcallback_t)(aim_session_t *, aim_frame_t *, ...); |
---|
| 543 | |
---|
| 544 | struct aim_clientrelease { |
---|
| 545 | char *name; |
---|
| 546 | fu32_t build; |
---|
| 547 | char *url; |
---|
| 548 | char *info; |
---|
| 549 | }; |
---|
| 550 | |
---|
| 551 | struct aim_authresp_info { |
---|
| 552 | char *sn; |
---|
| 553 | fu16_t errorcode; |
---|
| 554 | char *errorurl; |
---|
| 555 | fu16_t regstatus; |
---|
| 556 | char *email; |
---|
| 557 | char *bosip; |
---|
| 558 | fu8_t *cookie; |
---|
[862371b] | 559 | char *chpassurl; |
---|
[5e53c4a] | 560 | struct aim_clientrelease latestrelease; |
---|
| 561 | struct aim_clientrelease latestbeta; |
---|
| 562 | }; |
---|
| 563 | |
---|
| 564 | /* Callback data for redirect. */ |
---|
| 565 | struct aim_redirect_data { |
---|
| 566 | fu16_t group; |
---|
| 567 | const char *ip; |
---|
| 568 | const fu8_t *cookie; |
---|
| 569 | struct { /* group == AIM_CONN_TYPE_CHAT */ |
---|
| 570 | fu16_t exchange; |
---|
| 571 | const char *room; |
---|
| 572 | fu16_t instance; |
---|
| 573 | } chat; |
---|
| 574 | }; |
---|
| 575 | |
---|
| 576 | faim_export int aim_clientready(aim_session_t *sess, aim_conn_t *conn); |
---|
| 577 | faim_export int aim_sendflapver(aim_session_t *sess, aim_conn_t *conn); |
---|
| 578 | faim_export int aim_request_login(aim_session_t *sess, aim_conn_t *conn, const char *sn); |
---|
| 579 | faim_export int aim_send_login(aim_session_t *, aim_conn_t *, const char *, const char *, struct client_info_s *, const char *key); |
---|
| 580 | faim_export int aim_encode_password_md5(const char *password, const char *key, unsigned char *digest); |
---|
| 581 | faim_export void aim_purge_rxqueue(aim_session_t *); |
---|
| 582 | |
---|
| 583 | #define AIM_TX_QUEUED 0 /* default */ |
---|
| 584 | #define AIM_TX_IMMEDIATE 1 |
---|
| 585 | #define AIM_TX_USER 2 |
---|
| 586 | faim_export int aim_tx_setenqueue(aim_session_t *sess, int what, int (*func)(aim_session_t *, aim_frame_t *)); |
---|
| 587 | |
---|
| 588 | faim_export int aim_tx_flushqueue(aim_session_t *); |
---|
| 589 | faim_export void aim_tx_purgequeue(aim_session_t *); |
---|
| 590 | |
---|
| 591 | faim_export int aim_conn_setlatency(aim_conn_t *conn, int newval); |
---|
| 592 | |
---|
| 593 | faim_export int aim_conn_addhandler(aim_session_t *, aim_conn_t *conn, u_short family, u_short type, aim_rxcallback_t newhandler, u_short flags); |
---|
| 594 | faim_export int aim_clearhandlers(aim_conn_t *conn); |
---|
| 595 | |
---|
| 596 | faim_export aim_conn_t *aim_conn_findbygroup(aim_session_t *sess, fu16_t group); |
---|
| 597 | faim_export aim_session_t *aim_conn_getsess(aim_conn_t *conn); |
---|
| 598 | faim_export void aim_conn_close(aim_conn_t *deadconn); |
---|
| 599 | faim_export aim_conn_t *aim_newconn(aim_session_t *, int type, const char *dest); |
---|
| 600 | faim_export int aim_conngetmaxfd(aim_session_t *); |
---|
| 601 | faim_export aim_conn_t *aim_select(aim_session_t *, struct timeval *, int *); |
---|
| 602 | faim_export int aim_conn_isready(aim_conn_t *); |
---|
| 603 | faim_export int aim_conn_setstatus(aim_conn_t *, int); |
---|
| 604 | faim_export int aim_conn_completeconnect(aim_session_t *sess, aim_conn_t *conn); |
---|
| 605 | faim_export int aim_conn_isconnecting(aim_conn_t *conn); |
---|
| 606 | |
---|
| 607 | typedef void (*faim_debugging_callback_t)(aim_session_t *sess, int level, const char *format, va_list va); |
---|
| 608 | faim_export int aim_setdebuggingcb(aim_session_t *sess, faim_debugging_callback_t); |
---|
| 609 | faim_export void aim_session_init(aim_session_t *, unsigned long flags, int debuglevel); |
---|
| 610 | faim_export void aim_session_kill(aim_session_t *); |
---|
| 611 | faim_export void aim_setupproxy(aim_session_t *sess, const char *server, const char *username, const char *password); |
---|
| 612 | faim_export aim_conn_t *aim_getconn_type(aim_session_t *, int type); |
---|
| 613 | faim_export aim_conn_t *aim_getconn_type_all(aim_session_t *, int type); |
---|
| 614 | faim_export aim_conn_t *aim_getconn_fd(aim_session_t *, int fd); |
---|
| 615 | |
---|
[862371b] | 616 | /* misc.c */ |
---|
[5e53c4a] | 617 | |
---|
| 618 | #define AIM_VISIBILITYCHANGE_PERMITADD 0x05 |
---|
| 619 | #define AIM_VISIBILITYCHANGE_PERMITREMOVE 0x06 |
---|
| 620 | #define AIM_VISIBILITYCHANGE_DENYADD 0x07 |
---|
| 621 | #define AIM_VISIBILITYCHANGE_DENYREMOVE 0x08 |
---|
| 622 | |
---|
| 623 | #define AIM_PRIVFLAGS_ALLOWIDLE 0x01 |
---|
| 624 | #define AIM_PRIVFLAGS_ALLOWMEMBERSINCE 0x02 |
---|
| 625 | |
---|
| 626 | #define AIM_WARN_ANON 0x01 |
---|
| 627 | |
---|
| 628 | faim_export int aim_sendpauseack(aim_session_t *sess, aim_conn_t *conn); |
---|
| 629 | faim_export int aim_send_warning(aim_session_t *sess, aim_conn_t *conn, const char *destsn, fu32_t flags); |
---|
| 630 | faim_export int aim_nop(aim_session_t *, aim_conn_t *); |
---|
| 631 | faim_export int aim_flap_nop(aim_session_t *sess, aim_conn_t *conn); |
---|
| 632 | faim_export int aim_bos_setidle(aim_session_t *, aim_conn_t *, fu32_t); |
---|
| 633 | faim_export int aim_bos_changevisibility(aim_session_t *, aim_conn_t *, int, const char *); |
---|
| 634 | faim_export int aim_bos_setbuddylist(aim_session_t *, aim_conn_t *, const char *); |
---|
| 635 | faim_export int aim_bos_setprofile(aim_session_t *sess, aim_conn_t *conn, const char *profile, const char *awaymsg, fu32_t caps); |
---|
| 636 | faim_export int aim_bos_setgroupperm(aim_session_t *, aim_conn_t *, fu32_t mask); |
---|
| 637 | faim_export int aim_bos_setprivacyflags(aim_session_t *, aim_conn_t *, fu32_t); |
---|
| 638 | faim_export int aim_reqpersonalinfo(aim_session_t *, aim_conn_t *); |
---|
| 639 | faim_export int aim_reqservice(aim_session_t *, aim_conn_t *, fu16_t); |
---|
| 640 | faim_export int aim_bos_reqrights(aim_session_t *, aim_conn_t *); |
---|
| 641 | faim_export int aim_bos_reqbuddyrights(aim_session_t *, aim_conn_t *); |
---|
| 642 | faim_export int aim_bos_reqlocaterights(aim_session_t *, aim_conn_t *); |
---|
| 643 | faim_export int aim_setdirectoryinfo(aim_session_t *sess, aim_conn_t *conn, const char *first, const char *middle, const char *last, const char *maiden, const char *nickname, const char *street, const char *city, const char *state, const char *zip, int country, fu16_t privacy); |
---|
| 644 | faim_export int aim_setuserinterests(aim_session_t *sess, aim_conn_t *conn, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, fu16_t privacy); |
---|
| 645 | faim_export int aim_setextstatus(aim_session_t *sess, aim_conn_t *conn, fu32_t status); |
---|
| 646 | |
---|
| 647 | faim_export struct aim_fileheader_t *aim_getlisting(aim_session_t *sess, FILE *); |
---|
| 648 | |
---|
| 649 | #define AIM_CLIENTTYPE_UNKNOWN 0x0000 |
---|
| 650 | #define AIM_CLIENTTYPE_MC 0x0001 |
---|
| 651 | #define AIM_CLIENTTYPE_WINAIM 0x0002 |
---|
| 652 | #define AIM_CLIENTTYPE_WINAIM41 0x0003 |
---|
| 653 | #define AIM_CLIENTTYPE_AOL_TOC 0x0004 |
---|
| 654 | faim_export unsigned short aim_fingerprintclient(unsigned char *msghdr, int len); |
---|
| 655 | |
---|
| 656 | #define AIM_RATE_CODE_CHANGE 0x0001 |
---|
| 657 | #define AIM_RATE_CODE_WARNING 0x0002 |
---|
| 658 | #define AIM_RATE_CODE_LIMIT 0x0003 |
---|
| 659 | #define AIM_RATE_CODE_CLEARLIMIT 0x0004 |
---|
| 660 | faim_export int aim_ads_requestads(aim_session_t *sess, aim_conn_t *conn); |
---|
| 661 | |
---|
[862371b] | 662 | /* im.c */ |
---|
[5e53c4a] | 663 | |
---|
| 664 | struct aim_fileheader_t { |
---|
| 665 | #if 0 |
---|
| 666 | char magic[4]; /* 0 */ |
---|
| 667 | short hdrlen; /* 4 */ |
---|
| 668 | short hdrtype; /* 6 */ |
---|
| 669 | #endif |
---|
| 670 | char bcookie[8]; /* 8 */ |
---|
| 671 | short encrypt; /* 16 */ |
---|
| 672 | short compress; /* 18 */ |
---|
| 673 | short totfiles; /* 20 */ |
---|
| 674 | short filesleft; /* 22 */ |
---|
| 675 | short totparts; /* 24 */ |
---|
| 676 | short partsleft; /* 26 */ |
---|
| 677 | long totsize; /* 28 */ |
---|
| 678 | long size; /* 32 */ |
---|
| 679 | long modtime; /* 36 */ |
---|
| 680 | long checksum; /* 40 */ |
---|
| 681 | long rfrcsum; /* 44 */ |
---|
| 682 | long rfsize; /* 48 */ |
---|
| 683 | long cretime; /* 52 */ |
---|
| 684 | long rfcsum; /* 56 */ |
---|
| 685 | long nrecvd; /* 60 */ |
---|
| 686 | long recvcsum; /* 64 */ |
---|
| 687 | char idstring[32]; /* 68 */ |
---|
| 688 | char flags; /* 100 */ |
---|
| 689 | char lnameoffset; /* 101 */ |
---|
| 690 | char lsizeoffset; /* 102 */ |
---|
| 691 | char dummy[69]; /* 103 */ |
---|
| 692 | char macfileinfo[16]; /* 172 */ |
---|
| 693 | short nencode; /* 188 */ |
---|
| 694 | short nlanguage; /* 190 */ |
---|
| 695 | char name[64]; /* 192 */ |
---|
| 696 | /* 256 */ |
---|
| 697 | }; |
---|
| 698 | |
---|
[862371b] | 699 | #define AIM_OFT_SUBTYPE_SEND_FILE 0x0001 |
---|
| 700 | #define AIM_OFT_SUBTYPE_SEND_DIR 0x0002 |
---|
| 701 | #define AIM_OFT_SUBTYPE_GET_FILE 0x0011 |
---|
| 702 | #define AIM_OPT_SUBTYPE_GET_LIST 0x0012 |
---|
[5e53c4a] | 703 | |
---|
| 704 | struct aim_chat_roominfo { |
---|
| 705 | unsigned short exchange; |
---|
| 706 | char *name; |
---|
| 707 | unsigned short instance; |
---|
| 708 | }; |
---|
| 709 | |
---|
| 710 | #define AIM_IMFLAGS_AWAY 0x0001 /* mark as an autoreply */ |
---|
| 711 | #define AIM_IMFLAGS_ACK 0x0002 /* request a receipt notice */ |
---|
| 712 | #define AIM_IMFLAGS_UNICODE 0x0004 |
---|
| 713 | #define AIM_IMFLAGS_ISO_8859_1 0x0008 |
---|
| 714 | #define AIM_IMFLAGS_BUDDYREQ 0x0010 /* buddy icon requested */ |
---|
| 715 | #define AIM_IMFLAGS_HASICON 0x0020 /* already has icon */ |
---|
| 716 | #define AIM_IMFLAGS_SUBENC_MACINTOSH 0x0040 /* damn that Steve Jobs! */ |
---|
| 717 | #define AIM_IMFLAGS_CUSTOMFEATURES 0x0080 /* features field present */ |
---|
| 718 | #define AIM_IMFLAGS_EXTDATA 0x0100 |
---|
| 719 | #define AIM_IMFLAGS_CUSTOMCHARSET 0x0200 /* charset fields set */ |
---|
| 720 | #define AIM_IMFLAGS_MULTIPART 0x0400 /* ->mpmsg section valid */ |
---|
| 721 | #define AIM_IMFLAGS_OFFLINE 0x0800 /* send to offline user */ |
---|
[862371b] | 722 | #define AIM_IMFLAGS_TYPINGNOT 0x1000 /* typing notification */ |
---|
[5e53c4a] | 723 | |
---|
| 724 | /* |
---|
| 725 | * Multipart message structures. |
---|
| 726 | */ |
---|
| 727 | typedef struct aim_mpmsg_section_s { |
---|
| 728 | fu16_t charset; |
---|
| 729 | fu16_t charsubset; |
---|
| 730 | fu8_t *data; |
---|
| 731 | fu16_t datalen; |
---|
| 732 | struct aim_mpmsg_section_s *next; |
---|
| 733 | } aim_mpmsg_section_t; |
---|
| 734 | |
---|
| 735 | typedef struct aim_mpmsg_s { |
---|
| 736 | int numparts; |
---|
| 737 | aim_mpmsg_section_t *parts; |
---|
| 738 | } aim_mpmsg_t; |
---|
| 739 | |
---|
| 740 | faim_export int aim_mpmsg_init(aim_session_t *sess, aim_mpmsg_t *mpm); |
---|
| 741 | faim_export int aim_mpmsg_addraw(aim_session_t *sess, aim_mpmsg_t *mpm, fu16_t charset, fu16_t charsubset, const fu8_t *data, fu16_t datalen); |
---|
| 742 | faim_export int aim_mpmsg_addascii(aim_session_t *sess, aim_mpmsg_t *mpm, const char *ascii); |
---|
| 743 | faim_export int aim_mpmsg_addunicode(aim_session_t *sess, aim_mpmsg_t *mpm, const fu16_t *unicode, fu16_t unicodelen); |
---|
| 744 | faim_export void aim_mpmsg_free(aim_session_t *sess, aim_mpmsg_t *mpm); |
---|
| 745 | |
---|
| 746 | /* |
---|
| 747 | * Arguments to aim_send_im_ext(). |
---|
| 748 | * |
---|
| 749 | * This is really complicated. But immensely versatile. |
---|
| 750 | * |
---|
| 751 | */ |
---|
| 752 | struct aim_sendimext_args { |
---|
| 753 | |
---|
| 754 | /* These are _required_ */ |
---|
| 755 | const char *destsn; |
---|
| 756 | fu32_t flags; /* often 0 */ |
---|
| 757 | |
---|
| 758 | /* Only required if not using multipart messages */ |
---|
| 759 | const char *msg; |
---|
| 760 | int msglen; |
---|
| 761 | |
---|
| 762 | /* Required if ->msg is not provided */ |
---|
| 763 | aim_mpmsg_t *mpmsg; |
---|
| 764 | |
---|
| 765 | /* Only used if AIM_IMFLAGS_HASICON is set */ |
---|
| 766 | fu32_t iconlen; |
---|
| 767 | time_t iconstamp; |
---|
| 768 | fu32_t iconsum; |
---|
| 769 | |
---|
| 770 | /* Only used if AIM_IMFLAGS_CUSTOMFEATURES is set */ |
---|
| 771 | fu8_t *features; |
---|
| 772 | fu8_t featureslen; |
---|
| 773 | |
---|
| 774 | /* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set and mpmsg not used */ |
---|
| 775 | fu16_t charset; |
---|
| 776 | fu16_t charsubset; |
---|
| 777 | }; |
---|
| 778 | |
---|
| 779 | /* |
---|
| 780 | * Arguments to aim_send_rtfmsg(). |
---|
| 781 | */ |
---|
| 782 | struct aim_sendrtfmsg_args { |
---|
| 783 | const char *destsn; |
---|
| 784 | fu32_t fgcolor; |
---|
| 785 | fu32_t bgcolor; |
---|
| 786 | const char *rtfmsg; /* must be in RTF */ |
---|
| 787 | }; |
---|
| 788 | |
---|
| 789 | /* |
---|
| 790 | * This information is provided in the Incoming ICBM callback for |
---|
| 791 | * Channel 1 ICBM's. |
---|
| 792 | * |
---|
| 793 | * Note that although CUSTOMFEATURES and CUSTOMCHARSET say they |
---|
| 794 | * are optional, both are always set by the current libfaim code. |
---|
| 795 | * That may or may not change in the future. It is mainly for |
---|
| 796 | * consistency with aim_sendimext_args. |
---|
| 797 | * |
---|
| 798 | * Multipart messages require some explanation. If you want to use them, |
---|
| 799 | * I suggest you read all the comments in im.c. |
---|
| 800 | * |
---|
| 801 | */ |
---|
| 802 | struct aim_incomingim_ch1_args { |
---|
| 803 | |
---|
| 804 | /* Always provided */ |
---|
| 805 | aim_mpmsg_t mpmsg; |
---|
| 806 | fu32_t icbmflags; /* some flags apply only to ->msg, not all mpmsg */ |
---|
| 807 | |
---|
| 808 | /* Only provided if message has a human-readable section */ |
---|
| 809 | char *msg; |
---|
| 810 | int msglen; |
---|
| 811 | |
---|
| 812 | /* Only provided if AIM_IMFLAGS_HASICON is set */ |
---|
| 813 | time_t iconstamp; |
---|
| 814 | fu32_t iconlen; |
---|
| 815 | fu16_t iconsum; |
---|
| 816 | |
---|
| 817 | /* Only provided if AIM_IMFLAGS_CUSTOMFEATURES is set */ |
---|
| 818 | fu8_t *features; |
---|
| 819 | fu8_t featureslen; |
---|
| 820 | |
---|
| 821 | /* Only provided if AIM_IMFLAGS_EXTDATA is set */ |
---|
| 822 | fu8_t extdatalen; |
---|
| 823 | fu8_t *extdata; |
---|
| 824 | |
---|
| 825 | /* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set */ |
---|
| 826 | fu16_t charset; |
---|
| 827 | fu16_t charsubset; |
---|
| 828 | }; |
---|
| 829 | |
---|
| 830 | /* Valid values for channel 2 args->status */ |
---|
| 831 | #define AIM_RENDEZVOUS_PROPOSE 0x0000 |
---|
| 832 | #define AIM_RENDEZVOUS_CANCEL 0x0001 |
---|
| 833 | #define AIM_RENDEZVOUS_ACCEPT 0x0002 |
---|
| 834 | |
---|
| 835 | struct aim_incomingim_ch2_args { |
---|
| 836 | fu8_t cookie[8]; |
---|
| 837 | fu16_t reqclass; |
---|
| 838 | fu16_t status; |
---|
| 839 | fu16_t errorcode; |
---|
| 840 | const char *clientip; |
---|
| 841 | const char *clientip2; |
---|
| 842 | const char *verifiedip; |
---|
| 843 | fu16_t port; |
---|
| 844 | const char *msg; /* invite message or file description */ |
---|
| 845 | const char *encoding; |
---|
| 846 | const char *language; |
---|
| 847 | union { |
---|
| 848 | struct { |
---|
| 849 | fu32_t checksum; |
---|
| 850 | fu32_t length; |
---|
| 851 | time_t timestamp; |
---|
| 852 | fu8_t *icon; |
---|
| 853 | } icon; |
---|
| 854 | struct { |
---|
| 855 | struct aim_chat_roominfo roominfo; |
---|
| 856 | } chat; |
---|
| 857 | struct { |
---|
| 858 | fu32_t fgcolor; |
---|
| 859 | fu32_t bgcolor; |
---|
| 860 | const char *rtfmsg; |
---|
| 861 | } rtfmsg; |
---|
[862371b] | 862 | struct { |
---|
| 863 | fu16_t subtype; |
---|
| 864 | fu16_t totfiles; |
---|
| 865 | fu32_t totsize; |
---|
| 866 | char *filename; |
---|
| 867 | } sendfile; |
---|
[5e53c4a] | 868 | } info; |
---|
| 869 | void *destructor; /* used internally only */ |
---|
| 870 | }; |
---|
| 871 | |
---|
[862371b] | 872 | /* Valid values for channel 4 args->type */ |
---|
| 873 | #define AIM_ICQMSG_AUTHREQUEST 0x0006 |
---|
| 874 | #define AIM_ICQMSG_AUTHDENIED 0x0007 |
---|
| 875 | #define AIM_ICQMSG_AUTHGRANTED 0x0008 |
---|
| 876 | |
---|
| 877 | struct aim_incomingim_ch4_args { |
---|
| 878 | fu32_t uin; /* Of the sender of the ICBM */ |
---|
| 879 | fu16_t type; |
---|
| 880 | char *msg; /* Reason for auth request, deny, or accept */ |
---|
| 881 | }; |
---|
| 882 | |
---|
[5e53c4a] | 883 | faim_export int aim_send_rtfmsg(aim_session_t *sess, struct aim_sendrtfmsg_args *args); |
---|
| 884 | faim_export int aim_send_im_ext(aim_session_t *sess, struct aim_sendimext_args *args); |
---|
| 885 | faim_export int aim_send_im(aim_session_t *, const char *destsn, unsigned short flags, const char *msg); |
---|
| 886 | faim_export int aim_send_icon(aim_session_t *sess, const char *sn, const fu8_t *icon, int iconlen, time_t stamp, fu16_t iconsum); |
---|
| 887 | faim_export fu16_t aim_iconsum(const fu8_t *buf, int buflen); |
---|
[862371b] | 888 | faim_export int aim_send_typing(aim_session_t *sess, aim_conn_t *conn, int typing); |
---|
| 889 | faim_export int aim_send_im_direct(aim_session_t *, aim_conn_t *, const char *msg, int len, int encoding); |
---|
[5e53c4a] | 890 | faim_export const char *aim_directim_getsn(aim_conn_t *conn); |
---|
| 891 | faim_export aim_conn_t *aim_directim_initiate(aim_session_t *, const char *destsn); |
---|
| 892 | faim_export aim_conn_t *aim_directim_connect(aim_session_t *, const char *sn, const char *addr, const fu8_t *cookie); |
---|
| 893 | |
---|
[862371b] | 894 | faim_export int aim_send_im_ch2_geticqmessage(aim_session_t *sess, const char *sn, int type); |
---|
| 895 | faim_export aim_conn_t *aim_sendfile_initiate(aim_session_t *, const char *destsn, const char *filename, fu16_t numfiles, fu32_t totsize, char *cookret); |
---|
| 896 | faim_export int aim_send_im_ch4(aim_session_t *sess, char *sn, fu16_t type, fu8_t *message); |
---|
| 897 | |
---|
| 898 | faim_export int aim_mtn_send(aim_session_t *sess, fu16_t type1, char *sn, fu16_t type2); |
---|
[5e53c4a] | 899 | |
---|
| 900 | faim_export aim_conn_t *aim_getfile_initiate(aim_session_t *sess, aim_conn_t *conn, const char *destsn); |
---|
| 901 | faim_export int aim_oft_getfile_request(aim_session_t *sess, aim_conn_t *conn, const char *name, int size); |
---|
[862371b] | 902 | faim_export int aim_oft_sendfile_request(aim_session_t *sess, aim_conn_t *conn, |
---|
| 903 | const char *name, int filesdone, int numfiles, int size, |
---|
| 904 | int totsize); |
---|
[5e53c4a] | 905 | faim_export int aim_oft_getfile_ack(aim_session_t *sess, aim_conn_t *conn); |
---|
[862371b] | 906 | faim_export int aim_oft_end(aim_session_t *sess, aim_conn_t *conn); |
---|
[5e53c4a] | 907 | |
---|
[862371b] | 908 | /* info.c */ |
---|
[5e53c4a] | 909 | #define AIM_CAPS_BUDDYICON 0x00000001 |
---|
| 910 | #define AIM_CAPS_VOICE 0x00000002 |
---|
| 911 | #define AIM_CAPS_IMIMAGE 0x00000004 |
---|
| 912 | #define AIM_CAPS_CHAT 0x00000008 |
---|
| 913 | #define AIM_CAPS_GETFILE 0x00000010 |
---|
| 914 | #define AIM_CAPS_SENDFILE 0x00000020 |
---|
| 915 | #define AIM_CAPS_GAMES 0x00000040 |
---|
| 916 | #define AIM_CAPS_SAVESTOCKS 0x00000080 |
---|
| 917 | #define AIM_CAPS_SENDBUDDYLIST 0x00000100 |
---|
| 918 | #define AIM_CAPS_GAMES2 0x00000200 |
---|
| 919 | #define AIM_CAPS_ICQ 0x00000400 |
---|
| 920 | #define AIM_CAPS_APINFO 0x00000800 |
---|
| 921 | #define AIM_CAPS_ICQRTF 0x00001000 |
---|
| 922 | #define AIM_CAPS_EMPTY 0x00002000 |
---|
| 923 | #define AIM_CAPS_ICQSERVERRELAY 0x00004000 |
---|
| 924 | #define AIM_CAPS_ICQUNKNOWN 0x00008000 |
---|
| 925 | #define AIM_CAPS_TRILLIANCRYPT 0x00010000 |
---|
| 926 | #define AIM_CAPS_LAST 0x00020000 |
---|
| 927 | |
---|
| 928 | faim_export int aim_0002_000b(aim_session_t *sess, aim_conn_t *conn, const char *sn); |
---|
| 929 | |
---|
| 930 | #define AIM_SENDMEMBLOCK_FLAG_ISREQUEST 0 |
---|
| 931 | #define AIM_SENDMEMBLOCK_FLAG_ISHASH 1 |
---|
| 932 | |
---|
| 933 | faim_export int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, unsigned long offset, unsigned long len, const unsigned char *buf, unsigned char flag); |
---|
| 934 | |
---|
| 935 | #define AIM_GETINFO_GENERALINFO 0x00001 |
---|
| 936 | #define AIM_GETINFO_AWAYMESSAGE 0x00003 |
---|
| 937 | #define AIM_GETINFO_CAPABILITIES 0x0004 |
---|
| 938 | |
---|
| 939 | struct aim_invite_priv { |
---|
| 940 | char *sn; |
---|
| 941 | char *roomname; |
---|
| 942 | fu16_t exchange; |
---|
| 943 | fu16_t instance; |
---|
| 944 | }; |
---|
| 945 | |
---|
| 946 | #define AIM_COOKIETYPE_UNKNOWN 0x00 |
---|
| 947 | #define AIM_COOKIETYPE_ICBM 0x01 |
---|
| 948 | #define AIM_COOKIETYPE_ADS 0x02 |
---|
| 949 | #define AIM_COOKIETYPE_BOS 0x03 |
---|
| 950 | #define AIM_COOKIETYPE_IM 0x04 |
---|
| 951 | #define AIM_COOKIETYPE_CHAT 0x05 |
---|
| 952 | #define AIM_COOKIETYPE_CHATNAV 0x06 |
---|
| 953 | #define AIM_COOKIETYPE_INVITE 0x07 |
---|
| 954 | /* we'll move OFT up a bit to give breathing room. not like it really |
---|
| 955 | * matters. */ |
---|
| 956 | #define AIM_COOKIETYPE_OFTIM 0x10 |
---|
| 957 | #define AIM_COOKIETYPE_OFTGET 0x11 |
---|
| 958 | #define AIM_COOKIETYPE_OFTSEND 0x12 |
---|
| 959 | #define AIM_COOKIETYPE_OFTVOICE 0x13 |
---|
| 960 | #define AIM_COOKIETYPE_OFTIMAGE 0x14 |
---|
| 961 | #define AIM_COOKIETYPE_OFTICON 0x15 |
---|
| 962 | |
---|
| 963 | faim_export int aim_handlerendconnect(aim_session_t *sess, aim_conn_t *cur); |
---|
| 964 | |
---|
| 965 | #define AIM_TRANSFER_DENY_NOTSUPPORTED 0x0000 |
---|
| 966 | #define AIM_TRANSFER_DENY_DECLINE 0x0001 |
---|
| 967 | #define AIM_TRANSFER_DENY_NOTACCEPTING 0x0002 |
---|
| 968 | faim_export int aim_denytransfer(aim_session_t *sess, const char *sender, const char *cookie, unsigned short code); |
---|
[862371b] | 969 | faim_export aim_conn_t *aim_accepttransfer(aim_session_t *sess, aim_conn_t *conn, const char *sn, const fu8_t *cookie, const fu8_t *ip, fu16_t port, fu16_t rendid, ...); |
---|
| 970 | faim_export int aim_canceltransfer(aim_session_t *sess, aim_conn_t *conn, |
---|
| 971 | const char *cookie, const char *sn, int rendid); |
---|
| 972 | faim_export fu32_t aim_update_checksum(aim_session_t *sess, aim_conn_t *conn, |
---|
| 973 | const unsigned char *buffer, int bufferlen); |
---|
[5e53c4a] | 974 | |
---|
| 975 | faim_export int aim_getinfo(aim_session_t *, aim_conn_t *, const char *, unsigned short); |
---|
| 976 | faim_export int aim_sendbuddyoncoming(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *info); |
---|
| 977 | faim_export int aim_sendbuddyoffgoing(aim_session_t *sess, aim_conn_t *conn, const char *sn); |
---|
| 978 | |
---|
| 979 | #define AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED 0x00000001 |
---|
| 980 | #define AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED 0x00000002 |
---|
| 981 | |
---|
| 982 | /* This is what the server will give you if you don't set them yourself. */ |
---|
| 983 | #define AIM_IMPARAM_DEFAULTS { \ |
---|
| 984 | 0, \ |
---|
| 985 | AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \ |
---|
| 986 | 512, /* !! Note how small this is. */ \ |
---|
| 987 | (99.9)*10, (99.9)*10, \ |
---|
| 988 | 1000 /* !! And how large this is. */ \ |
---|
| 989 | } |
---|
| 990 | |
---|
| 991 | /* This is what most AIM versions use. */ |
---|
| 992 | #define AIM_IMPARAM_REASONABLE { \ |
---|
| 993 | 0, \ |
---|
| 994 | AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \ |
---|
| 995 | 8000, \ |
---|
| 996 | (99.9)*10, (99.9)*10, \ |
---|
| 997 | 0 \ |
---|
| 998 | } |
---|
| 999 | |
---|
| 1000 | |
---|
| 1001 | struct aim_icbmparameters { |
---|
[862371b] | 1002 | fu16_t maxchan; |
---|
| 1003 | fu32_t flags; /* AIM_IMPARAM_FLAG_ */ |
---|
| 1004 | fu16_t maxmsglen; /* message size that you will accept */ |
---|
| 1005 | fu16_t maxsenderwarn; /* this and below are *10 (999=99.9%) */ |
---|
| 1006 | fu16_t maxrecverwarn; |
---|
| 1007 | fu32_t minmsginterval; /* in milliseconds? */ |
---|
[5e53c4a] | 1008 | }; |
---|
| 1009 | |
---|
| 1010 | faim_export int aim_reqicbmparams(aim_session_t *sess); |
---|
| 1011 | faim_export int aim_seticbmparam(aim_session_t *sess, struct aim_icbmparameters *params); |
---|
| 1012 | |
---|
| 1013 | |
---|
| 1014 | /* auth.c */ |
---|
| 1015 | faim_export int aim_sendcookie(aim_session_t *, aim_conn_t *, const fu8_t *); |
---|
| 1016 | |
---|
| 1017 | faim_export int aim_admin_changepasswd(aim_session_t *, aim_conn_t *, const char *newpw, const char *curpw); |
---|
| 1018 | faim_export int aim_admin_reqconfirm(aim_session_t *sess, aim_conn_t *conn); |
---|
| 1019 | faim_export int aim_admin_getinfo(aim_session_t *sess, aim_conn_t *conn, fu16_t info); |
---|
| 1020 | faim_export int aim_admin_setemail(aim_session_t *sess, aim_conn_t *conn, const char *newemail); |
---|
| 1021 | faim_export int aim_admin_setnick(aim_session_t *sess, aim_conn_t *conn, const char *newnick); |
---|
| 1022 | |
---|
[862371b] | 1023 | /* buddylist.c */ |
---|
[5e53c4a] | 1024 | faim_export int aim_add_buddy(aim_session_t *, aim_conn_t *, const char *); |
---|
| 1025 | faim_export int aim_remove_buddy(aim_session_t *, aim_conn_t *, const char *); |
---|
| 1026 | |
---|
[862371b] | 1027 | /* search.c */ |
---|
[5e53c4a] | 1028 | faim_export int aim_usersearch_address(aim_session_t *, aim_conn_t *, const char *); |
---|
| 1029 | |
---|
[862371b] | 1030 | /* newsearch.c */ |
---|
| 1031 | struct aim_usersearch { |
---|
| 1032 | char *first; |
---|
| 1033 | char *last; |
---|
| 1034 | char *middle; |
---|
| 1035 | char *maiden; |
---|
| 1036 | char *email; |
---|
| 1037 | char *country; |
---|
| 1038 | char *state; |
---|
| 1039 | char *city; |
---|
| 1040 | char *sn; |
---|
| 1041 | char *interest; |
---|
| 1042 | char *nick; |
---|
| 1043 | char *zip; |
---|
| 1044 | char *region; |
---|
| 1045 | char *address; |
---|
| 1046 | struct aim_usersearch *next; |
---|
| 1047 | }; |
---|
| 1048 | |
---|
| 1049 | faim_export int aim_usersearch_email(aim_session_t *, const char *, const char *); |
---|
| 1050 | faim_export int aim_usersearch_name(aim_session_t *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *); |
---|
| 1051 | faim_export int aim_usersearch_interest(aim_session_t *, const char *, const char *); |
---|
| 1052 | |
---|
| 1053 | |
---|
[5e53c4a] | 1054 | /* These apply to exchanges as well. */ |
---|
| 1055 | #define AIM_CHATROOM_FLAG_EVILABLE 0x0001 |
---|
| 1056 | #define AIM_CHATROOM_FLAG_NAV_ONLY 0x0002 |
---|
| 1057 | #define AIM_CHATROOM_FLAG_INSTANCING_ALLOWED 0x0004 |
---|
| 1058 | #define AIM_CHATROOM_FLAG_OCCUPANT_PEEK_ALLOWED 0x0008 |
---|
| 1059 | |
---|
| 1060 | struct aim_chat_exchangeinfo { |
---|
| 1061 | fu16_t number; |
---|
| 1062 | fu16_t flags; |
---|
| 1063 | char *name; |
---|
| 1064 | char *charset1; |
---|
| 1065 | char *lang1; |
---|
| 1066 | char *charset2; |
---|
| 1067 | char *lang2; |
---|
| 1068 | }; |
---|
| 1069 | |
---|
| 1070 | #define AIM_CHATFLAGS_NOREFLECT 0x0001 |
---|
| 1071 | #define AIM_CHATFLAGS_AWAY 0x0002 |
---|
| 1072 | faim_export int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, fu16_t flags, const char *msg, int msglen); |
---|
| 1073 | faim_export int aim_chat_join(aim_session_t *sess, aim_conn_t *conn, fu16_t exchange, const char *roomname, fu16_t instance); |
---|
| 1074 | faim_export int aim_chat_attachname(aim_conn_t *conn, fu16_t exchange, const char *roomname, fu16_t instance); |
---|
| 1075 | faim_export char *aim_chat_getname(aim_conn_t *conn); |
---|
| 1076 | faim_export aim_conn_t *aim_chat_getconn(aim_session_t *, const char *name); |
---|
| 1077 | |
---|
| 1078 | faim_export int aim_chatnav_reqrights(aim_session_t *sess, aim_conn_t *conn); |
---|
| 1079 | |
---|
| 1080 | faim_export int aim_chat_invite(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *msg, fu16_t exchange, const char *roomname, fu16_t instance); |
---|
| 1081 | |
---|
| 1082 | faim_export int aim_chatnav_createroom(aim_session_t *sess, aim_conn_t *conn, const char *name, fu16_t exchange); |
---|
| 1083 | faim_export int aim_chat_leaveroom(aim_session_t *sess, const char *name); |
---|
| 1084 | |
---|
| 1085 | |
---|
| 1086 | #define AIM_SSI_TYPE_BUDDY 0x0000 |
---|
| 1087 | #define AIM_SSI_TYPE_GROUP 0x0001 |
---|
[862371b] | 1088 | #define AIM_SSI_TYPE_PERMIT 0x0002 |
---|
| 1089 | #define AIM_SSI_TYPE_DENY 0x0003 |
---|
[5e53c4a] | 1090 | #define AIM_SSI_TYPE_PDINFO 0x0004 |
---|
| 1091 | #define AIM_SSI_TYPE_PRESENCEPREFS 0x0005 |
---|
| 1092 | |
---|
| 1093 | struct aim_ssi_item { |
---|
| 1094 | char *name; |
---|
| 1095 | fu16_t gid; |
---|
| 1096 | fu16_t bid; |
---|
| 1097 | fu16_t type; |
---|
| 1098 | void *data; |
---|
| 1099 | struct aim_ssi_item *next; |
---|
| 1100 | }; |
---|
| 1101 | |
---|
[862371b] | 1102 | /* These build the actual SNACs and queue them to be sent */ |
---|
[5e53c4a] | 1103 | faim_export int aim_ssi_reqrights(aim_session_t *sess, aim_conn_t *conn); |
---|
| 1104 | faim_export int aim_ssi_reqdata(aim_session_t *sess, aim_conn_t *conn, time_t localstamp, fu16_t localrev); |
---|
| 1105 | faim_export int aim_ssi_enable(aim_session_t *sess, aim_conn_t *conn); |
---|
[862371b] | 1106 | faim_export int aim_ssi_addmoddel(aim_session_t *sess, aim_conn_t *conn, struct aim_ssi_item **items, unsigned int num, fu16_t subtype); |
---|
[5e53c4a] | 1107 | faim_export int aim_ssi_modbegin(aim_session_t *sess, aim_conn_t *conn); |
---|
| 1108 | faim_export int aim_ssi_modend(aim_session_t *sess, aim_conn_t *conn); |
---|
| 1109 | |
---|
[862371b] | 1110 | /* These handle the local variables */ |
---|
| 1111 | faim_export struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_item *list, fu16_t gid, fu16_t bid); |
---|
| 1112 | faim_export struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_item *list, const char *gn, const char *sn, fu16_t type); |
---|
| 1113 | faim_export struct aim_ssi_item *aim_ssi_itemlist_findparent(struct aim_ssi_item *list, char *sn); |
---|
| 1114 | faim_export int aim_ssi_getpermdeny(struct aim_ssi_item *list); |
---|
| 1115 | faim_export fu32_t aim_ssi_getpresence(struct aim_ssi_item *list); |
---|
| 1116 | faim_export int aim_ssi_cleanlist(aim_session_t *sess, aim_conn_t *conn); |
---|
| 1117 | faim_export int aim_ssi_addbuddies(aim_session_t *sess, aim_conn_t *conn, const char *gn, const char **sn, unsigned int num); |
---|
| 1118 | faim_export int aim_ssi_addmastergroup(aim_session_t *sess, aim_conn_t *conn); |
---|
| 1119 | faim_export int aim_ssi_addgroups(aim_session_t *sess, aim_conn_t *conn, const char **gn, unsigned int num); |
---|
| 1120 | faim_export int aim_ssi_addpord(aim_session_t *sess, aim_conn_t *conn, const char **sn, unsigned int num, fu16_t type); |
---|
| 1121 | faim_export int aim_ssi_movebuddy(aim_session_t *sess, aim_conn_t *conn, const char *oldgn, const char *newgn, const char *sn); |
---|
| 1122 | faim_export int aim_ssi_rename_group(aim_session_t *sess, aim_conn_t *conn, const char *oldgn, const char *newgn); |
---|
| 1123 | faim_export int aim_ssi_delbuddies(aim_session_t *sess, aim_conn_t *conn, const char *gn, char **sn, unsigned int num); |
---|
| 1124 | faim_export int aim_ssi_delmastergroup(aim_session_t *sess, aim_conn_t *conn); |
---|
| 1125 | faim_export int aim_ssi_delgroups(aim_session_t *sess, aim_conn_t *conn, char **gn, unsigned int num); |
---|
| 1126 | faim_export int aim_ssi_deletelist(aim_session_t *sess, aim_conn_t *conn); |
---|
| 1127 | faim_export int aim_ssi_delpord(aim_session_t *sess, aim_conn_t *conn, const char **sn, unsigned int num, fu16_t type); |
---|
| 1128 | faim_export int aim_ssi_setpermdeny(aim_session_t *sess, aim_conn_t *conn, fu8_t permdeny, fu32_t vismask); |
---|
| 1129 | faim_export int aim_ssi_setpresence(aim_session_t *sess, aim_conn_t *conn, fu32_t presence); |
---|
| 1130 | |
---|
[5e53c4a] | 1131 | struct aim_icq_offlinemsg { |
---|
| 1132 | fu32_t sender; |
---|
| 1133 | fu16_t year; |
---|
| 1134 | fu8_t month, day, hour, minute; |
---|
| 1135 | fu16_t type; |
---|
| 1136 | char *msg; |
---|
| 1137 | }; |
---|
| 1138 | |
---|
| 1139 | struct aim_icq_simpleinfo { |
---|
| 1140 | fu32_t uin; |
---|
| 1141 | char *nick; |
---|
| 1142 | char *first; |
---|
| 1143 | char *last; |
---|
| 1144 | char *email; |
---|
| 1145 | }; |
---|
| 1146 | |
---|
| 1147 | faim_export int aim_icq_reqofflinemsgs(aim_session_t *sess); |
---|
| 1148 | faim_export int aim_icq_ackofflinemsgs(aim_session_t *sess); |
---|
| 1149 | faim_export int aim_icq_getsimpleinfo(aim_session_t *sess, const char *uin); |
---|
| 1150 | |
---|
[862371b] | 1151 | /* email.c */ |
---|
| 1152 | struct aim_emailinfo { |
---|
| 1153 | fu8_t *cookie16; |
---|
| 1154 | fu8_t *cookie8; |
---|
| 1155 | char *url; |
---|
| 1156 | fu16_t nummsgs; |
---|
| 1157 | fu8_t unread; |
---|
| 1158 | char *domain; |
---|
| 1159 | fu16_t flag; |
---|
| 1160 | struct aim_emailinfo *next; |
---|
| 1161 | }; |
---|
| 1162 | |
---|
| 1163 | faim_export int aim_email_sendcookies(aim_session_t *sess, aim_conn_t *conn); |
---|
| 1164 | faim_export int aim_email_activate(aim_session_t *sess, aim_conn_t *conn); |
---|
| 1165 | |
---|
| 1166 | /* util.c */ |
---|
[5e53c4a] | 1167 | /* |
---|
| 1168 | * These are really ugly. You'd think this was LISP. I wish it was. |
---|
| 1169 | * |
---|
| 1170 | * XXX With the advent of bstream's, these should be removed to enforce |
---|
| 1171 | * their use. |
---|
| 1172 | * |
---|
| 1173 | */ |
---|
| 1174 | #define aimutil_put8(buf, data) ((*(buf) = (u_char)(data)&0xff),1) |
---|
| 1175 | #define aimutil_get8(buf) ((*(buf))&0xff) |
---|
| 1176 | #define aimutil_put16(buf, data) ( \ |
---|
| 1177 | (*(buf) = (u_char)((data)>>8)&0xff), \ |
---|
| 1178 | (*((buf)+1) = (u_char)(data)&0xff), \ |
---|
| 1179 | 2) |
---|
| 1180 | #define aimutil_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff)) |
---|
| 1181 | #define aimutil_put32(buf, data) ( \ |
---|
| 1182 | (*((buf)) = (u_char)((data)>>24)&0xff), \ |
---|
| 1183 | (*((buf)+1) = (u_char)((data)>>16)&0xff), \ |
---|
| 1184 | (*((buf)+2) = (u_char)((data)>>8)&0xff), \ |
---|
| 1185 | (*((buf)+3) = (u_char)(data)&0xff), \ |
---|
| 1186 | 4) |
---|
| 1187 | #define aimutil_get32(buf) ((((*(buf))<<24)&0xff000000) + \ |
---|
| 1188 | (((*((buf)+1))<<16)&0x00ff0000) + \ |
---|
| 1189 | (((*((buf)+2))<< 8)&0x0000ff00) + \ |
---|
| 1190 | (((*((buf)+3) )&0x000000ff))) |
---|
| 1191 | |
---|
| 1192 | /* Little-endian versions (damn ICQ) */ |
---|
| 1193 | #define aimutil_putle8(buf, data) ( \ |
---|
| 1194 | (*(buf) = (unsigned char)(data) & 0xff), \ |
---|
| 1195 | 1) |
---|
| 1196 | #define aimutil_getle8(buf) ( \ |
---|
| 1197 | (*(buf)) & 0xff \ |
---|
| 1198 | ) |
---|
| 1199 | #define aimutil_putle16(buf, data) ( \ |
---|
| 1200 | (*((buf)+0) = (unsigned char)((data) >> 0) & 0xff), \ |
---|
| 1201 | (*((buf)+1) = (unsigned char)((data) >> 8) & 0xff), \ |
---|
| 1202 | 2) |
---|
| 1203 | #define aimutil_getle16(buf) ( \ |
---|
| 1204 | (((*((buf)+0)) << 0) & 0x00ff) + \ |
---|
| 1205 | (((*((buf)+1)) << 8) & 0xff00) \ |
---|
| 1206 | ) |
---|
| 1207 | #define aimutil_putle32(buf, data) ( \ |
---|
| 1208 | (*((buf)+0) = (unsigned char)((data) >> 0) & 0xff), \ |
---|
| 1209 | (*((buf)+1) = (unsigned char)((data) >> 8) & 0xff), \ |
---|
| 1210 | (*((buf)+2) = (unsigned char)((data) >> 16) & 0xff), \ |
---|
| 1211 | (*((buf)+3) = (unsigned char)((data) >> 24) & 0xff), \ |
---|
| 1212 | 4) |
---|
| 1213 | #define aimutil_getle32(buf) ( \ |
---|
| 1214 | (((*((buf)+0)) << 0) & 0x000000ff) + \ |
---|
| 1215 | (((*((buf)+1)) << 8) & 0x0000ff00) + \ |
---|
| 1216 | (((*((buf)+2)) << 16) & 0x00ff0000) + \ |
---|
| 1217 | (((*((buf)+3)) << 24) & 0xff000000)) |
---|
| 1218 | |
---|
| 1219 | |
---|
| 1220 | faim_export int aimutil_putstr(u_char *, const char *, int); |
---|
| 1221 | faim_export int aimutil_tokslen(char *toSearch, int index, char dl); |
---|
| 1222 | faim_export int aimutil_itemcnt(char *toSearch, char dl); |
---|
| 1223 | faim_export char *aimutil_itemidx(char *toSearch, int index, char dl); |
---|
| 1224 | |
---|
| 1225 | faim_export int aim_snlen(const char *sn); |
---|
| 1226 | faim_export int aim_sncmp(const char *sn1, const char *sn2); |
---|
| 1227 | |
---|
| 1228 | /* for libc's that dont have it */ |
---|
| 1229 | faim_export char *aim_strsep(char **pp, const char *delim); |
---|
| 1230 | |
---|
[862371b] | 1231 | /* meta.c */ |
---|
[5e53c4a] | 1232 | faim_export char *aim_getbuilddate(void); |
---|
| 1233 | faim_export char *aim_getbuildtime(void); |
---|
| 1234 | faim_export int aim_getbuildstring(char *buf, int buflen); |
---|
| 1235 | |
---|
| 1236 | #include <aim_internal.h> |
---|
| 1237 | |
---|
| 1238 | #endif /* __AIM_H__ */ |
---|
| 1239 | |
---|