| 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 Myer |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
#ifndef __AIM_H__ |
| 10 |
#define __AIM_H__ |
| 11 |
|
| 12 |
#define FAIM_VERSION_MAJOR 0 |
| 13 |
#define FAIM_VERSION_MINOR 99 |
| 14 |
#define FAIM_VERSION_MINORMINOR 1 |
| 15 |
|
| 16 |
#include <faimconfig.h> |
| 17 |
#include <aim_cbtypes.h> |
| 18 |
|
| 19 |
#include "config.h" |
| 20 |
#include <stdbool.h> |
| 21 |
|
| 22 |
#include <stdio.h> |
| 23 |
#include <string.h> |
| 24 |
#include <fcntl.h> |
| 25 |
#include <sys/types.h> |
| 26 |
#include <stdlib.h> |
| 27 |
#include <stdarg.h> |
| 28 |
#include <errno.h> |
| 29 |
#include <time.h> |
| 30 |
|
| 31 |
#ifndef _WIN32 |
| 32 |
#include <sys/time.h> |
| 33 |
#include <unistd.h> |
| 34 |
#include <netdb.h> |
| 35 |
#include <netinet/in.h> |
| 36 |
#include <sys/socket.h> |
| 37 |
#else |
| 38 |
#include <winsock.h> |
| 39 |
#endif |
| 40 |
|
| 41 |
#ifdef __cplusplus |
| 42 |
extern "C" { |
| 43 |
#endif |
| 44 |
|
| 45 |
/* XXX adjust these based on autoconf-detected platform */ |
| 46 |
typedef unsigned char fu8_t; |
| 47 |
typedef unsigned short fu16_t; |
| 48 |
typedef unsigned int fu32_t; |
| 49 |
typedef fu32_t aim_snacid_t; |
| 50 |
typedef fu16_t flap_seqnum_t; |
| 51 |
|
| 52 |
#if defined(mach) && defined(__APPLE__) |
| 53 |
#define gethostbyname(x) gethostbyname2(x, AF_INET) |
| 54 |
#endif |
| 55 |
|
| 56 |
#if defined(_WIN32) && !defined(WIN32_STATIC) |
| 57 |
/* |
| 58 |
* For a win32 DLL, we define WIN32_INDLL if this file |
| 59 |
* is included while compiling the DLL. If its not |
| 60 |
* defined (its included in a client app), the symbols |
| 61 |
* will be imported instead of exported. |
| 62 |
*/ |
| 63 |
#ifdef WIN32_INDLL |
| 64 |
#define faim_export __declspec(dllexport) |
| 65 |
#else |
| 66 |
#define faim_export __declspec(dllimport) |
| 67 |
#endif /* WIN32_INDLL */ |
| 68 |
#define faim_internal |
| 69 |
#else |
| 70 |
/* |
| 71 |
* Nothing normally needed for unix... |
| 72 |
*/ |
| 73 |
#define faim_export |
| 74 |
#define faim_internal |
| 75 |
#endif |
| 76 |
|
| 77 |
#ifndef FALSE |
| 78 |
#define FALSE false |
| 79 |
#endif |
| 80 |
|
| 81 |
#ifndef TRUE |
| 82 |
#define TRUE true |
| 83 |
#endif |
| 84 |
|
| 85 |
/* |
| 86 |
* Current Maximum Length for Screen Names (not including NULL) |
| 87 |
* |
| 88 |
* Currently only names up to 16 characters can be registered |
| 89 |
* however it is aparently legal for them to be larger. |
| 90 |
*/ |
| 91 |
#define MAXSNLEN 97 |
| 92 |
|
| 93 |
/* |
| 94 |
* Current Maximum Length for Instant Messages |
| 95 |
* |
| 96 |
* This was found basically by experiment, but not wholly |
| 97 |
* accurate experiment. It should not be regarded |
| 98 |
* as completely correct. But its a decent approximation. |
| 99 |
* |
| 100 |
* Note that although we can send this much, its impossible |
| 101 |
* for WinAIM clients (up through the latest (4.0.1957)) to |
| 102 |
* send any more than 1kb. Amaze all your windows friends |
| 103 |
* with utterly oversized instant messages! |
| 104 |
* |
| 105 |
* XXX: the real limit is the total SNAC size at 8192. Fix this. |
| 106 |
* |
| 107 |
*/ |
| 108 |
#define MAXMSGLEN 7987 |
| 109 |
|
| 110 |
/* |
| 111 |
* Maximum size of a Buddy Icon. |
| 112 |
*/ |
| 113 |
#define MAXICONLEN 7168 |
| 114 |
#define AIM_ICONIDENT "AVT1picture.id" |
| 115 |
|
| 116 |
/* |
| 117 |
* Current Maximum Length for Chat Room Messages |
| 118 |
* |
| 119 |
* This is actually defined by the protocol to be |
| 120 |
* dynamic, but I have yet to see due cause to |
| 121 |
* define it dynamically here. Maybe later. |
| 122 |
* |
| 123 |
*/ |
| 124 |
#define MAXCHATMSGLEN 512 |
| 125 |
|
| 126 |
/** |
| 127 |
* Maximum length for the password of an ICQ account |
| 128 |
*/ |
| 129 |
#define MAXICQPASSLEN 8 |
| 130 |
|
| 131 |
#define AIM_MD5_STRING "AOL Instant Messenger (SM)" |
| 132 |
|
| 133 |
/* |
| 134 |
* Client info. Filled in by the client and passed in to |
| 135 |
* aim_send_login(). The information ends up getting passed to OSCAR |
| 136 |
* through the initial login command. |
| 137 |
* |
| 138 |
*/ |
| 139 |
struct client_info_s { |
| 140 |
const char *clientstring; |
| 141 |
fu16_t clientid; |
| 142 |
fu16_t major; |
| 143 |
fu16_t minor; |
| 144 |
fu16_t point; |
| 145 |
fu16_t build; |
| 146 |
fu32_t distrib; |
| 147 |
const char *country; /* two-letter abbrev */ |
| 148 |
const char *lang; /* two-letter abbrev */ |
| 149 |
}; |
| 150 |
|
| 151 |
/* Needs to be checked */ |
| 152 |
#define CLIENTINFO_AIM_3_5_1670 { \ |
| 153 |
"AOL Instant Messenger (SM), version 3.5.1670/WIN32", \ |
| 154 |
0x0004, \ |
| 155 |
0x0003, 0x0005, \ |
| 156 |
0x0000, 0x0686, \ |
| 157 |
0x0000002a, \ |
| 158 |
"us", "en", \ |
| 159 |
} |
| 160 |
|
| 161 |
/* Needs to be checked */ |
| 162 |
/* Latest winaim without ssi */ |
| 163 |
#define CLIENTINFO_AIM_4_1_2010 { \ |
| 164 |
"AOL Instant Messenger (SM), version 4.1.2010/WIN32", \ |
| 165 |
0x0004, \ |
| 166 |
0x0004, 0x0001, \ |
| 167 |
0x0000, 0x07da, \ |
| 168 |
0x0000004b, \ |
| 169 |
"us", "en", \ |
| 170 |
} |
| 171 |
|
| 172 |
/* Needs to be checked */ |
| 173 |
#define CLIENTINFO_AIM_4_3_2188 { \ |
| 174 |
"AOL Instant Messenger (SM), version 4.3.2188/WIN32", \ |
| 175 |
0x0109, \ |
| 176 |
0x0400, 0x0003, \ |
| 177 |
0x0000, 0x088c, \ |
| 178 |
0x00000086, \ |
| 179 |
"us", "en", \ |
| 180 |
} |
| 181 |
|
| 182 |
/* Needs to be checked */ |
| 183 |
#define CLIENTINFO_AIM_4_8_2540 { \ |
| 184 |
"AOL Instant Messenger (SM), version 4.8.2540/WIN32", \ |
| 185 |
0x0109, \ |
| 186 |
0x0004, 0x0008, \ |
| 187 |
0x0000, 0x09ec, \ |
| 188 |
0x000000af, \ |
| 189 |
"us", "en", \ |
| 190 |
} |
| 191 |
|
| 192 |
/* Needs to be checked */ |
| 193 |
#define CLIENTINFO_AIM_5_0_2938 { \ |
| 194 |
"AOL Instant Messenger, version 5.0.2938/WIN32", \ |
| 195 |
0x0109, \ |
| 196 |
0x0005, 0x0000, \ |
| 197 |
0x0000, 0x0b7a, \ |
| 198 |
0x00000000, \ |
| 199 |
"us", "en", \ |
| 200 |
} |
| 201 |
|
| 202 |
#define CLIENTINFO_AIM_5_1_3036 { \ |
| 203 |
"AOL Instant Messenger, version 5.1.3036/WIN32", \ |
| 204 |
0x0109, \ |
| 205 |
0x0005, 0x0001, \ |
| 206 |
0x0000, 0x0bdc, \ |
| 207 |
0x000000d2, \ |
| 208 |
"us", "en", \ |
| 209 |
} |
| 210 |
|
| 211 |
#define CLIENTINFO_AIM_5_5_3415 { \ |
| 212 |
"AOL Instant Messenger, version 5.5.3415/WIN32", \ |
| 213 |
0x0109, \ |
| 214 |
0x0005, 0x0005, \ |
| 215 |
0x0000, 0x0057, \ |
| 216 |
0x000000ef, \ |
| 217 |
"us", "en", \ |
| 218 |
} |
| 219 |
|
| 220 |
#define CLIENTINFO_ICHAT_1_0 { \ |
| 221 |
"Apple iChat", \ |
| 222 |
0x311a, \ |
| 223 |
0x0001, 0x0000, \ |
| 224 |
0x0000, 0x003c, \ |
| 225 |
0x000000c6, \ |
| 226 |
"us", "en", \ |
| 227 |
} |
| 228 |
|
| 229 |
/* Needs to be checked */ |
| 230 |
#define CLIENTINFO_ICQ_4_65_3281 { \ |
| 231 |
"ICQ Inc. - Product of ICQ (TM) 2000b.4.65.1.3281.85", \ |
| 232 |
0x010a, \ |
| 233 |
0x0004, 0x0041, \ |
| 234 |
0x0001, 0x0cd1, \ |
| 235 |
0x00000055, \ |
| 236 |
"us", "en", \ |
| 237 |
} |
| 238 |
|
| 239 |
/* Needs to be checked */ |
| 240 |
#define CLIENTINFO_ICQ_5_34_3728 { \ |
| 241 |
"ICQ Inc. - Product of ICQ (TM).2002a.5.34.1.3728.85", \ |
| 242 |
0x010a, \ |
| 243 |
0x0005, 0x0022, \ |
| 244 |
0x0001, 0x0e8f, \ |
| 245 |
0x00000055, \ |
| 246 |
"us", "en", \ |
| 247 |
} |
| 248 |
|
| 249 |
#define CLIENTINFO_ICQ_5_45_3777 { \ |
| 250 |
"ICQ Inc. - Product of ICQ (TM).2003a.5.45.1.3777.85", \ |
| 251 |
0x010a, \ |
| 252 |
0x0005, 0x002d, \ |
| 253 |
0x0001, 0x0ec1, \ |
| 254 |
0x00000055, \ |
| 255 |
"us", "en", \ |
| 256 |
} |
| 257 |
|
| 258 |
#define CLIENTINFO_ICQBASIC_14_3_1068 { \ |
| 259 |
"ICQBasic", \ |
| 260 |
0x010a, \ |
| 261 |
0x0014, 0x0003, \ |
| 262 |
0x0000, 0x042c, \ |
| 263 |
0x0000043d, \ |
| 264 |
"us", "en", \ |
| 265 |
} |
| 266 |
|
| 267 |
#define CLIENTINFO_NETSCAPE_7_0_1 { \ |
| 268 |
"Netscape 2000 an approved user of AOL Instant Messenger (SM)", \ |
| 269 |
0x1d0d, \ |
| 270 |
0x0007, 0x0000, \ |
| 271 |
0x0001, 0x0000, \ |
| 272 |
0x00000058, \ |
| 273 |
"us", "en", \ |
| 274 |
} |
| 275 |
|
| 276 |
#define CLIENTINFO_AIM_KNOWNGOOD CLIENTINFO_AIM_5_1_3036 |
| 277 |
#define CLIENTINFO_ICQ_KNOWNGOOD CLIENTINFO_ICQ_5_45_3777 |
| 278 |
|
| 279 |
/* |
| 280 |
* These could be arbitrary, but its easier to use the actual AIM values |
| 281 |
*/ |
| 282 |
#define AIM_CONN_TYPE_BOS 0x0002 |
| 283 |
#define AIM_CONN_TYPE_ADS 0x0005 |
| 284 |
#define AIM_CONN_TYPE_AUTH 0x0007 |
| 285 |
#define AIM_CONN_TYPE_CHATNAV 0x000d |
| 286 |
#define AIM_CONN_TYPE_CHAT 0x000e |
| 287 |
#define AIM_CONN_TYPE_SEARCH 0x000f |
| 288 |
#define AIM_CONN_TYPE_ICON 0x0010 |
| 289 |
#define AIM_CONN_TYPE_EMAIL 0x0018 |
| 290 |
|
| 291 |
/* they start getting arbitrary for rendezvous stuff =) */ |
| 292 |
#define AIM_CONN_TYPE_RENDEZVOUS 0xfffe /* these do not speak FLAP! */ |
| 293 |
#define AIM_CONN_TYPE_LISTENER 0xffff /* socket waiting for accept() */ |
| 294 |
|
| 295 |
/* |
| 296 |
* Subtypes, we need these for OFT stuff. |
| 297 |
*/ |
| 298 |
#define AIM_CONN_SUBTYPE_OFT_DIRECTIM 0x0001 |
| 299 |
#define AIM_CONN_SUBTYPE_OFT_GETFILE 0x0002 |
| 300 |
#define AIM_CONN_SUBTYPE_OFT_SENDFILE 0x0003 |
| 301 |
#define AIM_CONN_SUBTYPE_OFT_BUDDYICON 0x0004 |
| 302 |
#define AIM_CONN_SUBTYPE_OFT_VOICE 0x0005 |
| 303 |
|
| 304 |
/* |
| 305 |
* Status values returned from aim_conn_new(). ORed together. |
| 306 |
*/ |
| 307 |
#define AIM_CONN_STATUS_READY 0x0001 |
| 308 |
#define AIM_CONN_STATUS_INTERNALERR 0x0002 |
| 309 |
#define AIM_CONN_STATUS_RESOLVERR 0x0040 |
| 310 |
#define AIM_CONN_STATUS_CONNERR 0x0080 |
| 311 |
#define AIM_CONN_STATUS_INPROGRESS 0x0100 |
| 312 |
|
| 313 |
#define AIM_FRAMETYPE_FLAP 0x0000 |
| 314 |
#define AIM_FRAMETYPE_OFT 0x0001 |
| 315 |
|
| 316 |
typedef struct aim_conn_s { |
| 317 |
int fd; |
| 318 |
fu16_t type; |
| 319 |
fu16_t subtype; |
| 320 |
flap_seqnum_t seqnum; |
| 321 |
fu32_t status; |
| 322 |
void *priv; /* misc data the client may want to store */ |
| 323 |
void *internal; /* internal conn-specific libfaim data */ |
| 324 |
time_t lastactivity; /* time of last transmit */ |
| 325 |
int forcedlatency; |
| 326 |
void *handlerlist; |
| 327 |
void *sessv; /* pointer to parent session */ |
| 328 |
void *inside; /* only accessible from inside libfaim */ |
| 329 |
struct aim_conn_s *next; |
| 330 |
} aim_conn_t; |
| 331 |
|
| 332 |
/* |
| 333 |
* Byte Stream type. Sort of. |
| 334 |
* |
| 335 |
* Use of this type serves a couple purposes: |
| 336 |
* - Buffer/buflen pairs are passed all around everywhere. This turns |
| 337 |
* that into one value, as well as abstracting it slightly. |
| 338 |
* - Through the abstraction, it is possible to enable bounds checking |
| 339 |
* for robustness at the cost of performance. But a clean failure on |
| 340 |
* weird packets is much better than a segfault. |
| 341 |
* - I like having variables named "bs". |
| 342 |
* |
| 343 |
* Don't touch the insides of this struct. Or I'll have to kill you. |
| 344 |
* |
| 345 |
*/ |
| 346 |
typedef struct aim_bstream_s { |
| 347 |
fu8_t *data; |
| 348 |
fu32_t len; |
| 349 |
fu32_t offset; |
| 350 |
} aim_bstream_t; |
| 351 |
|
| 352 |
typedef struct aim_frame_s { |
| 353 |
fu8_t hdrtype; /* defines which piece of the union to use */ |
| 354 |
union { |
| 355 |
struct { |
| 356 |
fu8_t type; |
| 357 |
flap_seqnum_t seqnum; |
| 358 |
} flap; |
| 359 |
struct { |
| 360 |
fu8_t magic[4]; /* ODC2 or OFT2 */ |
| 361 |
fu16_t hdrlen; |
| 362 |
fu16_t type; |
| 363 |
} rend; |
| 364 |
} hdr; |
| 365 |
aim_bstream_t data; /* payload stream */ |
| 366 |
fu8_t handled; /* 0 = new, !0 = been handled */ |
| 367 |
fu8_t nofree; /* 0 = free data on purge, 1 = only unlink */ |
| 368 |
aim_conn_t *conn; /* the connection it came in on... */ |
| 369 |
struct aim_frame_s *next; |
| 370 |
} aim_frame_t; |
| 371 |
|
| 372 |
typedef struct aim_msgcookie_s { |
| 373 |
fu8_t cookie[8]; |
| 374 |
int type; |
| 375 |
void *data; |
| 376 |
time_t addtime; |
| 377 |
struct aim_msgcookie_s *next; |
| 378 |
} aim_msgcookie_t; |
| 379 |
|
| 380 |
/* |
| 381 |
* AIM Session: The main client-data interface. |
| 382 |
* |
| 383 |
*/ |
| 384 |
typedef struct aim_session_s { |
| 385 |
|
| 386 |
/* ---- Client Accessible ------------------------ */ |
| 387 |
|
| 388 |
/* Our screen name. */ |
| 389 |
char sn[MAXSNLEN+1]; |
| 390 |
|
| 391 |
/* |
| 392 |
* Pointer to anything the client wants to |
| 393 |
* explicitly associate with this session. |
| 394 |
* |
| 395 |
* This is for use in the callbacks mainly. In any |
| 396 |
* callback, you can access this with sess->aux_data. |
| 397 |
* |
| 398 |
*/ |
| 399 |
void *aux_data; |
| 400 |
|
| 401 |
/* ---- Internal Use Only ------------------------ */ |
| 402 |
|
| 403 |
/* Connection information */ |
| 404 |
aim_conn_t *connlist; |
| 405 |
|
| 406 |
/* |
| 407 |
* Transmit/receive queues. |
| 408 |
* |
| 409 |
* These are only used when you don't use your own lowlevel |
| 410 |
* I/O. I don't suggest that you use libfaim's internal I/O. |
| 411 |
* Its really bad and the API/event model is quirky at best. |
| 412 |
* |
| 413 |
*/ |
| 414 |
aim_frame_t *queue_outgoing; |
| 415 |
aim_frame_t *queue_incoming; |
| 416 |
|
| 417 |
/* |
| 418 |
* Tx Enqueuing function. |
| 419 |
* |
| 420 |
* This is how you override the transmit direction of libfaim's |
| 421 |
* internal I/O. This function will be called whenever it needs |
| 422 |
* to send something. |
| 423 |
* |
| 424 |
*/ |
| 425 |
int (*tx_enqueue)(struct aim_session_s *, aim_frame_t *); |
| 426 |
|
| 427 |
void *modlistv; |
| 428 |
|
| 429 |
struct { |
| 430 |
char server[128]; |
| 431 |
char username[128]; |
| 432 |
char password[128]; |
| 433 |
} socksproxy; |
| 434 |
|
| 435 |
bool nonblocking; |
| 436 |
|
| 437 |
int debug; |
| 438 |
void (*debugcb)(struct aim_session_s *sess, int level, const char *format, va_list va); /* same as faim_debugging_callback_t */ |
| 439 |
|
| 440 |
/* |
| 441 |
* Outstanding snac handling |
| 442 |
* |
| 443 |
* XXX: Should these be per-connection? -mid |
| 444 |
*/ |
| 445 |
void *snac_hash[FAIM_SNAC_HASH_SIZE]; |
| 446 |
aim_snacid_t snacid_next; |
| 447 |
|
| 448 |
aim_msgcookie_t *msgcookies; |
| 449 |
struct aim_icq_info *icq_info; |
| 450 |
struct aim_oft_info *oft_info; |
| 451 |
struct aim_authresp_info *authinfo; |
| 452 |
struct aim_emailinfo *emailinfo; |
| 453 |
|
| 454 |
struct { |
| 455 |
struct aim_userinfo_s *userinfo; |
| 456 |
struct userinfo_node *torequest; |
| 457 |
struct userinfo_node *requested; |
| 458 |
int waiting_for_response; |
| 459 |
} locate; |
| 460 |
|
| 461 |
/* Server-stored information (ssi) */ |
| 462 |
struct { |
| 463 |
int received_data; |
| 464 |
fu16_t numitems; |
| 465 |
struct aim_ssi_item *official; |
| 466 |
struct aim_ssi_item *local; |
| 467 |
struct aim_ssi_tmp *pending; |
| 468 |
time_t timestamp; |
| 469 |
int waiting_for_ack; |
| 470 |
} ssi; |
| 471 |
} aim_session_t; |
| 472 |
|
| 473 |
/* Valid for calling aim_icq_setstatus() and for aim_userinfo_t->icqinfo.status */ |
| 474 |
#define AIM_ICQ_STATE_NORMAL 0x00000000 |
| 475 |
#define AIM_ICQ_STATE_AWAY 0x00000001 |
| 476 |
#define AIM_ICQ_STATE_DND 0x00000002 |
| 477 |
#define AIM_ICQ_STATE_OUT 0x00000004 |
| 478 |
#define AIM_ICQ_STATE_BUSY 0x00000010 |
| 479 |
#define AIM_ICQ_STATE_CHAT 0x00000020 |
| 480 |
#define AIM_ICQ_STATE_INVISIBLE 0x00000100 |
| 481 |
#define AIM_ICQ_STATE_WEBAWARE 0x00010000 |
| 482 |
#define AIM_ICQ_STATE_HIDEIP 0x00020000 |
| 483 |
#define AIM_ICQ_STATE_BIRTHDAY 0x00080000 |
| 484 |
#define AIM_ICQ_STATE_DIRECTDISABLED 0x00100000 |
| 485 |
#define AIM_ICQ_STATE_ICQHOMEPAGE 0x00200000 |
| 486 |
#define AIM_ICQ_STATE_DIRECTREQUIREAUTH 0x10000000 |
| 487 |
#define AIM_ICQ_STATE_DIRECTCONTACTLIST 0x20000000 |
| 488 |
|
| 489 |
|
| 490 |
|
| 491 |
/* |
| 492 |
* Get command from connections |
| 493 |
* |
| 494 |
* aim_get_commmand() is the libfaim lowlevel I/O in the receive direction. |
| 495 |
* XXX Make this easily overridable. |
| 496 |
* |
| 497 |
*/ |
| 498 |
faim_export int aim_get_command(aim_session_t *, aim_conn_t *); |
| 499 |
|
| 500 |
/* |
| 501 |
* Dispatch commands that are in the rx queue. |
| 502 |
*/ |
| 503 |
faim_export void aim_rxdispatch(aim_session_t *); |
| 504 |
|
| 505 |
faim_export int aim_debugconn_sendconnect(aim_session_t *sess, aim_conn_t *conn); |
| 506 |
|
| 507 |
faim_export int aim_logoff(aim_session_t *); |
| 508 |
|
| 509 |
#if !defined(FAIM_INTERNAL) || defined(FAIM_INTERNAL_INSANE) |
| 510 |
/* the library should never call aim_conn_kill */ |
| 511 |
faim_export void aim_conn_kill(aim_session_t *sess, aim_conn_t **deadconn); |
| 512 |
#endif |
| 513 |
|
| 514 |
typedef int (*aim_rxcallback_t)(aim_session_t *, aim_frame_t *, ...); |
| 515 |
|
| 516 |
|
| 517 |
/* auth.c */ |
| 518 |
struct aim_clientrelease { |
| 519 |
char *name; |
| 520 |
fu32_t build; |
| 521 |
char *url; |
| 522 |
char *info; |
| 523 |
}; |
| 524 |
|
| 525 |
struct aim_authresp_info { |
| 526 |
char *sn; |
| 527 |
fu16_t errorcode; |
| 528 |
char *errorurl; |
| 529 |
fu16_t regstatus; |
| 530 |
char *email; |
| 531 |
char *bosip; |
| 532 |
fu16_t cookielen; |
| 533 |
fu8_t *cookie; |
| 534 |
char *chpassurl; |
| 535 |
struct aim_clientrelease latestrelease; |
| 536 |
struct aim_clientrelease latestbeta; |
| 537 |
}; |
| 538 |
|
| 539 |
/* Callback data for redirect. */ |
| 540 |
struct aim_redirect_data { |
| 541 |
fu16_t group; |
| 542 |
const char *ip; |
| 543 |
fu16_t cookielen; |
| 544 |
const fu8_t *cookie; |
| 545 |
struct { /* group == AIM_CONN_TYPE_CHAT */ |
| 546 |
fu16_t exchange; |
| 547 |
const char *room; |
| 548 |
fu16_t instance; |
| 549 |
} chat; |
| 550 |
}; |
| 551 |
|
| 552 |
faim_export int aim_clientready(aim_session_t *sess, aim_conn_t *conn); |
| 553 |
faim_export int aim_sendflapver(aim_session_t *sess, aim_conn_t *conn); |
| 554 |
faim_export int aim_request_login(aim_session_t *sess, aim_conn_t *conn, const char *sn); |
| 555 |
faim_export int aim_send_login(aim_session_t *, aim_conn_t *, const char *, const char *, struct client_info_s *, const char *key); |
| 556 |
faim_export void aim_purge_rxqueue(aim_session_t *); |
| 557 |
faim_export void aim_cleansnacs(aim_session_t *, int maxage); |
| 558 |
|
| 559 |
#define AIM_TX_QUEUED 0 /* default */ |
| 560 |
#define AIM_TX_IMMEDIATE 1 |
| 561 |
#define AIM_TX_USER 2 |
| 562 |
faim_export int aim_tx_setenqueue(aim_session_t *sess, int what, int (*func)(aim_session_t *, aim_frame_t *)); |
| 563 |
|
| 564 |
faim_export int aim_tx_flushqueue(aim_session_t *); |
| 565 |
faim_export void aim_tx_purgequeue(aim_session_t *); |
| 566 |
|
| 567 |
faim_export int aim_conn_setlatency(aim_conn_t *conn, int newval); |
| 568 |
|
| 569 |
faim_export int aim_conn_addhandler(aim_session_t *, aim_conn_t *conn, fu16_t family, fu16_t type, aim_rxcallback_t newhandler, fu16_t flags); |
| 570 |
faim_export int aim_clearhandlers(aim_conn_t *conn); |
| 571 |
|
| 572 |
faim_export aim_conn_t *aim_conn_findbygroup(aim_session_t *sess, fu16_t group); |
| 573 |
faim_export aim_session_t *aim_conn_getsess(aim_conn_t *conn); |
| 574 |
faim_export void aim_conn_close(aim_conn_t *deadconn); |
| 575 |
faim_export aim_conn_t *aim_newconn(aim_session_t *, int type, const char *dest); |
| 576 |
faim_export int aim_conngetmaxfd(aim_session_t *); |
| 577 |
faim_export aim_conn_t *aim_select(aim_session_t *, struct timeval *, int *); |
| 578 |
faim_export int aim_conn_in_sess(aim_session_t *sess, aim_conn_t *conn); |
| 579 |
faim_export int aim_conn_isready(aim_conn_t *); |
| 580 |
faim_export int aim_conn_setstatus(aim_conn_t *, int); |
| 581 |
faim_export int aim_conn_completeconnect(aim_session_t *sess, aim_conn_t *conn); |
| 582 |
faim_export int aim_conn_isconnecting(aim_conn_t *conn); |
| 583 |
|
| 584 |
typedef void (*faim_debugging_callback_t)(aim_session_t *sess, int level, const char *format, va_list va); |
| 585 |
faim_export int aim_setdebuggingcb(aim_session_t *sess, faim_debugging_callback_t); |
| 586 |
faim_export void aim_session_init(aim_session_t *, bool nonblocking, int debuglevel); |
| 587 |
faim_export void aim_session_kill(aim_session_t *); |
| 588 |
faim_export void aim_setupproxy(aim_session_t *sess, const char *server, const char *username, const char *password); |
| 589 |
faim_export aim_conn_t *aim_getconn_type(aim_session_t *, int type); |
| 590 |
faim_export aim_conn_t *aim_getconn_type_all(aim_session_t *, int type); |
| 591 |
faim_export aim_conn_t *aim_getconn_fd(aim_session_t *, int fd); |
| 592 |
|
| 593 |
|
| 594 |
|
| 595 |
/* 0x0001 - service.c */ |
| 596 |
faim_export int aim_srv_setavailmsg(aim_session_t *sess, char *msg); |
| 597 |
faim_export int aim_srv_setidle(aim_session_t *sess, fu32_t idletime); |
| 598 |
|
| 599 |
|
| 600 |
|
| 601 |
/* misc.c */ |
| 602 |
|
| 603 |
#define AIM_VISIBILITYCHANGE_PERMITADD 0x05 |
| 604 |
#define AIM_VISIBILITYCHANGE_PERMITREMOVE 0x06 |
| 605 |
#define AIM_VISIBILITYCHANGE_DENYADD 0x07 |
| 606 |
#define AIM_VISIBILITYCHANGE_DENYREMOVE 0x08 |
| 607 |
|
| 608 |
#define AIM_PRIVFLAGS_ALLOWIDLE 0x01 |
| 609 |
#define AIM_PRIVFLAGS_ALLOWMEMBERSINCE 0x02 |
| 610 |
|
| 611 |
#define AIM_WARN_ANON 0x01 |
| 612 |
|
| 613 |
faim_export int aim_sendpauseack(aim_session_t *sess, aim_conn_t *conn); |
| 614 |
faim_export int aim_nop(aim_session_t *, aim_conn_t *); |
| 615 |
faim_export int aim_flap_nop(aim_session_t *sess, aim_conn_t *conn); |
| 616 |
faim_export int aim_bos_changevisibility(aim_session_t *, aim_conn_t *, int, const char *); |
| 617 |
faim_export int aim_bos_setgroupperm(aim_session_t *, aim_conn_t *, fu32_t mask); |
| 618 |
faim_export int aim_bos_setprivacyflags(aim_session_t *, aim_conn_t *, fu32_t); |
| 619 |
faim_export int aim_reqpersonalinfo(aim_session_t *, aim_conn_t *); |
| 620 |
faim_export int aim_reqservice(aim_session_t *, aim_conn_t *, fu16_t); |
| 621 |
faim_export int aim_bos_reqrights(aim_session_t *, aim_conn_t *); |
| 622 |
faim_export int aim_setextstatus(aim_session_t *sess, fu32_t status); |
| 623 |
|
| 624 |
#define AIM_CLIENTTYPE_UNKNOWN 0x0000 |
| 625 |
#define AIM_CLIENTTYPE_MC 0x0001 |
| 626 |
#define AIM_CLIENTTYPE_WINAIM 0x0002 |
| 627 |
#define AIM_CLIENTTYPE_WINAIM41 0x0003 |
| 628 |
#define AIM_CLIENTTYPE_AOL_TOC 0x0004 |
| 629 |
faim_export fu16_t aim_im_fingerprint(const fu8_t *msghdr, int len); |
| 630 |
|
| 631 |
#define AIM_RATE_CODE_CHANGE 0x0001 |
| 632 |
#define AIM_RATE_CODE_WARNING 0x0002 |
| 633 |
#define AIM_RATE_CODE_LIMIT 0x0003 |
| 634 |
#define AIM_RATE_CODE_CLEARLIMIT 0x0004 |
| 635 |
faim_export int aim_ads_requestads(aim_session_t *sess, aim_conn_t *conn); |
| 636 |
|
| 637 |
|
| 638 |
|
| 639 |
/* im.c */ |
| 640 |
#define AIM_OFT_SUBTYPE_SEND_FILE 0x0001 |
| 641 |
#define AIM_OFT_SUBTYPE_SEND_DIR 0x0002 |
| 642 |
#define AIM_OFT_SUBTYPE_GET_FILE 0x0011 |
| 643 |
#define AIM_OPT_SUBTYPE_GET_LIST 0x0012 |
| 644 |
|
| 645 |
#define AIM_TRANSFER_DENY_NOTSUPPORTED 0x0000 |
| 646 |
#define AIM_TRANSFER_DENY_DECLINE 0x0001 |
| 647 |
#define AIM_TRANSFER_DENY_NOTACCEPTING 0x0002 |
| 648 |
|
| 649 |
#define AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED 0x00000001 |
| 650 |
#define AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED 0x00000002 |
| 651 |
|
| 652 |
/* This is what the server will give you if you don't set them yourself. */ |
| 653 |
#define AIM_IMPARAM_DEFAULTS { \ |
| 654 |
0, \ |
| 655 |
AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \ |
| 656 |
512, /* !! Note how small this is. */ \ |
| 657 |
(99.9)*10, (99.9)*10, \ |
| 658 |
1000 /* !! And how large this is. */ \ |
| 659 |
} |
| 660 |
|
| 661 |
/* This is what most AIM versions use. */ |
| 662 |
#define AIM_IMPARAM_REASONABLE { \ |
| 663 |
0, \ |
| 664 |
AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \ |
| 665 |
8000, \ |
| 666 |
(99.9)*10, (99.9)*10, \ |
| 667 |
0 \ |
| 668 |
} |
| 669 |
|
| 670 |
struct aim_icbmparameters { |
| 671 |
fu16_t maxchan; |
| 672 |
fu32_t flags; /* AIM_IMPARAM_FLAG_ */ |
| 673 |
fu16_t maxmsglen; /* message size that you will accept */ |
| 674 |
fu16_t maxsenderwarn; /* this and below are *10 (999=99.9%) */ |
| 675 |
fu16_t maxrecverwarn; |
| 676 |
fu32_t minmsginterval; /* in milliseconds? */ |
| 677 |
}; |
| 678 |
|
| 679 |
struct aim_chat_roominfo { |
| 680 |
fu16_t exchange; |
| 681 |
char *name; |
| 682 |
fu16_t instance; |
| 683 |
}; |
| 684 |
|
| 685 |
#define AIM_IMFLAGS_AWAY 0x0001 /* mark as an autoreply */ |
| 686 |
#define AIM_IMFLAGS_ACK 0x0002 /* request a receipt notice */ |
| 687 |
#define AIM_IMFLAGS_UNICODE 0x0004 |
| 688 |
#define AIM_IMFLAGS_ISO_8859_1 0x0008 |
| 689 |
#define AIM_IMFLAGS_BUDDYREQ 0x0010 /* buddy icon requested */ |
| 690 |
#define AIM_IMFLAGS_HASICON 0x0020 /* already has icon */ |
| 691 |
#define AIM_IMFLAGS_SUBENC_MACINTOSH 0x0040 /* damn that Steve Jobs! */ |
| 692 |
#define AIM_IMFLAGS_CUSTOMFEATURES 0x0080 /* features field present */ |
| 693 |
#define AIM_IMFLAGS_EXTDATA 0x0100 |
| 694 |
#define AIM_IMFLAGS_X 0x0200 |
| 695 |
#define AIM_IMFLAGS_MULTIPART 0x0400 /* ->mpmsg section valid */ |
| 696 |
#define AIM_IMFLAGS_OFFLINE 0x0800 /* send to offline user */ |
| 697 |
#define AIM_IMFLAGS_TYPINGNOT 0x1000 /* typing notification */ |
| 698 |
|
| 699 |
/* |
| 700 |
* Multipart message structures. |
| 701 |
*/ |
| 702 |
typedef struct aim_mpmsg_section_s { |
| 703 |
fu16_t charset; |
| 704 |
fu16_t charsubset; |
| 705 |
fu8_t *data; |
| 706 |
fu16_t datalen; |
| 707 |
struct aim_mpmsg_section_s *next; |
| 708 |
} aim_mpmsg_section_t; |
| 709 |
|
| 710 |
typedef struct aim_mpmsg_s { |
| 711 |
int numparts; |
| 712 |
aim_mpmsg_section_t *parts; |
| 713 |
} aim_mpmsg_t; |
| 714 |
|
| 715 |
faim_export int aim_mpmsg_init(aim_session_t *sess, aim_mpmsg_t *mpm); |
| 716 |
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); |
| 717 |
faim_export int aim_mpmsg_addascii(aim_session_t *sess, aim_mpmsg_t *mpm, const char *ascii); |
| 718 |
faim_export int aim_mpmsg_addunicode(aim_session_t *sess, aim_mpmsg_t *mpm, const fu16_t *unicode, fu16_t unicodelen); |
| 719 |
faim_export void aim_mpmsg_free(aim_session_t *sess, aim_mpmsg_t *mpm); |
| 720 |
|
| 721 |
/* |
| 722 |
* Arguments to aim_send_im_ext(). |
| 723 |
* |
| 724 |
* This is really complicated. But immensely versatile. |
| 725 |
* |
| 726 |
*/ |
| 727 |
struct aim_sendimext_args { |
| 728 |
|
| 729 |
/* These are _required_ */ |
| 730 |
const char *destsn; |
| 731 |
fu32_t flags; /* often 0 */ |
| 732 |
|
| 733 |
/* Only required if not using multipart messages */ |
| 734 |
const char *msg; |
| 735 |
int msglen; |
| 736 |
|
| 737 |
/* Required if ->msg is not provided */ |
| 738 |
aim_mpmsg_t *mpmsg; |
| 739 |
|
| 740 |
/* Only used if AIM_IMFLAGS_HASICON is set */ |
| 741 |
fu32_t iconlen; |
| 742 |
time_t iconstamp; |
| 743 |
fu32_t iconsum; |
| 744 |
|
| 745 |
/* Only used if AIM_IMFLAGS_CUSTOMFEATURES is set */ |
| 746 |
fu8_t *features; |
| 747 |
fu8_t featureslen; |
| 748 |
|
| 749 |
/* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set and mpmsg not used */ |
| 750 |
fu16_t charset; |
| 751 |
fu16_t charsubset; |
| 752 |
}; |
| 753 |
|
| 754 |
/* |
| 755 |
* Arguments to aim_send_rtfmsg(). |
| 756 |
*/ |
| 757 |
struct aim_sendrtfmsg_args { |
| 758 |
const char *destsn; |
| 759 |
fu32_t fgcolor; |
| 760 |
fu32_t bgcolor; |
| 761 |
const char *rtfmsg; /* must be in RTF */ |
| 762 |
}; |
| 763 |
|
| 764 |
/* |
| 765 |
* This information is provided in the Incoming ICBM callback for |
| 766 |
* Channel 1 ICBM's. |
| 767 |
* |
| 768 |
* Note that although CUSTOMFEATURES and CUSTOMCHARSET say they |
| 769 |
* are optional, both are always set by the current libfaim code. |
| 770 |
* That may or may not change in the future. It is mainly for |
| 771 |
* consistency with aim_sendimext_args. |
| 772 |
* |
| 773 |
* Multipart messages require some explanation. If you want to use them, |
| 774 |
* I suggest you read all the comments in im.c. |
| 775 |
* |
| 776 |
*/ |
| 777 |
struct aim_incomingim_ch1_args { |
| 778 |
|
| 779 |
/* Always provided */ |
| 780 |
aim_mpmsg_t mpmsg; |
| 781 |
fu32_t icbmflags; /* some flags apply only to ->msg, not all mpmsg */ |
| 782 |
|
| 783 |
/* Only provided if message has a human-readable section */ |
| 784 |
char *msg; |
| 785 |
int msglen; |
| 786 |
|
| 787 |
/* Only provided if AIM_IMFLAGS_HASICON is set */ |
| 788 |
time_t iconstamp; |
| 789 |
fu32_t iconlen; |
| 790 |
fu16_t iconsum; |
| 791 |
|
| 792 |
/* Only provided if AIM_IMFLAGS_CUSTOMFEATURES is set */ |
| 793 |
fu8_t *features; |
| 794 |
fu8_t featureslen; |
| 795 |
|
| 796 |
/* Only provided if AIM_IMFLAGS_EXTDATA is set */ |
| 797 |
fu8_t extdatalen; |
| 798 |
fu8_t *extdata; |
| 799 |
|
| 800 |
/* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set */ |
| 801 |
fu16_t charset; |
| 802 |
fu16_t charsubset; |
| 803 |
}; |
| 804 |
|
| 805 |
/* Valid values for channel 2 args->status */ |
| 806 |
#define AIM_RENDEZVOUS_PROPOSE 0x0000 |
| 807 |
#define AIM_RENDEZVOUS_CANCEL 0x0001 |
| 808 |
#define AIM_RENDEZVOUS_ACCEPT 0x0002 |
| 809 |
|
| 810 |
struct aim_incomingim_ch2_args { |
| 811 |
fu16_t status; |
| 812 |
fu8_t cookie[8]; |
| 813 |
int reqclass; |
| 814 |
const char *proxyip; |
| 815 |
const char *clientip; |
| 816 |
const char *verifiedip; |
| 817 |
fu16_t port; |
| 818 |
fu16_t errorcode; |
| 819 |
const char *msg; /* invite message or file description */ |
| 820 |
const char *encoding; |
| 821 |
const char *language; |
| 822 |
union { |
| 823 |
struct { |
| 824 |
fu32_t checksum; |
| 825 |
fu32_t length; |
| 826 |
time_t timestamp; |
| 827 |
fu8_t *icon; |
| 828 |
} icon; |
| 829 |
struct { |
| 830 |
struct aim_chat_roominfo roominfo; |
| 831 |
} chat; |
| 832 |
struct { |
| 833 |
fu32_t fgcolor; |
| 834 |
fu32_t bgcolor; |
| 835 |
const char *rtfmsg; |
| 836 |
} rtfmsg; |
| 837 |
struct { |
| 838 |
fu16_t subtype; |
| 839 |
fu16_t totfiles; |
| 840 |
fu32_t totsize; |
| 841 |
char *filename; |
| 842 |
} sendfile; |
| 843 |
} info; |
| 844 |
void *destructor; /* used internally only */ |
| 845 |
}; |
| 846 |
|
| 847 |
/* Valid values for channel 4 args->type */ |
| 848 |
#define AIM_ICQMSG_AUTHREQUEST 0x0006 |
| 849 |
#define AIM_ICQMSG_AUTHDENIED 0x0007 |
| 850 |
#define AIM_ICQMSG_AUTHGRANTED 0x0008 |
| 851 |
|
| 852 |
struct aim_incomingim_ch4_args { |
| 853 |
fu32_t uin; /* Of the sender of the ICBM */ |
| 854 |
fu8_t type; |
| 855 |
fu8_t flags; |
| 856 |
char *msg; /* Reason for auth request, deny, or accept */ |
| 857 |
int msglen; |
| 858 |
}; |
| 859 |
|
| 860 |
/* SNAC sending functions */ |
| 861 |
/* 0x0002 */ faim_export int aim_im_setparams(aim_session_t *sess, struct aim_icbmparameters *params); |
| 862 |
/* 0x0004 */ faim_export int aim_im_reqparams(aim_session_t *sess); |
| 863 |
/* 0x0006 */ faim_export int aim_im_sendch1_ext(aim_session_t *sess, struct aim_sendimext_args *args); |
| 864 |
/* 0x0006 */ faim_export int aim_im_sendch1(aim_session_t *, const char *destsn, fu16_t flags, const char *msg); |
| 865 |
/* 0x0006 */ faim_export int aim_im_sendch2_icon(aim_session_t *sess, const char *sn, const fu8_t *icon, int iconlen, time_t stamp, fu16_t iconsum); |
| 866 |
/* 0x0006 */ faim_export int aim_im_sendch2_rtfmsg(aim_session_t *sess, struct aim_sendrtfmsg_args *args); |
| 867 |
/* 0x0006 */ faim_export int aim_im_sendch2_odcrequest(aim_session_t *sess, fu8_t *cookie, const char *sn, const fu8_t *ip, fu16_t port); |
| 868 |
/* 0x0006 */ faim_export int aim_im_sendch2_sendfile_ask(aim_session_t *sess, struct aim_oft_info *oft_info); |
| 869 |
/* 0x0006 */ faim_export int aim_im_sendch2_sendfile_accept(aim_session_t *sess, struct aim_oft_info *info); |
| 870 |
/* 0x0006 */ faim_export int aim_im_sendch2_sendfile_cancel(aim_session_t *sess, struct aim_oft_info *oft_info); |
| 871 |
/* 0x0006 */ faim_export int aim_im_sendch2_geticqaway(aim_session_t *sess, const char *sn, int type); |
| 872 |
/* 0x0006 */ faim_export int aim_im_sendch4(aim_session_t *sess, char *sn, fu16_t type, fu8_t *message); |
| 873 |
/* 0x0008 */ faim_export int aim_im_warn(aim_session_t *sess, aim_conn_t *conn, const char *destsn, fu32_t flags); |
| 874 |
/* 0x000b */ faim_export int aim_im_denytransfer(aim_session_t *sess, const char *sender, const char *cookie, fu16_t code); |
| 875 |
/* 0x0014 */ faim_export int aim_im_sendmtn(aim_session_t *sess, fu16_t type1, const char *sn, fu16_t type2); |
| 876 |
|
| 877 |
|
| 878 |
|
| 879 |
/* ft.c */ |
| 880 |
struct aim_fileheader_t { |
| 881 |
#if 0 |
| 882 |
char magic[4]; /* 0 */ |
| 883 |
fu16_t hdrlen; /* 4 */ |
| 884 |
fu16_t hdrtype; /* 6 */ |
| 885 |
#endif |
| 886 |
char bcookie[8]; /* 8 */ |
| 887 |
fu16_t encrypt; /* 16 */ |
| 888 |
fu16_t compress; /* 18 */ |
| 889 |
fu16_t totfiles; /* 20 */ |
| 890 |
fu16_t filesleft; /* 22 */ |
| 891 |
fu16_t totparts; /* 24 */ |
| 892 |
fu16_t partsleft; /* 26 */ |
| 893 |
fu32_t totsize; /* 28 */ |
| 894 |
fu32_t size; /* 32 */ |
| 895 |
fu32_t modtime; /* 36 */ |
| 896 |
fu32_t checksum; /* 40 */ |
| 897 |
fu32_t rfrcsum; /* 44 */ |
| 898 |
fu32_t rfsize; /* 48 */ |
| 899 |
fu32_t cretime; /* 52 */ |
| 900 |
fu32_t rfcsum; /* 56 */ |
| 901 |
fu32_t nrecvd; /* 60 */ |
| 902 |
fu32_t recvcsum; /* 64 */ |
| 903 |
fu8_t idstring[32]; /* 68 */ |
| 904 |
fu8_t flags; /* 100 */ |
| 905 |
fu8_t lnameoffset; /* 101 */ |
| 906 |
fu8_t lsizeoffset; /* 102 */ |
| 907 |
char dummy[69]; /* 103 */ |
| 908 |
char macfileinfo[16]; /* 172 */ |
| 909 |
fu16_t nencode; /* 188 */ |
| 910 |
fu16_t nlanguage; /* 190 */ |
| 911 |
char name[64]; /* 192 */ |
| 912 |
/* 256 */ |
| 913 |
}; |
| 914 |
|
| 915 |
struct aim_oft_info { |
| 916 |
char cookie[8]; |
| 917 |
char *sn; |
| 918 |
char *proxyip; |
| 919 |
char *clientip; |
| 920 |
char *verifiedip; |
| 921 |
fu16_t port; |
| 922 |
aim_conn_t *conn; |
| 923 |
aim_session_t *sess; |
| 924 |
struct aim_fileheader_t fh; |
| 925 |
struct aim_oft_info *next; |
| 926 |
}; |
| 927 |
|
| 928 |
faim_export fu32_t aim_oft_checksum_chunk(const fu8_t *buffer, int bufferlen, fu32_t prevcheck); |
| 929 |
faim_export fu32_t aim_oft_checksum_file(char *filename); |
| 930 |
faim_export int aim_handlerendconnect(aim_session_t *sess, aim_conn_t *cur); |
| 931 |
faim_export int aim_odc_send_typing(aim_session_t *sess, aim_conn_t *conn, int typing); |
| 932 |
faim_export int aim_odc_send_im(aim_session_t *sess, aim_conn_t *conn, const char *msg, int len, int encoding, int isawaymsg); |
| 933 |
faim_export const char *aim_odc_getsn(aim_conn_t *conn); |
| 934 |
faim_export aim_conn_t *aim_odc_getconn(aim_session_t *sess, const char *sn); |
| 935 |
faim_export aim_conn_t *aim_odc_initiate(aim_session_t *sess, const char *sn); |
| 936 |
faim_export aim_conn_t *aim_odc_connect(aim_session_t *sess, const char *sn, const char *addr, const fu8_t *cookie); |
| 937 |
|
| 938 |
faim_export struct aim_oft_info *aim_oft_createinfo(aim_session_t *sess, const fu8_t *cookie, const char *sn, const char *ip, fu16_t port, fu32_t size, fu32_t modtime, char *filename); |
| 939 |
faim_export int aim_oft_destroyinfo(struct aim_oft_info *oft_info); |
| 940 |
faim_export int aim_sendfile_listen(aim_session_t *sess, struct aim_oft_info *oft_info); |
| 941 |
faim_export int aim_oft_sendheader(aim_session_t *sess, fu16_t type, struct aim_oft_info *oft_info); |
| 942 |
|
| 943 |
|
| 944 |
|
| 945 |
/* 0x0002 - locate.c */ |
| 946 |
/* |
| 947 |
* AIM User Info, Standard Form. |
| 948 |
*/ |
| 949 |
#define AIM_FLAG_UNCONFIRMED 0x0001 /* "damned transients" */ |
| 950 |
#define AIM_FLAG_ADMINISTRATOR 0x0002 |
| 951 |
#define AIM_FLAG_AOL 0x0004 |
| 952 |
#define AIM_FLAG_OSCAR_PAY 0x0008 |
| 953 |
#define AIM_FLAG_FREE 0x0010 |
| 954 |
#define AIM_FLAG_AWAY 0x0020 |
| 955 |
#define AIM_FLAG_ICQ 0x0040 |
| 956 |
#define AIM_FLAG_WIRELESS 0x0080 |
| 957 |
#define AIM_FLAG_UNKNOWN100 0x0100 |
| 958 |
#define AIM_FLAG_UNKNOWN200 0x0200 |
| 959 |
#define AIM_FLAG_ACTIVEBUDDY 0x0400 |
| 960 |
#define AIM_FLAG_UNKNOWN800 0x0800 |
| 961 |
#define AIM_FLAG_ABINTERNAL 0x1000 |
| 962 |
#define AIM_FLAG_ALLUSERS 0x001f |
| 963 |
|
| 964 |
#define AIM_USERINFO_PRESENT_FLAGS 0x00000001 |
| 965 |
#define AIM_USERINFO_PRESENT_MEMBERSINCE 0x00000002 |
| 966 |
#define AIM_USERINFO_PRESENT_ONLINESINCE 0x00000004 |
| 967 |
#define AIM_USERINFO_PRESENT_IDLE 0x00000008 |
| 968 |
#define AIM_USERINFO_PRESENT_ICQEXTSTATUS 0x00000010 |
| 969 |
#define AIM_USERINFO_PRESENT_ICQIPADDR 0x00000020 |
| 970 |
#define AIM_USERINFO_PRESENT_ICQDATA 0x00000040 |
| 971 |
#define AIM_USERINFO_PRESENT_CAPABILITIES 0x00000080 |
| 972 |
#define AIM_USERINFO_PRESENT_SESSIONLEN 0x00000100 |
| 973 |
#define AIM_USERINFO_PRESENT_CREATETIME 0x00000200 |
| 974 |
|
| 975 |
struct userinfo_node { |
| 976 |
char *sn; |
| 977 |
struct userinfo_node *next; |
| 978 |
}; |
| 979 |
|
| 980 |
typedef struct aim_userinfo_s { |
| 981 |
char *sn; |
| 982 |
fu16_t warnlevel; /* evil percent * 10 (999 = 99.9%) */ |
| 983 |
fu16_t idletime; /* in seconds */ |
| 984 |
fu16_t flags; |
| 985 |
fu32_t createtime; /* time_t */ |
| 986 |
fu32_t membersince; /* time_t */ |
| 987 |
fu32_t onlinesince; /* time_t */ |
| 988 |
fu32_t sessionlen; /* in seconds */ |
| 989 |
fu32_t capabilities; |
| 990 |
struct { |
| 991 |
fu32_t status; |
| 992 |
fu32_t ipaddr; |
| 993 |
fu8_t crap[0x25]; /* until we figure it out... */ |
| 994 |
} icqinfo; |
| 995 |
fu32_t present; |
| 996 |
|
| 997 |
fu16_t iconcsumlen; |
| 998 |
fu8_t *iconcsum; |
| 999 |
|
| 1000 |
char *info; |
| 1001 |
char *info_encoding; |
| 1002 |
fu16_t info_len; |
| 1003 |
|
| 1004 |
char *avail; |
| 1005 |
char *avail_encoding; |
| 1006 |
fu16_t avail_len; |
| 1007 |
|
| 1008 |
char *away; |
| 1009 |
char *away_encoding; |
| 1010 |
fu16_t away_len; |
| 1011 |
|
| 1012 |
struct aim_userinfo_s *next; |
| 1013 |
} aim_userinfo_t; |
| 1014 |
|
| 1015 |
#define AIM_CAPS_BUDDYICON 0x00000001 |
| 1016 |
#define AIM_CAPS_VOICE 0x00000002 |
| 1017 |
#define AIM_CAPS_DIRECTIM 0x00000004 |
| 1018 |
#define AIM_CAPS_CHAT 0x00000008 |
| 1019 |
#define AIM_CAPS_GETFILE 0x00000010 |
| 1020 |
#define AIM_CAPS_SENDFILE 0x00000020 |
| 1021 |
#define AIM_CAPS_GAMES 0x00000040 |
| 1022 |
#define AIM_CAPS_SAVESTOCKS 0x00000080 |
| 1023 |
#define AIM_CAPS_SENDBUDDYLIST 0x00000100 |
| 1024 |
#define AIM_CAPS_GAMES2 0x00000200 |
| 1025 |
#define AIM_CAPS_ICQ_DIRECT 0x00000400 |
| 1026 |
#define AIM_CAPS_APINFO 0x00000800 |
| 1027 |
#define AIM_CAPS_ICQRTF 0x00001000 |
| 1028 |
#define AIM_CAPS_EMPTY 0x00002000 |
| 1029 |
#define AIM_CAPS_ICQSERVERRELAY 0x00004000 |
| 1030 |
#define AIM_CAPS_ICQUTF8OLD 0x00008000 |
| 1031 |
#define AIM_CAPS_TRILLIANCRYPT 0x00010000 |
| 1032 |
#define AIM_CAPS_ICQUTF8 0x00020000 |
| 1033 |
#define AIM_CAPS_INTEROPERATE 0x00040000 |
| 1034 |
#define AIM_CAPS_ICHAT 0x00080000 |
| 1035 |
#define AIM_CAPS_HIPTOP 0x00100000 |
| 1036 |
#define AIM_CAPS_SECUREIM 0x00200000 |
| 1037 |
#define AIM_CAPS_SMS 0x00400000 |
| 1038 |
#define AIM_CAPS_GENERICUNKNOWN 0x00800000 |
| 1039 |
#define AIM_CAPS_VIDEO 0x01000000 |
| 1040 |
#define AIM_CAPS_LAST 0x02000000 |
| 1041 |
|
| 1042 |
#define AIM_SENDMEMBLOCK_FLAG_ISREQUEST 0 |
| 1043 |
#define AIM_SENDMEMBLOCK_FLAG_ISHASH 1 |
| 1044 |
|
| 1045 |
faim_export int aim_sendmemblock(aim_session_t *sess, aim_conn_t *conn, fu32_t offset, fu32_t len, const fu8_t *buf, fu8_t flag); |
| 1046 |
|
| 1047 |
struct aim_invite_priv { |
| 1048 |
char *sn; |
| 1049 |
char *roomname; |
| 1050 |
fu16_t exchange; |
| 1051 |
fu16_t instance; |
| 1052 |
}; |
| 1053 |
|
| 1054 |
#define AIM_COOKIETYPE_UNKNOWN 0x00 |
| 1055 |
#define AIM_COOKIETYPE_ICBM 0x01 |
| 1056 |
#define AIM_COOKIETYPE_ADS 0x02 |
| 1057 |
#define AIM_COOKIETYPE_BOS 0x03 |
| 1058 |
#define AIM_COOKIETYPE_IM 0x04 |
| 1059 |
#define AIM_COOKIETYPE_CHAT 0x05 |
| 1060 |
#define AIM_COOKIETYPE_CHATNAV 0x06 |
| 1061 |
#define AIM_COOKIETYPE_INVITE 0x07 |
| 1062 |
/* we'll move OFT up a bit to give breathing room. not like it really |
| 1063 |
* matters. */ |
| 1064 |
#define AIM_COOKIETYPE_OFTIM 0x10 |
| 1065 |
#define AIM_COOKIETYPE_OFTGET 0x11 |
| 1066 |
#define AIM_COOKIETYPE_OFTSEND 0x12 |
| 1067 |
#define AIM_COOKIETYPE_OFTVOICE 0x13 |
| 1068 |
#define AIM_COOKIETYPE_OFTIMAGE 0x14 |
| 1069 |
#define AIM_COOKIETYPE_OFTICON 0x15 |
| 1070 |
|
| 1071 |
faim_export aim_userinfo_t *aim_locate_finduserinfo(aim_session_t *sess, const char *sn); |
| 1072 |
|
| 1073 |
/* 0x0002 */ faim_export int aim_locate_reqrights(aim_session_t *sess); |
| 1074 |
/* 0x0004 */ faim_export int aim_locate_setprofile(aim_session_t *sess, const char *profile_encoding, const char *profile, const int profile_len, const char *awaymsg_encoding, const char *awaymsg, const int awaymsg_len); |
| 1075 |
/* 0x0004 */ faim_export int aim_locate_setcaps(aim_session_t *sess, fu32_t caps); |
| 1076 |
/* 0x0005 */ faim_export int aim_locate_getinfo(aim_session_t *sess, const char *, fu16_t); |
| 1077 |
/* 0x0009 */ faim_export int aim_locate_setdirinfo(aim_session_t *sess, 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); |
| 1078 |
/* 0x000b */ faim_export int aim_locate_000b(aim_session_t *sess, const char *sn); |
| 1079 |
/* 0x000f */ faim_export int aim_locate_setinterests(aim_session_t *sess, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, fu16_t privacy); |
| 1080 |
/* 0x0015 */ faim_export int aim_locate_getinfoshort(aim_session_t *sess, const char *sn, fu32_t flags); |
| 1081 |
|
| 1082 |
|
| 1083 |
|
| 1084 |
/* 0x0003 - buddylist.c */ |
| 1085 |
/* 0x0002 */ faim_export int aim_buddylist_reqrights(aim_session_t *, aim_conn_t *); |
| 1086 |
/* 0x0004 */ faim_export int aim_buddylist_set(aim_session_t *, aim_conn_t *, const char *); |
| 1087 |
/* 0x0004 */ faim_export int aim_buddylist_addbuddy(aim_session_t *, aim_conn_t *, const char *); |
| 1088 |
/* 0x0005 */ faim_export int aim_buddylist_removebuddy(aim_session_t *, aim_conn_t *, const char *); |
| 1089 |
/* 0x000b */ faim_export int aim_buddylist_oncoming(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *info); |
| 1090 |
/* 0x000c */ faim_export int aim_buddylist_offgoing(aim_session_t *sess, aim_conn_t *conn, const char *sn); |
| 1091 |
|
| 1092 |
|
| 1093 |
|
| 1094 |
/* 0x000a - search.c */ |
| 1095 |
faim_export int aim_search_address(aim_session_t *, aim_conn_t *, const char *); |
| 1096 |
|
| 1097 |
|
| 1098 |
|
| 1099 |
/* 0x000d - chatnav.c */ |
| 1100 |
/* 0x000e - chat.c */ |
| 1101 |
/* These apply to exchanges as well. */ |
| 1102 |
#define AIM_CHATROOM_FLAG_EVILABLE 0x0001 |
| 1103 |
#define AIM_CHATROOM_FLAG_NAV_ONLY 0x0002 |
| 1104 |
#define AIM_CHATROOM_FLAG_INSTANCING_ALLOWED 0x0004 |
| 1105 |
#define AIM_CHATROOM_FLAG_OCCUPANT_PEEK_ALLOWED 0x0008 |
| 1106 |
|
| 1107 |
struct aim_chat_exchangeinfo { |
| 1108 |
fu16_t number; |
| 1109 |
fu16_t flags; |
| 1110 |
char *name; |
| 1111 |
char *charset1; |
| 1112 |
char *lang1; |
| 1113 |
char *charset2; |
| 1114 |
char *lang2; |
| 1115 |
}; |
| 1116 |
|
| 1117 |
#define AIM_CHATFLAGS_NOREFLECT 0x0001 |
| 1118 |
#define AIM_CHATFLAGS_AWAY 0x0002 |
| 1119 |
faim_export int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, fu16_t flags, const char *msg, int msglen); |
| 1120 |
faim_export int aim_chat_join(aim_session_t *sess, aim_conn_t *conn, fu16_t exchange, const char *roomname, fu16_t instance); |
| 1121 |
faim_export int aim_chat_attachname(aim_conn_t *conn, fu16_t exchange, const char *roomname, fu16_t instance); |
| 1122 |
faim_export char *aim_chat_getname(aim_conn_t *conn); |
| 1123 |
faim_export aim_conn_t *aim_chat_getconn(aim_session_t *, const char *name); |
| 1124 |
|
| 1125 |
faim_export int aim_chatnav_reqrights(aim_session_t *sess, aim_conn_t *conn); |
| 1126 |
|
| 1127 |
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); |
| 1128 |
|
| 1129 |
faim_export int aim_chatnav_createroom(aim_session_t *sess, aim_conn_t *conn, const char *name, fu16_t exchange); |
| 1130 |
faim_export int aim_chat_leaveroom(aim_session_t *sess, const char *name); |
| 1131 |
|
| 1132 |
|
| 1133 |
|
| 1134 |
/* 0x000f - odir.c */ |
| 1135 |
struct aim_odir { |
| 1136 |
char *first; |
| 1137 |
char *last; |
| 1138 |
char *middle; |
| 1139 |
char *maiden; |
| 1140 |
char *email; |
| 1141 |
char *country; |
| 1142 |
char *state; |
| 1143 |
char *city; |
| 1144 |
char *sn; |
| 1145 |
char *interest; |
| 1146 |
char *nick; |
| 1147 |
char *zip; |
| 1148 |
char *region; |
| 1149 |
char *address; |
| 1150 |
struct aim_odir *next; |
| 1151 |
}; |
| 1152 |
|
| 1153 |
faim_export int aim_odir_email(aim_session_t *, const char *, const char *); |
| 1154 |
faim_export int aim_odir_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 *); |
| 1155 |
faim_export int aim_odir_interest(aim_session_t *, const char *, const char *); |
| 1156 |
|
| 1157 |
|
| 1158 |
|
| 1159 |
/* 0x0010 - icon.c */ |
| 1160 |
faim_export int aim_bart_upload(aim_session_t *sess, const fu8_t *icon, fu16_t iconlen); |
| 1161 |
faim_export int aim_bart_request(aim_session_t *sess, const char *sn, const fu8_t *iconstr, fu16_t iconstrlen); |
| 1162 |
|
| 1163 |
|
| 1164 |
|
| 1165 |
/* 0x0013 - ssi.c */ |
| 1166 |
#define AIM_SSI_TYPE_BUDDY 0x0000 |
| 1167 |
#define AIM_SSI_TYPE_GROUP 0x0001 |
| 1168 |
#define AIM_SSI_TYPE_PERMIT 0x0002 |
| 1169 |
#define AIM_SSI_TYPE_DENY 0x0003 |
| 1170 |
#define AIM_SSI_TYPE_PDINFO 0x0004 |
| 1171 |
#define AIM_SSI_TYPE_PRESENCEPREFS 0x0005 |
| 1172 |
#define AIM_SSI_TYPE_ICONINFO 0x0014 |
| 1173 |
|
| 1174 |
#define AIM_SSI_ACK_SUCCESS 0x0000 |
| 1175 |
#define AIM_SSI_ACK_ITEMNOTFOUND 0x0002 |
| 1176 |
#define AIM_SSI_ACK_IDNUMINUSE 0x000a |
| 1177 |
#define AIM_SSI_ACK_ATMAX 0x000c |
| 1178 |
#define AIM_SSI_ACK_INVALIDNAME 0x000d |
| 1179 |
#define AIM_SSI_ACK_AUTHREQUIRED 0x000e |
| 1180 |
|
| 1181 |
struct aim_ssi_item { |
| 1182 |
char *name; |
| 1183 |
fu16_t gid; |
| 1184 |
fu16_t bid; |
| 1185 |
fu16_t type; |
| 1186 |
struct aim_tlvlist_s *data; |
| 1187 |
struct aim_ssi_item *next; |
| 1188 |
}; |
| 1189 |
|
| 1190 |
struct aim_ssi_tmp { |
| 1191 |
fu16_t action; |
| 1192 |
fu16_t ack; |
| 1193 |
char *name; |
| 1194 |
struct aim_ssi_item *item; |
| 1195 |
struct aim_ssi_tmp *next; |
| 1196 |
}; |
| 1197 |
|
| 1198 |
/* These build the actual SNACs and queue them to be sent */ |
| 1199 |
/* 0x0002 */ faim_export int aim_ssi_reqrights(aim_session_t *sess); |
| 1200 |
/* 0x0004 */ faim_export int aim_ssi_reqdata(aim_session_t *sess); |
| 1201 |
/* 0x0005 */ faim_export int aim_ssi_reqifchanged(aim_session_t *sess, time_t localstamp, fu16_t localrev); |
| 1202 |
/* 0x0007 */ faim_export int aim_ssi_enable(aim_session_t *sess); |
| 1203 |
/* 0x0008 */ faim_export int aim_ssi_addmoddel(aim_session_t *sess); |
| 1204 |
/* 0x0011 */ faim_export int aim_ssi_modbegin(aim_session_t *sess); |
| 1205 |
/* 0x0012 */ faim_export int aim_ssi_modend(aim_session_t *sess); |
| 1206 |
/* 0x0014 */ faim_export int aim_ssi_sendauth(aim_session_t *sess, char *sn, char *msg); |
| 1207 |
/* 0x0018 */ faim_export int aim_ssi_sendauthrequest(aim_session_t *sess, char *sn, char *msg); |
| 1208 |
/* 0x001a */ faim_export int aim_ssi_sendauthreply(aim_session_t *sess, char *sn, fu8_t reply, char *msg); |
| 1209 |
|
| 1210 |
/* Client functions for retrieving SSI data */ |
| 1211 |
faim_export struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_item *list, fu16_t gid, fu16_t bid); |
| 1212 |
faim_export struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_item *list, const char *gn, const char *sn, fu16_t type); |
| 1213 |
faim_export struct aim_ssi_item *aim_ssi_itemlist_exists(struct aim_ssi_item *list, const char *sn); |
| 1214 |
faim_export char *aim_ssi_itemlist_findparentname(struct aim_ssi_item *list, const char *sn); |
| 1215 |
faim_export int aim_ssi_getpermdeny(struct aim_ssi_item *list); |
| 1216 |
faim_export fu32_t aim_ssi_getpresence(struct aim_ssi_item *list); |
| 1217 |
faim_export char *aim_ssi_getalias(struct aim_ssi_item *list, const char *gn, const char *sn); |
| 1218 |
faim_export char *aim_ssi_getcomment(struct aim_ssi_item *list, const char *gn, const char *sn); |
| 1219 |
faim_export int aim_ssi_waitingforauth(struct aim_ssi_item *list, const char *gn, const char *sn); |
| 1220 |
|
| 1221 |
/* Client functions for changing SSI data */ |
| 1222 |
faim_export int aim_ssi_addbuddy(aim_session_t *sess, const char *name, const char *group, const char *alias, const char *comment, const char *smsnum, int needauth); |
| 1223 |
faim_export int aim_ssi_addpermit(aim_session_t *sess, const char *name); |
| 1224 |
faim_export int aim_ssi_adddeny(aim_session_t *sess, const char *name); |
| 1225 |
faim_export int aim_ssi_delbuddy(aim_session_t *sess, const char *name, const char *group); |
| 1226 |
faim_export int aim_ssi_delpermit(aim_session_t *sess, const char *name); |
| 1227 |
faim_export int aim_ssi_deldeny(aim_session_t *sess, const char *name); |
| 1228 |
faim_export int aim_ssi_movebuddy(aim_session_t *sess, const char *oldgn, const char *newgn, const char *sn); |
| 1229 |
faim_export int aim_ssi_aliasbuddy(aim_session_t *sess, const char *gn, const char *sn, const char *alias); |
| 1230 |
faim_export int aim_ssi_editcomment(aim_session_t *sess, const char *gn, const char *sn, const char *alias); |
| 1231 |
faim_export int aim_ssi_rename_group(aim_session_t *sess, const char *oldgn, const char *newgn); |
| 1232 |
faim_export int aim_ssi_cleanlist(aim_session_t *sess); |
| 1233 |
faim_export int aim_ssi_deletelist(aim_session_t *sess); |
| 1234 |
faim_export int aim_ssi_setpermdeny(aim_session_t *sess, fu8_t permdeny, fu32_t vismask); |
| 1235 |
faim_export int aim_ssi_setpresence(aim_session_t *sess, fu32_t presence); |
| 1236 |
faim_export int aim_ssi_seticon(aim_session_t *sess, fu8_t *iconsum, fu16_t iconsumlen); |
| 1237 |
faim_export int aim_ssi_delicon(aim_session_t *sess); |
| 1238 |
|
| 1239 |
|
| 1240 |
|
| 1241 |
/* 0x0015 - icq.c */ |
| 1242 |
#define AIM_ICQ_INFO_SIMPLE 0x001 |
| 1243 |
#define AIM_ICQ_INFO_SUMMARY 0x002 |
| 1244 |
#define AIM_ICQ_INFO_EMAIL 0x004 |
| 1245 |
#define AIM_ICQ_INFO_PERSONAL 0x008 |
| 1246 |
#define AIM_ICQ_INFO_ADDITIONAL 0x010 |
| 1247 |
#define AIM_ICQ_INFO_WORK 0x020 |
| 1248 |
#define AIM_ICQ_INFO_INTERESTS 0x040 |
| 1249 |
#define AIM_ICQ_INFO_ORGS 0x080 |
| 1250 |
#define AIM_ICQ_INFO_UNKNOWN 0x100 |
| 1251 |
#define AIM_ICQ_INFO_HAVEALL 0x1ff |
| 1252 |
|
| 1253 |
struct aim_icq_offlinemsg { |
| 1254 |
fu32_t sender; |
| 1255 |
fu16_t year; |
| 1256 |
fu8_t month, day, hour, minute; |
| 1257 |
fu8_t type; |
| 1258 |
fu8_t flags; |
| 1259 |
char *msg; |
| 1260 |
int msglen; |
| 1261 |
}; |
| 1262 |
|
| 1263 |
struct aim_icq_info { |
| 1264 |
fu16_t reqid; |
| 1265 |
|
| 1266 |
/* simple */ |
| 1267 |
fu32_t uin; |
| 1268 |
|
| 1269 |
/* general and "home" information (0x00c8) */ |
| 1270 |
char *nick; |
| 1271 |
char *first; |
| 1272 |
char *last; |
| 1273 |
char *email; |
| 1274 |
char *homecity; |
| 1275 |
char *homestate; |
| 1276 |
char *homephone; |
| 1277 |
char *homefax; |
| 1278 |
char *homeaddr; |
| 1279 |
char *mobile; |
| 1280 |
char *homezip; |
| 1281 |
fu16_t homecountry; |
| 1282 |
/* fu8_t timezone; |
| 1283 |
fu8_t hideemail; */ |
| 1284 |
|
| 1285 |
/* personal (0x00dc) */ |
| 1286 |
fu8_t age; |
| 1287 |
fu8_t unknown; |
| 1288 |
fu8_t gender; |
| 1289 |
char *personalwebpage; |
| 1290 |
fu16_t birthyear; |
| 1291 |
fu8_t birthmonth; |
| 1292 |
fu8_t birthday; |
| 1293 |
fu8_t language1; |
| 1294 |
fu8_t language2; |
| 1295 |
fu8_t language3; |
| 1296 |
|
| 1297 |
/* work (0x00d2) */ |
| 1298 |
char *workcity; |
| 1299 |
char *workstate; |
| 1300 |
char *workphone; |
| 1301 |
char *workfax; |
| 1302 |
char *workaddr; |
| 1303 |
char *workzip; |
| 1304 |
fu16_t workcountry; |
| 1305 |
char *workcompany; |
| 1306 |
char *workdivision; |
| 1307 |
char *workposition; |
| 1308 |
char *workwebpage; |
| 1309 |
|
| 1310 |
/* additional personal information (0x00e6) */ |
| 1311 |
char *info; |
| 1312 |
|
| 1313 |
/* email (0x00eb) */ |
| 1314 |
fu16_t numaddresses; |
| 1315 |
char **email2; |
| 1316 |
|
| 1317 |
/* we keep track of these in a linked list because we're 1337 */ |
| 1318 |
struct aim_icq_info *next; |
| 1319 |
}; |
| 1320 |
|
| 1321 |
faim_export int aim_icq_reqofflinemsgs(aim_session_t *sess); |
| 1322 |
faim_export int aim_icq_ackofflinemsgs(aim_session_t *sess); |
| 1323 |
faim_export int aim_icq_hideip(aim_session_t *sess); |
| 1324 |
faim_export int aim_icq_changepasswd(aim_session_t *sess, const char *passwd); |
| 1325 |
faim_export int aim_icq_getsimpleinfo(aim_session_t *sess, const char *uin); |
| 1326 |
faim_export int aim_icq_getalias(aim_session_t *sess, const char *uin); |
| 1327 |
faim_export int aim_icq_getallinfo(aim_session_t *sess, const char *uin); |
| 1328 |
|
| 1329 |
|
| 1330 |
|
| 1331 |
/* 0x0017 - auth.c */ |
| 1332 |
faim_export int aim_sendcookie(aim_session_t *, aim_conn_t *, const fu16_t length, const fu8_t *); |
| 1333 |
faim_export int aim_admin_changepasswd(aim_session_t *, aim_conn_t *, const char *newpw, const char *curpw); |
| 1334 |
faim_export int aim_admin_reqconfirm(aim_session_t *sess, aim_conn_t *conn); |
| 1335 |
faim_export int aim_admin_getinfo(aim_session_t *sess, aim_conn_t *conn, fu16_t info); |
| 1336 |
faim_export int aim_admin_setemail(aim_session_t *sess, aim_conn_t *conn, const char *newemail); |
| 1337 |
faim_export int aim_admin_setnick(aim_session_t *sess, aim_conn_t *conn, const char *newnick); |
| 1338 |
|
| 1339 |
|
| 1340 |
|
| 1341 |
/* 0x0018 - email.c */ |
| 1342 |
struct aim_emailinfo { |
| 1343 |
fu8_t *cookie16; |
| 1344 |
fu8_t *cookie8; |
| 1345 |
char *url; |
| 1346 |
fu16_t nummsgs; |
| 1347 |
fu8_t unread; |
| 1348 |
char *domain; |
| 1349 |
fu16_t flag; |
| 1350 |
struct aim_emailinfo *next; |
| 1351 |
}; |
| 1352 |
|
| 1353 |
faim_export int aim_email_sendcookies(aim_session_t *sess); |
| 1354 |
faim_export int aim_email_activate(aim_session_t *sess); |
| 1355 |
|
| 1356 |
|
| 1357 |
|
| 1358 |
#if defined(FAIM_INTERNAL) || defined(FAIM_NEED_TLV) |
| 1359 |
/* tlv.c - TLV handling */ |
| 1360 |
|
| 1361 |
/* TLV structure */ |
| 1362 |
typedef struct aim_tlv_s { |
| 1363 |
fu16_t type; |
| 1364 |
fu16_t length; |
| 1365 |
fu8_t *value; |
| 1366 |
} aim_tlv_t; |
| 1367 |
|
| 1368 |
/* TLV List structure */ |
| 1369 |
typedef struct aim_tlvlist_s { |
| 1370 |
aim_tlv_t *tlv; |
| 1371 |
struct aim_tlvlist_s *next; |
| 1372 |
} aim_tlvlist_t; |
| 1373 |
|
| 1374 |
/* TLV handling functions */ |
| 1375 |
faim_internal aim_tlv_t *aim_tlv_gettlv(aim_tlvlist_t *list, fu16_t type, const int nth); |
| 1376 |
faim_internal char *aim_tlv_getstr(aim_tlvlist_t *list, const fu16_t type, const int nth); |
| 1377 |
faim_internal fu8_t aim_tlv_get8(aim_tlvlist_t *list, const fu16_t type, const int nth); |
| 1378 |
faim_internal fu16_t aim_tlv_get16(aim_tlvlist_t *list, const fu16_t type, const int nth); |
| 1379 |
faim_internal fu32_t aim_tlv_get32(aim_tlvlist_t *list, const fu16_t type, const int nth); |
| 1380 |
|
| 1381 |
/* TLV list handling functions */ |
| 1382 |
faim_internal aim_tlvlist_t *aim_tlvlist_read(aim_bstream_t *bs); |
| 1383 |
faim_internal aim_tlvlist_t *aim_tlvlist_readnum(aim_bstream_t *bs, fu16_t num); |
| 1384 |
faim_internal aim_tlvlist_t *aim_tlvlist_readlen(aim_bstream_t *bs, fu16_t len); |
| 1385 |
faim_internal aim_tlvlist_t *aim_tlvlist_copy(aim_tlvlist_t *orig); |
| 1386 |
|
| 1387 |
faim_internal int aim_tlvlist_count(aim_tlvlist_t **list); |
| 1388 |
faim_internal int aim_tlvlist_size(aim_tlvlist_t **list); |
| 1389 |
faim_internal int aim_tlvlist_cmp(aim_tlvlist_t *one, aim_tlvlist_t *two); |
| 1390 |
faim_internal int aim_tlvlist_write(aim_bstream_t *bs, aim_tlvlist_t **list); |
| 1391 |
faim_internal void aim_tlvlist_free(aim_tlvlist_t **list); |
| 1392 |
|
| 1393 |
faim_internal int aim_tlvlist_add_raw(aim_tlvlist_t **list, const fu16_t type, const fu16_t length, const fu8_t *value); |
| 1394 |
faim_internal int aim_tlvlist_add_noval(aim_tlvlist_t **list, const fu16_t type); |
| 1395 |
faim_internal int aim_tlvlist_add_8(aim_tlvlist_t **list, const fu16_t type, const fu8_t value); |
| 1396 |
faim_internal int aim_tlvlist_add_16(aim_tlvlist_t **list, const fu16_t type, const fu16_t value); |
| 1397 |
faim_internal int aim_tlvlist_add_32(aim_tlvlist_t **list, const fu16_t type, const fu32_t value); |
| 1398 |
faim_internal int aim_tlvlist_add_caps(aim_tlvlist_t **list, const fu16_t type, const fu32_t caps); |
| 1399 |
faim_internal int aim_tlvlist_add_userinfo(aim_tlvlist_t **list, fu16_t type, aim_userinfo_t *userinfo); |
| 1400 |
faim_internal int aim_tlvlist_add_frozentlvlist(aim_tlvlist_t **list, fu16_t type, aim_tlvlist_t **tl); |
| 1401 |
|
| 1402 |
faim_internal int aim_tlvlist_replace_raw(aim_tlvlist_t **list, const fu16_t type, const fu16_t lenth, const fu8_t *value); |
| 1403 |
faim_internal int aim_tlvlist_replace_noval(aim_tlvlist_t **list, const fu16_t type); |
| 1404 |
faim_internal int aim_tlvlist_replace_8(aim_tlvlist_t **list, const fu16_t type, const fu8_t value); |
| 1405 |
faim_internal int aim_tlvlist_replace_16(aim_tlvlist_t **list, const fu16_t type, const fu16_t value); |
| 1406 |
faim_internal int aim_tlvlist_replace_32(aim_tlvlist_t **list, const fu16_t type, const fu32_t value); |
| 1407 |
|
| 1408 |
faim_internal void aim_tlvlist_remove(aim_tlvlist_t **list, const fu16_t type); |
| 1409 |
#endif /* FAIM_INTERNAL */ |
| 1410 |
|
| 1411 |
|
| 1412 |
|
| 1413 |
/* util.c */ |
| 1414 |
/* |
| 1415 |
* These are really ugly. You'd think this was LISP. I wish it was. |
| 1416 |
* |
| 1417 |
* XXX With the advent of bstream's, these should be removed to enforce |
| 1418 |
* their use. |
| 1419 |
* |
| 1420 |
*/ |
| 1421 |
#define aimutil_put8(buf, data) ((*(buf) = (fu8_t)(data)&0xff),1) |
| 1422 |
#define aimutil_get8(buf) ((*(buf))&0xff) |
| 1423 |
#define aimutil_put16(buf, data) ( \ |
| 1424 |
(*(buf) = (fu8_t)((data)>>8)&0xff), \ |
| 1425 |
(*((buf)+1) = (fu8_t)(data)&0xff), \ |
| 1426 |
2) |
| 1427 |
#define aimutil_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff)) |
| 1428 |
#define aimutil_put32(buf, data) ( \ |
| 1429 |
(*((buf)) = (fu8_t)((data)>>24)&0xff), \ |
| 1430 |
(*((buf)+1) = (fu8_t)((data)>>16)&0xff), \ |
| 1431 |
(*((buf)+2) = (fu8_t)((data)>>8)&0xff), \ |
| 1432 |
(*((buf)+3) = (fu8_t)(data)&0xff), \ |
| 1433 |
4) |
| 1434 |
#define aimutil_get32(buf) ((((*(buf))<<24)&0xff000000) + \ |
| 1435 |
(((*((buf)+1))<<16)&0x00ff0000) + \ |
| 1436 |
(((*((buf)+2))<< 8)&0x0000ff00) + \ |
| 1437 |
(((*((buf)+3) )&0x000000ff))) |
| 1438 |
|
| 1439 |
/* Little-endian versions (damn ICQ) */ |
| 1440 |
#define aimutil_putle8(buf, data) ( \ |
| 1441 |
(*(buf) = (fu8_t)(data) & 0xff), \ |
| 1442 |
1) |
| 1443 |
#define aimutil_getle8(buf) ( \ |
| 1444 |
(*(buf)) & 0xff \ |
| 1445 |
) |
| 1446 |
#define aimutil_putle16(buf, data) ( \ |
| 1447 |
(*((buf)+0) = (fu8_t)((data) >> 0) & 0xff), \ |
| 1448 |
(*((buf)+1) = (fu8_t)((data) >> 8) & 0xff), \ |
| 1449 |
2) |
| 1450 |
#define aimutil_getle16(buf) ( \ |
| 1451 |
(((*((buf)+0)) << 0) & 0x00ff) + \ |
| 1452 |
(((*((buf)+1)) << 8) & 0xff00) \ |
| 1453 |
) |
| 1454 |
#define aimutil_putle32(buf, data) ( \ |
| 1455 |
(*((buf)+0) = (fu8_t)((data) >> 0) & 0xff), \ |
| 1456 |
(*((buf)+1) = (fu8_t)((data) >> 8) & 0xff), \ |
| 1457 |
(*((buf)+2) = (fu8_t)((data) >> 16) & 0xff), \ |
| 1458 |
(*((buf)+3) = (fu8_t)((data) >> 24) & 0xff), \ |
| 1459 |
4) |
| 1460 |
#define aimutil_getle32(buf) ( \ |
| 1461 |
(((*((buf)+0)) << 0) & 0x000000ff) + \ |
| 1462 |
(((*((buf)+1)) << 8) & 0x0000ff00) + \ |
| 1463 |
(((*((buf)+2)) << 16) & 0x00ff0000) + \ |
| 1464 |
(((*((buf)+3)) << 24) & 0xff000000)) |
| 1465 |
|
| 1466 |
|
| 1467 |
faim_export int aimutil_putstr(char *, const char *, int); |
| 1468 |
faim_export fu16_t aimutil_iconsum(const fu8_t *buf, int buflen); |
| 1469 |
faim_export int aim_util_getlocalip(fu8_t *ip); |
| 1470 |
faim_export int aimutil_tokslen(char *toSearch, int theindex, char dl); |
| 1471 |
faim_export int aimutil_itemcnt(char *toSearch, char dl); |
| 1472 |
faim_export char *aimutil_itemindex(char *toSearch, int theindex, char dl); |
| 1473 |
|
| 1474 |
faim_export int aim_snlen(const char *sn); |
| 1475 |
faim_export int aim_sncmp(const char *sn1, const char *sn2); |
| 1476 |
|
| 1477 |
#include <aim_internal.h> |
| 1478 |
|
| 1479 |
#ifdef __cplusplus |
| 1480 |
} |
| 1481 |
#endif |
| 1482 |
|
| 1483 |
#endif /* __AIM_H__ */ |