*/
#define MAXMSGLEN 7987
+/*
+ * Maximum size of a Buddy Icon.
+ */
+#define MAXICONLEN 7168
+#define AIM_ICONIDENT "AVT1picture.id"
+
/*
* Current Maximum Length for Chat Room Messages
*
long unknown;
};
-#define AIM_CLIENTINFO_KNOWNGOOD { \
+#define AIM_CLIENTINFO_KNOWNGOOD_3_5_1670 { \
"AOL Instant Messenger (SM), version 3.5.1670/WIN32", \
0x0003, \
0x0005, \
0x0000002a, \
}
+#define AIM_CLIENTINFO_KNOWNGOOD_4_1_2010 { \
+ "AOL Instant Messenger (SM), version 4.1.2010/WIN32", \
+ 0x0004, \
+ 0x0001, \
+ 0x07da, \
+ "us", \
+ "en", \
+ 0x0004, \
+ 0x0000, \
+ 0x0000004b, \
+}
+
+/*
+ * I would make 4.1.2010 the default, but they seem to have found
+ * an alternate way of breaking that one.
+ *
+ * 3.5.1670 should work fine, however, you will be subjected to the
+ * memory test, which may require you to have a WinAIM binary laying
+ * around. (see login.c::memrequest())
+ */
+#define AIM_CLIENTINFO_KNOWNGOOD AIM_CLIENTINFO_KNOWNGOOD_3_5_1670
+
#ifndef TRUE
#define TRUE 1
#define FALSE 0
struct aim_rxcblist_t *handlerlist;
faim_mutex_t active; /* lock around read/writes */
faim_mutex_t seqnum_lock; /* lock around ->seqnum changes */
+ void *sessv;
struct aim_conn_t *next;
};
faim_export int aim_logoff(struct aim_session_t *);
-#ifndef FAIM_INTERNAL
+#if !defined(FAIM_INTERNAL) || defined(FAIM_INTERNAL_INSANE)
/* the library should never call aim_conn_kill */
faim_export void aim_conn_kill(struct aim_session_t *sess, struct aim_conn_t **deadconn);
-#endif /* ndef FAIM_INTERNAL */
+#endif
-typedef int (*rxcallback_t)(struct aim_session_t *, struct command_rx_struct *, ...);
+typedef int (*aim_rxcallback_t)(struct aim_session_t *, struct command_rx_struct *, ...);
/* aim_login.c */
-faim_export int aim_sendconnack(struct aim_session_t *sess, struct aim_conn_t *conn);
-faim_export int aim_request_login (struct aim_session_t *sess, struct aim_conn_t *conn, char *sn);
+faim_export int aim_sendflapver(struct aim_session_t *sess, struct aim_conn_t *conn);
+faim_export int aim_request_login (struct aim_session_t *sess, struct aim_conn_t *conn, const char *sn);
faim_export int aim_send_login (struct aim_session_t *, struct aim_conn_t *, char *, char *, struct client_info_s *, char *key);
faim_export int aim_encode_password_md5(const char *password, const char *key, unsigned char *digest);
faim_export unsigned long aim_sendauthresp(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn, int errorcode, char *errorurl, char *bosip, char *cookie, char *email, int regstatus);
struct aim_rxcblist_t {
u_short family;
u_short type;
- rxcallback_t handler;
+ aim_rxcallback_t handler;
u_short flags;
struct aim_rxcblist_t *next;
};
faim_export int aim_conn_setlatency(struct aim_conn_t *conn, int newval);
-faim_export int aim_conn_addhandler(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short type, rxcallback_t newhandler, u_short flags);
+faim_export int aim_conn_addhandler(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short type, aim_rxcallback_t newhandler, u_short flags);
faim_export int aim_clearhandlers(struct aim_conn_t *conn);
+faim_export struct aim_session_t *aim_conn_getsess(struct aim_conn_t *conn);
faim_export void aim_conn_close(struct aim_conn_t *deadconn);
faim_export struct aim_conn_t *aim_newconn(struct aim_session_t *, int type, char *dest);
faim_export int aim_conngetmaxfd(struct aim_session_t *);
faim_export void aim_session_kill(struct aim_session_t *);
faim_export void aim_setupproxy(struct aim_session_t *sess, char *server, char *username, char *password);
faim_export struct aim_conn_t *aim_getconn_type(struct aim_session_t *, int type);
+faim_export struct aim_conn_t *aim_getconn_type_all(struct aim_session_t *, int type);
+faim_export struct aim_conn_t *aim_getconn_fd(struct aim_session_t *, int fd);
/* aim_misc.c */
#define AIM_WARN_ANON 0x01
-faim_export int aim_send_warning(struct aim_session_t *sess, struct aim_conn_t *conn, char *destsn, int anon);
+faim_export int aim_send_warning(struct aim_session_t *sess, struct aim_conn_t *conn, const char *destsn, unsigned long flags);
faim_export unsigned long aim_bos_nop(struct aim_session_t *, struct aim_conn_t *);
faim_export unsigned long aim_flap_nop(struct aim_session_t *sess, struct aim_conn_t *conn);
faim_export unsigned long aim_bos_setidle(struct aim_session_t *, struct aim_conn_t *, u_long);
faim_export unsigned long aim_bos_changevisibility(struct aim_session_t *, struct aim_conn_t *, int, char *);
faim_export unsigned long aim_bos_setbuddylist(struct aim_session_t *, struct aim_conn_t *, char *);
-faim_export unsigned long aim_bos_setprofile(struct aim_session_t *, struct aim_conn_t *, char *, char *, unsigned short);
+faim_export unsigned long aim_bos_setprofile(struct aim_session_t *sess, struct aim_conn_t *conn, const char *profile, const char *awaymsg, unsigned short caps);
faim_export unsigned long aim_bos_setgroupperm(struct aim_session_t *, struct aim_conn_t *, u_long);
faim_export unsigned long aim_bos_clientready(struct aim_session_t *, struct aim_conn_t *);
faim_export unsigned long aim_bos_reqrate(struct aim_session_t *, struct aim_conn_t *);
faim_export unsigned long aim_bos_reqrights(struct aim_session_t *, struct aim_conn_t *);
faim_export unsigned long aim_bos_reqbuddyrights(struct aim_session_t *, struct aim_conn_t *);
faim_export unsigned long aim_bos_reqlocaterights(struct aim_session_t *, struct aim_conn_t *);
-faim_export unsigned long aim_bos_reqicbmparaminfo(struct aim_session_t *, struct aim_conn_t *);
-faim_export unsigned long aim_addicbmparam(struct aim_session_t *sess,struct aim_conn_t *conn);
faim_export unsigned long aim_setversions(struct aim_session_t *sess, struct aim_conn_t *conn);
faim_export unsigned long aim_auth_setversions(struct aim_session_t *sess, struct aim_conn_t *conn);
faim_export unsigned long aim_auth_reqconfirm(struct aim_session_t *sess, struct aim_conn_t *conn);
};
struct aim_filetransfer_priv {
- char sn[MAXSNLEN];
- char cookie[8];
- char ip[30];
- int state;
- struct aim_fileheader_t fh;
+ char sn[MAXSNLEN];
+ char cookie[8];
+ char ip[30];
+ int state;
+ struct aim_fileheader_t fh;
};
+struct aim_chat_roominfo {
+ unsigned short exchange;
+ char *name;
+ unsigned short instance;
+};
#define AIM_IMFLAGS_AWAY 0x01 /* mark as an autoreply */
#define AIM_IMFLAGS_ACK 0x02 /* request a receipt notice */
+#define AIM_IMFLAGS_UNICODE 0x04
+#define AIM_IMFLAGS_ISO_8859_1 0x08
+#define AIM_IMFLAGS_BUDDYREQ 0x10 /* buddy icon requested */
+#define AIM_IMFLAGS_HASICON 0x20 /* already has icon (timestamp included) */
+#define AIM_IMFLAGS_SUBENC_MACINTOSH 0x40 /* damn that Steve Jobs! */
+
+struct aim_sendimext_args {
+ const char *destsn;
+ unsigned short flags;
+ const char *msg;
+ int msglen;
+ int iconlen;
+ time_t iconstamp;
+ unsigned short iconsum;
+};
-faim_export unsigned long aim_send_im(struct aim_session_t *, struct aim_conn_t *, char *, u_int, char *);
+struct aim_incomingim_ch1_args {
+ char *msg;
+ int msglen;
+ unsigned long icbmflags;
+ unsigned short flag1;
+ unsigned short flag2;
+ int finlen;
+ unsigned char fingerprint[10];
+ time_t iconstamp;
+ int extdatalen;
+ unsigned char *extdata;
+};
+
+struct aim_incomingim_ch2_args {
+ unsigned short reqclass;
+ unsigned short status;
+ union {
+ struct {
+ unsigned int length;
+ time_t timestamp;
+ unsigned char *icon;
+ } icon;
+ struct {
+ } voice;
+ struct aim_directim_priv *directim;
+ struct {
+ char *msg;
+ char *encoding;
+ char *lang;
+ struct aim_chat_roominfo roominfo;
+ } chat;
+ struct {
+ char *ip;
+ unsigned char *cookie;
+ } getfile;
+ struct {
+ } sendfile;
+ } info;
+};
+
+faim_export int aim_send_im_ext(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_sendimext_args *args);
+faim_export int aim_send_im(struct aim_session_t *, struct aim_conn_t *, const char *destsn, unsigned short flags, const char *msg);
+faim_export int aim_send_icon(struct aim_session_t *sess, struct aim_conn_t *conn, const char *sn, const unsigned char *icon, int iconlen, time_t stamp, unsigned short iconsum);
+faim_export unsigned short aim_iconsum(const unsigned char *buf, int buflen);
faim_export int aim_send_im_direct(struct aim_session_t *, struct aim_conn_t *, char *);
faim_export struct aim_conn_t * aim_directim_initiate(struct aim_session_t *, struct aim_conn_t *, struct aim_directim_priv *, char *destsn);
faim_export struct aim_conn_t *aim_directim_connect(struct aim_session_t *, struct aim_conn_t *, struct aim_directim_priv *);
-faim_export unsigned long aim_seticbmparam(struct aim_session_t *, struct aim_conn_t *conn);
faim_export struct aim_conn_t *aim_getfile_initiate(struct aim_session_t *sess, struct aim_conn_t *conn, char *destsn);
faim_export int aim_oft_getfile_request(struct aim_session_t *sess, struct aim_conn_t *conn, const unsigned char *name, const int size);
faim_export int aim_oft_getfile_end(struct aim_session_t *sess, struct aim_conn_t *conn);
/* aim_info.c */
-#define AIM_CAPS_BUDDYICON 0x01
-#define AIM_CAPS_VOICE 0x02
-#define AIM_CAPS_IMIMAGE 0x04
-#define AIM_CAPS_CHAT 0x08
-#define AIM_CAPS_GETFILE 0x10
-#define AIM_CAPS_SENDFILE 0x20
-#define AIM_CAPS_GAMES 0x40
-#define AIM_CAPS_SAVESTOCKS 0x80
+#define AIM_CAPS_BUDDYICON 0x0001
+#define AIM_CAPS_VOICE 0x0002
+#define AIM_CAPS_IMIMAGE 0x0004
+#define AIM_CAPS_CHAT 0x0008
+#define AIM_CAPS_GETFILE 0x0010
+#define AIM_CAPS_SENDFILE 0x0020
+#define AIM_CAPS_GAMES 0x0040
+#define AIM_CAPS_SAVESTOCKS 0x0080
+#define AIM_CAPS_SENDBUDDYLIST 0x0100
+#define AIM_CAPS_GAMES2 0x0200
+#define AIM_CAPS_LAST 0x8000
+
+faim_export int aim_0002_000b(struct aim_session_t *sess, struct aim_conn_t *conn, const char *sn);
+
+#define AIM_SENDMEMBLOCK_FLAG_ISREQUEST 0
+#define AIM_SENDMEMBLOCK_FLAG_ISHASH 1
+
+faim_export int aim_sendmemblock(struct aim_session_t *sess, struct aim_conn_t *conn, unsigned long offset, unsigned long len, const unsigned char *buf, unsigned char flag);
#define AIM_GETINFO_GENERALINFO 0x00001
#define AIM_GETINFO_AWAYMESSAGE 0x00003
#define AIM_TRANSFER_DENY_NOTSUPPORTED 0x0000
#define AIM_TRANSFER_DENY_DECLINE 0x0001
#define AIM_TRANSFER_DENY_NOTACCEPTING 0x0002
-faim_export unsigned long aim_denytransfer(struct aim_session_t *sess, struct aim_conn_t *conn, char *sender, char *cookie, unsigned short code);
+faim_export int aim_denytransfer(struct aim_session_t *sess, struct aim_conn_t *conn, const char *sender, const char *cookie, unsigned short code);
faim_export struct aim_conn_t *aim_accepttransfer(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn, char *cookie, char *ip, unsigned short listingfiles, unsigned short listingtotsize, unsigned short listingsize, unsigned int listingchecksum, unsigned short rendid);
-faim_export unsigned long aim_getinfo(struct aim_session_t *, struct aim_conn_t *, const char *, unsigned short);
+faim_export int aim_getinfo(struct aim_session_t *, struct aim_conn_t *, const char *, unsigned short);
faim_export int aim_sendbuddyoncoming(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_userinfo_s *info);
faim_export int aim_sendbuddyoffgoing(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn);
+#define AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED 0x00000001
+#define AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED 0x00000002
+
+/* This is what the server will give you if you don't set them yourself. */
+#define AIM_IMPARAM_DEFAULTS { \
+ 0, \
+ AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \
+ 512, /* !! Note how small this is. */ \
+ (99.9)*10, (99.9)*10, \
+ 1000 \
+}
+
+/* This is what most AIM versions use. */
+#define AIM_IMPARAM_REASONABLE { \
+ 0, \
+ AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \
+ 8000, \
+ (99.9)*10, (99.9)*10, \
+ 0 \
+}
+
+
+struct aim_icbmparameters {
+ unsigned short maxchan;
+ unsigned long flags; /* AIM_IMPARAM_FLAG_ */
+ unsigned short maxmsglen; /* message size that you will accept */
+ unsigned short maxsenderwarn; /* this and below are *10 (999=99.9%) */
+ unsigned short maxrecverwarn;
+ unsigned long minmsginterval; /* in milliseconds? */
+};
+
+faim_export unsigned long aim_reqicbmparams(struct aim_session_t *sess, struct aim_conn_t *conn);
+faim_export unsigned long aim_seticbmparam(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_icbmparameters *params);
+
/* aim_auth.c */
faim_export int aim_auth_sendcookie(struct aim_session_t *, struct aim_conn_t *, u_char *);
/* aim_search.c */
faim_export u_long aim_usersearch_address(struct aim_session_t *, struct aim_conn_t *, char *);
-struct aim_chat_roominfo {
- u_short exchange;
- char *name;
- u_short instance;
-};
-
struct aim_chat_exchangeinfo {
u_short number;
char *name;
char *lang2;
};
-faim_export unsigned long aim_chat_send_im(struct aim_session_t *sess, struct aim_conn_t *conn, char *msg);
+#define AIM_CHATFLAGS_NOREFLECT 0x0001
+#define AIM_CHATFLAGS_AWAY 0x0002
+faim_export unsigned long aim_chat_send_im(struct aim_session_t *sess, struct aim_conn_t *conn, unsigned short flags, const char *msg, int msglen);
faim_export unsigned long aim_chat_join(struct aim_session_t *sess, struct aim_conn_t *conn, u_short exchange, const char *roomname);
faim_export unsigned long aim_chat_clientready(struct aim_session_t *sess, struct aim_conn_t *conn);
faim_export int aim_chat_attachname(struct aim_conn_t *conn, char *roomname);
/* aim_meta.c */
faim_export char *aim_getbuilddate(void);
faim_export char *aim_getbuildtime(void);
-faim_export char *aim_getbuildstring(void);
+faim_export int aim_getbuildstring(char *buf, int buflen);
#include <aim_internal.h>