Mercurial > pidgin
changeset 840:595ac7759563
[gaim-migrate @ 850]
lots of (mostly useless for us) libfaim changes. should help portability, but it was always portable between unices.... stupid win32ers.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Mon, 04 Sep 2000 23:37:32 +0000 |
parents | 8f66e00af045 |
children | 3b09dd379600 |
files | libfaim/CHANGES libfaim/aim_ads.c libfaim/aim_auth.c libfaim/aim_buddylist.c libfaim/aim_chat.c libfaim/aim_chatnav.c libfaim/aim_conn.c libfaim/aim_ft.c libfaim/aim_im.c libfaim/aim_info.c libfaim/aim_login.c libfaim/aim_meta.c libfaim/aim_msgcookie.c libfaim/aim_rxhandlers.c libfaim/aim_rxqueue.c libfaim/aim_search.c libfaim/aim_snac.c libfaim/aim_tlv.c libfaim/aim_txqueue.c libfaim/aim_util.c libfaim/faim/aim.h src/oscar.c |
diffstat | 22 files changed, 548 insertions(+), 433 deletions(-) [+] |
line wrap: on
line diff
--- a/libfaim/CHANGES Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/CHANGES Mon Sep 04 23:37:32 2000 +0000 @@ -1,6 +1,19 @@ No release numbers ------------------ + - Mon Sep 4 22:08:35 GMT 2000 + - Forgot aim_snac and aim_search + + - Mon Sep 4 21:38:09 GMT 2000 + - A mild step towards ANSI compliance + - Compiles cleanly with -pedantic (except for the libc issue in socket.h) + - Fixes various sign mismatch things. There may be more, we'll see + what MSVC has to say about it. + - Add faim_internal and faim_export macros so Win32 DLL is easier + + - Sun Sep 3 23:58:17 UTC 2000 + - Portability fixes (for solaris, set the SOLARIS env var first) + - Sat Sep 2 23:42:37 UTC 2000 - Hopefully fix aim_snac.c bugs - Add Buddy List Rights parser (max buddies and max watchers)
--- a/libfaim/aim_ads.c Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/aim_ads.c Mon Sep 04 23:37:32 2000 +0000 @@ -5,8 +5,8 @@ #include <faim/aim.h> -u_long aim_ads_clientready(struct aim_session_t *sess, - struct aim_conn_t *conn) +faim_export unsigned long aim_ads_clientready(struct aim_session_t *sess, + struct aim_conn_t *conn) { struct command_tx_struct *newpacket; int i; @@ -35,8 +35,8 @@ return (sess->snac_nextid++); } -u_long aim_ads_requestads(struct aim_session_t *sess, - struct aim_conn_t *conn) +faim_export unsigned long aim_ads_requestads(struct aim_session_t *sess, + struct aim_conn_t *conn) { return aim_genericreq_n(sess, conn, 0x0005, 0x0002); }
--- a/libfaim/aim_auth.c Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/aim_auth.c Mon Sep 04 23:37:32 2000 +0000 @@ -8,9 +8,9 @@ #include <faim/aim.h> /* this just pushes the passed cookie onto the passed connection -- NO SNAC! */ -int aim_auth_sendcookie(struct aim_session_t *sess, - struct aim_conn_t *conn, - u_char *chipsahoy) +faim_export int aim_auth_sendcookie(struct aim_session_t *sess, + struct aim_conn_t *conn, + unsigned char *chipsahoy) { struct command_tx_struct *newpacket; int curbyte=0; @@ -29,8 +29,8 @@ return aim_tx_enqueue(sess, newpacket); } -u_long aim_auth_clientready(struct aim_session_t *sess, - struct aim_conn_t *conn) +faim_export unsigned long aim_auth_clientready(struct aim_session_t *sess, + struct aim_conn_t *conn) { struct command_tx_struct *newpacket; int curbyte = 0; @@ -68,9 +68,9 @@ return (sess->snac_nextid++); } -u_long aim_auth_changepasswd(struct aim_session_t *sess, - struct aim_conn_t *conn, - char *new, char *current) +faim_export unsigned long aim_auth_changepasswd(struct aim_session_t *sess, + struct aim_conn_t *conn, + char *new, char *current) { struct command_tx_struct *newpacket; int i;
--- a/libfaim/aim_buddylist.c Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/aim_buddylist.c Mon Sep 04 23:37:32 2000 +0000 @@ -7,9 +7,9 @@ * Adds a single buddy to your buddy list after login. * */ -u_long aim_add_buddy(struct aim_session_t *sess, - struct aim_conn_t *conn, - char *sn ) +faim_export unsigned long aim_add_buddy(struct aim_session_t *sess, + struct aim_conn_t *conn, + char *sn ) { struct command_tx_struct *newpacket; int i; @@ -47,9 +47,9 @@ return( sess->snac_nextid++ ); } -u_long aim_remove_buddy(struct aim_session_t *sess, - struct aim_conn_t *conn, - char *sn ) +faim_export unsigned long aim_remove_buddy(struct aim_session_t *sess, + struct aim_conn_t *conn, + char *sn ) { struct command_tx_struct *newpacket; int i; @@ -86,8 +86,8 @@ return( sess->snac_nextid++ ); } -int aim_parse_buddyrights(struct aim_session_t *sess, - struct command_rx_struct *command, ...) +faim_internal int aim_parse_buddyrights(struct aim_session_t *sess, + struct command_rx_struct *command, ...) { rxcallback_t userfunc = NULL; int ret=1;
--- a/libfaim/aim_chat.c Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/aim_chat.c Mon Sep 04 23:37:32 2000 +0000 @@ -7,7 +7,7 @@ #include <faim/aim.h> -char *aim_chat_getname(struct aim_conn_t *conn) +faim_export char *aim_chat_getname(struct aim_conn_t *conn) { if (!conn) return NULL; @@ -17,7 +17,7 @@ return (char *)conn->priv; /* yuck ! */ } -struct aim_conn_t *aim_chat_getconn(struct aim_session_t *sess, char *name) +faim_export struct aim_conn_t *aim_chat_getconn(struct aim_session_t *sess, char *name) { struct aim_conn_t *cur; @@ -33,7 +33,7 @@ return cur; } -int aim_chat_attachname(struct aim_conn_t *conn, char *roomname) +faim_export int aim_chat_attachname(struct aim_conn_t *conn, char *roomname) { if (!conn || !roomname) return -1; @@ -44,9 +44,9 @@ return 0; } -u_long aim_chat_send_im(struct aim_session_t *sess, - struct aim_conn_t *conn, - char *msg) +faim_export unsigned long aim_chat_send_im(struct aim_session_t *sess, + struct aim_conn_t *conn, + char *msg) { int curbyte,i; @@ -121,10 +121,10 @@ * and room name. * */ -u_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_join(struct aim_session_t *sess, + struct aim_conn_t *conn, + u_short exchange, + const char *roomname) { struct command_tx_struct *newpacket; int i; @@ -188,7 +188,7 @@ return (sess->snac_nextid++); } -int aim_chat_readroominfo(u_char *buf, struct aim_chat_roominfo *outinfo) +faim_internal int aim_chat_readroominfo(u_char *buf, struct aim_chat_roominfo *outinfo) { int namelen = 0; int i = 0; @@ -211,7 +211,7 @@ i += 2; return i; -}; +} /* @@ -223,8 +223,8 @@ * * SNAC 000e/0002 */ -int aim_chat_parse_infoupdate(struct aim_session_t *sess, - struct command_rx_struct *command) +faim_internal int aim_chat_parse_infoupdate(struct aim_session_t *sess, + struct command_rx_struct *command) { struct aim_userinfo_s *userinfo = NULL; rxcallback_t userfunc=NULL; @@ -358,8 +358,8 @@ return ret; } -int aim_chat_parse_joined(struct aim_session_t *sess, - struct command_rx_struct *command) +faim_internal int aim_chat_parse_joined(struct aim_session_t *sess, + struct command_rx_struct *command) { struct aim_userinfo_s *userinfo = NULL; rxcallback_t userfunc=NULL; @@ -384,8 +384,8 @@ return ret; } -int aim_chat_parse_leave(struct aim_session_t *sess, - struct command_rx_struct *command) +faim_internal int aim_chat_parse_leave(struct aim_session_t *sess, + struct command_rx_struct *command) { struct aim_userinfo_s *userinfo = NULL; @@ -416,8 +416,8 @@ * code as channel 0x0003, however, since only the start * would be the same, we might as well do it here. */ -int aim_chat_parse_incoming(struct aim_session_t *sess, - struct command_rx_struct *command) +faim_internal int aim_chat_parse_incoming(struct aim_session_t *sess, + struct command_rx_struct *command) { struct aim_userinfo_s userinfo; rxcallback_t userfunc=NULL; @@ -511,8 +511,8 @@ return ret; } -u_long aim_chat_clientready(struct aim_session_t *sess, - struct aim_conn_t *conn) +faim_export unsigned long aim_chat_clientready(struct aim_session_t *sess, + struct aim_conn_t *conn) { struct command_tx_struct *newpacket; int i; @@ -542,7 +542,7 @@ return (sess->snac_nextid++); } -int aim_chat_leaveroom(struct aim_session_t *sess, char *name) +faim_export int aim_chat_leaveroom(struct aim_session_t *sess, char *name) { struct aim_conn_t *conn; @@ -557,13 +557,13 @@ /* * conn must be a BOS connection! */ -u_long aim_chat_invite(struct aim_session_t *sess, - struct aim_conn_t *conn, - char *sn, - char *msg, - u_short exchange, - char *roomname, - u_short instance) +faim_export unsigned long aim_chat_invite(struct aim_session_t *sess, + struct aim_conn_t *conn, + char *sn, + char *msg, + u_short exchange, + char *roomname, + u_short instance) { struct command_tx_struct *newpacket; int i,curbyte=0;
--- a/libfaim/aim_chatnav.c Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/aim_chatnav.c Mon Sep 04 23:37:32 2000 +0000 @@ -11,8 +11,8 @@ /* * conn must be a chatnav connection! */ -u_long aim_chatnav_reqrights(struct aim_session_t *sess, - struct aim_conn_t *conn) +faim_export unsigned long aim_chatnav_reqrights(struct aim_session_t *sess, + struct aim_conn_t *conn) { struct aim_snac_t snac; @@ -28,8 +28,8 @@ return (sess->snac_nextid); /* already incremented */ } -u_long aim_chatnav_clientready(struct aim_session_t *sess, - struct aim_conn_t *conn) +faim_export unsigned long aim_chatnav_clientready(struct aim_session_t *sess, + struct aim_conn_t *conn) { struct command_tx_struct *newpacket; int i; @@ -63,7 +63,7 @@ * we must lookup the snacid to determine the original * snac subtype that was called. */ -int aim_chatnav_parse_info(struct aim_session_t *sess, struct command_rx_struct *command) +faim_internal int aim_chatnav_parse_info(struct aim_session_t *sess, struct command_rx_struct *command) { struct aim_snac_t *snac; u_long snacid; @@ -306,10 +306,10 @@ return ret; } -u_long aim_chatnav_createroom(struct aim_session_t *sess, - struct aim_conn_t *conn, - char *name, - u_short exchange) +faim_export unsigned long aim_chatnav_createroom(struct aim_session_t *sess, + struct aim_conn_t *conn, + char *name, + u_short exchange) { struct command_tx_struct *newpacket; int i;
--- a/libfaim/aim_conn.c Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/aim_conn.c Mon Sep 04 23:37:32 2000 +0000 @@ -8,10 +8,14 @@ #include <faim/aim.h> +#include <netdb.h> +#include <sys/socket.h> +#include <netinet/in.h> + /* * Clears out connection list, killing remaining connections. */ -void aim_connrst(struct aim_session_t *sess) +faim_internal void aim_connrst(struct aim_session_t *sess) { faim_mutex_init(&sess->connlistlock); if (sess->connlist) { @@ -31,7 +35,7 @@ /* * Gets a new connection structure. */ -struct aim_conn_t *aim_conn_getnext(struct aim_session_t *sess) +faim_internal struct aim_conn_t *aim_conn_getnext(struct aim_session_t *sess) { struct aim_conn_t *newconn, *cur; @@ -74,7 +78,7 @@ return; } -void aim_conn_kill(struct aim_session_t *sess, struct aim_conn_t **deadconn) +faim_export void aim_conn_kill(struct aim_session_t *sess, struct aim_conn_t **deadconn) { struct aim_conn_t *cur; @@ -111,7 +115,7 @@ return; } -void aim_conn_close(struct aim_conn_t *deadconn) +faim_export void aim_conn_close(struct aim_conn_t *deadconn) { int typesav = -1, subtypesav = -1; void *privsav = NULL; @@ -141,8 +145,8 @@ return; } -struct aim_conn_t *aim_getconn_type(struct aim_session_t *sess, - int type) +faim_internal struct aim_conn_t *aim_getconn_type(struct aim_session_t *sess, + int type) { struct aim_conn_t *cur; @@ -164,8 +168,8 @@ * FIXME: Return errors in a more sane way. * */ -struct aim_conn_t *aim_newconn(struct aim_session_t *sess, - int type, char *dest) +faim_export struct aim_conn_t *aim_newconn(struct aim_session_t *sess, + int type, char *dest) { struct aim_conn_t *connstruct; int ret; @@ -236,7 +240,7 @@ return connstruct; } -int aim_conngetmaxfd(struct aim_session_t *sess) +faim_export int aim_conngetmaxfd(struct aim_session_t *sess) { int j = 0; struct aim_conn_t *cur; @@ -251,7 +255,7 @@ return j; } -int aim_countconn(struct aim_session_t *sess) +static int aim_countconn(struct aim_session_t *sess) { int cnt = 0; struct aim_conn_t *cur; @@ -279,8 +283,8 @@ * XXX: we could probably stand to do a little courser locking here. * */ -struct aim_conn_t *aim_select(struct aim_session_t *sess, - struct timeval *timeout, int *status) +faim_export struct aim_conn_t *aim_select(struct aim_session_t *sess, + struct timeval *timeout, int *status) { struct aim_conn_t *cur; fd_set fds; @@ -333,14 +337,14 @@ return NULL; /* no waiting or error, return */ } -int aim_conn_isready(struct aim_conn_t *conn) +faim_export int aim_conn_isready(struct aim_conn_t *conn) { if (conn) return (conn->status & 0x0001); return -1; } -int aim_conn_setstatus(struct aim_conn_t *conn, int status) +faim_export int aim_conn_setstatus(struct aim_conn_t *conn, int status) { int val; @@ -353,7 +357,7 @@ return val; } -int aim_conn_setlatency(struct aim_conn_t *conn, int newval) +faim_export int aim_conn_setlatency(struct aim_conn_t *conn, int newval) { if (!conn) return -1; @@ -366,7 +370,7 @@ return 0; } -void aim_session_init(struct aim_session_t *sess) +faim_export void aim_session_init(struct aim_session_t *sess) { if (!sess) return;
--- a/libfaim/aim_ft.c Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/aim_ft.c Mon Sep 04 23:37:32 2000 +0000 @@ -1,5 +1,8 @@ #include <faim/aim.h> +#include <netdb.h> +#include <sys/socket.h> +#include <netinet/in.h> #include <sys/utsname.h> /* for aim_directim_initiate */ #include <arpa/inet.h> /* for inet_ntoa */ @@ -14,11 +17,11 @@ aim_filetransfer_accept aim_im.c aim_getlisting aim_misc.c (?!) -- prototype function. can be ignored. establish aim_misc.c - aim_get_command_rendezvous aim_rxqueue.c + aim_get_command_rendezvous aim_r oft_getfh aim_rxqueue.c */ -int aim_handlerendconnect(struct aim_session_t *sess, struct aim_conn_t *cur) +faim_export int aim_handlerendconnect(struct aim_session_t *sess, struct aim_conn_t *cur) { int acceptfd = 0; rxcallback_t userfunc; @@ -86,9 +89,9 @@ * msg - null-terminated string to send */ -int aim_send_im_direct(struct aim_session_t *sess, - struct aim_conn_t *conn, - char *msg) +faim_export int aim_send_im_direct(struct aim_session_t *sess, + struct aim_conn_t *conn, + char *msg) { struct command_tx_struct *newpacket , *newpacket2; @@ -132,7 +135,7 @@ i += aimutil_put16(newpacket2->hdr.oft.hdr2+i, 0x0006); i += aimutil_put16(newpacket2->hdr.oft.hdr2+i, 0x0000); - i += aimutil_putstr(newpacket2->hdr.oft.hdr2+i, priv->cookie, 8); + i += aimutil_putstr(newpacket2->hdr.oft.hdr2+i, (char *)priv->cookie, 8); i += aimutil_put16(newpacket2->hdr.oft.hdr2+i, 0x0000); i += aimutil_put16(newpacket2->hdr.oft.hdr2+i, 0x0000); @@ -188,7 +191,7 @@ i += aimutil_put16(newpacket->hdr.oft.hdr2+i, 0x0006); i += aimutil_put16(newpacket->hdr.oft.hdr2+i, 0x0000); - i += aimutil_putstr(newpacket->hdr.oft.hdr2+i, priv->cookie, 8); + i += aimutil_putstr(newpacket->hdr.oft.hdr2+i, (char *)priv->cookie, 8); i += aimutil_put16(newpacket->hdr.oft.hdr2+i, 0x0000); i += aimutil_put16(newpacket->hdr.oft.hdr2+i, 0x0000); @@ -246,10 +249,10 @@ */ -struct aim_conn_t *aim_directim_initiate(struct aim_session_t *sess, - struct aim_conn_t *conn, - struct aim_directim_priv *priv, - char *destsn) +faim_export struct aim_conn_t *aim_directim_initiate(struct aim_session_t *sess, + struct aim_conn_t *conn, + struct aim_directim_priv *priv, + char *destsn) { struct command_tx_struct *newpacket; struct aim_conn_t *newconn; @@ -262,7 +265,7 @@ struct hostent *hptr; struct utsname myname; - char cap[16]; + unsigned char cap[16]; char d[4]; /* XXX: IPv6. *cough* */ /* @@ -447,9 +450,9 @@ } -struct aim_conn_t *aim_directim_connect(struct aim_session_t *sess, - struct aim_conn_t *conn, - struct aim_directim_priv *priv ) +faim_export struct aim_conn_t *aim_directim_connect(struct aim_session_t *sess, + struct aim_conn_t *conn, + struct aim_directim_priv *priv ) { struct aim_conn_t *newconn = NULL;; @@ -468,12 +471,12 @@ return newconn; } -u_long aim_accepttransfer(struct aim_session_t *sess, - struct aim_conn_t *conn, - struct aim_conn_t *oftconn, - char *sn, - char *cookie, - unsigned short rendid) +faim_export unsigned long aim_accepttransfer(struct aim_session_t *sess, + struct aim_conn_t *conn, + struct aim_conn_t *oftconn, + char *sn, + char *cookie, + unsigned short rendid) { struct command_tx_struct *newpacket, *newoft; struct aim_fileheader_t *listingfh; @@ -585,7 +588,7 @@ * */ -struct aim_fileheader_t *aim_getlisting(struct aim_session_t *sess) +faim_internal struct aim_fileheader_t *aim_getlisting(struct aim_session_t *sess) { struct aim_fileheader_t *fh; @@ -641,7 +644,7 @@ * returns your fd */ -int aim_listenestablish(u_short portnum) +faim_internal int aim_listenestablish(u_short portnum) { #if HAVE_GETADDRINFO int listenfd; @@ -680,7 +683,7 @@ #endif } -int aim_get_command_rendezvous(struct aim_session_t *sess, struct aim_conn_t *conn) +faim_internal int aim_get_command_rendezvous(struct aim_session_t *sess, struct aim_conn_t *conn) { /* XXX: NOT THREAD SAFE RIGHT NOW. the locks are acting up. deal. -- jbm */ @@ -733,7 +736,7 @@ payloadlength = aimutil_get32(hdr+22); flags = aimutil_get16(hdr+32); - snptr = hdr+38; + snptr = (char *)hdr+38; strncpy(priv->sn, snptr, MAXSNLEN); @@ -798,7 +801,7 @@ memcpy(&(ft->fh), fh, sizeof(struct aim_fileheader_t)); - cook = aim_checkcookie(sess, ft->fh.bcookie, AIM_COOKIETYPE_OFTGET); + cook = aim_checkcookie(sess, (unsigned char *)ft->fh.bcookie, AIM_COOKIETYPE_OFTGET); if(cook->data) free(cook->data); /* XXX */ @@ -842,7 +845,7 @@ memcpy(&(ft->fh), fh, sizeof(struct aim_fileheader_t)); - cook = aim_checkcookie(sess, ft->fh.bcookie, AIM_COOKIETYPE_OFTGET); + cook = aim_checkcookie(sess, (unsigned char *)ft->fh.bcookie, AIM_COOKIETYPE_OFTGET); if(cook->data) free(cook->data); /* XXX: integrate cookie caching */ @@ -873,11 +876,11 @@ if(hdrlen != 0x100) printf("faim: fileget_command(120c): um. hdrlen != 0x100..\n"); - listingfh = aim_oft_getfh((char *)hdr); + listingfh = aim_oft_getfh(hdr); memcpy(&(ft->fh), listingfh, sizeof(struct aim_fileheader_t)); - cook = aim_checkcookie(sess, ft->fh.bcookie, AIM_COOKIETYPE_OFTGET); + cook = aim_checkcookie(sess, (unsigned char *)ft->fh.bcookie, AIM_COOKIETYPE_OFTGET); if(cook->data) free(cook->data); /* XXX */ @@ -948,7 +951,7 @@ curbyte += aimutil_put32(newoft->hdr.oft.hdr2+curbyte, 0 /*listingfh->nrecvd*/); curbyte += aimutil_put32(newoft->hdr.oft.hdr2+curbyte, 0/*listingfh->recvcsum*/); - strncpy(newoft->hdr.oft.hdr2+curbyte, listingfh->idstring, 32); + strncpy((char *)newoft->hdr.oft.hdr2+curbyte, listingfh->idstring, 32); curbyte += 32; curbyte += aimutil_put8(newoft->hdr.oft.hdr2+curbyte, 0x20 /*listingfh->flags */); @@ -964,7 +967,7 @@ curbyte += aimutil_put16(newoft->hdr.oft.hdr2+curbyte, listingfh->nencode); curbyte += aimutil_put16(newoft->hdr.oft.hdr2+curbyte, listingfh->nlanguage); - strncpy(newoft->hdr.oft.hdr2+curbyte, listingfh->name, 64); + strncpy((char *)newoft->hdr.oft.hdr2+curbyte, listingfh->name, 64); curbyte += 64; free(listingfh); @@ -980,7 +983,7 @@ int i; struct aim_fileheader_t *fh; - fh = aim_oft_getfh((char *)hdr); + fh = aim_oft_getfh(hdr); c = (char *)calloc(1, fh->size); @@ -1022,7 +1025,7 @@ * this currently feeds totally bogus data */ -struct aim_fileheader_t *aim_oft_getfh(char *hdr) +faim_internal struct aim_fileheader_t *aim_oft_getfh(unsigned char *hdr) { struct aim_fileheader_t *fh; int i, j;
--- a/libfaim/aim_im.c Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/aim_im.c Mon Sep 04 23:37:32 2000 +0000 @@ -17,9 +17,9 @@ * when the message is received (of type 0x0004/0x000c) * */ -u_long aim_send_im(struct aim_session_t *sess, - struct aim_conn_t *conn, - char *destsn, u_int flags, char *msg) +faim_export unsigned long aim_send_im(struct aim_session_t *sess, + struct aim_conn_t *conn, + char *destsn, u_int flags, char *msg) { int curbyte,i; @@ -139,8 +139,8 @@ return (sess->snac_nextid++); } -int aim_parse_outgoing_im_middle(struct aim_session_t *sess, - struct command_rx_struct *command) +faim_internal int aim_parse_outgoing_im_middle(struct aim_session_t *sess, + struct command_rx_struct *command) { unsigned int i = 0, z; rxcallback_t userfunc = NULL; @@ -167,7 +167,7 @@ return 1; } - strncpy(sn, command->data+i+1, (int) *(command->data+i)); + strncpy(sn, (char *) command->data+i+1, (int) *(command->data+i)); i += 1 + (int) *(command->data+i); tlvlist = aim_readtlvchain(command->data+i, command->commandlen-i); @@ -180,7 +180,7 @@ if (aim_gettlv(tlvlist, 0x0002, 1)) { int j = 0; - msgblock = aim_gettlv_str(tlvlist, 0x0002, 1); + msgblock = (unsigned char *)aim_gettlv_str(tlvlist, 0x0002, 1); /* no, this really is correct. I'm not high or anything either. */ j += 2; @@ -222,8 +222,8 @@ * room we're invited to, but obviously can't attend... * */ -int aim_parse_incoming_im_middle(struct aim_session_t *sess, - struct command_rx_struct *command) +faim_internal int aim_parse_incoming_im_middle(struct aim_session_t *sess, + struct command_rx_struct *command) { u_int i = 0,z; rxcallback_t userfunc = NULL; @@ -785,11 +785,11 @@ * AIM_TRANSFER_DENY_NOTACCEPTING -- "client is not accepting transfers" * */ -u_long aim_denytransfer(struct aim_session_t *sess, - struct aim_conn_t *conn, - char *sender, - char *cookie, - unsigned short code) +faim_export unsigned long aim_denytransfer(struct aim_session_t *sess, + struct aim_conn_t *conn, + char *sender, + char *cookie, + unsigned short code) { struct command_tx_struct *newpacket; int curbyte, i; @@ -820,8 +820,8 @@ * idea. * */ -u_long aim_seticbmparam(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 command_tx_struct *newpacket; int curbyte; @@ -849,8 +849,8 @@ return (sess->snac_nextid++); } -int aim_parse_msgerror_middle(struct aim_session_t *sess, - struct command_rx_struct *command) +faim_internal int aim_parse_msgerror_middle(struct aim_session_t *sess, + struct command_rx_struct *command) { u_long snacid = 0x000000000; struct aim_snac_t *snac = NULL; @@ -898,8 +898,8 @@ } -int aim_parse_missedcall(struct aim_session_t *sess, - struct command_rx_struct *command) +faim_internal int aim_parse_missedcall(struct aim_session_t *sess, + struct command_rx_struct *command) { int i, ret = 1; rxcallback_t userfunc = NULL;
--- a/libfaim/aim_info.c Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/aim_info.c Mon Sep 04 23:37:32 2000 +0000 @@ -14,10 +14,10 @@ unsigned short infotype; }; -u_long aim_getinfo(struct aim_session_t *sess, - struct aim_conn_t *conn, - const char *sn, - unsigned short infotype) +faim_export unsigned long aim_getinfo(struct aim_session_t *sess, + struct aim_conn_t *conn, + const char *sn, + unsigned short infotype) { struct command_tx_struct *newpacket; int i = 0; @@ -57,8 +57,8 @@ return (sess->snac_nextid++); } -int aim_parse_locateerr(struct aim_session_t *sess, - struct command_rx_struct *command) +faim_internal int aim_parse_locateerr(struct aim_session_t *sess, + struct command_rx_struct *command) { u_long snacid = 0x000000000; struct aim_snac_t *snac = NULL; @@ -131,7 +131,7 @@ 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} }; -u_short aim_getcap(unsigned char *capblock, int buflen) +faim_internal unsigned short aim_getcap(unsigned char *capblock, int buflen) { u_short ret = 0; int y; @@ -156,7 +156,7 @@ return ret; } -int aim_putcap(unsigned char *capblock, int buflen, u_short caps) +faim_internal int aim_putcap(unsigned char *capblock, int buflen, u_short caps) { int offset = 0; @@ -195,7 +195,7 @@ * AIM is fairly regular about providing user info. This * is a generic routine to extract it in its standard form. */ -int aim_extractuserinfo(u_char *buf, struct aim_userinfo_s *outinfo) +faim_internal int aim_extractuserinfo(u_char *buf, struct aim_userinfo_s *outinfo) { int i = 0; int tlvcnt = 0; @@ -421,8 +421,8 @@ * through aim_extractuserinfo() however. * */ -int aim_parse_oncoming_middle(struct aim_session_t *sess, - struct command_rx_struct *command) +faim_internal int aim_parse_oncoming_middle(struct aim_session_t *sess, + struct command_rx_struct *command) { struct aim_userinfo_s userinfo; u_int i = 0; @@ -443,14 +443,14 @@ * information other than the name it applies to. * */ -int aim_parse_offgoing_middle(struct aim_session_t *sess, - struct command_rx_struct *command) +faim_internal int aim_parse_offgoing_middle(struct aim_session_t *sess, + struct command_rx_struct *command) { char sn[MAXSNLEN+1]; u_int i = 0; rxcallback_t userfunc=NULL; - strncpy(sn, command->data+11, (int)command->data[10]); + strncpy(sn, (char *)command->data+11, (int)command->data[10]); sn[(int)command->data[10]] = '\0'; userfunc = aim_callhandler(command->conn, AIM_CB_FAM_BUD, AIM_CB_BUD_OFFGOING); @@ -465,8 +465,8 @@ * the higher-level callback (in the user app). * */ -int aim_parse_userinfo_middle(struct aim_session_t *sess, - struct command_rx_struct *command) +faim_internal int aim_parse_userinfo_middle(struct aim_session_t *sess, + struct command_rx_struct *command) { struct aim_userinfo_s userinfo; char *text_encoding = NULL; @@ -548,7 +548,7 @@ /* * Inverse of aim_extractuserinfo() */ -int aim_putuserinfo(u_char *buf, int buflen, struct aim_userinfo_s *info) +faim_internal int aim_putuserinfo(u_char *buf, int buflen, struct aim_userinfo_s *info) { int i = 0; struct aim_tlvlist_t *tlvlist = NULL; @@ -576,7 +576,7 @@ return i; } -int aim_sendbuddyoncoming(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_userinfo_s *info) +faim_export int aim_sendbuddyoncoming(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_userinfo_s *info) { struct command_tx_struct *tx; int i = 0; @@ -604,7 +604,7 @@ return 0; } -int aim_sendbuddyoffgoing(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn) +faim_export int aim_sendbuddyoffgoing(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn) { struct command_tx_struct *tx; int i = 0;
--- a/libfaim/aim_login.c Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/aim_login.c Mon Sep 04 23:37:32 2000 +0000 @@ -18,8 +18,8 @@ #include "tis_telnet_proxy.h" #endif -int aim_sendconnack(struct aim_session_t *sess, - struct aim_conn_t *conn) +faim_export int aim_sendconnack(struct aim_session_t *sess, + struct aim_conn_t *conn) { int curbyte=0; @@ -45,9 +45,9 @@ * a 0017/0007 comes back, which is the signal to send * it the main login command (0017/0002). */ -int aim_request_login(struct aim_session_t *sess, - struct aim_conn_t *conn, - char *sn) +faim_export int aim_request_login(struct aim_session_t *sess, + struct aim_conn_t *conn, + char *sn) { int curbyte=0; @@ -75,10 +75,11 @@ * stupid method of doing it. * */ -int aim_send_login (struct aim_session_t *sess, - struct aim_conn_t *conn, - char *sn, char *password, struct client_info_s *clientinfo, - char *key) +faim_export int aim_send_login (struct aim_session_t *sess, + struct aim_conn_t *conn, + char *sn, char *password, + struct client_info_s *clientinfo, + char *key) { int curbyte=0; md5_byte_t digest[16]; @@ -100,7 +101,7 @@ curbyte+= aim_puttlv_str(newpacket->data+curbyte, 0x0001, strlen(sn), sn); aim_encode_password_md5(password, key, digest); - curbyte+= aim_puttlv_str(newpacket->data+curbyte, 0x0025, 16, digest); + curbyte+= aim_puttlv_str(newpacket->data+curbyte, 0x0025, 16, (char *)digest); /* XXX is clientstring required by oscar? */ if (strlen(clientinfo->clientstring)) @@ -197,8 +198,8 @@ * its nonzero, there was an error. * */ -int aim_authparse(struct aim_session_t *sess, - struct command_rx_struct *command) +faim_internal int aim_authparse(struct aim_session_t *sess, + struct command_rx_struct *command) { struct aim_tlvlist_t *tlvlist; int ret = 1; @@ -298,7 +299,7 @@ * Calls the client, which should then use the value to call aim_send_login. * */ -int aim_authkeyparse(struct aim_session_t *sess, struct command_rx_struct *command) +faim_internal int aim_authkeyparse(struct aim_session_t *sess, struct command_rx_struct *command) { unsigned char *key; int keylen; @@ -312,7 +313,7 @@ key[keylen] = '\0'; if ((userfunc = aim_callhandler(command->conn, 0x0017, 0x0007))) - ret = userfunc(sess, command, key); + ret = userfunc(sess, command, (char *)key); free(key); @@ -325,11 +326,11 @@ * You probably don't want this unless you're writing an AIM server. * */ -unsigned long aim_sendauthresp(struct aim_session_t *sess, - struct aim_conn_t *conn, - char *sn, char *bosip, - char *cookie, char *email, - int regstatus) +faim_export unsigned long aim_sendauthresp(struct aim_session_t *sess, + struct aim_conn_t *conn, + char *sn, char *bosip, + char *cookie, char *email, + int regstatus) { struct command_tx_struct *tx; struct aim_tlvlist_t *tlvlist = NULL; @@ -362,7 +363,7 @@ /* * Generate a random cookie. (Non-client use only) */ -int aim_gencookie(unsigned char *buf) +faim_export int aim_gencookie(unsigned char *buf) { int i; @@ -377,7 +378,7 @@ /* * Send Server Ready. (Non-client) */ -int aim_sendserverready(struct aim_session_t *sess, struct aim_conn_t *conn) +faim_export int aim_sendserverready(struct aim_session_t *sess, struct aim_conn_t *conn) { struct command_tx_struct *tx; int i = 0; @@ -411,11 +412,11 @@ /* * Send service redirect. (Non-Client) */ -unsigned long aim_sendredirect(struct aim_session_t *sess, - struct aim_conn_t *conn, - unsigned short servid, - char *ip, - char *cookie) +faim_export unsigned long aim_sendredirect(struct aim_session_t *sess, + struct aim_conn_t *conn, + unsigned short servid, + char *ip, + char *cookie) { struct command_tx_struct *tx; struct aim_tlvlist_t *tlvlist = NULL;
--- a/libfaim/aim_meta.c Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/aim_meta.c Mon Sep 04 23:37:32 2000 +0000 @@ -10,17 +10,17 @@ #include <faim/aim.h> /* #include <aim_buildcode.h> generated by mkbuildinfo.sh */ -char *aim_getbuilddate(void) +faim_export char *aim_getbuilddate(void) { return AIM_BUILDDATE; } -char *aim_getbuildtime(void) +faim_export char *aim_getbuildtime(void) { return AIM_BUILDTIME; } -char *aim_getbuildstring(void) +faim_export char *aim_getbuildstring(void) { static char string[100]; @@ -33,3 +33,21 @@ return string; } +#if debug > 0 +faim_internal void faimdprintf(int dlevel, const char *format, ...) +{ + if (dlevel >= debug) { + va_list ap; + + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + } + return; +} +#else +faim_internal void faimdprintf(int dlevel, const char *format, ...) +{ + return; +} +#endif
--- a/libfaim/aim_msgcookie.c Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/aim_msgcookie.c Mon Sep 04 23:37:32 2000 +0000 @@ -26,8 +26,8 @@ * * returns -1 on error, 0 on success. */ -int aim_cachecookie(struct aim_session_t *sess, - struct aim_msgcookie_t *cookie) +faim_internal int aim_cachecookie(struct aim_session_t *sess, + struct aim_msgcookie_t *cookie) { struct aim_msgcookie_t *newcook = NULL, *cur = NULL; @@ -80,7 +80,7 @@ * NULL on not found. */ -struct aim_msgcookie_t *aim_uncachecookie(struct aim_session_t *sess, char *cookie, int type) +faim_internal struct aim_msgcookie_t *aim_uncachecookie(struct aim_session_t *sess, unsigned char *cookie, int type) { struct aim_msgcookie_t *cur; @@ -120,7 +120,7 @@ * i'll avoid the puns. */ -int aim_purgecookies(struct aim_session_t *sess, int maxage) +faim_export int aim_purgecookies(struct aim_session_t *sess, int maxage) { struct aim_msgcookie_t *cur; struct aim_msgcookie_t *remed = NULL; @@ -153,7 +153,7 @@ return 0; } -struct aim_msgcookie_t *aim_mkcookie(unsigned char *c, int type, void *data) +faim_internal struct aim_msgcookie_t *aim_mkcookie(unsigned char *c, int type, void *data) { struct aim_msgcookie_t *cookie; @@ -172,7 +172,7 @@ return(cookie); } -struct aim_msgcookie_t *aim_checkcookie(struct aim_session_t *sess, char *cookie, int type) +faim_internal struct aim_msgcookie_t *aim_checkcookie(struct aim_session_t *sess, unsigned char *cookie, int type) { struct aim_msgcookie_t *cur; @@ -191,11 +191,11 @@ return(NULL); } -int aim_freecookie(struct aim_msgcookie_t *cookie) { +static int aim_freecookie(struct aim_msgcookie_t *cookie) { return(0); } -int aim_msgcookie_gettype(int reqclass) { +faim_internal int aim_msgcookie_gettype(int reqclass) { /* XXX: hokey-assed. needs fixed. */ switch(reqclass) { case AIM_CAPS_BUDDYICON:
--- a/libfaim/aim_rxhandlers.c Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/aim_rxhandlers.c Mon Sep 04 23:37:32 2000 +0000 @@ -13,7 +13,7 @@ * Bleck functions get called when there's no non-bleck functions * around to cleanup the mess... */ -int bleck(struct aim_session_t *sess,struct command_rx_struct *workingPtr, ...) +faim_internal int bleck(struct aim_session_t *sess,struct command_rx_struct *workingPtr, ...) { u_short family; u_short subtype; @@ -181,7 +181,7 @@ return 1; } -int aim_conn_addhandler(struct aim_session_t *sess, +faim_export int aim_conn_addhandler(struct aim_session_t *sess, struct aim_conn_t *conn, u_short family, u_short type, @@ -218,7 +218,7 @@ return 0; } -int aim_clearhandlers(struct aim_conn_t *conn) +faim_export int aim_clearhandlers(struct aim_conn_t *conn) { struct aim_rxcblist_t *cur,*tmp; if (!conn) @@ -234,9 +234,9 @@ return 0; } -rxcallback_t aim_callhandler(struct aim_conn_t *conn, - u_short family, - u_short type) +faim_internal rxcallback_t aim_callhandler(struct aim_conn_t *conn, + u_short family, + u_short type) { struct aim_rxcblist_t *cur; @@ -258,11 +258,11 @@ return aim_callhandler(conn, family, 0xffff); } -int aim_callhandler_noparam(struct aim_session_t *sess, - struct aim_conn_t *conn, - u_short family, - u_short type, - struct command_rx_struct *ptr) +faim_internal int aim_callhandler_noparam(struct aim_session_t *sess, + struct aim_conn_t *conn, + u_short family, + u_short type, + struct command_rx_struct *ptr) { rxcallback_t userfunc = NULL; userfunc = aim_callhandler(conn, family, type); @@ -294,7 +294,7 @@ TODO: Allow for NULL handlers. */ -int aim_rxdispatch(struct aim_session_t *sess) +faim_export int aim_rxdispatch(struct aim_session_t *sess) { int i = 0; struct command_rx_struct *workingPtr = NULL; @@ -376,8 +376,8 @@ /* Old login protocol */ /* any user callbacks will be called from here */ workingPtr->handled = aim_authparse(sess, workingPtr); +#endif break; -#endif } } break; @@ -614,7 +614,7 @@ return 0; } -int aim_parse_msgack_middle(struct aim_session_t *sess, struct command_rx_struct *command) +faim_internal int aim_parse_msgack_middle(struct aim_session_t *sess, struct command_rx_struct *command) { rxcallback_t userfunc = NULL; char sn[MAXSNLEN]; @@ -630,7 +630,7 @@ i++; memset(sn, 0, sizeof(sn)); - strncpy(sn, command->data+i, snlen); + strncpy(sn, (char *)command->data+i, snlen); if ((userfunc = aim_callhandler(command->conn, 0x0004, 0x000c))) ret = userfunc(sess, command, type, sn); @@ -638,7 +638,7 @@ return ret; } -int aim_parse_ratechange_middle(struct aim_session_t *sess, struct command_rx_struct *command) +faim_internal int aim_parse_ratechange_middle(struct aim_session_t *sess, struct command_rx_struct *command) { rxcallback_t userfunc = NULL; int ret = 1; @@ -657,7 +657,7 @@ return ret; } -int aim_parse_evilnotify_middle(struct aim_session_t *sess, struct command_rx_struct *command) +faim_internal int aim_parse_evilnotify_middle(struct aim_session_t *sess, struct command_rx_struct *command) { rxcallback_t userfunc = NULL; int ret = 1, pos; @@ -682,8 +682,8 @@ return ret; } -int aim_parsemotd_middle(struct aim_session_t *sess, - struct command_rx_struct *command, ...) +faim_internal int aim_parsemotd_middle(struct aim_session_t *sess, + struct command_rx_struct *command, ...) { rxcallback_t userfunc = NULL; char *msg; @@ -724,12 +724,12 @@ return ret; } -int aim_handleredirect_middle(struct aim_session_t *sess, +faim_internal int aim_handleredirect_middle(struct aim_session_t *sess, struct command_rx_struct *command, ...) { struct aim_tlv_t *tmptlv = NULL; int serviceid = 0x00; - char cookie[AIM_COOKIELEN]; + unsigned char cookie[AIM_COOKIELEN]; char *ip = NULL; rxcallback_t userfunc = NULL; struct aim_tlvlist_t *tlvlist; @@ -791,8 +791,8 @@ return ret; } -int aim_parse_unknown(struct aim_session_t *sess, - struct command_rx_struct *command, ...) +faim_internal int aim_parse_unknown(struct aim_session_t *sess, + struct command_rx_struct *command, ...) { u_int i = 0; @@ -812,8 +812,8 @@ } -int aim_negchan_middle(struct aim_session_t *sess, - struct command_rx_struct *command) +faim_internal int aim_negchan_middle(struct aim_session_t *sess, + struct command_rx_struct *command) { struct aim_tlvlist_t *tlvlist; char *msg = NULL; @@ -847,8 +847,8 @@ * Middle handler for 0x0001 snac of each family. * */ -int aim_parse_generalerrs(struct aim_session_t *sess, - struct command_rx_struct *command, ...) +faim_internal int aim_parse_generalerrs(struct aim_session_t *sess, + struct command_rx_struct *command, ...) { u_short family; u_short subtype;
--- a/libfaim/aim_rxqueue.c Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/aim_rxqueue.c Mon Sep 04 23:37:32 2000 +0000 @@ -7,12 +7,46 @@ */ #include <faim/aim.h> +#include <sys/socket.h> + +/* + * Since not all implementations support MSG_WAITALL, define + * an alternate guarenteed read function... + * + * We keep recv() for systems that can do it because it means + * a single system call for the entire packet, where read may + * take more for a badly fragmented packet. + * + */ +static int aim_recv(int fd, void *buf, size_t count) +{ +#ifdef MSG_WAITALL + return recv(fd, buf, count, MSG_WAITALL); +#else + int left, ret, cur = 0; + + left = count; + + while (left) { + ret = read(fd, ((unsigned char *)buf)+cur, left); + if (ret == -1) + return -1; + if (ret == 0) + return cur; + + cur += ret; + left -= ret; + } + + return cur; +#endif +} /* * Grab a single command sequence off the socket, and enqueue * it in the incoming event queue in a seperate struct. */ -int aim_get_command(struct aim_session_t *sess, struct aim_conn_t *conn) +faim_export int aim_get_command(struct aim_session_t *sess, struct aim_conn_t *conn) { unsigned char generic[6]; struct command_rx_struct *newrx = NULL; @@ -41,7 +75,7 @@ * 4 short -- Number of data bytes that follow. */ faim_mutex_lock(&conn->active); - if (recv(conn->fd, generic, 6, MSG_WAITALL) < 6){ + if (aim_recv(conn->fd, generic, 6) < 6){ aim_conn_close(conn); faim_mutex_unlock(&conn->active); return -1; @@ -89,7 +123,7 @@ } /* read the data portion of the packet */ - if (recv(conn->fd, newrx->data, newrx->commandlen, MSG_WAITALL) < newrx->commandlen){ + if (aim_recv(conn->fd, newrx->data, newrx->commandlen) < newrx->commandlen){ free(newrx->data); free(newrx); aim_conn_close(conn); @@ -136,7 +170,7 @@ * does not keep a pointer, it's lost forever. * */ -void aim_purge_rxqueue(struct aim_session_t *sess) +faim_export void aim_purge_rxqueue(struct aim_session_t *sess) { struct command_rx_struct *cur = NULL; struct command_rx_struct *tmp; @@ -194,7 +228,7 @@ * XXX: this is something that was handled better in the old connection * handling method, but eh. */ -void aim_rxqueue_cleanbyconn(struct aim_session_t *sess, struct aim_conn_t *conn) +faim_internal void aim_rxqueue_cleanbyconn(struct aim_session_t *sess, struct aim_conn_t *conn) { struct command_rx_struct *currx;
--- a/libfaim/aim_search.c Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/aim_search.c Mon Sep 04 23:37:32 2000 +0000 @@ -8,9 +8,9 @@ #include <faim/aim.h> -u_long aim_usersearch_address(struct aim_session_t *sess, - struct aim_conn_t *conn, - char *address) +faim_export unsigned long aim_usersearch_address(struct aim_session_t *sess, + struct aim_conn_t *conn, + char *address) { struct command_tx_struct *newpacket;
--- a/libfaim/aim_snac.c Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/aim_snac.c Mon Sep 04 23:37:32 2000 +0000 @@ -18,7 +18,7 @@ /* * Called from aim_session_init() to initialize the hash. */ -void aim_initsnachash(struct aim_session_t *sess) +faim_internal void aim_initsnachash(struct aim_session_t *sess) { int i; @@ -34,8 +34,8 @@ * Clones the passed snac structure and caches it in the * list/hash. */ -u_long aim_newsnac(struct aim_session_t *sess, - struct aim_snac_t *newsnac) +faim_internal unsigned long aim_newsnac(struct aim_session_t *sess, + struct aim_snac_t *newsnac) { struct aim_snac_t *snac = NULL; int index; @@ -56,8 +56,6 @@ sess->snac_hash[index] = snac; faim_mutex_unlock(&sess->snac_hash_locks[index]); - printf("faim: cached snac %lx\n", snac->id); - return(snac->id); } @@ -68,8 +66,8 @@ * The returned structure must be freed by the caller. * */ -struct aim_snac_t *aim_remsnac(struct aim_session_t *sess, - u_long id) +faim_internal struct aim_snac_t *aim_remsnac(struct aim_session_t *sess, + u_long id) { struct aim_snac_t *cur = NULL; int index; @@ -108,8 +106,8 @@ * maxage is the _minimum_ age in seconds to keep SNACs. * */ -int aim_cleansnacs(struct aim_session_t *sess, - int maxage) +faim_internal int aim_cleansnacs(struct aim_session_t *sess, + int maxage) { struct aim_snac_t *cur, *next, *prev = NULL; time_t curtime; @@ -133,8 +131,6 @@ else prev->next = next; - printf("faim: killing ancient snac %lx (%lx)\n", cur->id, curtime - cur->issuetime); - /* XXX should we have destructors here? */ if (cur->data) free(cur->data); @@ -152,7 +148,7 @@ return 0; } -int aim_putsnac(u_char *buf, int family, int subtype, int flags, u_long snacid) +faim_internal int aim_putsnac(u_char *buf, int family, int subtype, int flags, u_long snacid) { int curbyte = 0; curbyte += aimutil_put16(buf+curbyte, (u_short)(family&0xffff));
--- a/libfaim/aim_tlv.c Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/aim_tlv.c Mon Sep 04 23:37:32 2000 +0000 @@ -1,6 +1,6 @@ #include <faim/aim.h> -struct aim_tlvlist_t *aim_readtlvchain(u_char *buf, int maxlen) +faim_internal struct aim_tlvlist_t *aim_readtlvchain(u_char *buf, int maxlen) { int pos; struct aim_tlvlist_t *list; @@ -62,7 +62,7 @@ return list; } -void aim_freetlvchain(struct aim_tlvlist_t **list) +faim_internal void aim_freetlvchain(struct aim_tlvlist_t **list) { struct aim_tlvlist_t *cur, *cur2; @@ -81,7 +81,7 @@ return; } -int aim_counttlvchain(struct aim_tlvlist_t **list) +faim_internal int aim_counttlvchain(struct aim_tlvlist_t **list) { struct aim_tlvlist_t *cur; int count = 0; @@ -95,7 +95,7 @@ return count; } -int aim_addtlvtochain_str(struct aim_tlvlist_t **list, unsigned short type, char *str, int len) +faim_internal int aim_addtlvtochain_str(struct aim_tlvlist_t **list, unsigned short type, char *str, int len) { struct aim_tlvlist_t *new; struct aim_tlvlist_t *cur; @@ -126,7 +126,7 @@ return new->tlv->length; } -int aim_addtlvtochain16(struct aim_tlvlist_t **list, unsigned short type, unsigned short val) +faim_internal int aim_addtlvtochain16(struct aim_tlvlist_t **list, unsigned short type, unsigned short val) { struct aim_tlvlist_t *new; struct aim_tlvlist_t *cur; @@ -157,7 +157,7 @@ return 2; } -int aim_addtlvtochain32(struct aim_tlvlist_t **list, unsigned short type, unsigned long val) +faim_internal int aim_addtlvtochain32(struct aim_tlvlist_t **list, unsigned short type, unsigned long val) { struct aim_tlvlist_t *new; struct aim_tlvlist_t *cur; @@ -188,7 +188,7 @@ return 4; } -int aim_writetlvchain(u_char *buf, int buflen, struct aim_tlvlist_t **list) +faim_internal int aim_writetlvchain(u_char *buf, int buflen, struct aim_tlvlist_t **list) { int goodbuflen = 0; int i = 0; @@ -221,7 +221,7 @@ /* * Grab the Nth TLV of type type in the TLV list list. */ -struct aim_tlv_t *aim_gettlv(struct aim_tlvlist_t *list, u_short type, int nth) +faim_internal struct aim_tlv_t *aim_gettlv(struct aim_tlvlist_t *list, u_short type, int nth) { int i; struct aim_tlvlist_t *cur; @@ -240,7 +240,7 @@ return NULL; } -char *aim_gettlv_str(struct aim_tlvlist_t *list, u_short type, int nth) +faim_internal char *aim_gettlv_str(struct aim_tlvlist_t *list, u_short type, int nth) { struct aim_tlv_t *tlv; char *newstr; @@ -255,7 +255,7 @@ return newstr; } -struct aim_tlv_t *aim_grabtlv(u_char *src) +faim_internal struct aim_tlv_t *aim_grabtlv(u_char *src) { struct aim_tlv_t *dest = NULL; @@ -275,7 +275,7 @@ return dest; } -struct aim_tlv_t *aim_grabtlvstr(u_char *src) +faim_internal struct aim_tlv_t *aim_grabtlvstr(u_char *src) { struct aim_tlv_t *dest = NULL; @@ -296,7 +296,7 @@ return dest; } -int aim_puttlv (u_char *dest, struct aim_tlv_t *newtlv) +faim_internal int aim_puttlv(u_char *dest, struct aim_tlv_t *newtlv) { int i=0; @@ -309,7 +309,7 @@ return i; } -struct aim_tlv_t *aim_createtlv(void) +faim_internal struct aim_tlv_t *aim_createtlv(void) { struct aim_tlv_t *newtlv = NULL; newtlv = (struct aim_tlv_t *)malloc(sizeof(struct aim_tlv_t)); @@ -317,7 +317,7 @@ return newtlv; } -int aim_freetlv(struct aim_tlv_t **oldtlv) +faim_internal int aim_freetlv(struct aim_tlv_t **oldtlv) { if (!oldtlv) return -1; @@ -331,7 +331,7 @@ return 0; } -int aim_puttlv_16(u_char *buf, u_short t, u_short v) +faim_internal int aim_puttlv_16(u_char *buf, u_short t, u_short v) { int curbyte=0; curbyte += aimutil_put16(buf+curbyte, (u_short)(t&0xffff)); @@ -340,7 +340,7 @@ return curbyte; } -int aim_puttlv_32(u_char *buf, u_short t, u_long v) +faim_internal int aim_puttlv_32(u_char *buf, u_short t, u_long v) { int curbyte=0; curbyte += aimutil_put16(buf+curbyte, (u_short)(t&0xffff)); @@ -349,7 +349,7 @@ return curbyte; } -int aim_puttlv_str(u_char *buf, u_short t, u_short l, u_char *v) +faim_internal int aim_puttlv_str(u_char *buf, u_short t, u_short l, char *v) { int curbyte; @@ -357,7 +357,7 @@ curbyte += aimutil_put16(buf+curbyte, (u_short)(t&0xffff)); curbyte += aimutil_put16(buf+curbyte, (u_short)(l&0xffff)); if (v) - memcpy(buf+curbyte, v, l); + memcpy(buf+curbyte, (unsigned char *)v, l); curbyte += l; return curbyte; }
--- a/libfaim/aim_txqueue.c Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/aim_txqueue.c Mon Sep 04 23:37:32 2000 +0000 @@ -19,7 +19,7 @@ * chan = channel for OSCAR, hdrtype for OFT * */ -struct command_tx_struct *aim_tx_new(unsigned short framing, int chan, struct aim_conn_t *conn, int datalen) +faim_internal struct command_tx_struct *aim_tx_new(unsigned short framing, int chan, struct aim_conn_t *conn, int datalen) { struct command_tx_struct *new; @@ -70,8 +70,8 @@ * that is, when sess->tx_enqueue is set to &aim_tx_enqueue__queuebased. * */ -int aim_tx_enqueue__queuebased(struct aim_session_t *sess, - struct command_tx_struct *newpacket) +faim_internal int aim_tx_enqueue__queuebased(struct aim_session_t *sess, + struct command_tx_struct *newpacket) { struct command_tx_struct *cur; @@ -122,7 +122,7 @@ * right here. * */ -int aim_tx_enqueue__immediate(struct aim_session_t *sess, struct command_tx_struct *newpacket) +faim_internal int aim_tx_enqueue__immediate(struct aim_session_t *sess, struct command_tx_struct *newpacket) { if (newpacket->conn == NULL) { faimdprintf(1, "aim_tx_enqueue: ERROR: packet has no connection\n"); @@ -156,7 +156,7 @@ * before enqueuement (in aim_tx_enqueue()). * */ -u_int aim_get_next_txseqnum(struct aim_conn_t *conn) +faim_internal unsigned int aim_get_next_txseqnum(struct aim_conn_t *conn) { u_int ret; @@ -175,7 +175,7 @@ * */ #if debug == 2 -int aim_tx_printqueue(struct aim_session_t *sess) +faim_internal int aim_tx_printqueue(struct aim_session_t *sess) { struct command_tx_struct *cur; @@ -225,7 +225,7 @@ * 9) Step to next struct in list and go back to 1. * */ -int aim_tx_sendframe(struct aim_session_t *sess, struct command_tx_struct *cur) +faim_internal int aim_tx_sendframe(struct aim_session_t *sess, struct command_tx_struct *cur) { int buflen = 0; unsigned char *curPacket; @@ -327,7 +327,7 @@ return 1; /* success */ } -int aim_tx_flushqueue(struct aim_session_t *sess) +faim_export int aim_tx_flushqueue(struct aim_session_t *sess) { struct command_tx_struct *cur; @@ -371,7 +371,7 @@ * reduce memory footprint at run time! * */ -void aim_tx_purgequeue(struct aim_session_t *sess) +faim_export void aim_tx_purgequeue(struct aim_session_t *sess) { struct command_tx_struct *cur = NULL; struct command_tx_struct *tmp;
--- a/libfaim/aim_util.c Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/aim_util.c Mon Sep 04 23:37:32 2000 +0000 @@ -7,18 +7,16 @@ #include <faim/aim.h> #include <ctype.h> -#define AIMUTIL_USEMACROS - #ifdef AIMUTIL_USEMACROS /* macros in faim/aim.h */ #else -inline int aimutil_put8(u_char *buf, u_char data) +faim_shortfunc int aimutil_put8(u_char *buf, u_char data) { buf[0] = (u_char)data&0xff; return 1; } -inline u_char aimutil_get8(u_char *buf) +faim_shortfunc u_char aimutil_get8(u_char *buf) { return buf[0]; } @@ -26,14 +24,14 @@ /* * Endian-ness issues here? */ -inline int aimutil_put16(u_char *buf, u_short data) +faim_shortfunc int aimutil_put16(u_char *buf, u_short data) { buf[0] = (u_char)(data>>8)&0xff; buf[1] = (u_char)(data)&0xff; return 2; } -inline u_short aimutil_get16(u_char *buf) +faim_shortfunc u_short aimutil_get16(u_char *buf) { u_short val; val = (buf[0] << 8) & 0xff00; @@ -41,7 +39,7 @@ return val; } -inline int aimutil_put32(u_char *buf, u_long data) +faim_shortfunc int aimutil_put32(u_char *buf, u_long data) { buf[0] = (u_char)(data>>24)&0xff; buf[1] = (u_char)(data>>16)&0xff; @@ -50,7 +48,7 @@ return 4; } -inline u_long aimutil_get32(u_char *buf) +faim_shortfunc u_long aimutil_get32(u_char *buf) { u_long val; val = (buf[0] << 24) & 0xff000000; @@ -61,7 +59,7 @@ } #endif /* AIMUTIL_USEMACROS */ -inline int aimutil_putstr(u_char *dest, const u_char *src, int len) +faim_export faim_shortfunc int aimutil_putstr(u_char *dest, const char *src, int len) { memcpy(dest, src, len); return len; @@ -72,7 +70,7 @@ * -- DMP. * */ -int aimutil_tokslen(char *toSearch, int index, char dl) +faim_export int aimutil_tokslen(char *toSearch, int index, char dl) { int curCount = 1; char *next; @@ -97,7 +95,7 @@ return toReturn; } -int aimutil_itemcnt(char *toSearch, char dl) +faim_export int aimutil_itemcnt(char *toSearch, char dl) { int curCount; char *next; @@ -115,7 +113,7 @@ return curCount; } -char *aimutil_itemidx(char *toSearch, int index, char dl) +faim_export char *aimutil_itemidx(char *toSearch, int index, char dl) { int curCount; char *next; @@ -171,7 +169,7 @@ * return is equal to that of strlen(). * */ -int aim_snlen(const char *sn) +faim_export int aim_snlen(const char *sn) { int i = 0; const char *curPtr = NULL; @@ -202,7 +200,7 @@ * */ -int aim_sncmp(const char *sn1, const char *sn2) +faim_export int aim_sncmp(const char *sn1, const char *sn2) { const char *curPtr1 = NULL, *curPtr2 = NULL; @@ -227,3 +225,41 @@ return 0; } + +/* strsep Copyright (C) 1992, 1993 Free Software Foundation, Inc. + strsep is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, write to the Free Software Foundation, Inc., 675 Mass Ave, + Cambridge, MA 02139, USA. */ + +/* Minor changes by and1000 on 15/1/97 to make it go under Nemesis */ + +faim_export char *aim_strsep(char **pp, const char *delim) +{ + char *p, *q; + + if (!(p = *pp)) + return 0; + + if ((q = strpbrk (p, delim))) + { + *pp = q + 1; + *q = '\0'; + } + else + *pp = 0; + + return p; +}
--- a/libfaim/faim/aim.h Mon Sep 04 01:15:38 2000 +0000 +++ b/libfaim/faim/aim.h Mon Sep 04 23:37:32 2000 +0000 @@ -30,9 +30,6 @@ #include <time.h> #include <io.h> #else -#include <netdb.h> -#include <sys/socket.h> -#include <netinet/in.h> #include <sys/time.h> #include <unistd.h> #endif @@ -70,9 +67,31 @@ #define gethostbyname(x) gethostbyname2(x, AF_INET) #endif -#if !defined(MSG_WAITALL) -#warning FIX YOUR LIBC! MSG_WAITALL is required! -#define MSG_WAITALL 0x100 +#if defined(_WIN32) || defined(STRICT_ANSI) +#define faim_shortfunc +#else +#define faim_shortfunc inline +#endif + +#if defined(_WIN32) +/* + * For a win32 DLL, we define WIN32_INDLL if this file + * is included while compiling the DLL. If its not + * defined (its included in a client app), the symbols + * will be imported instead of exported. + */ +#ifdef WIN32_INDLL +#define faim_export __declspec(dllexport) +#else +#define faim_export __declspec(dllimport) +#endif /* WIN32_INDLL */ +#define faim_internal +#else +/* + * Nothing normally needed for unix... + */ +#define faim_export +#define faim_internal #endif /* @@ -117,12 +136,6 @@ #define AIM_MD5_STRING "AOL Instant Messenger (SM)" -#if debug > 0 -#define faimdprintf(l, x...) {if (l >= debug) printf(x); } -#else -#define faimdprintf(l, x...) -#endif - /* * Login info. Passes information from the Authorization * stage of login to the service (BOS, etc) connection @@ -132,7 +145,7 @@ struct aim_login_struct { char screen_name[MAXSNLEN+1]; char *BOSIP; - char cookie[AIM_COOKIELEN]; + unsigned char cookie[AIM_COOKIELEN]; char *email; u_short regstatus; char *errorurl; @@ -362,36 +375,36 @@ }; /* TLV-handling functions */ -struct aim_tlvlist_t *aim_readtlvchain(u_char *buf, int maxlen); -void aim_freetlvchain(struct aim_tlvlist_t **list); -struct aim_tlv_t *aim_grabtlv(u_char *src); -struct aim_tlv_t *aim_grabtlvstr(u_char *src); -struct aim_tlv_t *aim_gettlv(struct aim_tlvlist_t *, u_short, int); -char *aim_gettlv_str(struct aim_tlvlist_t *, u_short, int); -int aim_puttlv (u_char *dest, struct aim_tlv_t *newtlv); -struct aim_tlv_t *aim_createtlv(void); -int aim_freetlv(struct aim_tlv_t **oldtlv); -int aim_puttlv_16(u_char *, u_short, u_short); -int aim_puttlv_32(u_char *, u_short, u_long); -int aim_puttlv_str(u_char *buf, u_short t, u_short l, u_char *v); -int aim_writetlvchain(u_char *buf, int buflen, struct aim_tlvlist_t **list); -int aim_addtlvtochain16(struct aim_tlvlist_t **list, unsigned short type, unsigned short val); -int aim_addtlvtochain32(struct aim_tlvlist_t **list, unsigned short type, unsigned long val); -int aim_addtlvtochain_str(struct aim_tlvlist_t **list, unsigned short type, char *str, int len); -int aim_counttlvchain(struct aim_tlvlist_t **list); +faim_internal struct aim_tlvlist_t *aim_readtlvchain(u_char *buf, int maxlen); +faim_internal void aim_freetlvchain(struct aim_tlvlist_t **list); +faim_internal struct aim_tlv_t *aim_grabtlv(u_char *src); +faim_internal struct aim_tlv_t *aim_grabtlvstr(u_char *src); +faim_internal struct aim_tlv_t *aim_gettlv(struct aim_tlvlist_t *, u_short, int); +faim_internal char *aim_gettlv_str(struct aim_tlvlist_t *, u_short, int); +faim_internal int aim_puttlv (u_char *dest, struct aim_tlv_t *newtlv); +faim_internal struct aim_tlv_t *aim_createtlv(void); +faim_internal int aim_freetlv(struct aim_tlv_t **oldtlv); +faim_internal int aim_puttlv_16(u_char *, u_short, u_short); +faim_internal int aim_puttlv_32(u_char *, u_short, u_long); +faim_internal int aim_puttlv_str(u_char *buf, u_short t, u_short l, char *v); +faim_internal int aim_writetlvchain(u_char *buf, int buflen, struct aim_tlvlist_t **list); +faim_internal int aim_addtlvtochain16(struct aim_tlvlist_t **list, unsigned short type, unsigned short val); +faim_internal int aim_addtlvtochain32(struct aim_tlvlist_t **list, unsigned short type, unsigned long val); +faim_internal int aim_addtlvtochain_str(struct aim_tlvlist_t **list, unsigned short type, char *str, int len); +faim_internal int aim_counttlvchain(struct aim_tlvlist_t **list); /* * Get command from connections / Dispatch commands * already in queue. */ -int aim_get_command(struct aim_session_t *, struct aim_conn_t *); +faim_export int aim_get_command(struct aim_session_t *, struct aim_conn_t *); int aim_rxdispatch(struct aim_session_t *); u_long aim_debugconn_sendconnect(struct aim_session_t *sess, struct aim_conn_t *conn); int aim_logoff(struct aim_session_t *); -void aim_conn_kill(struct aim_session_t *sess, struct aim_conn_t **deadconn); +faim_export void aim_conn_kill(struct aim_session_t *sess, struct aim_conn_t **deadconn); typedef int (*rxcallback_t)(struct aim_session_t *, struct command_rx_struct *, ...); int aim_register_callbacks(rxcallback_t *); @@ -400,42 +413,34 @@ u_long aim_genericreq_l(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype, u_long *); u_long aim_genericreq_s(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype, u_short *); -struct aim_fileheader_t *aim_oft_getfh(char *hdr); +faim_internal struct aim_fileheader_t *aim_oft_getfh(unsigned char *hdr); /* 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 *, char *key); -unsigned long aim_sendauthresp(struct aim_session_t *sess, - struct aim_conn_t *conn, - char *sn, char *bosip, - char *cookie, char *email, - 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, - char *ip, - char *cookie); -void aim_purge_rxqueue(struct aim_session_t *); -void aim_rxqueue_cleanbyconn(struct aim_session_t *sess, struct aim_conn_t *conn); +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_send_login (struct aim_session_t *, struct aim_conn_t *, char *, char *, struct client_info_s *, char *key); +faim_export unsigned long aim_sendauthresp(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn, char *bosip, char *cookie, char *email, int regstatus); +faim_export int aim_gencookie(unsigned char *buf); +faim_export int aim_sendserverready(struct aim_session_t *sess, struct aim_conn_t *conn); +faim_internal int aim_authkeyparse(struct aim_session_t *sess, struct command_rx_struct *command); +faim_export unsigned long aim_sendredirect(struct aim_session_t *sess, struct aim_conn_t *conn, unsigned short servid, char *ip, char *cookie); +faim_export void aim_purge_rxqueue(struct aim_session_t *); +faim_internal void aim_rxqueue_cleanbyconn(struct aim_session_t *sess, struct aim_conn_t *conn); int aim_parse_unknown(struct aim_session_t *, struct command_rx_struct *command, ...); int aim_parse_missed_im(struct aim_session_t *, struct command_rx_struct *, ...); int aim_parse_last_bad(struct aim_session_t *, struct command_rx_struct *, ...); -int aim_get_command_rendezvous(struct aim_session_t *sess, struct aim_conn_t *conn); +faim_internal int aim_get_command_rendezvous(struct aim_session_t *sess, struct aim_conn_t *conn); -struct command_tx_struct *aim_tx_new(unsigned short framing, int chan, struct aim_conn_t *conn, int datalen); -int aim_tx_enqueue__queuebased(struct aim_session_t *, struct command_tx_struct *); -int aim_tx_enqueue__immediate(struct aim_session_t *, struct command_tx_struct *); +faim_internal struct command_tx_struct *aim_tx_new(unsigned short framing, int chan, struct aim_conn_t *conn, int datalen); +faim_internal int aim_tx_enqueue__queuebased(struct aim_session_t *, struct command_tx_struct *); +faim_internal int aim_tx_enqueue__immediate(struct aim_session_t *, struct command_tx_struct *); #define aim_tx_enqueue(x, y) ((*(x->tx_enqueue))(x, y)) -int aim_tx_sendframe(struct aim_session_t *sess, struct command_tx_struct *cur); -u_int aim_get_next_txseqnum(struct aim_conn_t *); -int aim_tx_flushqueue(struct aim_session_t *); -int aim_tx_printqueue(struct aim_session_t *); -void aim_tx_purgequeue(struct aim_session_t *); +faim_internal int aim_tx_sendframe(struct aim_session_t *sess, struct command_tx_struct *cur); +faim_internal unsigned int aim_get_next_txseqnum(struct aim_conn_t *); +faim_export int aim_tx_flushqueue(struct aim_session_t *); +faim_internal int aim_tx_printqueue(struct aim_session_t *); +faim_export void aim_tx_purgequeue(struct aim_session_t *); struct aim_rxcblist_t { u_short family; @@ -445,11 +450,11 @@ struct aim_rxcblist_t *next; }; -int aim_conn_setlatency(struct aim_conn_t *conn, int newval); +faim_export int aim_conn_setlatency(struct aim_conn_t *conn, int newval); -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); -rxcallback_t aim_callhandler(struct aim_conn_t *conn, u_short family, u_short type); -int aim_clearhandlers(struct aim_conn_t *conn); +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_internal rxcallback_t aim_callhandler(struct aim_conn_t *conn, u_short family, u_short type); +faim_export int aim_clearhandlers(struct aim_conn_t *conn); /* * Generic SNAC structure. Rarely if ever used. @@ -463,23 +468,23 @@ 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); -int aim_putsnac(u_char *, int, int, int, u_long); +faim_internal void aim_initsnachash(struct aim_session_t *sess); +faim_internal unsigned long aim_newsnac(struct aim_session_t *, struct aim_snac_t *newsnac); +faim_internal struct aim_snac_t *aim_remsnac(struct aim_session_t *, u_long id); +faim_internal int aim_cleansnacs(struct aim_session_t *, int maxage); +faim_internal int aim_putsnac(u_char *, int, int, int, u_long); -void aim_connrst(struct aim_session_t *); -struct aim_conn_t *aim_conn_getnext(struct aim_session_t *); -void aim_conn_close(struct aim_conn_t *deadconn); -struct aim_conn_t *aim_getconn_type(struct aim_session_t *, int type); -struct aim_conn_t *aim_newconn(struct aim_session_t *, int type, char *dest); -int aim_conngetmaxfd(struct aim_session_t *); -struct aim_conn_t *aim_select(struct aim_session_t *, struct timeval *, int *); -int aim_conn_isready(struct aim_conn_t *); -int aim_conn_setstatus(struct aim_conn_t *, int); -void aim_session_init(struct aim_session_t *); +faim_internal void aim_connrst(struct aim_session_t *); +faim_internal struct aim_conn_t *aim_conn_getnext(struct aim_session_t *); +faim_export void aim_conn_close(struct aim_conn_t *deadconn); +faim_internal struct aim_conn_t *aim_getconn_type(struct aim_session_t *, int type); +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 struct aim_conn_t *aim_select(struct aim_session_t *, struct timeval *, int *); +faim_export int aim_conn_isready(struct aim_conn_t *); +faim_export int aim_conn_setstatus(struct aim_conn_t *, int); +faim_export void aim_session_init(struct aim_session_t *); /* aim_misc.c */ @@ -500,33 +505,36 @@ u_long aim_bos_setbuddylist(struct aim_session_t *, struct aim_conn_t *, char *); u_long aim_bos_setprofile(struct aim_session_t *, struct aim_conn_t *, char *, char *, unsigned int); u_long aim_bos_setgroupperm(struct aim_session_t *, struct aim_conn_t *, u_long); -u_long aim_bos_clientready(struct aim_session_t *, struct aim_conn_t *); +unsigned long aim_bos_clientready(struct aim_session_t *, struct aim_conn_t *); u_long aim_bos_reqrate(struct aim_session_t *, struct aim_conn_t *); u_long aim_bos_ackrateresp(struct aim_session_t *, struct aim_conn_t *); u_long aim_bos_setprivacyflags(struct aim_session_t *, struct aim_conn_t *, u_long); u_long aim_bos_reqpersonalinfo(struct aim_session_t *, struct aim_conn_t *); u_long aim_bos_reqservice(struct aim_session_t *, struct aim_conn_t *, u_short); -u_long aim_bos_reqrights(struct aim_session_t *, struct aim_conn_t *); +unsigned long aim_bos_reqrights(struct aim_session_t *, struct aim_conn_t *); u_long aim_bos_reqbuddyrights(struct aim_session_t *, struct aim_conn_t *); u_long aim_bos_reqlocaterights(struct aim_session_t *, struct aim_conn_t *); u_long aim_bos_reqicbmparaminfo(struct aim_session_t *, struct aim_conn_t *); unsigned long aim_addicbmparam(struct aim_session_t *sess,struct aim_conn_t *conn); u_long aim_setversions(struct aim_session_t *sess, struct aim_conn_t *conn); -struct aim_fileheader_t *aim_getlisting(struct aim_session_t*); -int aim_listenestablish(u_short); +faim_internal struct aim_fileheader_t *aim_getlisting(struct aim_session_t*); +faim_internal int aim_listenestablish(u_short); /* aim_rxhandlers.c */ -int aim_rxdispatch(struct aim_session_t *); -int aim_authparse(struct aim_session_t *, struct command_rx_struct *); -int aim_handleredirect_middle(struct aim_session_t *, struct command_rx_struct *, ...); -int aim_parse_unknown(struct aim_session_t *, struct command_rx_struct *, ...); +faim_export int aim_rxdispatch(struct aim_session_t *); +faim_internal int aim_authparse(struct aim_session_t *, struct command_rx_struct *); +faim_internal int aim_handleredirect_middle(struct aim_session_t *, struct command_rx_struct *, ...); +faim_internal int aim_parse_unknown(struct aim_session_t *, struct command_rx_struct *, ...); 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); +faim_internal int aim_parse_generalerrs(struct aim_session_t *, struct command_rx_struct *command, ...); +faim_internal int aim_parsemotd_middle(struct aim_session_t *sess, struct command_rx_struct *command, ...); +faim_internal int aim_parse_ratechange_middle(struct aim_session_t *sess, struct command_rx_struct *command); +faim_internal int aim_parse_evilnotify_middle(struct aim_session_t *sess, struct command_rx_struct *command); +faim_internal int aim_parse_msgack_middle(struct aim_session_t *sess, struct command_rx_struct *command); + +faim_export unsigned long aim_ads_clientready(struct aim_session_t *sess, struct aim_conn_t *conn); +faim_export unsigned long aim_ads_requestads(struct aim_session_t *sess, struct aim_conn_t *conn); /* aim_im.c */ struct aim_directim_priv { @@ -538,18 +546,18 @@ #define AIM_IMFLAGS_AWAY 0x01 /* mark as an autoreply */ #define AIM_IMFLAGS_ACK 0x02 /* request a receipt notice */ -u_long aim_send_im(struct aim_session_t *, struct aim_conn_t *, char *, u_int, char *); -int aim_parse_incoming_im_middle(struct aim_session_t *, struct command_rx_struct *); -int aim_parse_outgoing_im_middle(struct aim_session_t *, struct command_rx_struct *); -u_long aim_seticbmparam(struct aim_session_t *, struct aim_conn_t *conn); -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); +faim_export unsigned long aim_send_im(struct aim_session_t *, struct aim_conn_t *, char *, u_int, char *); +faim_internal int aim_parse_incoming_im_middle(struct aim_session_t *, struct command_rx_struct *); +faim_internal int aim_parse_outgoing_im_middle(struct aim_session_t *, struct command_rx_struct *); +faim_export unsigned long aim_seticbmparam(struct aim_session_t *, struct aim_conn_t *conn); +faim_internal int aim_parse_msgerror_middle(struct aim_session_t *, struct command_rx_struct *); +faim_internal int aim_negchan_middle(struct aim_session_t *sess, struct command_rx_struct *command); int aim_parse_bosrights(struct aim_session_t *sess, struct command_rx_struct *command, ...); -int aim_parse_missedcall(struct aim_session_t *sess, struct command_rx_struct *command); +faim_internal int aim_parse_missedcall(struct aim_session_t *sess, struct command_rx_struct *command); -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 *); +faim_export struct aim_conn_t * aim_directim_initiate(struct aim_session_t *, struct aim_conn_t *, struct aim_directim_priv *, char *); +faim_export int aim_send_im_direct(struct aim_session_t *, struct aim_conn_t *, char *); +faim_export struct aim_conn_t *aim_directim_connect(struct aim_session_t *, struct aim_conn_t *, struct aim_directim_priv *); /* aim_info.c */ #define AIM_CAPS_BUDDYICON 0x01 @@ -560,8 +568,8 @@ #define AIM_CAPS_SENDFILE 0x20 extern u_char aim_caps[6][16]; -u_short aim_getcap(unsigned char *capblock, int buflen); -int aim_putcap(unsigned char *capblock, int buflen, u_short caps); +faim_internal unsigned short aim_getcap(unsigned char *capblock, int buflen); +faim_internal int aim_putcap(unsigned char *capblock, int buflen, u_short caps); #define AIM_GETINFO_GENERALINFO 0x00001 #define AIM_GETINFO_AWAYMESSAGE 0x00003 @@ -633,44 +641,43 @@ #define AIM_COOKIETYPE_OFTIMAGE 0x14 #define AIM_COOKIETYPE_OFTICON 0x15 -int aim_cachecookie(struct aim_session_t *sess, struct aim_msgcookie_t *cookie); -int aim_purgecookies(struct aim_session_t *sess, int maxage); -struct aim_msgcookie_t *aim_uncachecookie(struct aim_session_t *sess, char *cookie, int type); -struct aim_msgcookie_t *aim_mkcookie(unsigned char *, int, void *); -struct aim_msgcookie_t *aim_checkcookie(struct aim_session_t *, char *, int); -int aim_getcookietype(int); +faim_internal int aim_cachecookie(struct aim_session_t *sess, struct aim_msgcookie_t *cookie); +faim_export int aim_purgecookies(struct aim_session_t *sess, int maxage); +faim_internal struct aim_msgcookie_t *aim_uncachecookie(struct aim_session_t *sess, unsigned char *cookie, int type); +faim_internal struct aim_msgcookie_t *aim_mkcookie(unsigned char *, int, void *); +faim_internal struct aim_msgcookie_t *aim_checkcookie(struct aim_session_t *, unsigned char *, int); +faim_internal int aim_msgcookie_gettype(int reqclass); -int aim_handlerendconnect(struct aim_session_t *sess, struct aim_conn_t *cur); +faim_export int aim_handlerendconnect(struct aim_session_t *sess, struct aim_conn_t *cur); #define AIM_TRANSFER_DENY_NOTSUPPORTED 0x0000 #define AIM_TRANSFER_DENY_DECLINE 0x0001 #define AIM_TRANSFER_DENY_NOTACCEPTING 0x0002 -u_long aim_denytransfer(struct aim_session_t *sess, struct aim_conn_t *conn, char *sender, char *cookie, unsigned short code); -u_long aim_accepttransfer(struct aim_session_t *sess, struct aim_conn_t *conn,struct aim_conn_t *oftconn, char *sender, char *cookie, unsigned short rendid); +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 unsigned long aim_accepttransfer(struct aim_session_t *sess, struct aim_conn_t *conn,struct aim_conn_t *oftconn, char *sender, char *cookie, unsigned short rendid); -u_long aim_getinfo(struct aim_session_t *, struct aim_conn_t *, const char *, unsigned short); -int aim_extractuserinfo(u_char *, struct aim_userinfo_s *); -int aim_parse_userinfo_middle(struct aim_session_t *, struct command_rx_struct *); -int aim_parse_oncoming_middle(struct aim_session_t *, struct command_rx_struct *); -int aim_parse_offgoing_middle(struct aim_session_t *, struct command_rx_struct *); -int aim_putuserinfo(u_char *buf, int buflen, struct aim_userinfo_s *info); -int aim_sendbuddyoncoming(struct aim_session_t *sess, struct aim_conn_t *conn, struct aim_userinfo_s *info); -int aim_sendbuddyoffgoing(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn); -int aim_parse_locateerr(struct aim_session_t *sess, struct command_rx_struct *command); +faim_export unsigned long aim_getinfo(struct aim_session_t *, struct aim_conn_t *, const char *, unsigned short); +faim_internal int aim_extractuserinfo(u_char *, struct aim_userinfo_s *); +faim_internal int aim_parse_userinfo_middle(struct aim_session_t *, struct command_rx_struct *); +faim_internal int aim_parse_oncoming_middle(struct aim_session_t *, struct command_rx_struct *); +faim_internal int aim_parse_offgoing_middle(struct aim_session_t *, struct command_rx_struct *); +faim_internal int aim_putuserinfo(u_char *buf, int buflen, struct aim_userinfo_s *info); +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); +faim_internal int aim_parse_locateerr(struct aim_session_t *sess, struct command_rx_struct *command); /* aim_auth.c */ -int aim_auth_sendcookie(struct aim_session_t *, struct aim_conn_t *, u_char *); -u_long aim_auth_clientready(struct aim_session_t *, struct aim_conn_t *); -u_long aim_auth_changepasswd(struct aim_session_t *, struct aim_conn_t *, char *, char *); +faim_export int aim_auth_sendcookie(struct aim_session_t *, struct aim_conn_t *, u_char *); +faim_export u_long aim_auth_clientready(struct aim_session_t *, struct aim_conn_t *); +faim_export unsigned long aim_auth_changepasswd(struct aim_session_t *, struct aim_conn_t *, char *, char *); /* aim_buddylist.c */ -u_long aim_add_buddy(struct aim_session_t *, struct aim_conn_t *, char *); -u_long aim_remove_buddy(struct aim_session_t *, struct aim_conn_t *, char *); -int aim_parse_buddyrights(struct aim_session_t *sess, struct command_rx_struct *command, ...); +faim_export unsigned long aim_add_buddy(struct aim_session_t *, struct aim_conn_t *, char *); +faim_export unsigned long aim_remove_buddy(struct aim_session_t *, struct aim_conn_t *, char *); +faim_internal int aim_parse_buddyrights(struct aim_session_t *sess, struct command_rx_struct *command, ...); /* aim_search.c */ -u_long aim_usersearch_address(struct aim_session_t *, struct aim_conn_t *, char *); -/* u_long aim_usersearch_name(struct aim_session_t *, struct aim_conn_t *, char *); */ +faim_export u_long aim_usersearch_address(struct aim_session_t *, struct aim_conn_t *, char *); struct aim_chat_roominfo { @@ -678,22 +685,22 @@ char *name; u_short instance; }; -int aim_chat_readroominfo(u_char *buf, struct aim_chat_roominfo *outinfo); -int aim_chat_parse_infoupdate(struct aim_session_t *sess, struct command_rx_struct *command); -int aim_chat_parse_joined(struct aim_session_t *sess, struct command_rx_struct *command); -int aim_chat_parse_leave(struct aim_session_t *sess, struct command_rx_struct *command); -int aim_chat_parse_incoming(struct aim_session_t *sess, struct command_rx_struct *command); -u_long aim_chat_send_im(struct aim_session_t *sess, struct aim_conn_t *conn, char *msg); -u_long aim_chat_join(struct aim_session_t *sess, struct aim_conn_t *conn, u_short exchange, const char *roomname); -u_long aim_chat_clientready(struct aim_session_t *sess, struct aim_conn_t *conn); -int aim_chat_attachname(struct aim_conn_t *conn, char *roomname); -char *aim_chat_getname(struct aim_conn_t *conn); -struct aim_conn_t *aim_chat_getconn(struct aim_session_t *, char *name); +faim_internal int aim_chat_readroominfo(u_char *buf, struct aim_chat_roominfo *outinfo); +faim_internal int aim_chat_parse_infoupdate(struct aim_session_t *sess, struct command_rx_struct *command); +faim_internal int aim_chat_parse_joined(struct aim_session_t *sess, struct command_rx_struct *command); +faim_internal int aim_chat_parse_leave(struct aim_session_t *sess, struct command_rx_struct *command); +faim_internal int aim_chat_parse_incoming(struct aim_session_t *sess, struct command_rx_struct *command); +faim_export unsigned long aim_chat_send_im(struct aim_session_t *sess, struct aim_conn_t *conn, char *msg); +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); +faim_export char *aim_chat_getname(struct aim_conn_t *conn); +faim_export struct aim_conn_t *aim_chat_getconn(struct aim_session_t *, char *name); -u_long aim_chatnav_reqrights(struct aim_session_t *sess, struct aim_conn_t *conn); -u_long aim_chatnav_clientready(struct aim_session_t *sess, struct aim_conn_t *conn); +faim_export unsigned long aim_chatnav_reqrights(struct aim_session_t *sess, struct aim_conn_t *conn); +faim_export unsigned long aim_chatnav_clientready(struct aim_session_t *sess, struct aim_conn_t *conn); -u_long aim_chat_invite(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn, char *msg, u_short exchange, char *roomname, u_short instance); +faim_export unsigned long aim_chat_invite(struct aim_session_t *sess, struct aim_conn_t *conn, char *sn, char *msg, u_short exchange, char *roomname, u_short instance); struct aim_chat_exchangeinfo { u_short number; @@ -703,9 +710,9 @@ char *charset2; char *lang2; }; -int aim_chatnav_parse_info(struct aim_session_t *sess, struct command_rx_struct *command); -u_long aim_chatnav_createroom(struct aim_session_t *sess, struct aim_conn_t *conn, char *name, u_short exchange); -int aim_chat_leaveroom(struct aim_session_t *sess, char *name); +faim_internal int aim_chatnav_parse_info(struct aim_session_t *sess, struct command_rx_struct *command); +faim_export u_long aim_chatnav_createroom(struct aim_session_t *sess, struct aim_conn_t *conn, char *name, u_short exchange); +faim_export int aim_chat_leaveroom(struct aim_session_t *sess, char *name); /* aim_util.c */ #ifdef AIMUTIL_USEMACROS @@ -739,18 +746,22 @@ u_long aimutil_get32(u_char *); #endif -int aimutil_putstr(u_char *, const u_char *, int); -int aimutil_tokslen(char *toSearch, int index, char dl); -int aimutil_itemcnt(char *toSearch, char dl); -char *aimutil_itemidx(char *toSearch, int index, char dl); +faim_export int aimutil_putstr(u_char *, const char *, int); +faim_export int aimutil_tokslen(char *toSearch, int index, char dl); +faim_export int aimutil_itemcnt(char *toSearch, char dl); +faim_export char *aimutil_itemidx(char *toSearch, int index, char dl); -int aim_snlen(const char *sn); -int aim_sncmp(const char *sn1, const char *sn2); +faim_export int aim_snlen(const char *sn); +faim_export int aim_sncmp(const char *sn1, const char *sn2); + +/* for libc's that dont have it */ +faim_export char *aim_strsep(char **pp, const char *delim); /* aim_meta.c */ -char *aim_getbuilddate(void); -char *aim_getbuildtime(void); -char *aim_getbuildstring(void); +faim_export char *aim_getbuilddate(void); +faim_export char *aim_getbuildtime(void); +faim_export char *aim_getbuildstring(void); +faim_internal void faimdprintf(int dlevel, const char *format, ...); #endif /* __AIM_H__ */
--- a/src/oscar.c Mon Sep 04 01:15:38 2000 +0000 +++ b/src/oscar.c Mon Sep 04 23:37:32 2000 +0000 @@ -211,7 +211,6 @@ int oscar_login(char *username, char *password) { struct aim_session_t *sess; struct aim_conn_t *conn; -/* struct client_info_s info = {"AOL Instant Messenger (TM), version 2.1.1187/WIN32", 4, 30, 3141, "us", "en", 0x0004, 0x0001, 0x055}; */ struct aim_user *u; char buf[256]; @@ -399,7 +398,7 @@ int gaim_parse_login(struct aim_session_t *sess, struct command_rx_struct *command, ...) { struct client_info_s info = {"AOL Instant Messenger (TM), version 2.1.1187/WIN32", 4, 30, 3141, "us", "en", 0x0004, 0x0001, 0x055}; - unsigned char *key; + char *key; va_list ap; va_start(ap, command); @@ -455,12 +454,12 @@ va_list ap; int serviceid; char *ip; - char *cookie; + unsigned char *cookie; va_start(ap, command); serviceid = va_arg(ap, int); ip = va_arg(ap, char *); - cookie = va_arg(ap, char *); + cookie = va_arg(ap, unsigned char *); switch(serviceid) { case 0x7: /* Authorizer */ @@ -1034,7 +1033,7 @@ debug_print(debug_buff); return 1; -}; +} int gaim_parse_evilnotify(struct aim_session_t *sess, struct command_rx_struct *command, ...) { va_list ap;