#ifdef FAIM_USEPTHREADS
#include <pthread.h>
#define faim_mutex_t pthread_mutex_t
-#define faim_mutex_init pthread_mutex_init
-#define faim_mutex_lock pthread_mutex_lock
-#define faim_mutex_unlock pthread_mutex_unlock
-#define faim_mutex_destroy pthread_mutex_destroy
+#define faim_mutex_init(x) pthread_mutex_init(x, NULL)
+#define faim_mutex_lock(x) pthread_mutex_lock(x)
+#define faim_mutex_unlock(x) pthread_mutex_unlock(x)
+#define faim_mutex_destroy(x) pthread_mutex_destroy(x)
#elif defined(FAIM_USEFAKELOCKS)
/*
* For platforms without pthreads, we also assume
* But they get it to compile.
*/
#define faim_mutex_t char
-#define faim_mutex_init(x, y) *x = 0
+#define faim_mutex_init(x) *x = 0
#define faim_mutex_lock(x) *x = 1;
#define faim_mutex_unlock(x) *x = 0;
#define faim_mutex_destroy(x) *x = 0;
* for WinAIM clients (up through the latest (4.0.1957)) to
* send any more than 1kb. Amaze all your windows friends
* with utterly oversized instant messages!
+ *
+ * XXX: the real limit is the total SNAC size at 8192. Fix this.
*
*/
#define MAXMSGLEN 7987
*/
#define AIM_COOKIELEN 0x100
+#define AIM_MD5_STRING "AOL Instant Messenger (SM)"
+
#if debug > 0
#define faimdprintf(l, x...) {if (l >= debug) printf(x); }
#else
* Outstanding snac handling
*
* XXX: Should these be per-connection? -mid
- **/
- struct aim_snac_t *outstanding_snacs;
+ */
+ struct aim_snac_t *snac_hash[FAIM_SNAC_HASH_SIZE];
+ faim_mutex_t snac_hash_locks[FAIM_SNAC_HASH_SIZE];
u_long snac_nextid;
struct aim_msgcookie_t *msgcookies;
u_short capabilities;
};
-#define AIM_CLASS_TRIAL 0x0001
-#define AIM_CLASS_UNKNOWN2 0x0002
+#define AIM_CLASS_TRIAL 0x0001 /* "damned transients" */
+#define AIM_CLASS_ADMINISTRATOR 0x0002
#define AIM_CLASS_AOL 0x0004
-#define AIM_CLASS_UNKNOWN4 0x0008
+#define AIM_CLASS_OSCAR_PAY 0x0008
#define AIM_CLASS_FREE 0x0010
#define AIM_CLASS_AWAY 0x0020
#define AIM_CLASS_UNKNOWN40 0x0040
#define AIM_CLASS_UNKNOWN80 0x0080
+#define AIM_CLASS_ALLUSERS 0x001f
+
/*
* TLV handling
*/
/* aim_login.c */
int aim_sendconnack(struct aim_session_t *sess, struct aim_conn_t *conn);
int aim_request_login (struct aim_session_t *sess, struct aim_conn_t *conn, char *sn);
-int aim_send_login (struct aim_session_t *, struct aim_conn_t *, char *, char *, struct client_info_s *);
-int aim_encode_password(const char *, u_char *);
-int aimicq_encode_password(const char *password, u_char *encoded);
+int aim_send_login (struct aim_session_t *, struct aim_conn_t *, char *, char *, struct client_info_s *, char *key);
unsigned long aim_sendauthresp(struct aim_session_t *sess,
struct aim_conn_t *conn,
char *sn, char *bosip,
int regstatus);
int aim_gencookie(unsigned char *buf);
int aim_sendserverready(struct aim_session_t *sess, struct aim_conn_t *conn);
+int aim_authkeyparse(struct aim_session_t *sess, struct command_rx_struct *command);
unsigned long aim_sendredirect(struct aim_session_t *sess,
struct aim_conn_t *conn,
unsigned short servid,
time_t issuetime;
struct aim_snac_t *next;
};
+void aim_initsnachash(struct aim_session_t *sess);
u_long aim_newsnac(struct aim_session_t *, struct aim_snac_t *newsnac);
struct aim_snac_t *aim_remsnac(struct aim_session_t *, u_long id);
int aim_cleansnacs(struct aim_session_t *, int maxage);
#define AIM_VISIBILITYCHANGE_DENYADD 0x07
#define AIM_VISIBILITYCHANGE_DENYREMOVE 0x08
+#define AIM_PRIVFLAGS_ALLOWIDLE 0x01
+#define AIM_PRIVFLAGS_ALLOWMEMBERSINCE 0x02
+
+#define AIM_WARN_ANON 0x01
+
+int aim_send_warning(struct aim_session_t *sess, struct aim_conn_t *conn, char *destsn, int anon);
u_long aim_bos_nop(struct aim_session_t *, struct aim_conn_t *);
u_long aim_bos_setidle(struct aim_session_t *, struct aim_conn_t *, u_long);
u_long aim_bos_changevisibility(struct aim_session_t *, struct aim_conn_t *, int, char *);
int aim_parse_last_bad(struct aim_session_t *, struct command_rx_struct *, ...);
int aim_parse_generalerrs(struct aim_session_t *, struct command_rx_struct *command, ...);
int aim_parsemotd_middle(struct aim_session_t *sess, struct command_rx_struct *command, ...);
+int aim_parse_ratechange_middle(struct aim_session_t *sess, struct command_rx_struct *command);
+int aim_parse_evilnotify_middle(struct aim_session_t *sess, struct command_rx_struct *command);
+int aim_parse_msgack_middle(struct aim_session_t *sess, struct command_rx_struct *command);
/* aim_im.c */
struct aim_directim_priv {
int aim_parse_msgerror_middle(struct aim_session_t *, struct command_rx_struct *);
int aim_negchan_middle(struct aim_session_t *sess, struct command_rx_struct *command);
-struct aim_conn_t * aim_directim_intiate(struct aim_session_t *, struct aim_conn_t *, struct aim_directim_priv *, char *);
+struct aim_conn_t * aim_directim_initiate(struct aim_session_t *, struct aim_conn_t *, struct aim_directim_priv *, char *);
int aim_send_im_direct(struct aim_session_t *, struct aim_conn_t *, char *);
struct aim_conn_t *aim_directim_connect(struct aim_session_t *, struct aim_conn_t *, struct aim_directim_priv *);