1.1 --- a/Frameworks/libpurple.framework/Versions/0.6.0/Headers/oscar.h Fri Aug 21 13:24:36 2009 -0700
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,1707 +0,0 @@
1.4 -/*
1.5 - * Purple's oscar protocol plugin
1.6 - * This file is the legal property of its developers.
1.7 - * Please see the AUTHORS file distributed alongside this file.
1.8 - *
1.9 - * This library is free software; you can redistribute it and/or
1.10 - * modify it under the terms of the GNU Lesser General Public
1.11 - * License as published by the Free Software Foundation; either
1.12 - * version 2 of the License, or (at your option) any later version.
1.13 - *
1.14 - * This library is distributed in the hope that it will be useful,
1.15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1.17 - * Lesser General Public License for more details.
1.18 - *
1.19 - * You should have received a copy of the GNU Lesser General Public
1.20 - * License along with this library; if not, write to the Free Software
1.21 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
1.22 -*/
1.23 -
1.24 -/*
1.25 - * Main libfaim header. Must be included in client for prototypes/macros.
1.26 - *
1.27 - * "come on, i turned a chick lesbian; i think this is the hackish equivalent"
1.28 - * -- Josh Myer
1.29 - *
1.30 - */
1.31 -
1.32 -#ifndef _OSCAR_H_
1.33 -#define _OSCAR_H_
1.34 -
1.35 -#include "circbuffer.h"
1.36 -#include "debug.h"
1.37 -#include "eventloop.h"
1.38 -#include "internal.h"
1.39 -#include "proxy.h"
1.40 -#include "sslconn.h"
1.41 -
1.42 -#include <stdio.h>
1.43 -#include <string.h>
1.44 -#include <fcntl.h>
1.45 -#include <sys/types.h>
1.46 -#include <stdlib.h>
1.47 -#include <stdarg.h>
1.48 -#include <errno.h>
1.49 -#include <time.h>
1.50 -
1.51 -#ifndef _WIN32
1.52 -#include <sys/time.h>
1.53 -#include <unistd.h>
1.54 -#include <netdb.h>
1.55 -#include <netinet/in.h>
1.56 -#include <sys/socket.h>
1.57 -#else
1.58 -#include "libc_interface.h"
1.59 -#endif
1.60 -
1.61 -typedef struct _ByteStream ByteStream;
1.62 -typedef struct _ClientInfo ClientInfo;
1.63 -typedef struct _FlapConnection FlapConnection;
1.64 -typedef struct _FlapFrame FlapFrame;
1.65 -typedef struct _IcbmArgsCh2 IcbmArgsCh2;
1.66 -typedef struct _IcbmCookie IcbmCookie;
1.67 -typedef struct _OscarData OscarData;
1.68 -typedef struct _QueuedSnac QueuedSnac;
1.69 -
1.70 -typedef guint32 aim_snacid_t;
1.71 -
1.72 -#include "snactypes.h"
1.73 -
1.74 -#ifdef __cplusplus
1.75 -extern "C" {
1.76 -#endif
1.77 -
1.78 -#define FAIM_SNAC_HASH_SIZE 16
1.79 -
1.80 -/*
1.81 - * Current Maximum Length for usernames (not including NULL)
1.82 - *
1.83 - * Currently only names up to 16 characters can be registered
1.84 - * however it is apparently legal for them to be larger.
1.85 - */
1.86 -#define MAXSNLEN 97
1.87 -
1.88 -/*
1.89 - * Current Maximum Length for Instant Messages
1.90 - *
1.91 - * This was found basically by experiment, but not wholly
1.92 - * accurate experiment. It should not be regarded
1.93 - * as completely correct. But its a decent approximation.
1.94 - *
1.95 - * Note that although we can send this much, its impossible
1.96 - * for WinAIM clients (up through the latest (4.0.1957)) to
1.97 - * send any more than 1kb. Amaze all your windows friends
1.98 - * with utterly oversized instant messages!
1.99 - */
1.100 -#define MAXMSGLEN 2544
1.101 -
1.102 -/*
1.103 - * Maximum size of a Buddy Icon.
1.104 - */
1.105 -#define MAXICONLEN 7168
1.106 -#define AIM_ICONIDENT "AVT1picture.id"
1.107 -
1.108 -/*
1.109 - * Current Maximum Length for Chat Room Messages
1.110 - *
1.111 - * This is actually defined by the protocol to be
1.112 - * dynamic, but I have yet to see due cause to
1.113 - * define it dynamically here. Maybe later.
1.114 - *
1.115 - */
1.116 -#define MAXCHATMSGLEN 512
1.117 -
1.118 -/*
1.119 - * Found by trial and error.
1.120 - */
1.121 -#define MAXAVAILMSGLEN 251
1.122 -
1.123 -/**
1.124 - * Maximum length for the password of an ICQ account
1.125 - */
1.126 -#define MAXICQPASSLEN 8
1.127 -
1.128 -#define AIM_MD5_STRING "AOL Instant Messenger (SM)"
1.129 -
1.130 -/*
1.131 - * Client info. Filled in by the client and passed in to
1.132 - * aim_send_login(). The information ends up getting passed to OSCAR
1.133 - * through the initial login command.
1.134 - *
1.135 - */
1.136 -struct _ClientInfo
1.137 -{
1.138 - const char *clientstring;
1.139 - guint16 clientid;
1.140 - guint16 major;
1.141 - guint16 minor;
1.142 - guint16 point;
1.143 - guint16 build;
1.144 - guint32 distrib;
1.145 - const char *country; /* two-letter abbrev */
1.146 - const char *lang; /* two-letter abbrev */
1.147 -};
1.148 -
1.149 -/* Needs to be checked */
1.150 -#define CLIENTINFO_AIM_3_5_1670 { \
1.151 - "AOL Instant Messenger (SM), version 3.5.1670/WIN32", \
1.152 - 0x0004, \
1.153 - 0x0003, 0x0005, \
1.154 - 0x0000, 0x0686, \
1.155 - 0x0000002a, \
1.156 - "us", "en", \
1.157 -}
1.158 -
1.159 -/* Needs to be checked */
1.160 -/* Latest winaim without ssi */
1.161 -#define CLIENTINFO_AIM_4_1_2010 { \
1.162 - "AOL Instant Messenger (SM), version 4.1.2010/WIN32", \
1.163 - 0x0004, \
1.164 - 0x0004, 0x0001, \
1.165 - 0x0000, 0x07da, \
1.166 - 0x0000004b, \
1.167 - "us", "en", \
1.168 -}
1.169 -
1.170 -/* Needs to be checked */
1.171 -#define CLIENTINFO_AIM_4_3_2188 { \
1.172 - "AOL Instant Messenger (SM), version 4.3.2188/WIN32", \
1.173 - 0x0109, \
1.174 - 0x0400, 0x0003, \
1.175 - 0x0000, 0x088c, \
1.176 - 0x00000086, \
1.177 - "us", "en", \
1.178 -}
1.179 -
1.180 -/* Needs to be checked */
1.181 -#define CLIENTINFO_AIM_4_8_2540 { \
1.182 - "AOL Instant Messenger (SM), version 4.8.2540/WIN32", \
1.183 - 0x0109, \
1.184 - 0x0004, 0x0008, \
1.185 - 0x0000, 0x09ec, \
1.186 - 0x000000af, \
1.187 - "us", "en", \
1.188 -}
1.189 -
1.190 -/* Needs to be checked */
1.191 -#define CLIENTINFO_AIM_5_0_2938 { \
1.192 - "AOL Instant Messenger, version 5.0.2938/WIN32", \
1.193 - 0x0109, \
1.194 - 0x0005, 0x0000, \
1.195 - 0x0000, 0x0b7a, \
1.196 - 0x00000000, \
1.197 - "us", "en", \
1.198 -}
1.199 -
1.200 -#define CLIENTINFO_AIM_5_1_3036 { \
1.201 - "AOL Instant Messenger, version 5.1.3036/WIN32", \
1.202 - 0x0109, \
1.203 - 0x0005, 0x0001, \
1.204 - 0x0000, 0x0bdc, \
1.205 - 0x000000d2, \
1.206 - "us", "en", \
1.207 -}
1.208 -
1.209 -#define CLIENTINFO_AIM_5_5_3415 { \
1.210 - "AOL Instant Messenger, version 5.5.3415/WIN32", \
1.211 - 0x0109, \
1.212 - 0x0005, 0x0005, \
1.213 - 0x0000, 0x0057, \
1.214 - 0x000000ef, \
1.215 - "us", "en", \
1.216 -}
1.217 -
1.218 -#define CLIENTINFO_AIM_5_9_3702 { \
1.219 - "AOL Instant Messenger, version 5.9.3702/WIN32", \
1.220 - 0x0109, \
1.221 - 0x0005, 0x0009, \
1.222 - 0x0000, 0x0e76, \
1.223 - 0x00000111, \
1.224 - "us", "en", \
1.225 -}
1.226 -
1.227 -#define CLIENTINFO_ICHAT_1_0 { \
1.228 - "Apple iChat", \
1.229 - 0x311a, \
1.230 - 0x0001, 0x0000, \
1.231 - 0x0000, 0x003c, \
1.232 - 0x000000c6, \
1.233 - "us", "en", \
1.234 -}
1.235 -
1.236 -/* Needs to be checked */
1.237 -#define CLIENTINFO_ICQ_4_65_3281 { \
1.238 - "ICQ Inc. - Product of ICQ (TM) 2000b.4.65.1.3281.85", \
1.239 - 0x010a, \
1.240 - 0x0004, 0x0041, \
1.241 - 0x0001, 0x0cd1, \
1.242 - 0x00000055, \
1.243 - "us", "en", \
1.244 -}
1.245 -
1.246 -/* Needs to be checked */
1.247 -#define CLIENTINFO_ICQ_5_34_3728 { \
1.248 - "ICQ Inc. - Product of ICQ (TM).2002a.5.34.1.3728.85", \
1.249 - 0x010a, \
1.250 - 0x0005, 0x0022, \
1.251 - 0x0001, 0x0e8f, \
1.252 - 0x00000055, \
1.253 - "us", "en", \
1.254 -}
1.255 -
1.256 -#define CLIENTINFO_ICQ_5_45_3777 { \
1.257 - "ICQ Inc. - Product of ICQ (TM).2003a.5.45.1.3777.85", \
1.258 - 0x010a, \
1.259 - 0x0005, 0x002d, \
1.260 - 0x0001, 0x0ec1, \
1.261 - 0x00000055, \
1.262 - "us", "en", \
1.263 -}
1.264 -
1.265 -#define CLIENTINFO_ICQ6_6_0_6059 { \
1.266 - "ICQ Client", \
1.267 - 0x010a, \
1.268 - 0x0006, 0x0000, \
1.269 - 0x0000, 0x17ab, \
1.270 - 0x00007535, \
1.271 - "us", "en", \
1.272 -}
1.273 -
1.274 -#define CLIENTINFO_ICQBASIC_14_3_1068 { \
1.275 - "ICQBasic", \
1.276 - 0x010a, \
1.277 - 0x0014, 0x0003, \
1.278 - 0x0000, 0x042c, \
1.279 - 0x0000043d, \
1.280 - "us", "en", \
1.281 -}
1.282 -
1.283 -#define CLIENTINFO_ICQBASIC_14_34_3000 { \
1.284 - "ICQBasic", \
1.285 - 0x010a, \
1.286 - 0x0014, 0x0034, \
1.287 - 0x0000, 0x0bb8, \
1.288 - 0x0000043d, \
1.289 - "us", "en", \
1.290 -}
1.291 -
1.292 -#define CLIENTINFO_ICQBASIC_14_34_3096 { \
1.293 - "ICQBasic", \
1.294 - 0x010a, \
1.295 - 0x0014, 0x0034, \
1.296 - 0x0000, 0x0c18, \
1.297 - 0x0000043d, \
1.298 - "us", "en", \
1.299 -}
1.300 -
1.301 -#define CLIENTINFO_NETSCAPE_7_0_1 { \
1.302 - "Netscape 2000 an approved user of AOL Instant Messenger (SM)", \
1.303 - 0x1d0d, \
1.304 - 0x0007, 0x0000, \
1.305 - 0x0001, 0x0000, \
1.306 - 0x00000058, \
1.307 - "us", "en", \
1.308 -}
1.309 -
1.310 -/*
1.311 - * We need to use the major-minor-micro versions from the official
1.312 - * AIM and ICQ programs here or AOL won't let us use certain features.
1.313 - *
1.314 - * 0x00000611 is the distid given to us by AOL for use as the default
1.315 - * libpurple distid.
1.316 - */
1.317 -#define CLIENTINFO_PURPLE_AIM { \
1.318 - NULL, \
1.319 - 0x0109, \
1.320 - 0x0005, 0x0001, \
1.321 - 0x0000, 0x0bdc, \
1.322 - 0x00000611, \
1.323 - "us", "en", \
1.324 -}
1.325 -
1.326 -#define CLIENTINFO_PURPLE_ICQ { \
1.327 - NULL, \
1.328 - 0x010a, \
1.329 - 0x0014, 0x0034, \
1.330 - 0x0000, 0x0c18, \
1.331 - 0x00000611, \
1.332 - "us", "en", \
1.333 -}
1.334 -
1.335 -#define CLIENTINFO_AIM_KNOWNGOOD CLIENTINFO_AIM_5_1_3036
1.336 -#define CLIENTINFO_ICQ_KNOWNGOOD CLIENTINFO_ICQBASIC_14_34_3096
1.337 -
1.338 -typedef enum
1.339 -{
1.340 - OSCAR_DISCONNECT_DONE, /* not considered an error */
1.341 - OSCAR_DISCONNECT_LOCAL_CLOSED, /* peer connections only, not considered an error */
1.342 - OSCAR_DISCONNECT_REMOTE_CLOSED,
1.343 - OSCAR_DISCONNECT_REMOTE_REFUSED, /* peer connections only */
1.344 - OSCAR_DISCONNECT_LOST_CONNECTION,
1.345 - OSCAR_DISCONNECT_INVALID_DATA,
1.346 - OSCAR_DISCONNECT_COULD_NOT_CONNECT,
1.347 - OSCAR_DISCONNECT_RETRYING /* peer connections only */
1.348 -} OscarDisconnectReason;
1.349 -
1.350 -typedef enum
1.351 -{
1.352 - OSCAR_CAPABILITY_BUDDYICON = 0x00000001,
1.353 - OSCAR_CAPABILITY_TALK = 0x00000002,
1.354 - OSCAR_CAPABILITY_DIRECTIM = 0x00000004,
1.355 - OSCAR_CAPABILITY_CHAT = 0x00000008,
1.356 - OSCAR_CAPABILITY_GETFILE = 0x00000010,
1.357 - OSCAR_CAPABILITY_SENDFILE = 0x00000020,
1.358 - OSCAR_CAPABILITY_GAMES = 0x00000040,
1.359 - OSCAR_CAPABILITY_ADDINS = 0x00000080,
1.360 - OSCAR_CAPABILITY_SENDBUDDYLIST = 0x00000100,
1.361 - OSCAR_CAPABILITY_GAMES2 = 0x00000200,
1.362 - OSCAR_CAPABILITY_ICQ_DIRECT = 0x00000400,
1.363 - OSCAR_CAPABILITY_APINFO = 0x00000800,
1.364 - OSCAR_CAPABILITY_ICQRTF = 0x00001000,
1.365 - OSCAR_CAPABILITY_EMPTY = 0x00002000,
1.366 - OSCAR_CAPABILITY_ICQSERVERRELAY = 0x00004000,
1.367 - OSCAR_CAPABILITY_UNICODEOLD = 0x00008000,
1.368 - OSCAR_CAPABILITY_TRILLIANCRYPT = 0x00010000,
1.369 - OSCAR_CAPABILITY_UNICODE = 0x00020000,
1.370 - OSCAR_CAPABILITY_INTEROPERATE = 0x00040000,
1.371 - OSCAR_CAPABILITY_SHORTCAPS = 0x00080000,
1.372 - OSCAR_CAPABILITY_HIPTOP = 0x00100000,
1.373 - OSCAR_CAPABILITY_SECUREIM = 0x00200000,
1.374 - OSCAR_CAPABILITY_SMS = 0x00400000,
1.375 - OSCAR_CAPABILITY_VIDEO = 0x00800000,
1.376 - OSCAR_CAPABILITY_ICHATAV = 0x01000000,
1.377 - OSCAR_CAPABILITY_LIVEVIDEO = 0x02000000,
1.378 - OSCAR_CAPABILITY_CAMERA = 0x04000000,
1.379 - OSCAR_CAPABILITY_ICHAT_SCREENSHARE = 0x08000000,
1.380 - OSCAR_CAPABILITY_TYPING = 0x10000000,
1.381 - OSCAR_CAPABILITY_GENERICUNKNOWN = 0x20000000,
1.382 - OSCAR_CAPABILITY_LAST = 0x40000000
1.383 -} OscarCapability;
1.384 -
1.385 -/*
1.386 - * Byte Stream type. Sort of.
1.387 - *
1.388 - * Use of this type serves a couple purposes:
1.389 - * - Buffer/buflen pairs are passed all around everywhere. This turns
1.390 - * that into one value, as well as abstracting it slightly.
1.391 - * - Through the abstraction, it is possible to enable bounds checking
1.392 - * for robustness at the cost of performance. But a clean failure on
1.393 - * weird packets is much better than a segfault.
1.394 - * - I like having variables named "bs".
1.395 - *
1.396 - * Don't touch the insides of this struct. Or I'll have to kill you.
1.397 - *
1.398 - */
1.399 -struct _ByteStream
1.400 -{
1.401 - guint8 *data;
1.402 - guint32 len;
1.403 - guint32 offset;
1.404 -};
1.405 -
1.406 -struct _QueuedSnac
1.407 -{
1.408 - guint16 family;
1.409 - guint16 subtype;
1.410 - FlapFrame *frame;
1.411 -};
1.412 -
1.413 -struct _FlapFrame
1.414 -{
1.415 - guint8 channel;
1.416 - guint16 seqnum;
1.417 - ByteStream data; /* payload stream */
1.418 -};
1.419 -
1.420 -struct _FlapConnection
1.421 -{
1.422 - OscarData *od; /**< Pointer to parent session. */
1.423 - gboolean connected;
1.424 - time_t lastactivity; /**< Time of last transmit. */
1.425 - guint destroy_timeout;
1.426 - OscarDisconnectReason disconnect_reason;
1.427 - gchar *error_message;
1.428 - guint16 disconnect_code;
1.429 -
1.430 - /* A few variables that are only used when connecting */
1.431 - PurpleProxyConnectData *connect_data;
1.432 - guint16 cookielen;
1.433 - guint8 *cookie;
1.434 - gpointer new_conn_data;
1.435 -
1.436 - int fd;
1.437 - PurpleSslConnection *gsc;
1.438 - guint8 header[6];
1.439 - gssize header_received;
1.440 - FlapFrame buffer_incoming;
1.441 - PurpleCircBuffer *buffer_outgoing;
1.442 - guint watcher_incoming;
1.443 - guint watcher_outgoing;
1.444 -
1.445 - guint16 type;
1.446 - guint16 subtype;
1.447 - guint16 seqnum_out; /**< The sequence number of most recently sent packet. */
1.448 - guint16 seqnum_in; /**< The sequence number of most recently received packet. */
1.449 - GSList *groups;
1.450 - GSList *rateclasses; /* Contains nodes of struct rateclass. */
1.451 -
1.452 - GQueue *queued_snacs; /**< Contains QueuedSnacs. */
1.453 - GQueue *queued_lowpriority_snacs; /**< Contains QueuedSnacs to send only once queued_snacs is empty */
1.454 - guint queued_timeout;
1.455 -
1.456 - void *internal; /* internal conn-specific libfaim data */
1.457 -};
1.458 -
1.459 -struct _IcbmCookie
1.460 -{
1.461 - guchar cookie[8];
1.462 - int type;
1.463 - void *data;
1.464 - time_t addtime;
1.465 - struct _IcbmCookie *next;
1.466 -};
1.467 -
1.468 -#include "peer.h"
1.469 -
1.470 -/*
1.471 - * AIM Session: The main client-data interface.
1.472 - *
1.473 - */
1.474 -struct _OscarData
1.475 -{
1.476 - /** Only used when connecting with clientLogin */
1.477 - PurpleUtilFetchUrlData *url_data;
1.478 -
1.479 - gboolean iconconnecting;
1.480 - gboolean set_icon;
1.481 -
1.482 - GSList *create_rooms;
1.483 -
1.484 - gboolean conf;
1.485 - gboolean reqemail;
1.486 - gboolean setemail;
1.487 - char *email;
1.488 - gboolean setnick;
1.489 - char *newformatting;
1.490 - gboolean chpass;
1.491 - char *oldp;
1.492 - char *newp;
1.493 -
1.494 - GSList *oscar_chats;
1.495 - GHashTable *buddyinfo;
1.496 - GSList *requesticon;
1.497 -
1.498 - gboolean use_ssl;
1.499 - gboolean icq;
1.500 - guint getblisttimer;
1.501 -
1.502 - struct {
1.503 - guint maxwatchers; /* max users who can watch you */
1.504 - guint maxbuddies; /* max users you can watch */
1.505 - guint maxgroups; /* max groups in server list */
1.506 - guint maxpermits; /* max users on permit list */
1.507 - guint maxdenies; /* max users on deny list */
1.508 - guint maxsiglen; /* max size (bytes) of profile */
1.509 - guint maxawaymsglen; /* max size (bytes) of posted away message */
1.510 - } rights;
1.511 -
1.512 - PurpleConnection *gc;
1.513 -
1.514 - void *modlistv;
1.515 -
1.516 - /*
1.517 - * Outstanding snac handling
1.518 - *
1.519 - * TODO: Should these be per-connection? -mid
1.520 - */
1.521 - void *snac_hash[FAIM_SNAC_HASH_SIZE];
1.522 - aim_snacid_t snacid_next;
1.523 -
1.524 - /*
1.525 - * TODO: Data specific to a certain family should go into a
1.526 - * hashtable and the core parts of libfaim shouldn't
1.527 - * need to know about them.
1.528 - */
1.529 -
1.530 - IcbmCookie *msgcookies;
1.531 - struct aim_icq_info *icq_info;
1.532 -
1.533 - /** Only used when connecting with the old-style BUCP login. */
1.534 - struct aim_authresp_info *authinfo;
1.535 - struct aim_emailinfo *emailinfo;
1.536 -
1.537 - struct {
1.538 - struct aim_userinfo_s *userinfo;
1.539 - struct userinfo_node *requested;
1.540 - } locate;
1.541 -
1.542 - /* Server-stored information (ssi) */
1.543 - struct {
1.544 - gboolean received_data;
1.545 - guint16 numitems;
1.546 - struct aim_ssi_item *official;
1.547 - struct aim_ssi_item *local;
1.548 - struct aim_ssi_tmp *pending;
1.549 - time_t timestamp;
1.550 - gboolean waiting_for_ack;
1.551 - gboolean in_transaction;
1.552 - } ssi;
1.553 -
1.554 - /** Contains pointers to handler functions for each family/subtype. */
1.555 - GHashTable *handlerlist;
1.556 -
1.557 - /** A linked list containing FlapConnections. */
1.558 - GSList *oscar_connections;
1.559 - guint16 default_port;
1.560 -
1.561 - /** A linked list containing PeerConnections. */
1.562 - GSList *peer_connections;
1.563 -};
1.564 -
1.565 -/* Valid for calling aim_icq_setstatus() and for aim_userinfo_t->icqinfo.status */
1.566 -#define AIM_ICQ_STATE_NORMAL 0x00000000
1.567 -#define AIM_ICQ_STATE_AWAY 0x00000001
1.568 -#define AIM_ICQ_STATE_DND 0x00000002
1.569 -#define AIM_ICQ_STATE_OUT 0x00000004
1.570 -#define AIM_ICQ_STATE_BUSY 0x00000010
1.571 -#define AIM_ICQ_STATE_CHAT 0x00000020
1.572 -#define AIM_ICQ_STATE_INVISIBLE 0x00000100
1.573 -#define AIM_ICQ_STATE_WEBAWARE 0x00010000
1.574 -#define AIM_ICQ_STATE_HIDEIP 0x00020000
1.575 -#define AIM_ICQ_STATE_BIRTHDAY 0x00080000
1.576 -#define AIM_ICQ_STATE_DIRECTDISABLED 0x00100000
1.577 -#define AIM_ICQ_STATE_ICQHOMEPAGE 0x00200000
1.578 -#define AIM_ICQ_STATE_DIRECTREQUIREAUTH 0x10000000
1.579 -#define AIM_ICQ_STATE_DIRECTCONTACTLIST 0x20000000
1.580 -
1.581 -/**
1.582 - * Only used when connecting with the old-style BUCP login.
1.583 - */
1.584 -struct aim_clientrelease
1.585 -{
1.586 - char *name;
1.587 - guint32 build;
1.588 - char *url;
1.589 - char *info;
1.590 -};
1.591 -
1.592 -/**
1.593 - * Only used when connecting with the old-style BUCP login.
1.594 - */
1.595 -struct aim_authresp_info
1.596 -{
1.597 - char *bn;
1.598 - guint16 errorcode;
1.599 - char *errorurl;
1.600 - guint16 regstatus;
1.601 - char *email;
1.602 - char *bosip;
1.603 - guint16 cookielen;
1.604 - guint8 *cookie;
1.605 - char *chpassurl;
1.606 - struct aim_clientrelease latestrelease;
1.607 - struct aim_clientrelease latestbeta;
1.608 -};
1.609 -
1.610 -/* Callback data for redirect. */
1.611 -struct aim_redirect_data
1.612 -{
1.613 - guint16 group;
1.614 - const char *ip;
1.615 - guint16 cookielen;
1.616 - const guint8 *cookie;
1.617 - const char *ssl_cert_cn;
1.618 - guint8 use_ssl;
1.619 - struct { /* group == SNAC_FAMILY_CHAT */
1.620 - guint16 exchange;
1.621 - const char *room;
1.622 - guint16 instance;
1.623 - } chat;
1.624 -};
1.625 -
1.626 -int oscar_connect_to_bos(PurpleConnection *gc, OscarData *od, const char *host, guint16 port, guint8 *cookie, guint16 cookielen);
1.627 -
1.628 -/* family_auth.c */
1.629 -
1.630 -/**
1.631 - * Only used when connecting with the old-style BUCP login.
1.632 - */
1.633 -int aim_request_login(OscarData *od, FlapConnection *conn, const char *bn);
1.634 -
1.635 -/**
1.636 - * Only used when connecting with the old-style BUCP login.
1.637 - */
1.638 -int aim_send_login(OscarData *od, FlapConnection *conn, const char *bn, const char *password, gboolean truncate_pass, ClientInfo *ci, const char *key, gboolean allow_multiple_logins);
1.639 -
1.640 -/**
1.641 - * Only used when connecting with the old-style BUCP login.
1.642 - */
1.643 -/* 0x000b */ int aim_auth_securid_send(OscarData *od, const char *securid);
1.644 -
1.645 -/**
1.646 - * Only used when connecting with clientLogin.
1.647 - */
1.648 -void send_client_login(OscarData *od, const char *username);
1.649 -
1.650 -/* flap_connection.c */
1.651 -FlapConnection *flap_connection_new(OscarData *, int type);
1.652 -void flap_connection_close(OscarData *od, FlapConnection *conn);
1.653 -void flap_connection_destroy(FlapConnection *conn, OscarDisconnectReason reason, const gchar *error_message);
1.654 -void flap_connection_schedule_destroy(FlapConnection *conn, OscarDisconnectReason reason, const gchar *error_message);
1.655 -FlapConnection *flap_connection_findbygroup(OscarData *od, guint16 group);
1.656 -FlapConnection *flap_connection_getbytype(OscarData *, int type);
1.657 -FlapConnection *flap_connection_getbytype_all(OscarData *, int type);
1.658 -void flap_connection_recv_cb(gpointer data, gint source, PurpleInputCondition cond);
1.659 -void flap_connection_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc, PurpleInputCondition cond);
1.660 -
1.661 -void flap_connection_send(FlapConnection *conn, FlapFrame *frame);
1.662 -void flap_connection_send_version(OscarData *od, FlapConnection *conn);
1.663 -void flap_connection_send_version_with_cookie(OscarData *od, FlapConnection *conn, guint16 length, const guint8 *chipsahoy);
1.664 -void flap_connection_send_version_with_cookie_and_clientinfo(OscarData *od, FlapConnection *conn, guint16 length, const guint8 *chipsahoy, ClientInfo *ci);
1.665 -void flap_connection_send_snac(OscarData *od, FlapConnection *conn, guint16 family, const guint16 subtype, guint16 flags, aim_snacid_t snacid, ByteStream *data);
1.666 -void flap_connection_send_snac_with_priority(OscarData *od, FlapConnection *conn, guint16 family, const guint16 subtype, guint16 flags, aim_snacid_t snacid, ByteStream *data, gboolean high_priority);
1.667 -void flap_connection_send_keepalive(OscarData *od, FlapConnection *conn);
1.668 -FlapFrame *flap_frame_new(OscarData *od, guint16 channel, int datalen);
1.669 -
1.670 -/* oscar_data.c */
1.671 -typedef int (*aim_rxcallback_t)(OscarData *od, FlapConnection *conn, FlapFrame *frame, ...);
1.672 -
1.673 -OscarData *oscar_data_new(void);
1.674 -void oscar_data_destroy(OscarData *);
1.675 -void oscar_data_addhandler(OscarData *od, guint16 family, guint16 subtype, aim_rxcallback_t newhandler, guint16 flags);
1.676 -aim_rxcallback_t aim_callhandler(OscarData *od, guint16 family, guint16 subtype);
1.677 -
1.678 -/* misc.c */
1.679 -#define AIM_VISIBILITYCHANGE_PERMITADD 0x05
1.680 -#define AIM_VISIBILITYCHANGE_PERMITREMOVE 0x06
1.681 -#define AIM_VISIBILITYCHANGE_DENYADD 0x07
1.682 -#define AIM_VISIBILITYCHANGE_DENYREMOVE 0x08
1.683 -
1.684 -#define AIM_PRIVFLAGS_ALLOWIDLE 0x01
1.685 -#define AIM_PRIVFLAGS_ALLOWMEMBERSINCE 0x02
1.686 -
1.687 -#define AIM_WARN_ANON 0x01
1.688 -
1.689 -
1.690 -
1.691 -/* 0x0001 - family_oservice.c */
1.692 -/* 0x0002 */ void aim_srv_clientready(OscarData *od, FlapConnection *conn);
1.693 -/* 0x0004 */ void aim_srv_requestnew(OscarData *od, guint16 serviceid);
1.694 -/* 0x0006 */ void aim_srv_reqrates(OscarData *od, FlapConnection *conn);
1.695 -/* 0x0008 */ void aim_srv_rates_addparam(OscarData *od, FlapConnection *conn);
1.696 -/* 0x0009 */ void aim_srv_rates_delparam(OscarData *od, FlapConnection *conn);
1.697 -/* 0x000c */ void aim_srv_sendpauseack(OscarData *od, FlapConnection *conn);
1.698 -/* 0x000e */ void aim_srv_reqpersonalinfo(OscarData *od, FlapConnection *conn);
1.699 -/* 0x0011 */ void aim_srv_setidle(OscarData *od, guint32 idletime);
1.700 -/* 0x0014 */ void aim_srv_setprivacyflags(OscarData *od, FlapConnection *conn, guint32);
1.701 -/* 0x0016 */ void aim_srv_nop(OscarData *od, FlapConnection *conn);
1.702 -/* 0x0017 */ void aim_srv_setversions(OscarData *od, FlapConnection *conn);
1.703 -/* 0x001e */ int aim_srv_setextrainfo(OscarData *od, gboolean seticqstatus, guint32 icqstatus, gboolean setstatusmsg, const char *statusmsg, const char *itmsurl);
1.704 -
1.705 -
1.706 -void aim_bos_reqrights(OscarData *od, FlapConnection *conn);
1.707 -int aim_bos_changevisibility(OscarData *od, FlapConnection *conn, int, const char *);
1.708 -void aim_bos_setgroupperm(OscarData *od, FlapConnection *conn, guint32 mask);
1.709 -
1.710 -
1.711 -
1.712 -#define AIM_CLIENTTYPE_UNKNOWN 0x0000
1.713 -#define AIM_CLIENTTYPE_MC 0x0001
1.714 -#define AIM_CLIENTTYPE_WINAIM 0x0002
1.715 -#define AIM_CLIENTTYPE_WINAIM41 0x0003
1.716 -#define AIM_CLIENTTYPE_AOL_TOC 0x0004
1.717 -guint16 aim_im_fingerprint(const guint8 *msghdr, int len);
1.718 -
1.719 -#define AIM_RATE_CODE_CHANGE 0x0001
1.720 -#define AIM_RATE_CODE_WARNING 0x0002
1.721 -#define AIM_RATE_CODE_LIMIT 0x0003
1.722 -#define AIM_RATE_CODE_CLEARLIMIT 0x0004
1.723 -void aim_ads_requestads(OscarData *od, FlapConnection *conn);
1.724 -
1.725 -
1.726 -
1.727 -/* family_icbm.c */
1.728 -#define AIM_OFT_SUBTYPE_SEND_FILE 0x0001
1.729 -#define AIM_OFT_SUBTYPE_SEND_DIR 0x0002
1.730 -#define AIM_OFT_SUBTYPE_GET_FILE 0x0011
1.731 -#define AIM_OFT_SUBTYPE_GET_LIST 0x0012
1.732 -
1.733 -#define AIM_TRANSFER_DENY_NOTSUPPORTED 0x0000
1.734 -#define AIM_TRANSFER_DENY_DECLINE 0x0001
1.735 -#define AIM_TRANSFER_DENY_NOTACCEPTING 0x0002
1.736 -
1.737 -#define AIM_IMPARAM_FLAG_CHANNEL_MSGS_ALLOWED 0x00000001
1.738 -#define AIM_IMPARAM_FLAG_MISSED_CALLS_ENABLED 0x00000002
1.739 -#define AIM_IMPARAM_FLAG_EVENTS_ALLOWED 0x00000008
1.740 -#define AIM_IMPARAM_FLAG_SMS_SUPPORTED 0x00000010
1.741 -#define AIM_IMPARAM_FLAG_OFFLINE_MSGS_ALLOWED 0x00000100
1.742 -
1.743 -/* This is what the server will give you if you don't set them yourself. */
1.744 -/* This is probably out of date. */
1.745 -#define AIM_IMPARAM_DEFAULTS { \
1.746 - 0, \
1.747 - AIM_IMPARAM_FLAG_CHANNEL_MSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSED_CALLS_ENABLED, \
1.748 - 512, /* !! Note how small this is. */ \
1.749 - (99.9)*10, (99.9)*10, \
1.750 - 1000 /* !! And how large this is. */ \
1.751 -}
1.752 -
1.753 -/* This is what most AIM versions use. */
1.754 -/* This is probably out of date. */
1.755 -#define AIM_IMPARAM_REASONABLE { \
1.756 - 0, \
1.757 - AIM_IMPARAM_FLAG_CHANNEL_MSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSED_CALLS_ENABLED, \
1.758 - 8000, \
1.759 - (99.9)*10, (99.9)*10, \
1.760 - 0 \
1.761 -}
1.762 -
1.763 -struct aim_icbmparameters
1.764 -{
1.765 - guint16 maxchan;
1.766 - guint32 flags; /* AIM_IMPARAM_FLAG_ */
1.767 - guint16 maxmsglen; /* message size that you will accept */
1.768 - guint16 maxsenderwarn; /* this and below are *10 (999=99.9%) */
1.769 - guint16 maxrecverwarn;
1.770 - guint32 minmsginterval; /* in milliseconds? */
1.771 -};
1.772 -
1.773 -/*
1.774 - * TODO: Should probably combine this with struct chat_connection.
1.775 - */
1.776 -struct aim_chat_roominfo
1.777 -{
1.778 - guint16 exchange;
1.779 - char *name;
1.780 - guint8 namelen;
1.781 - guint16 instance;
1.782 -};
1.783 -
1.784 -struct chat_connection
1.785 -{
1.786 - char *name;
1.787 - char *show; /* AOL did something funny to us */
1.788 - guint16 exchange;
1.789 - guint16 instance;
1.790 - FlapConnection *conn;
1.791 - int id;
1.792 - PurpleConnection *gc;
1.793 - PurpleConversation *conv;
1.794 - int maxlen;
1.795 - int maxvis;
1.796 -};
1.797 -
1.798 -/*
1.799 - * All this chat struct stuff should be in family_chat.c
1.800 - */
1.801 -void oscar_chat_destroy(struct chat_connection *cc);
1.802 -
1.803 -#define AIM_IMFLAGS_AWAY 0x0001 /* mark as an autoreply */
1.804 -#define AIM_IMFLAGS_ACK 0x0002 /* request a receipt notice */
1.805 -#define AIM_IMFLAGS_BUDDYREQ 0x0010 /* buddy icon requested */
1.806 -#define AIM_IMFLAGS_HASICON 0x0020 /* already has icon */
1.807 -#define AIM_IMFLAGS_SUBENC_MACINTOSH 0x0040 /* damn that Steve Jobs! */
1.808 -#define AIM_IMFLAGS_CUSTOMFEATURES 0x0080 /* features field present */
1.809 -#define AIM_IMFLAGS_EXTDATA 0x0100
1.810 -#define AIM_IMFLAGS_X 0x0200
1.811 -#define AIM_IMFLAGS_MULTIPART 0x0400 /* ->mpmsg section valid */
1.812 -#define AIM_IMFLAGS_OFFLINE 0x0800 /* send to offline user */
1.813 -#define AIM_IMFLAGS_TYPINGNOT 0x1000 /* typing notification */
1.814 -
1.815 -#define AIM_CHARSET_ASCII 0x0000
1.816 -#define AIM_CHARSET_UNICODE 0x0002 /* UTF-16BE */
1.817 -#define AIM_CHARSET_CUSTOM 0x0003
1.818 -
1.819 -/*
1.820 - * Multipart message structures.
1.821 - */
1.822 -typedef struct aim_mpmsg_section_s
1.823 -{
1.824 - guint16 charset;
1.825 - guint16 charsubset;
1.826 - gchar *data;
1.827 - guint16 datalen;
1.828 - struct aim_mpmsg_section_s *next;
1.829 -} aim_mpmsg_section_t;
1.830 -
1.831 -typedef struct aim_mpmsg_s
1.832 -{
1.833 - unsigned int numparts;
1.834 - aim_mpmsg_section_t *parts;
1.835 -} aim_mpmsg_t;
1.836 -
1.837 -int aim_mpmsg_init(OscarData *od, aim_mpmsg_t *mpm);
1.838 -int aim_mpmsg_addraw(OscarData *od, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, const gchar *data, guint16 datalen);
1.839 -int aim_mpmsg_addascii(OscarData *od, aim_mpmsg_t *mpm, const char *ascii);
1.840 -int aim_mpmsg_addunicode(OscarData *od, aim_mpmsg_t *mpm, const guint16 *unicode, guint16 unicodelen);
1.841 -void aim_mpmsg_free(OscarData *od, aim_mpmsg_t *mpm);
1.842 -
1.843 -/*
1.844 - * Arguments to aim_send_im_ext().
1.845 - *
1.846 - * This is really complicated. But immensely versatile.
1.847 - *
1.848 - */
1.849 -struct aim_sendimext_args
1.850 -{
1.851 -
1.852 - /* These are _required_ */
1.853 - const char *destbn;
1.854 - guint32 flags; /* often 0 */
1.855 -
1.856 - /* Only required if not using multipart messages */
1.857 - const char *msg;
1.858 - int msglen;
1.859 -
1.860 - /* Required if ->msg is not provided */
1.861 - aim_mpmsg_t *mpmsg;
1.862 -
1.863 - /* Only used if AIM_IMFLAGS_HASICON is set */
1.864 - guint32 iconlen;
1.865 - time_t iconstamp;
1.866 - guint32 iconsum;
1.867 -
1.868 - /* Only used if AIM_IMFLAGS_CUSTOMFEATURES is set */
1.869 - guint16 featureslen;
1.870 - guint8 *features;
1.871 -
1.872 - /* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set and mpmsg not used */
1.873 - guint16 charset;
1.874 - guint16 charsubset;
1.875 -};
1.876 -
1.877 -/*
1.878 - * Arguments to aim_send_rtfmsg().
1.879 - */
1.880 -struct aim_sendrtfmsg_args
1.881 -{
1.882 - const char *destbn;
1.883 - guint32 fgcolor;
1.884 - guint32 bgcolor;
1.885 - const char *rtfmsg; /* must be in RTF */
1.886 -};
1.887 -
1.888 -/*
1.889 - * This information is provided in the Incoming ICBM callback for
1.890 - * Channel 1 ICBM's.
1.891 - *
1.892 - * Note that although CUSTOMFEATURES and CUSTOMCHARSET say they
1.893 - * are optional, both are always set by the current libfaim code.
1.894 - * That may or may not change in the future. It is mainly for
1.895 - * consistency with aim_sendimext_args.
1.896 - *
1.897 - * Multipart messages require some explanation. If you want to use them,
1.898 - * I suggest you read all the comments in family_icbm.c.
1.899 - *
1.900 - */
1.901 -struct aim_incomingim_ch1_args
1.902 -{
1.903 -
1.904 - /* Always provided */
1.905 - aim_mpmsg_t mpmsg;
1.906 - guint32 icbmflags; /* some flags apply only to ->msg, not all mpmsg */
1.907 - time_t timestamp; /* Only set for offline messages */
1.908 -
1.909 - /* Only provided if message has a human-readable section */
1.910 - gchar *msg;
1.911 - int msglen;
1.912 -
1.913 - /* Only provided if AIM_IMFLAGS_HASICON is set */
1.914 - time_t iconstamp;
1.915 - guint32 iconlen;
1.916 - guint16 iconsum;
1.917 -
1.918 - /* Only provided if AIM_IMFLAGS_CUSTOMFEATURES is set */
1.919 - guint8 *features;
1.920 - guint8 featureslen;
1.921 -
1.922 - /* Only provided if AIM_IMFLAGS_EXTDATA is set */
1.923 - guint8 extdatalen;
1.924 - guint8 *extdata;
1.925 -
1.926 - /* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set */
1.927 - guint16 charset;
1.928 - guint16 charsubset;
1.929 -};
1.930 -
1.931 -/* Valid values for channel 2 args->status */
1.932 -#define AIM_RENDEZVOUS_PROPOSE 0x0000
1.933 -#define AIM_RENDEZVOUS_CANCEL 0x0001
1.934 -#define AIM_RENDEZVOUS_CONNECTED 0x0002
1.935 -
1.936 -struct _IcbmArgsCh2
1.937 -{
1.938 - guint16 status;
1.939 - guchar cookie[8];
1.940 - int type; /* One of the OSCAR_CAPABILITY_ constants */
1.941 - const char *proxyip;
1.942 - const char *clientip;
1.943 - const char *verifiedip;
1.944 - guint16 port;
1.945 - gboolean use_proxy;
1.946 - guint16 errorcode;
1.947 - const char *msg; /* invite message or file description */
1.948 - guint16 msglen;
1.949 - const char *encoding;
1.950 - const char *language;
1.951 - guint16 requestnumber;
1.952 - union {
1.953 - struct {
1.954 - guint32 checksum;
1.955 - guint32 length;
1.956 - time_t timestamp;
1.957 - guint8 *icon;
1.958 - } icon;
1.959 - struct {
1.960 - struct aim_chat_roominfo roominfo;
1.961 - } chat;
1.962 - struct {
1.963 - guint16 msgtype;
1.964 - guint32 fgcolor;
1.965 - guint32 bgcolor;
1.966 - const char *rtfmsg;
1.967 - } rtfmsg;
1.968 - struct {
1.969 - guint16 subtype;
1.970 - guint16 totfiles;
1.971 - guint32 totsize;
1.972 - char *filename;
1.973 - } sendfile;
1.974 - } info;
1.975 - void *destructor; /* used internally only */
1.976 -};
1.977 -
1.978 -/* Valid values for channel 4 args->type */
1.979 -#define AIM_ICQMSG_AUTHREQUEST 0x0006
1.980 -#define AIM_ICQMSG_AUTHDENIED 0x0007
1.981 -#define AIM_ICQMSG_AUTHGRANTED 0x0008
1.982 -
1.983 -struct aim_incomingim_ch4_args
1.984 -{
1.985 - guint32 uin; /* Of the sender of the ICBM */
1.986 - guint8 type;
1.987 - guint8 flags;
1.988 - gchar *msg; /* Reason for auth request, deny, or accept */
1.989 - int msglen;
1.990 -};
1.991 -
1.992 -/* SNAC sending functions */
1.993 -/* 0x0002 */ int aim_im_setparams(OscarData *od, struct aim_icbmparameters *params);
1.994 -/* 0x0004 */ int aim_im_reqparams(OscarData *od);
1.995 -/* 0x0006 */ int aim_im_sendch1_ext(OscarData *od, struct aim_sendimext_args *args);
1.996 -/* 0x0006 */ int aim_im_sendch1(OscarData *, const char *destbn, guint16 flags, const char *msg);
1.997 -/* 0x0006 */ int aim_im_sendch2_chatinvite(OscarData *od, const char *bn, const char *msg, guint16 exchange, const char *roomname, guint16 instance);
1.998 -/* 0x0006 */ int aim_im_sendch2_icon(OscarData *od, const char *bn, const guint8 *icon, int iconlen, time_t stamp, guint16 iconsum);
1.999 -/* 0x0006 */ int aim_im_sendch2_rtfmsg(OscarData *od, struct aim_sendrtfmsg_args *args);
1.1000 -
1.1001 -/* 0x0006 */ void aim_im_sendch2_cancel(PeerConnection *peer_conn);
1.1002 -/* 0x0006 */ void aim_im_sendch2_connected(PeerConnection *peer_conn);
1.1003 -/* 0x0006 */ void aim_im_sendch2_odc_requestdirect(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 port, guint16 requestnumber);
1.1004 -/* 0x0006 */ void aim_im_sendch2_odc_requestproxy(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 pin, guint16 requestnumber);
1.1005 -/* 0x0006 */ void aim_im_sendch2_sendfile_requestdirect(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 port, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles);
1.1006 -/* 0x0006 */ void aim_im_sendch2_sendfile_requestproxy(OscarData *od, guchar *cookie, const char *bn, const guint8 *ip, guint16 pin, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles);
1.1007 -
1.1008 -/* 0x0006 */ int aim_im_sendch2_geticqaway(OscarData *od, const char *bn, int type);
1.1009 -/* 0x0006 */ int aim_im_sendch4(OscarData *od, const char *bn, guint16 type, const char *message);
1.1010 -/* 0x0008 */ int aim_im_warn(OscarData *od, FlapConnection *conn, const char *destbn, guint32 flags);
1.1011 -/* 0x000b */ int aim_im_denytransfer(OscarData *od, const char *bn, const guchar *cookie, guint16 code);
1.1012 -/* 0x0010 */ int aim_im_reqofflinemsgs(OscarData *od);
1.1013 -/* 0x0014 */ int aim_im_sendmtn(OscarData *od, guint16 type1, const char *bn, guint16 type2);
1.1014 -void aim_icbm_makecookie(guchar* cookie);
1.1015 -gchar *oscar_encoding_extract(const char *encoding);
1.1016 -gchar *oscar_encoding_to_utf8(PurpleAccount *account, const char *encoding, const char *text, int textlen);
1.1017 -gchar *purple_plugin_oscar_decode_im_part(PurpleAccount *account, const char *sourcebn, guint16 charset, guint16 charsubset, const gchar *data, gsize datalen);
1.1018 -
1.1019 -
1.1020 -/* 0x0002 - family_locate.c */
1.1021 -/*
1.1022 - * AIM User Info, Standard Form.
1.1023 - */
1.1024 -#define AIM_FLAG_UNCONFIRMED 0x0001 /* "damned transients" */
1.1025 -#define AIM_FLAG_ADMINISTRATOR 0x0002
1.1026 -#define AIM_FLAG_AOL 0x0004
1.1027 -#define AIM_FLAG_OSCAR_PAY 0x0008
1.1028 -#define AIM_FLAG_FREE 0x0010
1.1029 -#define AIM_FLAG_AWAY 0x0020
1.1030 -#define AIM_FLAG_ICQ 0x0040
1.1031 -#define AIM_FLAG_WIRELESS 0x0080
1.1032 -#define AIM_FLAG_UNKNOWN100 0x0100
1.1033 -#define AIM_FLAG_UNKNOWN200 0x0200
1.1034 -#define AIM_FLAG_ACTIVEBUDDY 0x0400
1.1035 -#define AIM_FLAG_UNKNOWN800 0x0800
1.1036 -#define AIM_FLAG_ABINTERNAL 0x1000
1.1037 -#define AIM_FLAG_ALLUSERS 0x001f
1.1038 -
1.1039 -#define AIM_USERINFO_PRESENT_FLAGS 0x00000001
1.1040 -#define AIM_USERINFO_PRESENT_MEMBERSINCE 0x00000002
1.1041 -#define AIM_USERINFO_PRESENT_ONLINESINCE 0x00000004
1.1042 -#define AIM_USERINFO_PRESENT_IDLE 0x00000008
1.1043 -#define AIM_USERINFO_PRESENT_ICQEXTSTATUS 0x00000010
1.1044 -#define AIM_USERINFO_PRESENT_ICQIPADDR 0x00000020
1.1045 -#define AIM_USERINFO_PRESENT_ICQDATA 0x00000040
1.1046 -#define AIM_USERINFO_PRESENT_CAPABILITIES 0x00000080
1.1047 -#define AIM_USERINFO_PRESENT_SESSIONLEN 0x00000100
1.1048 -#define AIM_USERINFO_PRESENT_CREATETIME 0x00000200
1.1049 -
1.1050 -struct userinfo_node
1.1051 -{
1.1052 - char *bn;
1.1053 - struct userinfo_node *next;
1.1054 -};
1.1055 -
1.1056 -typedef struct aim_userinfo_s
1.1057 -{
1.1058 - char *bn;
1.1059 - guint16 warnlevel; /* evil percent * 10 (999 = 99.9%) */
1.1060 - guint16 idletime; /* in seconds */
1.1061 - guint16 flags;
1.1062 - guint32 createtime; /* time_t */
1.1063 - guint32 membersince; /* time_t */
1.1064 - guint32 onlinesince; /* time_t */
1.1065 - guint32 sessionlen; /* in seconds */
1.1066 - guint32 capabilities;
1.1067 - struct {
1.1068 - guint32 status;
1.1069 - guint32 ipaddr;
1.1070 - guint8 crap[0x25]; /* until we figure it out... */
1.1071 - } icqinfo;
1.1072 - guint32 present;
1.1073 -
1.1074 - guint8 iconcsumtype;
1.1075 - guint16 iconcsumlen;
1.1076 - guint8 *iconcsum;
1.1077 -
1.1078 - char *info;
1.1079 - char *info_encoding;
1.1080 - guint16 info_len;
1.1081 -
1.1082 - char *status;
1.1083 - char *status_encoding;
1.1084 - guint16 status_len;
1.1085 -
1.1086 - char *itmsurl;
1.1087 - char *itmsurl_encoding;
1.1088 - guint16 itmsurl_len;
1.1089 -
1.1090 - char *away;
1.1091 - char *away_encoding;
1.1092 - guint16 away_len;
1.1093 -
1.1094 - struct aim_userinfo_s *next;
1.1095 -} aim_userinfo_t;
1.1096 -
1.1097 -#define AIM_SENDMEMBLOCK_FLAG_ISREQUEST 0
1.1098 -#define AIM_SENDMEMBLOCK_FLAG_ISHASH 1
1.1099 -
1.1100 -int aim_sendmemblock(OscarData *od, FlapConnection *conn, guint32 offset, guint32 len, const guint8 *buf, guint8 flag);
1.1101 -
1.1102 -struct aim_invite_priv
1.1103 -{
1.1104 - char *bn;
1.1105 - char *roomname;
1.1106 - guint16 exchange;
1.1107 - guint16 instance;
1.1108 -};
1.1109 -
1.1110 -#define AIM_COOKIETYPE_UNKNOWN 0x00
1.1111 -#define AIM_COOKIETYPE_ICBM 0x01
1.1112 -#define AIM_COOKIETYPE_ADS 0x02
1.1113 -#define AIM_COOKIETYPE_BOS 0x03
1.1114 -#define AIM_COOKIETYPE_IM 0x04
1.1115 -#define AIM_COOKIETYPE_CHAT 0x05
1.1116 -#define AIM_COOKIETYPE_CHATNAV 0x06
1.1117 -#define AIM_COOKIETYPE_INVITE 0x07
1.1118 -/* we'll move OFT up a bit to give breathing room. not like it really
1.1119 - * matters. */
1.1120 -#define AIM_COOKIETYPE_OFTIM 0x10
1.1121 -#define AIM_COOKIETYPE_OFTGET 0x11
1.1122 -#define AIM_COOKIETYPE_OFTSEND 0x12
1.1123 -#define AIM_COOKIETYPE_OFTVOICE 0x13
1.1124 -#define AIM_COOKIETYPE_OFTIMAGE 0x14
1.1125 -#define AIM_COOKIETYPE_OFTICON 0x15
1.1126 -
1.1127 -aim_userinfo_t *aim_locate_finduserinfo(OscarData *od, const char *bn);
1.1128 -void aim_locate_dorequest(OscarData *od);
1.1129 -
1.1130 -/* 0x0002 */ int aim_locate_reqrights(OscarData *od);
1.1131 -/* 0x0004 */ int aim_locate_setcaps(OscarData *od, guint32 caps);
1.1132 -/* 0x0004 */ int aim_locate_setprofile(OscarData *od, const char *profile_encoding, const gchar *profile, const int profile_len, const char *awaymsg_encoding, const gchar *awaymsg, const int awaymsg_len);
1.1133 -/* 0x0005 */ int aim_locate_getinfo(OscarData *od, const char *, guint16);
1.1134 -/* 0x0009 */ int aim_locate_setdirinfo(OscarData *od, 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, guint16 privacy);
1.1135 -/* 0x000b */ int aim_locate_000b(OscarData *od, const char *bn);
1.1136 -/* 0x000f */ int aim_locate_setinterests(OscarData *od, const char *interest1, const char *interest2, const char *interest3, const char *interest4, const char *interest5, guint16 privacy);
1.1137 -/* 0x0015 */ int aim_locate_getinfoshort(OscarData *od, const char *bn, guint32 flags);
1.1138 -
1.1139 -void aim_locate_autofetch_away_message(OscarData *od, const char *bn);
1.1140 -guint32 aim_locate_getcaps(OscarData *od, ByteStream *bs, int len);
1.1141 -guint32 aim_locate_getcaps_short(OscarData *od, ByteStream *bs, int len);
1.1142 -void aim_info_free(aim_userinfo_t *);
1.1143 -int aim_info_extract(OscarData *od, ByteStream *bs, aim_userinfo_t *);
1.1144 -int aim_putuserinfo(ByteStream *bs, aim_userinfo_t *info);
1.1145 -
1.1146 -
1.1147 -
1.1148 -/* 0x0003 - family_buddy.c */
1.1149 -/* 0x0002 */ void aim_buddylist_reqrights(OscarData *, FlapConnection *);
1.1150 -/* 0x0004 */ int aim_buddylist_set(OscarData *, FlapConnection *, const char *);
1.1151 -/* 0x0004 */ int aim_buddylist_addbuddy(OscarData *, FlapConnection *, const char *);
1.1152 -/* 0x0005 */ int aim_buddylist_removebuddy(OscarData *, FlapConnection *, const char *);
1.1153 -
1.1154 -
1.1155 -
1.1156 -/* 0x000a - family_userlookup.c */
1.1157 -int aim_search_address(OscarData *, const char *);
1.1158 -
1.1159 -
1.1160 -
1.1161 -/* 0x000d - family_chatnav.c */
1.1162 -/* 0x000e - family_chat.c */
1.1163 -/* These apply to exchanges as well. */
1.1164 -#define AIM_CHATROOM_FLAG_EVILABLE 0x0001
1.1165 -#define AIM_CHATROOM_FLAG_NAV_ONLY 0x0002
1.1166 -#define AIM_CHATROOM_FLAG_INSTANCING_ALLOWED 0x0004
1.1167 -#define AIM_CHATROOM_FLAG_OCCUPANT_PEEK_ALLOWED 0x0008
1.1168 -
1.1169 -struct aim_chat_exchangeinfo
1.1170 -{
1.1171 - guint16 number;
1.1172 - guint16 flags;
1.1173 - char *name;
1.1174 - char *charset1;
1.1175 - char *lang1;
1.1176 - char *charset2;
1.1177 - char *lang2;
1.1178 -};
1.1179 -
1.1180 -#define AIM_CHATFLAGS_NOREFLECT 0x0001
1.1181 -#define AIM_CHATFLAGS_AWAY 0x0002
1.1182 -int aim_chat_send_im(OscarData *od, FlapConnection *conn, guint16 flags, const gchar *msg, int msglen, const char *encoding, const char *language);
1.1183 -int aim_chat_join(OscarData *od, guint16 exchange, const char *roomname, guint16 instance);
1.1184 -int aim_chat_attachname(FlapConnection *conn, guint16 exchange, const char *roomname, guint16 instance);
1.1185 -char *aim_chat_getname(FlapConnection *conn);
1.1186 -FlapConnection *aim_chat_getconn(OscarData *, const char *name);
1.1187 -
1.1188 -void aim_chatnav_reqrights(OscarData *od, FlapConnection *conn);
1.1189 -
1.1190 -int aim_chatnav_createroom(OscarData *od, FlapConnection *conn, const char *name, guint16 exchange);
1.1191 -int aim_chat_leaveroom(OscarData *od, const char *name);
1.1192 -
1.1193 -
1.1194 -
1.1195 -/* 0x000f - family_odir.c */
1.1196 -struct aim_odir
1.1197 -{
1.1198 - char *first;
1.1199 - char *last;
1.1200 - char *middle;
1.1201 - char *maiden;
1.1202 - char *email;
1.1203 - char *country;
1.1204 - char *state;
1.1205 - char *city;
1.1206 - char *bn;
1.1207 - char *interest;
1.1208 - char *nick;
1.1209 - char *zip;
1.1210 - char *region;
1.1211 - char *address;
1.1212 - struct aim_odir *next;
1.1213 -};
1.1214 -
1.1215 -int aim_odir_email(OscarData *, const char *, const char *);
1.1216 -int aim_odir_name(OscarData *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *);
1.1217 -int aim_odir_interest(OscarData *, const char *, const char *);
1.1218 -
1.1219 -
1.1220 -
1.1221 -/* 0x0010 - family_bart.c */
1.1222 -int aim_bart_upload(OscarData *od, const guint8 *icon, guint16 iconlen);
1.1223 -int aim_bart_request(OscarData *od, const char *bn, guint8 iconcsumtype, const guint8 *iconstr, guint16 iconstrlen);
1.1224 -
1.1225 -
1.1226 -
1.1227 -/* 0x0013 - family_feedbag.c */
1.1228 -#define AIM_SSI_TYPE_BUDDY 0x0000
1.1229 -#define AIM_SSI_TYPE_GROUP 0x0001
1.1230 -#define AIM_SSI_TYPE_PERMIT 0x0002
1.1231 -#define AIM_SSI_TYPE_DENY 0x0003
1.1232 -#define AIM_SSI_TYPE_PDINFO 0x0004
1.1233 -#define AIM_SSI_TYPE_PRESENCEPREFS 0x0005
1.1234 -#define AIM_SSI_TYPE_ICONINFO 0x0014
1.1235 -
1.1236 -#define AIM_SSI_ACK_SUCCESS 0x0000
1.1237 -#define AIM_SSI_ACK_ITEMNOTFOUND 0x0002
1.1238 -#define AIM_SSI_ACK_IDNUMINUSE 0x000a
1.1239 -#define AIM_SSI_ACK_ATMAX 0x000c
1.1240 -#define AIM_SSI_ACK_INVALIDNAME 0x000d
1.1241 -#define AIM_SSI_ACK_AUTHREQUIRED 0x000e
1.1242 -
1.1243 -/* These flags are set in the 0x00c9 TLV of SSI teyp 0x0005 */
1.1244 -#define AIM_SSI_PRESENCE_FLAG_SHOWIDLE 0x00000400
1.1245 -#define AIM_SSI_PRESENCE_FLAG_NORECENTBUDDIES 0x00020000
1.1246 -
1.1247 -struct aim_ssi_item
1.1248 -{
1.1249 - char *name;
1.1250 - guint16 gid;
1.1251 - guint16 bid;
1.1252 - guint16 type;
1.1253 - GSList *data;
1.1254 - struct aim_ssi_item *next;
1.1255 -};
1.1256 -
1.1257 -struct aim_ssi_tmp
1.1258 -{
1.1259 - guint16 action;
1.1260 - guint16 ack;
1.1261 - char *name;
1.1262 - struct aim_ssi_item *item;
1.1263 - struct aim_ssi_tmp *next;
1.1264 -};
1.1265 -
1.1266 -/* These build the actual SNACs and queue them to be sent */
1.1267 -/* 0x0002 */ int aim_ssi_reqrights(OscarData *od);
1.1268 -/* 0x0004 */ int aim_ssi_reqdata(OscarData *od);
1.1269 -/* 0x0005 */ int aim_ssi_reqifchanged(OscarData *od, time_t localstamp, guint16 localrev);
1.1270 -/* 0x0007 */ int aim_ssi_enable(OscarData *od);
1.1271 -/* 0x0011 */ int aim_ssi_modbegin(OscarData *od);
1.1272 -/* 0x0012 */ int aim_ssi_modend(OscarData *od);
1.1273 -/* 0x0014 */ int aim_ssi_sendauth(OscarData *od, char *bn, char *msg);
1.1274 -/* 0x0018 */ int aim_ssi_sendauthrequest(OscarData *od, char *bn, const char *msg);
1.1275 -/* 0x001a */ int aim_ssi_sendauthreply(OscarData *od, char *bn, guint8 reply, const char *msg);
1.1276 -
1.1277 -/* Client functions for retrieving SSI data */
1.1278 -struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_item *list, guint16 gid, guint16 bid);
1.1279 -struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_item *list, const char *gn, const char *bn, guint16 type);
1.1280 -struct aim_ssi_item *aim_ssi_itemlist_exists(struct aim_ssi_item *list, const char *bn);
1.1281 -char *aim_ssi_itemlist_findparentname(struct aim_ssi_item *list, const char *bn);
1.1282 -int aim_ssi_getpermdeny(struct aim_ssi_item *list);
1.1283 -guint32 aim_ssi_getpresence(struct aim_ssi_item *list);
1.1284 -char *aim_ssi_getalias(struct aim_ssi_item *list, const char *gn, const char *bn);
1.1285 -char *aim_ssi_getcomment(struct aim_ssi_item *list, const char *gn, const char *bn);
1.1286 -gboolean aim_ssi_waitingforauth(struct aim_ssi_item *list, const char *gn, const char *bn);
1.1287 -
1.1288 -/* Client functions for changing SSI data */
1.1289 -int aim_ssi_addbuddy(OscarData *od, const char *name, const char *group, GSList *tlvlist, const char *alias, const char *comment, const char *smsnum, gboolean needauth);
1.1290 -int aim_ssi_addpermit(OscarData *od, const char *name);
1.1291 -int aim_ssi_adddeny(OscarData *od, const char *name);
1.1292 -int aim_ssi_delbuddy(OscarData *od, const char *name, const char *group);
1.1293 -int aim_ssi_delgroup(OscarData *od, const char *group);
1.1294 -int aim_ssi_delpermit(OscarData *od, const char *name);
1.1295 -int aim_ssi_deldeny(OscarData *od, const char *name);
1.1296 -int aim_ssi_movebuddy(OscarData *od, const char *oldgn, const char *newgn, const char *bn);
1.1297 -int aim_ssi_aliasbuddy(OscarData *od, const char *gn, const char *bn, const char *alias);
1.1298 -int aim_ssi_editcomment(OscarData *od, const char *gn, const char *bn, const char *alias);
1.1299 -int aim_ssi_rename_group(OscarData *od, const char *oldgn, const char *newgn);
1.1300 -int aim_ssi_cleanlist(OscarData *od);
1.1301 -int aim_ssi_deletelist(OscarData *od);
1.1302 -int aim_ssi_setpermdeny(OscarData *od, guint8 permdeny, guint32 vismask);
1.1303 -int aim_ssi_setpresence(OscarData *od, guint32 presence);
1.1304 -int aim_ssi_seticon(OscarData *od, const guint8 *iconsum, guint8 iconsumlen);
1.1305 -int aim_ssi_delicon(OscarData *od);
1.1306 -
1.1307 -
1.1308 -
1.1309 -/* 0x0015 - family_icq.c */
1.1310 -#define AIM_ICQ_INFO_SIMPLE 0x001
1.1311 -#define AIM_ICQ_INFO_SUMMARY 0x002
1.1312 -#define AIM_ICQ_INFO_EMAIL 0x004
1.1313 -#define AIM_ICQ_INFO_PERSONAL 0x008
1.1314 -#define AIM_ICQ_INFO_ADDITIONAL 0x010
1.1315 -#define AIM_ICQ_INFO_WORK 0x020
1.1316 -#define AIM_ICQ_INFO_INTERESTS 0x040
1.1317 -#define AIM_ICQ_INFO_ORGS 0x080
1.1318 -#define AIM_ICQ_INFO_UNKNOWN 0x100
1.1319 -#define AIM_ICQ_INFO_HAVEALL 0x1ff
1.1320 -
1.1321 -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS
1.1322 -struct aim_icq_offlinemsg
1.1323 -{
1.1324 - guint32 sender;
1.1325 - guint16 year;
1.1326 - guint8 month, day, hour, minute;
1.1327 - guint8 type;
1.1328 - guint8 flags;
1.1329 - char *msg;
1.1330 - int msglen;
1.1331 -};
1.1332 -#endif /* OLDSTYLE_ICQ_OFFLINEMSGS */
1.1333 -
1.1334 -struct aim_icq_info
1.1335 -{
1.1336 - guint16 reqid;
1.1337 -
1.1338 - /* simple */
1.1339 - guint32 uin;
1.1340 -
1.1341 - /* general and "home" information (0x00c8) */
1.1342 - char *nick;
1.1343 - char *first;
1.1344 - char *last;
1.1345 - char *email;
1.1346 - char *homecity;
1.1347 - char *homestate;
1.1348 - char *homephone;
1.1349 - char *homefax;
1.1350 - char *homeaddr;
1.1351 - char *mobile;
1.1352 - char *homezip;
1.1353 - guint16 homecountry;
1.1354 -/* guint8 timezone;
1.1355 - guint8 hideemail; */
1.1356 -
1.1357 - /* personal (0x00dc) */
1.1358 - guint8 age;
1.1359 - guint8 unknown;
1.1360 - guint8 gender;
1.1361 - char *personalwebpage;
1.1362 - guint16 birthyear;
1.1363 - guint8 birthmonth;
1.1364 - guint8 birthday;
1.1365 - guint8 language1;
1.1366 - guint8 language2;
1.1367 - guint8 language3;
1.1368 -
1.1369 - /* work (0x00d2) */
1.1370 - char *workcity;
1.1371 - char *workstate;
1.1372 - char *workphone;
1.1373 - char *workfax;
1.1374 - char *workaddr;
1.1375 - char *workzip;
1.1376 - guint16 workcountry;
1.1377 - char *workcompany;
1.1378 - char *workdivision;
1.1379 - char *workposition;
1.1380 - char *workwebpage;
1.1381 -
1.1382 - /* additional personal information (0x00e6) */
1.1383 - char *info;
1.1384 -
1.1385 - /* email (0x00eb) */
1.1386 - guint16 numaddresses;
1.1387 - char **email2;
1.1388 -
1.1389 - /* we keep track of these in a linked list because we're 1337 */
1.1390 - struct aim_icq_info *next;
1.1391 -
1.1392 - /* status note info */
1.1393 - guint8 icbm_cookie[8];
1.1394 - char *status_note_title;
1.1395 -};
1.1396 -
1.1397 -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS
1.1398 -int aim_icq_reqofflinemsgs(OscarData *od);
1.1399 -int aim_icq_ackofflinemsgs(OscarData *od);
1.1400 -#endif
1.1401 -int aim_icq_setsecurity(OscarData *od, gboolean auth_required, gboolean webaware);
1.1402 -int aim_icq_changepasswd(OscarData *od, const char *passwd);
1.1403 -int aim_icq_getsimpleinfo(OscarData *od, const char *uin);
1.1404 -int aim_icq_getalias(OscarData *od, const char *uin);
1.1405 -int aim_icq_getallinfo(OscarData *od, const char *uin);
1.1406 -int aim_icq_sendsms(OscarData *od, const char *name, const char *msg, const char *alias);
1.1407 -
1.1408 -
1.1409 -/* 0x0017 - family_auth.c */
1.1410 -void aim_sendcookie(OscarData *, FlapConnection *, const guint16 length, const guint8 *);
1.1411 -void aim_admin_changepasswd(OscarData *, FlapConnection *, const char *newpw, const char *curpw);
1.1412 -void aim_admin_reqconfirm(OscarData *od, FlapConnection *conn);
1.1413 -void aim_admin_getinfo(OscarData *od, FlapConnection *conn, guint16 info);
1.1414 -void aim_admin_setemail(OscarData *od, FlapConnection *conn, const char *newemail);
1.1415 -void aim_admin_setnick(OscarData *od, FlapConnection *conn, const char *newnick);
1.1416 -
1.1417 -
1.1418 -
1.1419 -/* 0x0018 - family_alert.c */
1.1420 -struct aim_emailinfo
1.1421 -{
1.1422 - guint8 *cookie16;
1.1423 - guint8 *cookie8;
1.1424 - char *url;
1.1425 - guint16 nummsgs;
1.1426 - guint8 unread;
1.1427 - char *domain;
1.1428 - guint16 flag;
1.1429 - struct aim_emailinfo *next;
1.1430 -};
1.1431 -
1.1432 -int aim_email_sendcookies(OscarData *od);
1.1433 -int aim_email_activate(OscarData *od);
1.1434 -
1.1435 -
1.1436 -
1.1437 -/* tlv.c - TLV handling */
1.1438 -
1.1439 -/* TLV structure */
1.1440 -typedef struct aim_tlv_s
1.1441 -{
1.1442 - guint16 type;
1.1443 - guint16 length;
1.1444 - guint8 *value;
1.1445 -} aim_tlv_t;
1.1446 -
1.1447 -/* TLV handling functions */
1.1448 -char *aim_tlv_getvalue_as_string(aim_tlv_t *tlv);
1.1449 -
1.1450 -aim_tlv_t *aim_tlv_gettlv(GSList *list, const guint16 type, const int nth);
1.1451 -int aim_tlv_getlength(GSList *list, const guint16 type, const int nth);
1.1452 -char *aim_tlv_getstr(GSList *list, const guint16 type, const int nth);
1.1453 -guint8 aim_tlv_get8(GSList *list, const guint16 type, const int nth);
1.1454 -guint16 aim_tlv_get16(GSList *list, const guint16 type, const int nth);
1.1455 -guint32 aim_tlv_get32(GSList *list, const guint16 type, const int nth);
1.1456 -
1.1457 -/* TLV list handling functions */
1.1458 -GSList *aim_tlvlist_read(ByteStream *bs);
1.1459 -GSList *aim_tlvlist_readnum(ByteStream *bs, guint16 num);
1.1460 -GSList *aim_tlvlist_readlen(ByteStream *bs, guint16 len);
1.1461 -GSList *aim_tlvlist_copy(GSList *orig);
1.1462 -
1.1463 -int aim_tlvlist_count(GSList *list);
1.1464 -int aim_tlvlist_size(GSList *list);
1.1465 -int aim_tlvlist_cmp(GSList *one, GSList *two);
1.1466 -int aim_tlvlist_write(ByteStream *bs, GSList **list);
1.1467 -void aim_tlvlist_free(GSList *list);
1.1468 -
1.1469 -int aim_tlvlist_add_raw(GSList **list, const guint16 type, const guint16 length, const guint8 *value);
1.1470 -int aim_tlvlist_add_noval(GSList **list, const guint16 type);
1.1471 -int aim_tlvlist_add_8(GSList **list, const guint16 type, const guint8 value);
1.1472 -int aim_tlvlist_add_16(GSList **list, const guint16 type, const guint16 value);
1.1473 -int aim_tlvlist_add_32(GSList **list, const guint16 type, const guint32 value);
1.1474 -int aim_tlvlist_add_str(GSList **list, const guint16 type, const char *value);
1.1475 -int aim_tlvlist_add_caps(GSList **list, const guint16 type, const guint32 caps);
1.1476 -int aim_tlvlist_add_userinfo(GSList **list, guint16 type, aim_userinfo_t *userinfo);
1.1477 -int aim_tlvlist_add_chatroom(GSList **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance);
1.1478 -int aim_tlvlist_add_frozentlvlist(GSList **list, guint16 type, GSList **tl);
1.1479 -
1.1480 -int aim_tlvlist_replace_raw(GSList **list, const guint16 type, const guint16 lenth, const guint8 *value);
1.1481 -int aim_tlvlist_replace_str(GSList **list, const guint16 type, const char *str);
1.1482 -int aim_tlvlist_replace_noval(GSList **list, const guint16 type);
1.1483 -int aim_tlvlist_replace_8(GSList **list, const guint16 type, const guint8 value);
1.1484 -int aim_tlvlist_replace_16(GSList **list, const guint16 type, const guint16 value);
1.1485 -int aim_tlvlist_replace_32(GSList **list, const guint16 type, const guint32 value);
1.1486 -
1.1487 -void aim_tlvlist_remove(GSList **list, const guint16 type);
1.1488 -
1.1489 -
1.1490 -
1.1491 -/* util.c */
1.1492 -/* These are really ugly. You'd think this was LISP. I wish it was. */
1.1493 -#define aimutil_put8(buf, data) ((*(buf) = (guint8)(data)&0xff),1)
1.1494 -#define aimutil_get8(buf) ((*(buf))&0xff)
1.1495 -#define aimutil_put16(buf, data) ( \
1.1496 - (*(buf) = (guint8)((data)>>8)&0xff), \
1.1497 - (*((buf)+1) = (guint8)(data)&0xff), \
1.1498 - 2)
1.1499 -#define aimutil_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff))
1.1500 -#define aimutil_put32(buf, data) ( \
1.1501 - (*((buf)) = (guint8)((data)>>24)&0xff), \
1.1502 - (*((buf)+1) = (guint8)((data)>>16)&0xff), \
1.1503 - (*((buf)+2) = (guint8)((data)>>8)&0xff), \
1.1504 - (*((buf)+3) = (guint8)(data)&0xff), \
1.1505 - 4)
1.1506 -#define aimutil_get32(buf) ((((*(buf))<<24)&0xff000000) + \
1.1507 - (((*((buf)+1))<<16)&0x00ff0000) + \
1.1508 - (((*((buf)+2))<< 8)&0x0000ff00) + \
1.1509 - (((*((buf)+3) )&0x000000ff)))
1.1510 -
1.1511 -/* Little-endian versions (damn ICQ) */
1.1512 -#define aimutil_putle8(buf, data) ( \
1.1513 - (*(buf) = (guint8)(data) & 0xff), \
1.1514 - 1)
1.1515 -#define aimutil_getle8(buf) ( \
1.1516 - (*(buf)) & 0xff \
1.1517 - )
1.1518 -#define aimutil_putle16(buf, data) ( \
1.1519 - (*((buf)+0) = (guint8)((data) >> 0) & 0xff), \
1.1520 - (*((buf)+1) = (guint8)((data) >> 8) & 0xff), \
1.1521 - 2)
1.1522 -#define aimutil_getle16(buf) ( \
1.1523 - (((*((buf)+0)) << 0) & 0x00ff) + \
1.1524 - (((*((buf)+1)) << 8) & 0xff00) \
1.1525 - )
1.1526 -#define aimutil_putle32(buf, data) ( \
1.1527 - (*((buf)+0) = (guint8)((data) >> 0) & 0xff), \
1.1528 - (*((buf)+1) = (guint8)((data) >> 8) & 0xff), \
1.1529 - (*((buf)+2) = (guint8)((data) >> 16) & 0xff), \
1.1530 - (*((buf)+3) = (guint8)((data) >> 24) & 0xff), \
1.1531 - 4)
1.1532 -#define aimutil_getle32(buf) ( \
1.1533 - (((*((buf)+0)) << 0) & 0x000000ff) + \
1.1534 - (((*((buf)+1)) << 8) & 0x0000ff00) + \
1.1535 - (((*((buf)+2)) << 16) & 0x00ff0000) + \
1.1536 - (((*((buf)+3)) << 24) & 0xff000000))
1.1537 -
1.1538 -int oscar_get_ui_info_int(const char *str, int default_value);
1.1539 -const char *oscar_get_ui_info_string(const char *str, const char *default_value);
1.1540 -gchar *oscar_get_clientstring(void);
1.1541 -
1.1542 -guint16 aimutil_iconsum(const guint8 *buf, int buflen);
1.1543 -int aimutil_tokslen(char *toSearch, int theindex, char dl);
1.1544 -int aimutil_itemcnt(char *toSearch, char dl);
1.1545 -char *aimutil_itemindex(char *toSearch, int theindex, char dl);
1.1546 -
1.1547 -gboolean oscar_util_valid_name(const char *bn);
1.1548 -gboolean oscar_util_valid_name_icq(const char *bn);
1.1549 -gboolean oscar_util_valid_name_sms(const char *bn);
1.1550 -int oscar_util_name_compare(const char *bn1, const char *bn2);
1.1551 -
1.1552 -
1.1553 -
1.1554 -
1.1555 -typedef struct {
1.1556 - guint16 family;
1.1557 - guint16 subtype;
1.1558 - guint16 flags;
1.1559 - guint32 id;
1.1560 -} aim_modsnac_t;
1.1561 -
1.1562 -#define AIM_MODULENAME_MAXLEN 16
1.1563 -#define AIM_MODFLAG_MULTIFAMILY 0x0001
1.1564 -typedef struct aim_module_s
1.1565 -{
1.1566 - guint16 family;
1.1567 - guint16 version;
1.1568 - guint16 toolid;
1.1569 - guint16 toolversion;
1.1570 - guint16 flags;
1.1571 - char name[AIM_MODULENAME_MAXLEN+1];
1.1572 - int (*snachandler)(OscarData *od, FlapConnection *conn, struct aim_module_s *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs);
1.1573 - void (*shutdown)(OscarData *od, struct aim_module_s *mod);
1.1574 - void *priv;
1.1575 - struct aim_module_s *next;
1.1576 -} aim_module_t;
1.1577 -
1.1578 -int aim__registermodule(OscarData *od, int (*modfirst)(OscarData *, aim_module_t *));
1.1579 -void aim__shutdownmodules(OscarData *od);
1.1580 -aim_module_t *aim__findmodulebygroup(OscarData *od, guint16 group);
1.1581 -aim_module_t *aim__findmodule(OscarData *od, const char *name);
1.1582 -
1.1583 -int admin_modfirst(OscarData *od, aim_module_t *mod);
1.1584 -int buddylist_modfirst(OscarData *od, aim_module_t *mod);
1.1585 -int bos_modfirst(OscarData *od, aim_module_t *mod);
1.1586 -int search_modfirst(OscarData *od, aim_module_t *mod);
1.1587 -int stats_modfirst(OscarData *od, aim_module_t *mod);
1.1588 -int auth_modfirst(OscarData *od, aim_module_t *mod);
1.1589 -int msg_modfirst(OscarData *od, aim_module_t *mod);
1.1590 -int misc_modfirst(OscarData *od, aim_module_t *mod);
1.1591 -int chatnav_modfirst(OscarData *od, aim_module_t *mod);
1.1592 -int chat_modfirst(OscarData *od, aim_module_t *mod);
1.1593 -int locate_modfirst(OscarData *od, aim_module_t *mod);
1.1594 -int service_modfirst(OscarData *od, aim_module_t *mod);
1.1595 -int invite_modfirst(OscarData *od, aim_module_t *mod);
1.1596 -int translate_modfirst(OscarData *od, aim_module_t *mod);
1.1597 -int popups_modfirst(OscarData *od, aim_module_t *mod);
1.1598 -int adverts_modfirst(OscarData *od, aim_module_t *mod);
1.1599 -int odir_modfirst(OscarData *od, aim_module_t *mod);
1.1600 -int bart_modfirst(OscarData *od, aim_module_t *mod);
1.1601 -int ssi_modfirst(OscarData *od, aim_module_t *mod);
1.1602 -int icq_modfirst(OscarData *od, aim_module_t *mod);
1.1603 -int email_modfirst(OscarData *od, aim_module_t *mod);
1.1604 -
1.1605 -void aim_genericreq_n(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype);
1.1606 -void aim_genericreq_n_snacid(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype);
1.1607 -void aim_genericreq_l(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint32 *);
1.1608 -void aim_genericreq_s(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint16 *);
1.1609 -
1.1610 -/* bstream.c */
1.1611 -int byte_stream_new(ByteStream *bs, guint32 len);
1.1612 -int byte_stream_init(ByteStream *bs, guint8 *data, int len);
1.1613 -void byte_stream_destroy(ByteStream *bs);
1.1614 -int byte_stream_empty(ByteStream *bs);
1.1615 -int byte_stream_curpos(ByteStream *bs);
1.1616 -int byte_stream_setpos(ByteStream *bs, unsigned int off);
1.1617 -void byte_stream_rewind(ByteStream *bs);
1.1618 -int byte_stream_advance(ByteStream *bs, int n);
1.1619 -guint8 byte_stream_get8(ByteStream *bs);
1.1620 -guint16 byte_stream_get16(ByteStream *bs);
1.1621 -guint32 byte_stream_get32(ByteStream *bs);
1.1622 -guint8 byte_stream_getle8(ByteStream *bs);
1.1623 -guint16 byte_stream_getle16(ByteStream *bs);
1.1624 -guint32 byte_stream_getle32(ByteStream *bs);
1.1625 -int byte_stream_getrawbuf(ByteStream *bs, guint8 *buf, int len);
1.1626 -guint8 *byte_stream_getraw(ByteStream *bs, int len);
1.1627 -char *byte_stream_getstr(ByteStream *bs, int len);
1.1628 -int byte_stream_put8(ByteStream *bs, guint8 v);
1.1629 -int byte_stream_put16(ByteStream *bs, guint16 v);
1.1630 -int byte_stream_put32(ByteStream *bs, guint32 v);
1.1631 -int byte_stream_putle8(ByteStream *bs, guint8 v);
1.1632 -int byte_stream_putle16(ByteStream *bs, guint16 v);
1.1633 -int byte_stream_putle32(ByteStream *bs, guint32 v);
1.1634 -int byte_stream_putraw(ByteStream *bs, const guint8 *v, int len);
1.1635 -int byte_stream_putstr(ByteStream *bs, const char *str);
1.1636 -int byte_stream_putbs(ByteStream *bs, ByteStream *srcbs, int len);
1.1637 -int byte_stream_putuid(ByteStream *bs, OscarData *od);
1.1638 -int byte_stream_putcaps(ByteStream *bs, guint32 caps);
1.1639 -
1.1640 -/**
1.1641 - * Inserts a BART asset block into the given byte stream. The flags
1.1642 - * and length are set appropriately based on the value of data.
1.1643 - */
1.1644 -void byte_stream_put_bart_asset(ByteStream *bs, guint16 type, ByteStream *data);
1.1645 -
1.1646 -/**
1.1647 - * A helper function that calls byte_stream_put_bart_asset with the
1.1648 - * appropriate data ByteStream given the datastr.
1.1649 - */
1.1650 -void byte_stream_put_bart_asset_str(ByteStream *bs, guint16 type, const char *datastr);
1.1651 -
1.1652 -/*
1.1653 - * Generic SNAC structure. Rarely if ever used.
1.1654 - */
1.1655 -typedef struct aim_snac_s {
1.1656 - aim_snacid_t id;
1.1657 - guint16 family;
1.1658 - guint16 type;
1.1659 - guint16 flags;
1.1660 - void *data;
1.1661 - time_t issuetime;
1.1662 - struct aim_snac_s *next;
1.1663 -} aim_snac_t;
1.1664 -
1.1665 -/* snac.c */
1.1666 -void aim_initsnachash(OscarData *od);
1.1667 -aim_snacid_t aim_newsnac(OscarData *, aim_snac_t *newsnac);
1.1668 -aim_snacid_t aim_cachesnac(OscarData *od, const guint16 family, const guint16 type, const guint16 flags, const void *data, const int datalen);
1.1669 -aim_snac_t *aim_remsnac(OscarData *, aim_snacid_t id);
1.1670 -void aim_cleansnacs(OscarData *, int maxage);
1.1671 -int aim_putsnac(ByteStream *, guint16 family, guint16 type, guint16 flags, aim_snacid_t id);
1.1672 -
1.1673 -struct chatsnacinfo {
1.1674 - guint16 exchange;
1.1675 - char name[128];
1.1676 - guint16 instance;
1.1677 -};
1.1678 -
1.1679 -struct rateclass {
1.1680 - guint16 classid;
1.1681 - guint32 windowsize;
1.1682 - guint32 clear;
1.1683 - guint32 alert;
1.1684 - guint32 limit;
1.1685 - guint32 disconnect;
1.1686 - guint32 current;
1.1687 - guint32 max;
1.1688 - guint8 unknown[5]; /* only present in versions >= 3 */
1.1689 - GHashTable *members; /* Key is family and subtype, value is TRUE. */
1.1690 -
1.1691 - struct timeval last; /**< The time when we last sent a SNAC of this rate class. */
1.1692 -};
1.1693 -
1.1694 -int aim_cachecookie(OscarData *od, IcbmCookie *cookie);
1.1695 -IcbmCookie *aim_uncachecookie(OscarData *od, guint8 *cookie, int type);
1.1696 -IcbmCookie *aim_mkcookie(guint8 *, int, void *);
1.1697 -IcbmCookie *aim_checkcookie(OscarData *, const unsigned char *, const int);
1.1698 -int aim_freecookie(OscarData *od, IcbmCookie *cookie);
1.1699 -int aim_msgcookie_gettype(int type);
1.1700 -int aim_cookie_free(OscarData *od, IcbmCookie *cookie);
1.1701 -
1.1702 -int aim_chat_readroominfo(ByteStream *bs, struct aim_chat_roominfo *outinfo);
1.1703 -
1.1704 -void flap_connection_destroy_chat(OscarData *od, FlapConnection *conn);
1.1705 -
1.1706 -#ifdef __cplusplus
1.1707 -}
1.1708 -#endif
1.1709 -
1.1710 -#endif /* _OSCAR_H_ */