Frameworks/libpurple.framework/Versions/0.5.6/Headers/oscar.h
branchadium-1.3
changeset 350 708bedafdc3a
parent 349 17ef128722b7
child 351 b01ab9b157f9
     1.1 --- a/Frameworks/libpurple.framework/Versions/0.5.6/Headers/oscar.h	Sun Jun 21 22:04:11 2009 -0400
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,1656 +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 Screen Names (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 -
   1.315 -#define CLIENTINFO_PURPLE_AIM { \
   1.316 -	"Purple/" VERSION, \
   1.317 -	0x0109, \
   1.318 -	0x0005, 0x0001, \
   1.319 -	0x0000, 0x0bdc, \
   1.320 -	0x000000d2, \
   1.321 -	"us", "en", \
   1.322 -}
   1.323 -
   1.324 -#define CLIENTINFO_PURPLE_ICQ { \
   1.325 -	"Purple/" VERSION, \
   1.326 -	0x010a, \
   1.327 -	0x0014, 0x0034, \
   1.328 -	0x0000, 0x0c18, \
   1.329 -	0x0000043d, \
   1.330 -	"us", "en", \
   1.331 -}
   1.332 -
   1.333 -#define CLIENTINFO_AIM_KNOWNGOOD CLIENTINFO_AIM_5_1_3036
   1.334 -#define CLIENTINFO_ICQ_KNOWNGOOD CLIENTINFO_ICQBASIC_14_34_3096
   1.335 -
   1.336 -typedef enum
   1.337 -{
   1.338 -	OSCAR_DISCONNECT_DONE, /* not considered an error */
   1.339 -	OSCAR_DISCONNECT_LOCAL_CLOSED, /* peer connections only, not considered an error */
   1.340 -	OSCAR_DISCONNECT_REMOTE_CLOSED,
   1.341 -	OSCAR_DISCONNECT_REMOTE_REFUSED, /* peer connections only */
   1.342 -	OSCAR_DISCONNECT_LOST_CONNECTION,
   1.343 -	OSCAR_DISCONNECT_INVALID_DATA,
   1.344 -	OSCAR_DISCONNECT_COULD_NOT_CONNECT,
   1.345 -	OSCAR_DISCONNECT_RETRYING /* peer connections only */
   1.346 -} OscarDisconnectReason;
   1.347 -
   1.348 -typedef enum
   1.349 -{
   1.350 -	OSCAR_CAPABILITY_BUDDYICON            = 0x00000001,
   1.351 -	OSCAR_CAPABILITY_TALK                 = 0x00000002,
   1.352 -	OSCAR_CAPABILITY_DIRECTIM             = 0x00000004,
   1.353 -	OSCAR_CAPABILITY_CHAT                 = 0x00000008,
   1.354 -	OSCAR_CAPABILITY_GETFILE              = 0x00000010,
   1.355 -	OSCAR_CAPABILITY_SENDFILE             = 0x00000020,
   1.356 -	OSCAR_CAPABILITY_GAMES                = 0x00000040,
   1.357 -	OSCAR_CAPABILITY_ADDINS               = 0x00000080,
   1.358 -	OSCAR_CAPABILITY_SENDBUDDYLIST        = 0x00000100,
   1.359 -	OSCAR_CAPABILITY_GAMES2               = 0x00000200,
   1.360 -	OSCAR_CAPABILITY_ICQ_DIRECT           = 0x00000400,
   1.361 -	OSCAR_CAPABILITY_APINFO               = 0x00000800,
   1.362 -	OSCAR_CAPABILITY_ICQRTF               = 0x00001000,
   1.363 -	OSCAR_CAPABILITY_EMPTY                = 0x00002000,
   1.364 -	OSCAR_CAPABILITY_ICQSERVERRELAY       = 0x00004000,
   1.365 -	OSCAR_CAPABILITY_UNICODEOLD           = 0x00008000,
   1.366 -	OSCAR_CAPABILITY_TRILLIANCRYPT        = 0x00010000,
   1.367 -	OSCAR_CAPABILITY_UNICODE              = 0x00020000,
   1.368 -	OSCAR_CAPABILITY_INTEROPERATE         = 0x00040000,
   1.369 -	OSCAR_CAPABILITY_SHORTCAPS            = 0x00080000,
   1.370 -	OSCAR_CAPABILITY_HIPTOP               = 0x00100000,
   1.371 -	OSCAR_CAPABILITY_SECUREIM             = 0x00200000,
   1.372 -	OSCAR_CAPABILITY_SMS                  = 0x00400000,
   1.373 -	OSCAR_CAPABILITY_VIDEO                = 0x00800000,
   1.374 -	OSCAR_CAPABILITY_ICHATAV              = 0x01000000,
   1.375 -	OSCAR_CAPABILITY_LIVEVIDEO            = 0x02000000,
   1.376 -	OSCAR_CAPABILITY_CAMERA               = 0x04000000,
   1.377 -	OSCAR_CAPABILITY_ICHAT_SCREENSHARE    = 0x08000000,
   1.378 -	OSCAR_CAPABILITY_TYPING               = 0x10000000,
   1.379 -	OSCAR_CAPABILITY_GENERICUNKNOWN       = 0x20000000,
   1.380 -	OSCAR_CAPABILITY_LAST                 = 0x40000000
   1.381 -} OscarCapability;
   1.382 -
   1.383 -/*
   1.384 - * Byte Stream type. Sort of.
   1.385 - *
   1.386 - * Use of this type serves a couple purposes:
   1.387 - *   - Buffer/buflen pairs are passed all around everywhere. This turns
   1.388 - *     that into one value, as well as abstracting it slightly.
   1.389 - *   - Through the abstraction, it is possible to enable bounds checking
   1.390 - *     for robustness at the cost of performance.  But a clean failure on
   1.391 - *     weird packets is much better than a segfault.
   1.392 - *   - I like having variables named "bs".
   1.393 - *
   1.394 - * Don't touch the insides of this struct.  Or I'll have to kill you.
   1.395 - *
   1.396 - */
   1.397 -struct _ByteStream
   1.398 -{
   1.399 -	guint8 *data;
   1.400 -	guint32 len;
   1.401 -	guint32 offset;
   1.402 -};
   1.403 -
   1.404 -struct _QueuedSnac
   1.405 -{
   1.406 -	guint16 family;
   1.407 -	guint16 subtype;
   1.408 -	FlapFrame *frame;
   1.409 -};
   1.410 -
   1.411 -struct _FlapFrame
   1.412 -{
   1.413 -	guint8 channel;
   1.414 -	guint16 seqnum;
   1.415 -	ByteStream data;        /* payload stream */
   1.416 -};
   1.417 -
   1.418 -struct _FlapConnection
   1.419 -{
   1.420 -	OscarData *od;              /**< Pointer to parent session. */
   1.421 -	gboolean connected;
   1.422 -	time_t lastactivity;             /**< Time of last transmit. */
   1.423 -	guint destroy_timeout;
   1.424 -	OscarDisconnectReason disconnect_reason;
   1.425 -	gchar *error_message;
   1.426 -	guint16 disconnect_code;
   1.427 -
   1.428 -	/* A few variables that are only used when connecting */
   1.429 -	PurpleProxyConnectData *connect_data;
   1.430 -	guint16 cookielen;
   1.431 -	guint8 *cookie;
   1.432 -	gpointer new_conn_data;
   1.433 -	gchar *ssl_cert_cn;
   1.434 -
   1.435 -	int fd;
   1.436 -	PurpleSslConnection *gsc;
   1.437 -	guint8 header[6];
   1.438 -	gssize header_received;
   1.439 -	FlapFrame buffer_incoming;
   1.440 -	PurpleCircBuffer *buffer_outgoing;
   1.441 -	guint watcher_incoming;
   1.442 -	guint watcher_outgoing;
   1.443 -
   1.444 -	guint16 type;
   1.445 -	guint16 subtype;
   1.446 -	guint16 seqnum_out; /**< The sequence number of most recently sent packet. */
   1.447 -	guint16 seqnum_in; /**< The sequence number of most recently received packet. */
   1.448 -	GSList *groups;
   1.449 -	GSList *rateclasses; /* Contains nodes of struct rateclass. */
   1.450 -
   1.451 -	GQueue *queued_snacs; /**< Contains QueuedSnacs. */
   1.452 -	GQueue *queued_lowpriority_snacs; /**< Contains QueuedSnacs to send only once queued_snacs is empty */
   1.453 -	guint queued_timeout;
   1.454 -
   1.455 -	void *internal; /* internal conn-specific libfaim data */
   1.456 -};
   1.457 -
   1.458 -struct _IcbmCookie
   1.459 -{
   1.460 -	guchar cookie[8];
   1.461 -	int type;
   1.462 -	void *data;
   1.463 -	time_t addtime;
   1.464 -	struct _IcbmCookie *next;
   1.465 -};
   1.466 -
   1.467 -#include "peer.h"
   1.468 -
   1.469 -/*
   1.470 - * AIM Session: The main client-data interface.
   1.471 - *
   1.472 - */
   1.473 -struct _OscarData
   1.474 -{
   1.475 -	gboolean iconconnecting;
   1.476 -	gboolean set_icon;
   1.477 -
   1.478 -	GSList *create_rooms;
   1.479 -
   1.480 -	gboolean conf;
   1.481 -	gboolean reqemail;
   1.482 -	gboolean setemail;
   1.483 -	char *email;
   1.484 -	gboolean setnick;
   1.485 -	char *newsn;
   1.486 -	gboolean chpass;
   1.487 -	char *oldp;
   1.488 -	char *newp;
   1.489 -
   1.490 -	GSList *oscar_chats;
   1.491 -	GHashTable *buddyinfo;
   1.492 -	GSList *requesticon;
   1.493 -
   1.494 -	gboolean use_ssl;
   1.495 -	gboolean icq;
   1.496 -	guint getblisttimer;
   1.497 -
   1.498 -	struct {
   1.499 -		guint maxwatchers; /* max users who can watch you */
   1.500 -		guint maxbuddies; /* max users you can watch */
   1.501 -		guint maxgroups; /* max groups in server list */
   1.502 -		guint maxpermits; /* max users on permit list */
   1.503 -		guint maxdenies; /* max users on deny list */
   1.504 -		guint maxsiglen; /* max size (bytes) of profile */
   1.505 -		guint maxawaymsglen; /* max size (bytes) of posted away message */
   1.506 -	} rights;
   1.507 -
   1.508 -	PurpleConnection *gc;
   1.509 -
   1.510 -	void *modlistv;
   1.511 -
   1.512 -	/*
   1.513 -	 * Outstanding snac handling
   1.514 -	 *
   1.515 -	 * TODO: Should these be per-connection? -mid
   1.516 -	 */
   1.517 -	void *snac_hash[FAIM_SNAC_HASH_SIZE];
   1.518 -	aim_snacid_t snacid_next;
   1.519 -
   1.520 -	/*
   1.521 -	 * TODO: Data specific to a certain family should go into a
   1.522 -	 *       hashtable and the core parts of libfaim shouldn't
   1.523 -	 *       need to know about them.
   1.524 -	 */
   1.525 -
   1.526 -	IcbmCookie *msgcookies;
   1.527 -	struct aim_icq_info *icq_info;
   1.528 -	struct aim_authresp_info *authinfo;
   1.529 -	struct aim_emailinfo *emailinfo;
   1.530 -
   1.531 -	struct {
   1.532 -		struct aim_userinfo_s *userinfo;
   1.533 -		struct userinfo_node *requested;
   1.534 -	} locate;
   1.535 -
   1.536 -	/* Server-stored information (ssi) */
   1.537 -	struct {
   1.538 -		gboolean received_data;
   1.539 -		guint16 numitems;
   1.540 -		struct aim_ssi_item *official;
   1.541 -		struct aim_ssi_item *local;
   1.542 -		struct aim_ssi_tmp *pending;
   1.543 -		time_t timestamp;
   1.544 -		gboolean waiting_for_ack;
   1.545 -		gboolean in_transaction;
   1.546 -	} ssi;
   1.547 -
   1.548 -	/** Contains pointers to handler functions for each family/subtype. */
   1.549 -	GHashTable *handlerlist;
   1.550 -
   1.551 -	/** A linked list containing FlapConnections. */
   1.552 -	GSList *oscar_connections;
   1.553 -
   1.554 -	/** A linked list containing PeerConnections. */
   1.555 -	GSList *peer_connections;
   1.556 -};
   1.557 -
   1.558 -/* Valid for calling aim_icq_setstatus() and for aim_userinfo_t->icqinfo.status */
   1.559 -#define AIM_ICQ_STATE_NORMAL            0x00000000
   1.560 -#define AIM_ICQ_STATE_AWAY              0x00000001
   1.561 -#define AIM_ICQ_STATE_DND               0x00000002
   1.562 -#define AIM_ICQ_STATE_OUT               0x00000004
   1.563 -#define AIM_ICQ_STATE_BUSY              0x00000010
   1.564 -#define AIM_ICQ_STATE_CHAT              0x00000020
   1.565 -#define AIM_ICQ_STATE_INVISIBLE         0x00000100
   1.566 -#define AIM_ICQ_STATE_WEBAWARE          0x00010000
   1.567 -#define AIM_ICQ_STATE_HIDEIP            0x00020000
   1.568 -#define AIM_ICQ_STATE_BIRTHDAY          0x00080000
   1.569 -#define AIM_ICQ_STATE_DIRECTDISABLED    0x00100000
   1.570 -#define AIM_ICQ_STATE_ICQHOMEPAGE       0x00200000
   1.571 -#define AIM_ICQ_STATE_DIRECTREQUIREAUTH 0x10000000
   1.572 -#define AIM_ICQ_STATE_DIRECTCONTACTLIST 0x20000000
   1.573 -
   1.574 -typedef int (*aim_rxcallback_t)(OscarData *od, FlapConnection *conn, FlapFrame *frame, ...);
   1.575 -
   1.576 -
   1.577 -/* family_auth.c */
   1.578 -struct aim_clientrelease
   1.579 -{
   1.580 -	char *name;
   1.581 -	guint32 build;
   1.582 -	char *url;
   1.583 -	char *info;
   1.584 -};
   1.585 -
   1.586 -struct aim_authresp_info
   1.587 -{
   1.588 -	char *sn;
   1.589 -	guint16 errorcode;
   1.590 -	char *errorurl;
   1.591 -	guint16 regstatus;
   1.592 -	char *email;
   1.593 -	char *bosip;
   1.594 -	guint16 cookielen;
   1.595 -	guint8 *cookie;
   1.596 -	char *chpassurl;
   1.597 -	struct aim_clientrelease latestrelease;
   1.598 -	struct aim_clientrelease latestbeta;
   1.599 -};
   1.600 -
   1.601 -/* Callback data for redirect. */
   1.602 -struct aim_redirect_data
   1.603 -{
   1.604 -	guint16 group;
   1.605 -	const char *ip;
   1.606 -	guint16 cookielen;
   1.607 -	const guint8 *cookie;
   1.608 -	const char *ssl_cert_cn;
   1.609 -	guint8 use_ssl;
   1.610 -	struct { /* group == SNAC_FAMILY_CHAT */
   1.611 -		guint16 exchange;
   1.612 -		const char *room;
   1.613 -		guint16 instance;
   1.614 -	} chat;
   1.615 -};
   1.616 -
   1.617 -int aim_request_login(OscarData *od, FlapConnection *conn, const char *sn);
   1.618 -int aim_send_login(OscarData *od, FlapConnection *conn, const char *sn, const char *password, gboolean truncate_pass, ClientInfo *ci, const char *key, gboolean allow_multiple_logins);
   1.619 -/* 0x000b */ int aim_auth_securid_send(OscarData *od, const char *securid);
   1.620 -
   1.621 -void oscar_data_addhandler(OscarData *od, guint16 family, guint16 subtype, aim_rxcallback_t newhandler, guint16 flags);
   1.622 -aim_rxcallback_t aim_callhandler(OscarData *od, guint16 family, guint16 subtype);
   1.623 -
   1.624 -/* flap_connection.c */
   1.625 -FlapConnection *flap_connection_new(OscarData *, int type);
   1.626 -void flap_connection_close(OscarData *od, FlapConnection *conn);
   1.627 -void flap_connection_destroy(FlapConnection *conn, OscarDisconnectReason reason, const gchar *error_message);
   1.628 -void flap_connection_schedule_destroy(FlapConnection *conn, OscarDisconnectReason reason, const gchar *error_message);
   1.629 -FlapConnection *flap_connection_findbygroup(OscarData *od, guint16 group);
   1.630 -FlapConnection *flap_connection_getbytype(OscarData *, int type);
   1.631 -FlapConnection *flap_connection_getbytype_all(OscarData *, int type);
   1.632 -void flap_connection_recv_cb(gpointer data, gint source, PurpleInputCondition cond);
   1.633 -void flap_connection_recv_cb_ssl(gpointer data, PurpleSslConnection *gsc, PurpleInputCondition cond);
   1.634 -
   1.635 -void flap_connection_send(FlapConnection *conn, FlapFrame *frame);
   1.636 -void flap_connection_send_version(OscarData *od, FlapConnection *conn);
   1.637 -void flap_connection_send_version_with_cookie(OscarData *od, FlapConnection *conn, guint16 length, const guint8 *chipsahoy);
   1.638 -void flap_connection_send_snac(OscarData *od, FlapConnection *conn, guint16 family, const guint16 subtype, guint16 flags, aim_snacid_t snacid, ByteStream *data);
   1.639 -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.640 -void flap_connection_send_keepalive(OscarData *od, FlapConnection *conn);
   1.641 -FlapFrame *flap_frame_new(OscarData *od, guint16 channel, int datalen);
   1.642 -
   1.643 -OscarData *oscar_data_new(void);
   1.644 -void oscar_data_destroy(OscarData *);
   1.645 -
   1.646 -/* misc.c */
   1.647 -#define AIM_VISIBILITYCHANGE_PERMITADD    0x05
   1.648 -#define AIM_VISIBILITYCHANGE_PERMITREMOVE 0x06
   1.649 -#define AIM_VISIBILITYCHANGE_DENYADD      0x07
   1.650 -#define AIM_VISIBILITYCHANGE_DENYREMOVE   0x08
   1.651 -
   1.652 -#define AIM_PRIVFLAGS_ALLOWIDLE           0x01
   1.653 -#define AIM_PRIVFLAGS_ALLOWMEMBERSINCE    0x02
   1.654 -
   1.655 -#define AIM_WARN_ANON                     0x01
   1.656 -
   1.657 -
   1.658 -
   1.659 -/* 0x0001 - family_oservice.c */
   1.660 -/* 0x0002 */ void aim_srv_clientready(OscarData *od, FlapConnection *conn);
   1.661 -/* 0x0004 */ void aim_srv_requestnew(OscarData *od, guint16 serviceid);
   1.662 -/* 0x0006 */ void aim_srv_reqrates(OscarData *od, FlapConnection *conn);
   1.663 -/* 0x0008 */ void aim_srv_rates_addparam(OscarData *od, FlapConnection *conn);
   1.664 -/* 0x0009 */ void aim_srv_rates_delparam(OscarData *od, FlapConnection *conn);
   1.665 -/* 0x000c */ void aim_srv_sendpauseack(OscarData *od, FlapConnection *conn);
   1.666 -/* 0x000e */ void aim_srv_reqpersonalinfo(OscarData *od, FlapConnection *conn);
   1.667 -/* 0x0011 */ void aim_srv_setidle(OscarData *od, guint32 idletime);
   1.668 -/* 0x0014 */ void aim_srv_setprivacyflags(OscarData *od, FlapConnection *conn, guint32);
   1.669 -/* 0x0016 */ void aim_srv_nop(OscarData *od, FlapConnection *conn);
   1.670 -/* 0x0017 */ void aim_srv_setversions(OscarData *od, FlapConnection *conn);
   1.671 -/* 0x001e */ int aim_srv_setextrainfo(OscarData *od, gboolean seticqstatus, guint32 icqstatus, gboolean setavailmsg, const char *availmsg, const char *itmsurl);
   1.672 -
   1.673 -
   1.674 -void aim_bos_reqrights(OscarData *od, FlapConnection *conn);
   1.675 -int aim_bos_changevisibility(OscarData *od, FlapConnection *conn, int, const char *);
   1.676 -void aim_bos_setgroupperm(OscarData *od, FlapConnection *conn, guint32 mask);
   1.677 -
   1.678 -
   1.679 -
   1.680 -#define AIM_CLIENTTYPE_UNKNOWN  0x0000
   1.681 -#define AIM_CLIENTTYPE_MC       0x0001
   1.682 -#define AIM_CLIENTTYPE_WINAIM   0x0002
   1.683 -#define AIM_CLIENTTYPE_WINAIM41 0x0003
   1.684 -#define AIM_CLIENTTYPE_AOL_TOC  0x0004
   1.685 -guint16 aim_im_fingerprint(const guint8 *msghdr, int len);
   1.686 -
   1.687 -#define AIM_RATE_CODE_CHANGE     0x0001
   1.688 -#define AIM_RATE_CODE_WARNING    0x0002
   1.689 -#define AIM_RATE_CODE_LIMIT      0x0003
   1.690 -#define AIM_RATE_CODE_CLEARLIMIT 0x0004
   1.691 -void aim_ads_requestads(OscarData *od, FlapConnection *conn);
   1.692 -
   1.693 -
   1.694 -
   1.695 -/* family_icbm.c */
   1.696 -#define AIM_OFT_SUBTYPE_SEND_FILE	0x0001
   1.697 -#define AIM_OFT_SUBTYPE_SEND_DIR	0x0002
   1.698 -#define AIM_OFT_SUBTYPE_GET_FILE	0x0011
   1.699 -#define AIM_OFT_SUBTYPE_GET_LIST	0x0012
   1.700 -
   1.701 -#define AIM_TRANSFER_DENY_NOTSUPPORTED	0x0000
   1.702 -#define AIM_TRANSFER_DENY_DECLINE	0x0001
   1.703 -#define AIM_TRANSFER_DENY_NOTACCEPTING	0x0002
   1.704 -
   1.705 -#define AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED       0x00000001
   1.706 -#define AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED    0x00000002
   1.707 -#define AIM_IMPARAM_FLAG_SUPPORT_OFFLINEMSGS    0x00000100
   1.708 -
   1.709 -/* This is what the server will give you if you don't set them yourself. */
   1.710 -#define AIM_IMPARAM_DEFAULTS { \
   1.711 -	0, \
   1.712 -	AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \
   1.713 -	512, /* !! Note how small this is. */ \
   1.714 -	(99.9)*10, (99.9)*10, \
   1.715 -	1000 /* !! And how large this is. */ \
   1.716 -}
   1.717 -
   1.718 -/* This is what most AIM versions use. */
   1.719 -#define AIM_IMPARAM_REASONABLE { \
   1.720 -	0, \
   1.721 -	AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \
   1.722 -	8000, \
   1.723 -	(99.9)*10, (99.9)*10, \
   1.724 -	0 \
   1.725 -}
   1.726 -
   1.727 -struct aim_icbmparameters
   1.728 -{
   1.729 -	guint16 maxchan;
   1.730 -	guint32 flags; /* AIM_IMPARAM_FLAG_ */
   1.731 -	guint16 maxmsglen; /* message size that you will accept */
   1.732 -	guint16 maxsenderwarn; /* this and below are *10 (999=99.9%) */
   1.733 -	guint16 maxrecverwarn;
   1.734 -	guint32 minmsginterval; /* in milliseconds? */
   1.735 -};
   1.736 -
   1.737 -/*
   1.738 - * TODO: Should probably combine this with struct chat_connection.
   1.739 - */
   1.740 -struct aim_chat_roominfo
   1.741 -{
   1.742 -	guint16 exchange;
   1.743 -	char *name;
   1.744 -	guint8 namelen;
   1.745 -	guint16 instance;
   1.746 -};
   1.747 -
   1.748 -struct chat_connection
   1.749 -{
   1.750 -	char *name;
   1.751 -	char *show; /* AOL did something funny to us */
   1.752 -	guint16 exchange;
   1.753 -	guint16 instance;
   1.754 -	FlapConnection *conn;
   1.755 -	int id;
   1.756 -	PurpleConnection *gc;
   1.757 -	PurpleConversation *conv;
   1.758 -	int maxlen;
   1.759 -	int maxvis;
   1.760 -};
   1.761 -
   1.762 -/*
   1.763 - * All this chat struct stuff should be in family_chat.c
   1.764 - */
   1.765 -void oscar_chat_destroy(struct chat_connection *cc);
   1.766 -
   1.767 -#define AIM_IMFLAGS_AWAY				0x0001 /* mark as an autoreply */
   1.768 -#define AIM_IMFLAGS_ACK					0x0002 /* request a receipt notice */
   1.769 -#define AIM_IMFLAGS_BUDDYREQ			0x0010 /* buddy icon requested */
   1.770 -#define AIM_IMFLAGS_HASICON				0x0020 /* already has icon */
   1.771 -#define AIM_IMFLAGS_SUBENC_MACINTOSH	0x0040 /* damn that Steve Jobs! */
   1.772 -#define AIM_IMFLAGS_CUSTOMFEATURES		0x0080 /* features field present */
   1.773 -#define AIM_IMFLAGS_EXTDATA				0x0100
   1.774 -#define AIM_IMFLAGS_X					0x0200
   1.775 -#define AIM_IMFLAGS_MULTIPART			0x0400 /* ->mpmsg section valid */
   1.776 -#define AIM_IMFLAGS_OFFLINE				0x0800 /* send to offline user */
   1.777 -#define AIM_IMFLAGS_TYPINGNOT			0x1000 /* typing notification */
   1.778 -
   1.779 -#define AIM_CHARSET_ASCII		0x0000
   1.780 -#define AIM_CHARSET_UNICODE	0x0002 /* UTF-16BE */
   1.781 -#define AIM_CHARSET_CUSTOM	0x0003
   1.782 -
   1.783 -/*
   1.784 - * Multipart message structures.
   1.785 - */
   1.786 -typedef struct aim_mpmsg_section_s
   1.787 -{
   1.788 -	guint16 charset;
   1.789 -	guint16 charsubset;
   1.790 -	gchar *data;
   1.791 -	guint16 datalen;
   1.792 -	struct aim_mpmsg_section_s *next;
   1.793 -} aim_mpmsg_section_t;
   1.794 -
   1.795 -typedef struct aim_mpmsg_s
   1.796 -{
   1.797 -	unsigned int numparts;
   1.798 -	aim_mpmsg_section_t *parts;
   1.799 -} aim_mpmsg_t;
   1.800 -
   1.801 -int aim_mpmsg_init(OscarData *od, aim_mpmsg_t *mpm);
   1.802 -int aim_mpmsg_addraw(OscarData *od, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, const gchar *data, guint16 datalen);
   1.803 -int aim_mpmsg_addascii(OscarData *od, aim_mpmsg_t *mpm, const char *ascii);
   1.804 -int aim_mpmsg_addunicode(OscarData *od, aim_mpmsg_t *mpm, const guint16 *unicode, guint16 unicodelen);
   1.805 -void aim_mpmsg_free(OscarData *od, aim_mpmsg_t *mpm);
   1.806 -
   1.807 -/*
   1.808 - * Arguments to aim_send_im_ext().
   1.809 - *
   1.810 - * This is really complicated.  But immensely versatile.
   1.811 - *
   1.812 - */
   1.813 -struct aim_sendimext_args
   1.814 -{
   1.815 -
   1.816 -	/* These are _required_ */
   1.817 -	const char *destsn;
   1.818 -	guint32 flags; /* often 0 */
   1.819 -
   1.820 -	/* Only required if not using multipart messages */
   1.821 -	const char *msg;
   1.822 -	int msglen;
   1.823 -
   1.824 -	/* Required if ->msg is not provided */
   1.825 -	aim_mpmsg_t *mpmsg;
   1.826 -
   1.827 -	/* Only used if AIM_IMFLAGS_HASICON is set */
   1.828 -	guint32 iconlen;
   1.829 -	time_t iconstamp;
   1.830 -	guint32 iconsum;
   1.831 -
   1.832 -	/* Only used if AIM_IMFLAGS_CUSTOMFEATURES is set */
   1.833 -	guint16 featureslen;
   1.834 -	guint8 *features;
   1.835 -
   1.836 -	/* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set and mpmsg not used */
   1.837 -	guint16 charset;
   1.838 -	guint16 charsubset;
   1.839 -};
   1.840 -
   1.841 -/*
   1.842 - * Arguments to aim_send_rtfmsg().
   1.843 - */
   1.844 -struct aim_sendrtfmsg_args
   1.845 -{
   1.846 -	const char *destsn;
   1.847 -	guint32 fgcolor;
   1.848 -	guint32 bgcolor;
   1.849 -	const char *rtfmsg; /* must be in RTF */
   1.850 -};
   1.851 -
   1.852 -/*
   1.853 - * This information is provided in the Incoming ICBM callback for
   1.854 - * Channel 1 ICBM's.
   1.855 - *
   1.856 - * Note that although CUSTOMFEATURES and CUSTOMCHARSET say they
   1.857 - * are optional, both are always set by the current libfaim code.
   1.858 - * That may or may not change in the future.  It is mainly for
   1.859 - * consistency with aim_sendimext_args.
   1.860 - *
   1.861 - * Multipart messages require some explanation. If you want to use them,
   1.862 - * I suggest you read all the comments in family_icbm.c.
   1.863 - *
   1.864 - */
   1.865 -struct aim_incomingim_ch1_args
   1.866 -{
   1.867 -
   1.868 -	/* Always provided */
   1.869 -	aim_mpmsg_t mpmsg;
   1.870 -	guint32 icbmflags; /* some flags apply only to ->msg, not all mpmsg */
   1.871 -	time_t timestamp; /* Only set for offline messages */
   1.872 -
   1.873 -	/* Only provided if message has a human-readable section */
   1.874 -	gchar *msg;
   1.875 -	int msglen;
   1.876 -
   1.877 -	/* Only provided if AIM_IMFLAGS_HASICON is set */
   1.878 -	time_t iconstamp;
   1.879 -	guint32 iconlen;
   1.880 -	guint16 iconsum;
   1.881 -
   1.882 -	/* Only provided if AIM_IMFLAGS_CUSTOMFEATURES is set */
   1.883 -	guint8 *features;
   1.884 -	guint8 featureslen;
   1.885 -
   1.886 -	/* Only provided if AIM_IMFLAGS_EXTDATA is set */
   1.887 -	guint8 extdatalen;
   1.888 -	guint8 *extdata;
   1.889 -
   1.890 -	/* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set */
   1.891 -	guint16 charset;
   1.892 -	guint16 charsubset;
   1.893 -};
   1.894 -
   1.895 -/* Valid values for channel 2 args->status */
   1.896 -#define AIM_RENDEZVOUS_PROPOSE   0x0000
   1.897 -#define AIM_RENDEZVOUS_CANCEL    0x0001
   1.898 -#define AIM_RENDEZVOUS_CONNECTED 0x0002
   1.899 -
   1.900 -struct _IcbmArgsCh2
   1.901 -{
   1.902 -	guint16 status;
   1.903 -	guchar cookie[8];
   1.904 -	int type; /* One of the OSCAR_CAPABILITY_ constants */
   1.905 -	const char *proxyip;
   1.906 -	const char *clientip;
   1.907 -	const char *verifiedip;
   1.908 -	guint16 port;
   1.909 -	gboolean use_proxy;
   1.910 -	guint16 errorcode;
   1.911 -	const char *msg; /* invite message or file description */
   1.912 -	guint16 msglen;
   1.913 -	const char *encoding;
   1.914 -	const char *language;
   1.915 -	guint16 requestnumber;
   1.916 -	union {
   1.917 -		struct {
   1.918 -			guint32 checksum;
   1.919 -			guint32 length;
   1.920 -			time_t timestamp;
   1.921 -			guint8 *icon;
   1.922 -		} icon;
   1.923 -		struct {
   1.924 -			struct aim_chat_roominfo roominfo;
   1.925 -		} chat;
   1.926 -		struct {
   1.927 -			guint16 msgtype;
   1.928 -			guint32 fgcolor;
   1.929 -			guint32 bgcolor;
   1.930 -			const char *rtfmsg;
   1.931 -		} rtfmsg;
   1.932 -		struct {
   1.933 -			guint16 subtype;
   1.934 -			guint16 totfiles;
   1.935 -			guint32 totsize;
   1.936 -			char *filename;
   1.937 -		} sendfile;
   1.938 -	} info;
   1.939 -	void *destructor; /* used internally only */
   1.940 -};
   1.941 -
   1.942 -/* Valid values for channel 4 args->type */
   1.943 -#define AIM_ICQMSG_AUTHREQUEST	0x0006
   1.944 -#define AIM_ICQMSG_AUTHDENIED	0x0007
   1.945 -#define AIM_ICQMSG_AUTHGRANTED	0x0008
   1.946 -
   1.947 -struct aim_incomingim_ch4_args
   1.948 -{
   1.949 -	guint32 uin; /* Of the sender of the ICBM */
   1.950 -	guint8 type;
   1.951 -	guint8 flags;
   1.952 -	gchar *msg; /* Reason for auth request, deny, or accept */
   1.953 -	int msglen;
   1.954 -};
   1.955 -
   1.956 -/* SNAC sending functions */
   1.957 -/* 0x0002 */ int aim_im_setparams(OscarData *od, struct aim_icbmparameters *params);
   1.958 -/* 0x0004 */ int aim_im_reqparams(OscarData *od);
   1.959 -/* 0x0006 */ int aim_im_sendch1_ext(OscarData *od, struct aim_sendimext_args *args);
   1.960 -/* 0x0006 */ int aim_im_sendch1(OscarData *, const char *destsn, guint16 flags, const char *msg);
   1.961 -/* 0x0006 */ int aim_im_sendch2_chatinvite(OscarData *od, const char *sn, const char *msg, guint16 exchange, const char *roomname, guint16 instance);
   1.962 -/* 0x0006 */ int aim_im_sendch2_icon(OscarData *od, const char *sn, const guint8 *icon, int iconlen, time_t stamp, guint16 iconsum);
   1.963 -/* 0x0006 */ int aim_im_sendch2_rtfmsg(OscarData *od, struct aim_sendrtfmsg_args *args);
   1.964 -
   1.965 -/* 0x0006 */ void aim_im_sendch2_cancel(PeerConnection *peer_conn);
   1.966 -/* 0x0006 */ void aim_im_sendch2_connected(PeerConnection *peer_conn);
   1.967 -/* 0x0006 */ void aim_im_sendch2_odc_requestdirect(OscarData *od, guchar *cookie, const char *sn, const guint8 *ip, guint16 port, guint16 requestnumber);
   1.968 -/* 0x0006 */ void aim_im_sendch2_odc_requestproxy(OscarData *od, guchar *cookie, const char *sn, const guint8 *ip, guint16 pin, guint16 requestnumber);
   1.969 -/* 0x0006 */ void aim_im_sendch2_sendfile_requestdirect(OscarData *od, guchar *cookie, const char *sn, const guint8 *ip, guint16 port, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles);
   1.970 -/* 0x0006 */ void aim_im_sendch2_sendfile_requestproxy(OscarData *od, guchar *cookie, const char *sn, const guint8 *ip, guint16 pin, guint16 requestnumber, const gchar *filename, guint32 size, guint16 numfiles);
   1.971 -
   1.972 -/* 0x0006 */ int aim_im_sendch2_geticqaway(OscarData *od, const char *sn, int type);
   1.973 -/* 0x0006 */ int aim_im_sendch4(OscarData *od, const char *sn, guint16 type, const char *message);
   1.974 -/* 0x0008 */ int aim_im_warn(OscarData *od, FlapConnection *conn, const char *destsn, guint32 flags);
   1.975 -/* 0x000b */ int aim_im_denytransfer(OscarData *od, const char *sn, const guchar *cookie, guint16 code);
   1.976 -/* 0x0010 */ int aim_im_reqofflinemsgs(OscarData *od);
   1.977 -/* 0x0014 */ int aim_im_sendmtn(OscarData *od, guint16 type1, const char *sn, guint16 type2);
   1.978 -void aim_icbm_makecookie(guchar* cookie);
   1.979 -gchar *oscar_encoding_extract(const char *encoding);
   1.980 -gchar *oscar_encoding_to_utf8(PurpleAccount *account, const char *encoding, const char *text, int textlen);
   1.981 -gchar *purple_plugin_oscar_decode_im_part(PurpleAccount *account, const char *sourcesn, guint16 charset, guint16 charsubset, const gchar *data, gsize datalen);
   1.982 -
   1.983 -
   1.984 -/* 0x0002 - family_locate.c */
   1.985 -/*
   1.986 - * AIM User Info, Standard Form.
   1.987 - */
   1.988 -#define AIM_FLAG_UNCONFIRMED     0x0001 /* "damned transients" */
   1.989 -#define AIM_FLAG_ADMINISTRATOR   0x0002
   1.990 -#define AIM_FLAG_AOL             0x0004
   1.991 -#define AIM_FLAG_OSCAR_PAY       0x0008
   1.992 -#define AIM_FLAG_FREE            0x0010
   1.993 -#define AIM_FLAG_AWAY            0x0020
   1.994 -#define AIM_FLAG_ICQ             0x0040
   1.995 -#define AIM_FLAG_WIRELESS        0x0080
   1.996 -#define AIM_FLAG_UNKNOWN100      0x0100
   1.997 -#define AIM_FLAG_UNKNOWN200      0x0200
   1.998 -#define AIM_FLAG_ACTIVEBUDDY     0x0400
   1.999 -#define AIM_FLAG_UNKNOWN800      0x0800
  1.1000 -#define AIM_FLAG_ABINTERNAL      0x1000
  1.1001 -#define AIM_FLAG_ALLUSERS        0x001f
  1.1002 -
  1.1003 -#define AIM_USERINFO_PRESENT_FLAGS        0x00000001
  1.1004 -#define AIM_USERINFO_PRESENT_MEMBERSINCE  0x00000002
  1.1005 -#define AIM_USERINFO_PRESENT_ONLINESINCE  0x00000004
  1.1006 -#define AIM_USERINFO_PRESENT_IDLE         0x00000008
  1.1007 -#define AIM_USERINFO_PRESENT_ICQEXTSTATUS 0x00000010
  1.1008 -#define AIM_USERINFO_PRESENT_ICQIPADDR    0x00000020
  1.1009 -#define AIM_USERINFO_PRESENT_ICQDATA      0x00000040
  1.1010 -#define AIM_USERINFO_PRESENT_CAPABILITIES 0x00000080
  1.1011 -#define AIM_USERINFO_PRESENT_SESSIONLEN   0x00000100
  1.1012 -#define AIM_USERINFO_PRESENT_CREATETIME   0x00000200
  1.1013 -
  1.1014 -struct userinfo_node
  1.1015 -{
  1.1016 -	char *sn;
  1.1017 -	struct userinfo_node *next;
  1.1018 -};
  1.1019 -
  1.1020 -typedef struct aim_userinfo_s
  1.1021 -{
  1.1022 -	char *sn;
  1.1023 -	guint16 warnlevel; /* evil percent * 10 (999 = 99.9%) */
  1.1024 -	guint16 idletime; /* in seconds */
  1.1025 -	guint16 flags;
  1.1026 -	guint32 createtime; /* time_t */
  1.1027 -	guint32 membersince; /* time_t */
  1.1028 -	guint32 onlinesince; /* time_t */
  1.1029 -	guint32 sessionlen;  /* in seconds */
  1.1030 -	guint32 capabilities;
  1.1031 -	struct {
  1.1032 -		guint32 status;
  1.1033 -		guint32 ipaddr;
  1.1034 -		guint8 crap[0x25]; /* until we figure it out... */
  1.1035 -	} icqinfo;
  1.1036 -	guint32 present;
  1.1037 -
  1.1038 -	guint8 iconcsumtype;
  1.1039 -	guint16 iconcsumlen;
  1.1040 -	guint8 *iconcsum;
  1.1041 -
  1.1042 -	char *info;
  1.1043 -	char *info_encoding;
  1.1044 -	guint16 info_len;
  1.1045 -
  1.1046 -	char *status;
  1.1047 -	char *status_encoding;
  1.1048 -	guint16 status_len;
  1.1049 -
  1.1050 -	char *itmsurl;
  1.1051 -	char *itmsurl_encoding;
  1.1052 -	guint16 itmsurl_len;
  1.1053 -
  1.1054 -	char *away;
  1.1055 -	char *away_encoding;
  1.1056 -	guint16 away_len;
  1.1057 -
  1.1058 -	struct aim_userinfo_s *next;
  1.1059 -} aim_userinfo_t;
  1.1060 -
  1.1061 -#define AIM_SENDMEMBLOCK_FLAG_ISREQUEST  0
  1.1062 -#define AIM_SENDMEMBLOCK_FLAG_ISHASH     1
  1.1063 -
  1.1064 -int aim_sendmemblock(OscarData *od, FlapConnection *conn, guint32 offset, guint32 len, const guint8 *buf, guint8 flag);
  1.1065 -
  1.1066 -struct aim_invite_priv
  1.1067 -{
  1.1068 -	char *sn;
  1.1069 -	char *roomname;
  1.1070 -	guint16 exchange;
  1.1071 -	guint16 instance;
  1.1072 -};
  1.1073 -
  1.1074 -#define AIM_COOKIETYPE_UNKNOWN  0x00
  1.1075 -#define AIM_COOKIETYPE_ICBM     0x01
  1.1076 -#define AIM_COOKIETYPE_ADS      0x02
  1.1077 -#define AIM_COOKIETYPE_BOS      0x03
  1.1078 -#define AIM_COOKIETYPE_IM       0x04
  1.1079 -#define AIM_COOKIETYPE_CHAT     0x05
  1.1080 -#define AIM_COOKIETYPE_CHATNAV  0x06
  1.1081 -#define AIM_COOKIETYPE_INVITE   0x07
  1.1082 -/* we'll move OFT up a bit to give breathing room.  not like it really
  1.1083 - * matters. */
  1.1084 -#define AIM_COOKIETYPE_OFTIM    0x10
  1.1085 -#define AIM_COOKIETYPE_OFTGET   0x11
  1.1086 -#define AIM_COOKIETYPE_OFTSEND  0x12
  1.1087 -#define AIM_COOKIETYPE_OFTVOICE 0x13
  1.1088 -#define AIM_COOKIETYPE_OFTIMAGE 0x14
  1.1089 -#define AIM_COOKIETYPE_OFTICON  0x15
  1.1090 -
  1.1091 -aim_userinfo_t *aim_locate_finduserinfo(OscarData *od, const char *sn);
  1.1092 -void aim_locate_dorequest(OscarData *od);
  1.1093 -
  1.1094 -/* 0x0002 */ int aim_locate_reqrights(OscarData *od);
  1.1095 -/* 0x0004 */ int aim_locate_setcaps(OscarData *od, guint32 caps);
  1.1096 -/* 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.1097 -/* 0x0005 */ int aim_locate_getinfo(OscarData *od, const char *, guint16);
  1.1098 -/* 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.1099 -/* 0x000b */ int aim_locate_000b(OscarData *od, const char *sn);
  1.1100 -/* 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.1101 -/* 0x0015 */ int aim_locate_getinfoshort(OscarData *od, const char *sn, guint32 flags);
  1.1102 -
  1.1103 -void aim_locate_autofetch_away_message(OscarData *od, const char *sn);
  1.1104 -guint32 aim_locate_getcaps(OscarData *od, ByteStream *bs, int len);
  1.1105 -guint32 aim_locate_getcaps_short(OscarData *od, ByteStream *bs, int len);
  1.1106 -void aim_info_free(aim_userinfo_t *);
  1.1107 -int aim_info_extract(OscarData *od, ByteStream *bs, aim_userinfo_t *);
  1.1108 -int aim_putuserinfo(ByteStream *bs, aim_userinfo_t *info);
  1.1109 -
  1.1110 -
  1.1111 -
  1.1112 -/* 0x0003 - family_buddy.c */
  1.1113 -/* 0x0002 */ void aim_buddylist_reqrights(OscarData *, FlapConnection *);
  1.1114 -/* 0x0004 */ int aim_buddylist_set(OscarData *, FlapConnection *, const char *);
  1.1115 -/* 0x0004 */ int aim_buddylist_addbuddy(OscarData *, FlapConnection *, const char *);
  1.1116 -/* 0x0005 */ int aim_buddylist_removebuddy(OscarData *, FlapConnection *, const char *);
  1.1117 -
  1.1118 -
  1.1119 -
  1.1120 -/* 0x000a - family_userlookup.c */
  1.1121 -int aim_search_address(OscarData *, const char *);
  1.1122 -
  1.1123 -
  1.1124 -
  1.1125 -/* 0x000d - family_chatnav.c */
  1.1126 -/* 0x000e - family_chat.c */
  1.1127 -/* These apply to exchanges as well. */
  1.1128 -#define AIM_CHATROOM_FLAG_EVILABLE 0x0001
  1.1129 -#define AIM_CHATROOM_FLAG_NAV_ONLY 0x0002
  1.1130 -#define AIM_CHATROOM_FLAG_INSTANCING_ALLOWED 0x0004
  1.1131 -#define AIM_CHATROOM_FLAG_OCCUPANT_PEEK_ALLOWED 0x0008
  1.1132 -
  1.1133 -struct aim_chat_exchangeinfo
  1.1134 -{
  1.1135 -	guint16 number;
  1.1136 -	guint16 flags;
  1.1137 -	char *name;
  1.1138 -	char *charset1;
  1.1139 -	char *lang1;
  1.1140 -	char *charset2;
  1.1141 -	char *lang2;
  1.1142 -};
  1.1143 -
  1.1144 -#define AIM_CHATFLAGS_NOREFLECT 0x0001
  1.1145 -#define AIM_CHATFLAGS_AWAY      0x0002
  1.1146 -int aim_chat_send_im(OscarData *od, FlapConnection *conn, guint16 flags, const gchar *msg, int msglen, const char *encoding, const char *language);
  1.1147 -int aim_chat_join(OscarData *od, guint16 exchange, const char *roomname, guint16 instance);
  1.1148 -int aim_chat_attachname(FlapConnection *conn, guint16 exchange, const char *roomname, guint16 instance);
  1.1149 -char *aim_chat_getname(FlapConnection *conn);
  1.1150 -FlapConnection *aim_chat_getconn(OscarData *, const char *name);
  1.1151 -
  1.1152 -void aim_chatnav_reqrights(OscarData *od, FlapConnection *conn);
  1.1153 -
  1.1154 -int aim_chatnav_createroom(OscarData *od, FlapConnection *conn, const char *name, guint16 exchange);
  1.1155 -int aim_chat_leaveroom(OscarData *od, const char *name);
  1.1156 -
  1.1157 -
  1.1158 -
  1.1159 -/* 0x000f - family_odir.c */
  1.1160 -struct aim_odir
  1.1161 -{
  1.1162 -	char *first;
  1.1163 -	char *last;
  1.1164 -	char *middle;
  1.1165 -	char *maiden;
  1.1166 -	char *email;
  1.1167 -	char *country;
  1.1168 -	char *state;
  1.1169 -	char *city;
  1.1170 -	char *sn;
  1.1171 -	char *interest;
  1.1172 -	char *nick;
  1.1173 -	char *zip;
  1.1174 -	char *region;
  1.1175 -	char *address;
  1.1176 -	struct aim_odir *next;
  1.1177 -};
  1.1178 -
  1.1179 -int aim_odir_email(OscarData *, const char *, const char *);
  1.1180 -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.1181 -int aim_odir_interest(OscarData *, const char *, const char *);
  1.1182 -
  1.1183 -
  1.1184 -
  1.1185 -/* 0x0010 - family_bart.c */
  1.1186 -int aim_bart_upload(OscarData *od, const guint8 *icon, guint16 iconlen);
  1.1187 -int aim_bart_request(OscarData *od, const char *sn, guint8 iconcsumtype, const guint8 *iconstr, guint16 iconstrlen);
  1.1188 -
  1.1189 -
  1.1190 -
  1.1191 -/* 0x0013 - family_feedbag.c */
  1.1192 -#define AIM_SSI_TYPE_BUDDY		0x0000
  1.1193 -#define AIM_SSI_TYPE_GROUP		0x0001
  1.1194 -#define AIM_SSI_TYPE_PERMIT		0x0002
  1.1195 -#define AIM_SSI_TYPE_DENY		0x0003
  1.1196 -#define AIM_SSI_TYPE_PDINFO		0x0004
  1.1197 -#define AIM_SSI_TYPE_PRESENCEPREFS	0x0005
  1.1198 -#define AIM_SSI_TYPE_ICONINFO		0x0014
  1.1199 -
  1.1200 -#define AIM_SSI_ACK_SUCCESS		0x0000
  1.1201 -#define AIM_SSI_ACK_ITEMNOTFOUND	0x0002
  1.1202 -#define AIM_SSI_ACK_IDNUMINUSE		0x000a
  1.1203 -#define AIM_SSI_ACK_ATMAX		0x000c
  1.1204 -#define AIM_SSI_ACK_INVALIDNAME		0x000d
  1.1205 -#define AIM_SSI_ACK_AUTHREQUIRED	0x000e
  1.1206 -
  1.1207 -/* These flags are set in the 0x00c9 TLV of SSI teyp 0x0005 */
  1.1208 -#define AIM_SSI_PRESENCE_FLAG_SHOWIDLE        0x00000400
  1.1209 -#define AIM_SSI_PRESENCE_FLAG_NORECENTBUDDIES 0x00020000
  1.1210 -
  1.1211 -struct aim_ssi_item
  1.1212 -{
  1.1213 -	char *name;
  1.1214 -	guint16 gid;
  1.1215 -	guint16 bid;
  1.1216 -	guint16 type;
  1.1217 -	GSList *data;
  1.1218 -	struct aim_ssi_item *next;
  1.1219 -};
  1.1220 -
  1.1221 -struct aim_ssi_tmp
  1.1222 -{
  1.1223 -	guint16 action;
  1.1224 -	guint16 ack;
  1.1225 -	char *name;
  1.1226 -	struct aim_ssi_item *item;
  1.1227 -	struct aim_ssi_tmp *next;
  1.1228 -};
  1.1229 -
  1.1230 -/* These build the actual SNACs and queue them to be sent */
  1.1231 -/* 0x0002 */ int aim_ssi_reqrights(OscarData *od);
  1.1232 -/* 0x0004 */ int aim_ssi_reqdata(OscarData *od);
  1.1233 -/* 0x0005 */ int aim_ssi_reqifchanged(OscarData *od, time_t localstamp, guint16 localrev);
  1.1234 -/* 0x0007 */ int aim_ssi_enable(OscarData *od);
  1.1235 -/* 0x0011 */ int aim_ssi_modbegin(OscarData *od);
  1.1236 -/* 0x0012 */ int aim_ssi_modend(OscarData *od);
  1.1237 -/* 0x0014 */ int aim_ssi_sendauth(OscarData *od, char *sn, char *msg);
  1.1238 -/* 0x0018 */ int aim_ssi_sendauthrequest(OscarData *od, char *sn, const char *msg);
  1.1239 -/* 0x001a */ int aim_ssi_sendauthreply(OscarData *od, char *sn, guint8 reply, const char *msg);
  1.1240 -
  1.1241 -/* Client functions for retrieving SSI data */
  1.1242 -struct aim_ssi_item *aim_ssi_itemlist_find(struct aim_ssi_item *list, guint16 gid, guint16 bid);
  1.1243 -struct aim_ssi_item *aim_ssi_itemlist_finditem(struct aim_ssi_item *list, const char *gn, const char *sn, guint16 type);
  1.1244 -struct aim_ssi_item *aim_ssi_itemlist_exists(struct aim_ssi_item *list, const char *sn);
  1.1245 -char *aim_ssi_itemlist_findparentname(struct aim_ssi_item *list, const char *sn);
  1.1246 -int aim_ssi_getpermdeny(struct aim_ssi_item *list);
  1.1247 -guint32 aim_ssi_getpresence(struct aim_ssi_item *list);
  1.1248 -char *aim_ssi_getalias(struct aim_ssi_item *list, const char *gn, const char *sn);
  1.1249 -char *aim_ssi_getcomment(struct aim_ssi_item *list, const char *gn, const char *sn);
  1.1250 -gboolean aim_ssi_waitingforauth(struct aim_ssi_item *list, const char *gn, const char *sn);
  1.1251 -
  1.1252 -/* Client functions for changing SSI data */
  1.1253 -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.1254 -int aim_ssi_addpermit(OscarData *od, const char *name);
  1.1255 -int aim_ssi_adddeny(OscarData *od, const char *name);
  1.1256 -int aim_ssi_delbuddy(OscarData *od, const char *name, const char *group);
  1.1257 -int aim_ssi_delgroup(OscarData *od, const char *group);
  1.1258 -int aim_ssi_delpermit(OscarData *od, const char *name);
  1.1259 -int aim_ssi_deldeny(OscarData *od, const char *name);
  1.1260 -int aim_ssi_movebuddy(OscarData *od, const char *oldgn, const char *newgn, const char *sn);
  1.1261 -int aim_ssi_aliasbuddy(OscarData *od, const char *gn, const char *sn, const char *alias);
  1.1262 -int aim_ssi_editcomment(OscarData *od, const char *gn, const char *sn, const char *alias);
  1.1263 -int aim_ssi_rename_group(OscarData *od, const char *oldgn, const char *newgn);
  1.1264 -int aim_ssi_cleanlist(OscarData *od);
  1.1265 -int aim_ssi_deletelist(OscarData *od);
  1.1266 -int aim_ssi_setpermdeny(OscarData *od, guint8 permdeny, guint32 vismask);
  1.1267 -int aim_ssi_setpresence(OscarData *od, guint32 presence);
  1.1268 -int aim_ssi_seticon(OscarData *od, const guint8 *iconsum, guint8 iconsumlen);
  1.1269 -int aim_ssi_delicon(OscarData *od);
  1.1270 -
  1.1271 -
  1.1272 -
  1.1273 -/* 0x0015 - family_icq.c */
  1.1274 -#define AIM_ICQ_INFO_SIMPLE	0x001
  1.1275 -#define AIM_ICQ_INFO_SUMMARY	0x002
  1.1276 -#define AIM_ICQ_INFO_EMAIL	0x004
  1.1277 -#define AIM_ICQ_INFO_PERSONAL	0x008
  1.1278 -#define AIM_ICQ_INFO_ADDITIONAL	0x010
  1.1279 -#define AIM_ICQ_INFO_WORK	0x020
  1.1280 -#define AIM_ICQ_INFO_INTERESTS	0x040
  1.1281 -#define AIM_ICQ_INFO_ORGS	0x080
  1.1282 -#define AIM_ICQ_INFO_UNKNOWN	0x100
  1.1283 -#define AIM_ICQ_INFO_HAVEALL	0x1ff
  1.1284 -
  1.1285 -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS
  1.1286 -struct aim_icq_offlinemsg
  1.1287 -{
  1.1288 -	guint32 sender;
  1.1289 -	guint16 year;
  1.1290 -	guint8 month, day, hour, minute;
  1.1291 -	guint8 type;
  1.1292 -	guint8 flags;
  1.1293 -	char *msg;
  1.1294 -	int msglen;
  1.1295 -};
  1.1296 -#endif /* OLDSTYLE_ICQ_OFFLINEMSGS */
  1.1297 -
  1.1298 -struct aim_icq_info
  1.1299 -{
  1.1300 -	guint16 reqid;
  1.1301 -
  1.1302 -	/* simple */
  1.1303 -	guint32 uin;
  1.1304 -
  1.1305 -	/* general and "home" information (0x00c8) */
  1.1306 -	char *nick;
  1.1307 -	char *first;
  1.1308 -	char *last;
  1.1309 -	char *email;
  1.1310 -	char *homecity;
  1.1311 -	char *homestate;
  1.1312 -	char *homephone;
  1.1313 -	char *homefax;
  1.1314 -	char *homeaddr;
  1.1315 -	char *mobile;
  1.1316 -	char *homezip;
  1.1317 -	guint16 homecountry;
  1.1318 -/*	guint8 timezone;
  1.1319 -	guint8 hideemail; */
  1.1320 -
  1.1321 -	/* personal (0x00dc) */
  1.1322 -	guint8 age;
  1.1323 -	guint8 unknown;
  1.1324 -	guint8 gender;
  1.1325 -	char *personalwebpage;
  1.1326 -	guint16 birthyear;
  1.1327 -	guint8 birthmonth;
  1.1328 -	guint8 birthday;
  1.1329 -	guint8 language1;
  1.1330 -	guint8 language2;
  1.1331 -	guint8 language3;
  1.1332 -
  1.1333 -	/* work (0x00d2) */
  1.1334 -	char *workcity;
  1.1335 -	char *workstate;
  1.1336 -	char *workphone;
  1.1337 -	char *workfax;
  1.1338 -	char *workaddr;
  1.1339 -	char *workzip;
  1.1340 -	guint16 workcountry;
  1.1341 -	char *workcompany;
  1.1342 -	char *workdivision;
  1.1343 -	char *workposition;
  1.1344 -	char *workwebpage;
  1.1345 -
  1.1346 -	/* additional personal information (0x00e6) */
  1.1347 -	char *info;
  1.1348 -
  1.1349 -	/* email (0x00eb) */
  1.1350 -	guint16 numaddresses;
  1.1351 -	char **email2;
  1.1352 -
  1.1353 -	/* we keep track of these in a linked list because we're 1337 */
  1.1354 -	struct aim_icq_info *next;
  1.1355 -
  1.1356 -	/* status note info */
  1.1357 -	guint8 icbm_cookie[8];
  1.1358 -	char *status_note_title;
  1.1359 -};
  1.1360 -
  1.1361 -#ifdef OLDSTYLE_ICQ_OFFLINEMSGS
  1.1362 -int aim_icq_reqofflinemsgs(OscarData *od);
  1.1363 -int aim_icq_ackofflinemsgs(OscarData *od);
  1.1364 -#endif
  1.1365 -int aim_icq_setsecurity(OscarData *od, gboolean auth_required, gboolean webaware);
  1.1366 -int aim_icq_changepasswd(OscarData *od, const char *passwd);
  1.1367 -int aim_icq_getsimpleinfo(OscarData *od, const char *uin);
  1.1368 -int aim_icq_getalias(OscarData *od, const char *uin);
  1.1369 -int aim_icq_getallinfo(OscarData *od, const char *uin);
  1.1370 -int aim_icq_sendsms(OscarData *od, const char *name, const char *msg, const char *alias);
  1.1371 -
  1.1372 -
  1.1373 -/* 0x0017 - family_auth.c */
  1.1374 -void aim_sendcookie(OscarData *, FlapConnection *, const guint16 length, const guint8 *);
  1.1375 -void aim_admin_changepasswd(OscarData *, FlapConnection *, const char *newpw, const char *curpw);
  1.1376 -void aim_admin_reqconfirm(OscarData *od, FlapConnection *conn);
  1.1377 -void aim_admin_getinfo(OscarData *od, FlapConnection *conn, guint16 info);
  1.1378 -void aim_admin_setemail(OscarData *od, FlapConnection *conn, const char *newemail);
  1.1379 -void aim_admin_setnick(OscarData *od, FlapConnection *conn, const char *newnick);
  1.1380 -
  1.1381 -
  1.1382 -
  1.1383 -/* 0x0018 - family_alert.c */
  1.1384 -struct aim_emailinfo
  1.1385 -{
  1.1386 -	guint8 *cookie16;
  1.1387 -	guint8 *cookie8;
  1.1388 -	char *url;
  1.1389 -	guint16 nummsgs;
  1.1390 -	guint8 unread;
  1.1391 -	char *domain;
  1.1392 -	guint16 flag;
  1.1393 -	struct aim_emailinfo *next;
  1.1394 -};
  1.1395 -
  1.1396 -int aim_email_sendcookies(OscarData *od);
  1.1397 -int aim_email_activate(OscarData *od);
  1.1398 -
  1.1399 -
  1.1400 -
  1.1401 -/* tlv.c - TLV handling */
  1.1402 -
  1.1403 -/* TLV structure */
  1.1404 -typedef struct aim_tlv_s
  1.1405 -{
  1.1406 -	guint16 type;
  1.1407 -	guint16 length;
  1.1408 -	guint8 *value;
  1.1409 -} aim_tlv_t;
  1.1410 -
  1.1411 -/* TLV handling functions */
  1.1412 -char *aim_tlv_getvalue_as_string(aim_tlv_t *tlv);
  1.1413 -
  1.1414 -aim_tlv_t *aim_tlv_gettlv(GSList *list, const guint16 type, const int nth);
  1.1415 -int aim_tlv_getlength(GSList *list, const guint16 type, const int nth);
  1.1416 -char *aim_tlv_getstr(GSList *list, const guint16 type, const int nth);
  1.1417 -guint8 aim_tlv_get8(GSList *list, const guint16 type, const int nth);
  1.1418 -guint16 aim_tlv_get16(GSList *list, const guint16 type, const int nth);
  1.1419 -guint32 aim_tlv_get32(GSList *list, const guint16 type, const int nth);
  1.1420 -
  1.1421 -/* TLV list handling functions */
  1.1422 -GSList *aim_tlvlist_read(ByteStream *bs);
  1.1423 -GSList *aim_tlvlist_readnum(ByteStream *bs, guint16 num);
  1.1424 -GSList *aim_tlvlist_readlen(ByteStream *bs, guint16 len);
  1.1425 -GSList *aim_tlvlist_copy(GSList *orig);
  1.1426 -
  1.1427 -int aim_tlvlist_count(GSList *list);
  1.1428 -int aim_tlvlist_size(GSList *list);
  1.1429 -int aim_tlvlist_cmp(GSList *one, GSList *two);
  1.1430 -int aim_tlvlist_write(ByteStream *bs, GSList **list);
  1.1431 -void aim_tlvlist_free(GSList *list);
  1.1432 -
  1.1433 -int aim_tlvlist_add_raw(GSList **list, const guint16 type, const guint16 length, const guint8 *value);
  1.1434 -int aim_tlvlist_add_noval(GSList **list, const guint16 type);
  1.1435 -int aim_tlvlist_add_8(GSList **list, const guint16 type, const guint8 value);
  1.1436 -int aim_tlvlist_add_16(GSList **list, const guint16 type, const guint16 value);
  1.1437 -int aim_tlvlist_add_32(GSList **list, const guint16 type, const guint32 value);
  1.1438 -int aim_tlvlist_add_str(GSList **list, const guint16 type, const char *value);
  1.1439 -int aim_tlvlist_add_caps(GSList **list, const guint16 type, const guint32 caps);
  1.1440 -int aim_tlvlist_add_userinfo(GSList **list, guint16 type, aim_userinfo_t *userinfo);
  1.1441 -int aim_tlvlist_add_chatroom(GSList **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance);
  1.1442 -int aim_tlvlist_add_frozentlvlist(GSList **list, guint16 type, GSList **tl);
  1.1443 -
  1.1444 -int aim_tlvlist_replace_raw(GSList **list, const guint16 type, const guint16 lenth, const guint8 *value);
  1.1445 -int aim_tlvlist_replace_str(GSList **list, const guint16 type, const char *str);
  1.1446 -int aim_tlvlist_replace_noval(GSList **list, const guint16 type);
  1.1447 -int aim_tlvlist_replace_8(GSList **list, const guint16 type, const guint8 value);
  1.1448 -int aim_tlvlist_replace_16(GSList **list, const guint16 type, const guint16 value);
  1.1449 -int aim_tlvlist_replace_32(GSList **list, const guint16 type, const guint32 value);
  1.1450 -
  1.1451 -void aim_tlvlist_remove(GSList **list, const guint16 type);
  1.1452 -
  1.1453 -
  1.1454 -
  1.1455 -/* util.c */
  1.1456 -/* These are really ugly.  You'd think this was LISP.  I wish it was. */
  1.1457 -#define aimutil_put8(buf, data) ((*(buf) = (guint8)(data)&0xff),1)
  1.1458 -#define aimutil_get8(buf) ((*(buf))&0xff)
  1.1459 -#define aimutil_put16(buf, data) ( \
  1.1460 -		(*(buf) = (guint8)((data)>>8)&0xff), \
  1.1461 -		(*((buf)+1) = (guint8)(data)&0xff),  \
  1.1462 -		2)
  1.1463 -#define aimutil_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff))
  1.1464 -#define aimutil_put32(buf, data) ( \
  1.1465 -		(*((buf)) = (guint8)((data)>>24)&0xff), \
  1.1466 -		(*((buf)+1) = (guint8)((data)>>16)&0xff), \
  1.1467 -		(*((buf)+2) = (guint8)((data)>>8)&0xff), \
  1.1468 -		(*((buf)+3) = (guint8)(data)&0xff), \
  1.1469 -		4)
  1.1470 -#define aimutil_get32(buf) ((((*(buf))<<24)&0xff000000) + \
  1.1471 -		(((*((buf)+1))<<16)&0x00ff0000) + \
  1.1472 -		(((*((buf)+2))<< 8)&0x0000ff00) + \
  1.1473 -		(((*((buf)+3)    )&0x000000ff)))
  1.1474 -
  1.1475 -/* Little-endian versions (damn ICQ) */
  1.1476 -#define aimutil_putle8(buf, data) ( \
  1.1477 -		(*(buf) = (guint8)(data) & 0xff), \
  1.1478 -		1)
  1.1479 -#define aimutil_getle8(buf) ( \
  1.1480 -		(*(buf)) & 0xff \
  1.1481 -		)
  1.1482 -#define aimutil_putle16(buf, data) ( \
  1.1483 -		(*((buf)+0) = (guint8)((data) >> 0) & 0xff),  \
  1.1484 -		(*((buf)+1) = (guint8)((data) >> 8) & 0xff), \
  1.1485 -		2)
  1.1486 -#define aimutil_getle16(buf) ( \
  1.1487 -		(((*((buf)+0)) << 0) & 0x00ff) + \
  1.1488 -		(((*((buf)+1)) << 8) & 0xff00) \
  1.1489 -		)
  1.1490 -#define aimutil_putle32(buf, data) ( \
  1.1491 -		(*((buf)+0) = (guint8)((data) >>  0) & 0xff), \
  1.1492 -		(*((buf)+1) = (guint8)((data) >>  8) & 0xff), \
  1.1493 -		(*((buf)+2) = (guint8)((data) >> 16) & 0xff), \
  1.1494 -		(*((buf)+3) = (guint8)((data) >> 24) & 0xff), \
  1.1495 -		4)
  1.1496 -#define aimutil_getle32(buf) ( \
  1.1497 -		(((*((buf)+0)) <<  0) & 0x000000ff) + \
  1.1498 -		(((*((buf)+1)) <<  8) & 0x0000ff00) + \
  1.1499 -		(((*((buf)+2)) << 16) & 0x00ff0000) + \
  1.1500 -		(((*((buf)+3)) << 24) & 0xff000000))
  1.1501 -
  1.1502 -guint16 aimutil_iconsum(const guint8 *buf, int buflen);
  1.1503 -int aimutil_tokslen(char *toSearch, int theindex, char dl);
  1.1504 -int aimutil_itemcnt(char *toSearch, char dl);
  1.1505 -char *aimutil_itemindex(char *toSearch, int theindex, char dl);
  1.1506 -
  1.1507 -gboolean aim_snvalid(const char *sn);
  1.1508 -gboolean aim_snvalid_icq(const char *sn);
  1.1509 -gboolean aim_snvalid_sms(const char *sn);
  1.1510 -int aim_snlen(const char *sn);
  1.1511 -int aim_sncmp(const char *sn1, const char *sn2);
  1.1512 -
  1.1513 -
  1.1514 -
  1.1515 -
  1.1516 -typedef struct {
  1.1517 -	guint16 family;
  1.1518 -	guint16 subtype;
  1.1519 -	guint16 flags;
  1.1520 -	guint32 id;
  1.1521 -} aim_modsnac_t;
  1.1522 -
  1.1523 -#define AIM_MODULENAME_MAXLEN 16
  1.1524 -#define AIM_MODFLAG_MULTIFAMILY 0x0001
  1.1525 -typedef struct aim_module_s
  1.1526 -{
  1.1527 -	guint16 family;
  1.1528 -	guint16 version;
  1.1529 -	guint16 toolid;
  1.1530 -	guint16 toolversion;
  1.1531 -	guint16 flags;
  1.1532 -	char name[AIM_MODULENAME_MAXLEN+1];
  1.1533 -	int (*snachandler)(OscarData *od, FlapConnection *conn, struct aim_module_s *mod, FlapFrame *rx, aim_modsnac_t *snac, ByteStream *bs);
  1.1534 -	void (*shutdown)(OscarData *od, struct aim_module_s *mod);
  1.1535 -	void *priv;
  1.1536 -	struct aim_module_s *next;
  1.1537 -} aim_module_t;
  1.1538 -
  1.1539 -int aim__registermodule(OscarData *od, int (*modfirst)(OscarData *, aim_module_t *));
  1.1540 -void aim__shutdownmodules(OscarData *od);
  1.1541 -aim_module_t *aim__findmodulebygroup(OscarData *od, guint16 group);
  1.1542 -aim_module_t *aim__findmodule(OscarData *od, const char *name);
  1.1543 -
  1.1544 -int admin_modfirst(OscarData *od, aim_module_t *mod);
  1.1545 -int buddylist_modfirst(OscarData *od, aim_module_t *mod);
  1.1546 -int bos_modfirst(OscarData *od, aim_module_t *mod);
  1.1547 -int search_modfirst(OscarData *od, aim_module_t *mod);
  1.1548 -int stats_modfirst(OscarData *od, aim_module_t *mod);
  1.1549 -int auth_modfirst(OscarData *od, aim_module_t *mod);
  1.1550 -int msg_modfirst(OscarData *od, aim_module_t *mod);
  1.1551 -int misc_modfirst(OscarData *od, aim_module_t *mod);
  1.1552 -int chatnav_modfirst(OscarData *od, aim_module_t *mod);
  1.1553 -int chat_modfirst(OscarData *od, aim_module_t *mod);
  1.1554 -int locate_modfirst(OscarData *od, aim_module_t *mod);
  1.1555 -int service_modfirst(OscarData *od, aim_module_t *mod);
  1.1556 -int invite_modfirst(OscarData *od, aim_module_t *mod);
  1.1557 -int translate_modfirst(OscarData *od, aim_module_t *mod);
  1.1558 -int popups_modfirst(OscarData *od, aim_module_t *mod);
  1.1559 -int adverts_modfirst(OscarData *od, aim_module_t *mod);
  1.1560 -int odir_modfirst(OscarData *od, aim_module_t *mod);
  1.1561 -int bart_modfirst(OscarData *od, aim_module_t *mod);
  1.1562 -int ssi_modfirst(OscarData *od, aim_module_t *mod);
  1.1563 -int icq_modfirst(OscarData *od, aim_module_t *mod);
  1.1564 -int email_modfirst(OscarData *od, aim_module_t *mod);
  1.1565 -
  1.1566 -void aim_genericreq_n(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype);
  1.1567 -void aim_genericreq_n_snacid(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype);
  1.1568 -void aim_genericreq_l(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint32 *);
  1.1569 -void aim_genericreq_s(OscarData *od, FlapConnection *conn, guint16 family, guint16 subtype, guint16 *);
  1.1570 -
  1.1571 -/* bstream.c */
  1.1572 -int byte_stream_new(ByteStream *bs, guint32 len);
  1.1573 -int byte_stream_init(ByteStream *bs, guint8 *data, int len);
  1.1574 -void byte_stream_destroy(ByteStream *bs);
  1.1575 -int byte_stream_empty(ByteStream *bs);
  1.1576 -int byte_stream_curpos(ByteStream *bs);
  1.1577 -int byte_stream_setpos(ByteStream *bs, unsigned int off);
  1.1578 -void byte_stream_rewind(ByteStream *bs);
  1.1579 -int byte_stream_advance(ByteStream *bs, int n);
  1.1580 -guint8 byte_stream_get8(ByteStream *bs);
  1.1581 -guint16 byte_stream_get16(ByteStream *bs);
  1.1582 -guint32 byte_stream_get32(ByteStream *bs);
  1.1583 -guint8 byte_stream_getle8(ByteStream *bs);
  1.1584 -guint16 byte_stream_getle16(ByteStream *bs);
  1.1585 -guint32 byte_stream_getle32(ByteStream *bs);
  1.1586 -int byte_stream_getrawbuf(ByteStream *bs, guint8 *buf, int len);
  1.1587 -guint8 *byte_stream_getraw(ByteStream *bs, int len);
  1.1588 -char *byte_stream_getstr(ByteStream *bs, int len);
  1.1589 -int byte_stream_put8(ByteStream *bs, guint8 v);
  1.1590 -int byte_stream_put16(ByteStream *bs, guint16 v);
  1.1591 -int byte_stream_put32(ByteStream *bs, guint32 v);
  1.1592 -int byte_stream_putle8(ByteStream *bs, guint8 v);
  1.1593 -int byte_stream_putle16(ByteStream *bs, guint16 v);
  1.1594 -int byte_stream_putle32(ByteStream *bs, guint32 v);
  1.1595 -int byte_stream_putraw(ByteStream *bs, const guint8 *v, int len);
  1.1596 -int byte_stream_putstr(ByteStream *bs, const char *str);
  1.1597 -int byte_stream_putbs(ByteStream *bs, ByteStream *srcbs, int len);
  1.1598 -int byte_stream_putuid(ByteStream *bs, OscarData *od);
  1.1599 -int byte_stream_putcaps(ByteStream *bs, guint32 caps);
  1.1600 -
  1.1601 -/*
  1.1602 - * Generic SNAC structure.  Rarely if ever used.
  1.1603 - */
  1.1604 -typedef struct aim_snac_s {
  1.1605 -	aim_snacid_t id;
  1.1606 -	guint16 family;
  1.1607 -	guint16 type;
  1.1608 -	guint16 flags;
  1.1609 -	void *data;
  1.1610 -	time_t issuetime;
  1.1611 -	struct aim_snac_s *next;
  1.1612 -} aim_snac_t;
  1.1613 -
  1.1614 -/* snac.c */
  1.1615 -void aim_initsnachash(OscarData *od);
  1.1616 -aim_snacid_t aim_newsnac(OscarData *, aim_snac_t *newsnac);
  1.1617 -aim_snacid_t aim_cachesnac(OscarData *od, const guint16 family, const guint16 type, const guint16 flags, const void *data, const int datalen);
  1.1618 -aim_snac_t *aim_remsnac(OscarData *, aim_snacid_t id);
  1.1619 -void aim_cleansnacs(OscarData *, int maxage);
  1.1620 -int aim_putsnac(ByteStream *, guint16 family, guint16 type, guint16 flags, aim_snacid_t id);
  1.1621 -
  1.1622 -struct chatsnacinfo {
  1.1623 -	guint16 exchange;
  1.1624 -	char name[128];
  1.1625 -	guint16 instance;
  1.1626 -};
  1.1627 -
  1.1628 -struct rateclass {
  1.1629 -	guint16 classid;
  1.1630 -	guint32 windowsize;
  1.1631 -	guint32 clear;
  1.1632 -	guint32 alert;
  1.1633 -	guint32 limit;
  1.1634 -	guint32 disconnect;
  1.1635 -	guint32 current;
  1.1636 -	guint32 max;
  1.1637 -	guint8 unknown[5]; /* only present in versions >= 3 */
  1.1638 -	GHashTable *members; /* Key is family and subtype, value is TRUE. */
  1.1639 -
  1.1640 -	struct timeval last; /**< The time when we last sent a SNAC of this rate class. */
  1.1641 -};
  1.1642 -
  1.1643 -int aim_cachecookie(OscarData *od, IcbmCookie *cookie);
  1.1644 -IcbmCookie *aim_uncachecookie(OscarData *od, guint8 *cookie, int type);
  1.1645 -IcbmCookie *aim_mkcookie(guint8 *, int, void *);
  1.1646 -IcbmCookie *aim_checkcookie(OscarData *, const unsigned char *, const int);
  1.1647 -int aim_freecookie(OscarData *od, IcbmCookie *cookie);
  1.1648 -int aim_msgcookie_gettype(int type);
  1.1649 -int aim_cookie_free(OscarData *od, IcbmCookie *cookie);
  1.1650 -
  1.1651 -int aim_chat_readroominfo(ByteStream *bs, struct aim_chat_roominfo *outinfo);
  1.1652 -
  1.1653 -void flap_connection_destroy_chat(OscarData *od, FlapConnection *conn);
  1.1654 -
  1.1655 -#ifdef __cplusplus
  1.1656 -}
  1.1657 -#endif
  1.1658 -
  1.1659 -#endif /* _OSCAR_H_ */