# HG changeset patch # User Eric Warmenhoven # Date 968790096 0 # Node ID e1da6a6ec42bb3b2f6e531969703d720d8d15bc6 # Parent 38ffd1faa31ad0babcf67eeb35550a8be4f9f53c [gaim-migrate @ 899] Oscar works again committer: Tailor Script diff -r 38ffd1faa31a -r e1da6a6ec42b ChangeLog --- a/ChangeLog Tue Sep 12 17:56:39 2000 +0000 +++ b/ChangeLog Tue Sep 12 20:21:36 2000 +0000 @@ -2,6 +2,7 @@ version 0.10.1: * Better chatroom logging + * Oscar works again. Pay no attention to Slashdot. version 0.10.0 (09/11/2000): * New Smiley Faces and Pixmaps added. diff -r 38ffd1faa31a -r e1da6a6ec42b libfaim/CHANGES.gaim --- a/libfaim/CHANGES.gaim Tue Sep 12 17:56:39 2000 +0000 +++ b/libfaim/CHANGES.gaim Tue Sep 12 20:21:36 2000 +0000 @@ -1,3 +1,9 @@ + +Tue Sep 12 20:20:07 UTC 2000 EWarmenhoven + - Oscar works again. :) + - I'm updating to the latest libfaim. Everything should theoretically + work, except some users (notably Solaris) may not be able to start + Direct IM. Please tell me if you can't. Mon Sep 4 01:08:33 UTC 2000 EWarmenhoven - libfaim updates, gaim updates. diff -r 38ffd1faa31a -r e1da6a6ec42b libfaim/README.gaim --- a/libfaim/README.gaim Tue Sep 12 17:56:39 2000 +0000 +++ b/libfaim/README.gaim Tue Sep 12 20:21:36 2000 +0000 @@ -13,7 +13,6 @@ included with the libfaim source on sourceforge) with the Gaim GTK front-end. So far the changes to libfaim that I've made are: - remove mkbuildinfo.sh and put the #defines it creates into Makefile.am -- add #if HAVE_GETADDRINFO in aim_ft.c for Solaris people And finally, a word of warning. Gaim/Faim is VERY buggy. Please, don't use this for anything other than laughs right now. Hopefully we'll get it working better diff -r 38ffd1faa31a -r e1da6a6ec42b libfaim/aim_chat.c --- a/libfaim/aim_chat.c Tue Sep 12 17:56:39 2000 +0000 +++ b/libfaim/aim_chat.c Tue Sep 12 20:21:36 2000 +0000 @@ -68,7 +68,7 @@ * Generate a random message cookie */ for (i=0;i<8;i++) - curbyte += aimutil_put8(newpacket->data+curbyte, (u_char) random()); + curbyte += aimutil_put8(newpacket->data+curbyte, (u_char) rand()); aim_cachecookie(sess, aim_mkcookie(newpacket->data+curbyte-8, AIM_COOKIETYPE_CHAT, NULL)); diff -r 38ffd1faa31a -r e1da6a6ec42b libfaim/aim_conn.c --- a/libfaim/aim_conn.c Tue Sep 12 17:56:39 2000 +0000 +++ b/libfaim/aim_conn.c Tue Sep 12 20:21:36 2000 +0000 @@ -8,9 +8,11 @@ #include +#ifndef _WIN32 #include #include #include +#endif /* * Clears out connection list, killing remaining connections. @@ -202,7 +204,7 @@ * */ - for(i=0;i +#ifndef _WIN32 #include #include #include #include /* for aim_directim_initiate */ #include /* for inet_ntoa */ - -#include "config.h" +#endif /* aim_msgcookies.c is mostly new. just look at the diff and replace yours, easiest. */ @@ -61,8 +61,6 @@ case AIM_CONN_SUBTYPE_OFT_GETFILE: { struct aim_filetransfer_priv *priv; - priv->state = 0; - priv = (struct aim_filetransfer_priv *)calloc(1, sizeof(struct aim_filetransfer_priv)); snprintf(priv->ip, sizeof(priv->ip), "%s:%u", inet_ntoa(((struct sockaddr_in *)&cliaddr)->sin_addr), ntohs(((struct sockaddr_in *)&cliaddr)->sin_port)); @@ -263,7 +261,7 @@ short port = 4443; struct hostent *hptr; - struct utsname myname; + char localhost[129]; unsigned char cap[16]; char d[4]; /* XXX: IPv6. *cough* */ @@ -279,10 +277,10 @@ * get our local IP */ - if(uname(&myname) < 0) + if(gethostname(localhost, 128) < 0) return NULL; - if( (hptr = gethostbyname(myname.nodename)) == NULL) + if( (hptr = gethostbyname(localhost)) == NULL) return NULL; memcpy(&d, hptr->h_addr_list[0], 4); /* XXX: this probably isn't quite kosher, but it works */ @@ -307,7 +305,7 @@ * This cookie needs to be alphanumeric and NULL-terminated to be TOC-compatible. */ for (i=0;i<7;i++) - curbyte += aimutil_put8(newpacket->data+curbyte, 0x30 + ((u_char) random() % 20)); + curbyte += aimutil_put8(newpacket->data+curbyte, 0x30 + ((u_char) rand() % 20)); curbyte += aimutil_put8(newpacket->data+curbyte, 0x00); /* @@ -408,8 +406,10 @@ * allocate and set up our connection */ +#if 0 i = fcntl(listenfd, F_GETFL, 0); fcntl(listenfd, F_SETFL, i | O_NONBLOCK); +#endif newconn = aim_newconn(sess, AIM_CONN_TYPE_RENDEZVOUS_OUT, NULL); if (!newconn) { @@ -646,7 +646,7 @@ faim_internal int aim_listenestablish(u_short portnum) { -#if HAVE_GETADDRINFO +#if defined(__linux__) /* XXX what other OS's support getaddrinfo? */ int listenfd; const int on = 1; struct addrinfo hints, *res, *ressave; @@ -678,8 +678,35 @@ } freeaddrinfo(ressave); return listenfd; -#else - return -1; +#else + int listenfd; + const int on = 1; + struct sockaddr_in sockin; + + if ((listenfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { + perror("socket(listenfd)"); + return -1; + } + if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on) != 0)) { + perror("setsockopt(listenfd)"); + close(listenfd); + return -1; + } + memset(&sockin, 0, sizeof(struct sockaddr_in)); + sockin.sin_family = AF_INET; + sockin.sin_port = htons(portnum); + if (bind(listenfd, (struct sockaddr *)&sockin, sizeof(struct sockaddr_in)) != 0) { + perror("bind(listenfd)"); + close(listenfd); + return -1; + } + if (listen(listenfd, 4) != 0) { + perror("listen(listenfd)"); + close(listenfd); + return -1; + } + + return listenfd; #endif } @@ -699,7 +726,7 @@ faim_mutex_lock(&conn->active); /* gets locked down for the entirety */ - if ( (hdrlen = read(conn->fd, hdrbuf1, 6)) < 6) { + if ( (hdrlen = aim_recv(conn->fd, hdrbuf1, 6)) < 6) { if(hdrlen < 0) perror("read"); printf("faim: rend: read error (fd: %i) %02x%02x%02x%02x%02x%02x (%i)\n", conn->fd, hdrbuf1[0],hdrbuf1[1],hdrbuf1[0],hdrbuf1[0],hdrbuf1[0],hdrbuf1[0],hdrlen); @@ -714,7 +741,7 @@ if (!(hdr = malloc(hdrlen))) return -1; - if (read(conn->fd, hdr, hdrlen) < hdrlen) { + if (aim_recv(conn->fd, hdr, hdrlen) < hdrlen) { perror("read"); printf("faim: rend: read2 error\n"); free(hdr); @@ -756,7 +783,7 @@ return 0; } - if (recv(conn->fd, msg, payloadlength, MSG_WAITALL) < payloadlength) { + if (aim_recv(conn->fd, msg, payloadlength) < payloadlength) { perror("read"); printf("faim: rend: read3 error\n"); free(msg); @@ -815,7 +842,7 @@ data = calloc(1, commandlen); memcpy(data, "01/01/1999 00:00 100 file.txt\r\n", commandlen); - if (write(conn->fd, data, commandlen) != commandlen) { + if (send(conn->fd, data, commandlen, 0) != commandlen) { perror("listing write error"); } faim_mutex_unlock(&conn->active); @@ -911,8 +938,8 @@ if(newoft->commandlen > 0) { int i; - bzero(newoft->data, newoft->commandlen); - for(i = 0; i < newoft->commandlen; i++) + memset(newoft->data, 0, newoft->commandlen); + for(i = 0; i < (signed)newoft->commandlen; i++) newoft->data[i] = 0x30 + (i%10); // memcpy(newoft->data, "This has been a Test\r\n-josh\r\n", newoft->commandlen); @@ -994,7 +1021,7 @@ for(i = 0; i < fh->size; i++) c[i] = 0x30 + (i%10); - if ( (i = write(conn->fd, c, fh->size)) != fh->size ) { + if ( (i = send(conn->fd, c, fh->size, 0)) != fh->size ) { printf("whoopsy, didn't write it all...\n"); } diff -r 38ffd1faa31a -r e1da6a6ec42b libfaim/aim_im.c --- a/libfaim/aim_im.c Tue Sep 12 17:56:39 2000 +0000 +++ b/libfaim/aim_im.c Tue Sep 12 20:21:36 2000 +0000 @@ -47,7 +47,7 @@ * */ for (i=0;i<8;i++) - curbyte += aimutil_put8(newpacket->data+curbyte, (u_char) random()); + curbyte += aimutil_put8(newpacket->data+curbyte, (u_char) rand()); /* * Channel ID diff -r 38ffd1faa31a -r e1da6a6ec42b libfaim/aim_info.c --- a/libfaim/aim_info.c Tue Sep 12 17:56:39 2000 +0000 +++ b/libfaim/aim_info.c Tue Sep 12 20:21:36 2000 +0000 @@ -568,7 +568,7 @@ aim_addtlvtochain32(&tlvlist, 0x0003, info->onlinesince); aim_addtlvtochain16(&tlvlist, 0x0004, info->idletime); /* XXX: should put caps here */ - aim_addtlvtochain32(&tlvlist, (info->class)&AIM_CLASS_AOL?0x0010:0x000f, info->sessionlen); + aim_addtlvtochain32(&tlvlist, (unsigned short)((info->class)&AIM_CLASS_AOL?0x0010:0x000f), info->sessionlen); i += aim_writetlvchain(buf+i, buflen-i, &tlvlist); aim_freetlvchain(&tlvlist); diff -r 38ffd1faa31a -r e1da6a6ec42b libfaim/aim_login.c --- a/libfaim/aim_login.c Tue Sep 12 17:56:39 2000 +0000 +++ b/libfaim/aim_login.c Tue Sep 12 20:21:36 2000 +0000 @@ -107,11 +107,11 @@ if (strlen(clientinfo->clientstring)) curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x0003, strlen(clientinfo->clientstring), clientinfo->clientstring); - curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0016, clientinfo->major2); - curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0017, clientinfo->major); - curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0018, clientinfo->minor); - curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0019, clientinfo->minor2); - curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x001a, clientinfo->build); + curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0016, (unsigned short)clientinfo->major2); + curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0017, (unsigned short)clientinfo->major); + curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0018, (unsigned short)clientinfo->minor); + curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0019, (unsigned short)clientinfo->minor2); + curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x001a, (unsigned short)clientinfo->build); curbyte += aim_puttlv_32(newpacket->data+curbyte, 0x0014, clientinfo->unknown); curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0009, 0x0015); @@ -352,7 +352,7 @@ aim_addtlvtochain_str(&tlvlist, 0x0005, bosip, strlen(bosip)); aim_addtlvtochain_str(&tlvlist, 0x0006, cookie, AIM_COOKIELEN); aim_addtlvtochain_str(&tlvlist, 0x0011, email, strlen(email)); - aim_addtlvtochain16(&tlvlist, 0x0013, regstatus); + aim_addtlvtochain16(&tlvlist, 0x0013, (unsigned short)regstatus); } tx->commandlen = aim_writetlvchain(tx->data, tx->commandlen, &tlvlist); diff -r 38ffd1faa31a -r e1da6a6ec42b libfaim/aim_misc.c --- a/libfaim/aim_misc.c Tue Sep 12 17:56:39 2000 +0000 +++ b/libfaim/aim_misc.c Tue Sep 12 20:21:36 2000 +0000 @@ -21,9 +21,9 @@ * time. * */ -u_long aim_bos_setidle(struct aim_session_t *sess, - struct aim_conn_t *conn, - u_long idletime) +faim_export unsigned long aim_bos_setidle(struct aim_session_t *sess, + struct aim_conn_t *conn, + u_long idletime) { return aim_genericreq_l(sess, conn, 0x0001, 0x0011, &idletime); } @@ -57,9 +57,10 @@ * * */ -u_long aim_bos_changevisibility(struct aim_session_t *sess, - struct aim_conn_t *conn, - int changetype, char *denylist) +faim_export unsigned long aim_bos_changevisibility(struct aim_session_t *sess, + struct aim_conn_t *conn, + int changetype, + char *denylist) { struct command_tx_struct *newpacket; int packlen = 0; @@ -134,9 +135,9 @@ * XXX: I can't stress the TODO enough. * */ -u_long aim_bos_setbuddylist(struct aim_session_t *sess, - struct aim_conn_t *conn, - char *buddy_list) +faim_export unsigned long aim_bos_setbuddylist(struct aim_session_t *sess, + struct aim_conn_t *conn, + char *buddy_list) { int i, j; @@ -206,11 +207,11 @@ * * */ -u_long aim_bos_setprofile(struct aim_session_t *sess, - struct aim_conn_t *conn, - char *profile, - char *awaymsg, - unsigned int caps) +faim_export unsigned long aim_bos_setprofile(struct aim_session_t *sess, + struct aim_conn_t *conn, + char *profile, + char *awaymsg, + unsigned short caps) { struct command_tx_struct *newpacket; int i = 0, tmp, caplen; @@ -253,15 +254,15 @@ * a bitwise OR of all the user classes you want to see you. * */ -u_long aim_bos_setgroupperm(struct aim_session_t *sess, - struct aim_conn_t *conn, - u_long mask) +faim_export unsigned long aim_bos_setgroupperm(struct aim_session_t *sess, + struct aim_conn_t *conn, + u_long mask) { return aim_genericreq_l(sess, conn, 0x0009, 0x0004, &mask); } -int aim_parse_bosrights(struct aim_session_t *sess, - struct command_rx_struct *command, ...) +faim_internal int aim_parse_bosrights(struct aim_session_t *sess, + struct command_rx_struct *command, ...) { rxcallback_t userfunc = NULL; int ret=1; @@ -307,8 +308,8 @@ * TODO: Dynamisize. * */ -u_long aim_bos_clientready(struct aim_session_t *sess, - struct aim_conn_t *conn) +faim_export unsigned long aim_bos_clientready(struct aim_session_t *sess, + struct aim_conn_t *conn) { u_char command_2[] = { /* placeholders for dynamic data */ @@ -318,7 +319,10 @@ 0x00, 0x01, 0x00, 0x03, 0x00, 0x04, - 0x07, 0xda, + 0x06, 0x86, /* the good ones */ +#if 0 + 0x07, 0xda, /* DUPLE OF DEATH! */ +#endif 0x00, 0x02, 0x00, 0x01, @@ -380,8 +384,8 @@ * Request Rate Information. * */ -u_long aim_bos_reqrate(struct aim_session_t *sess, - struct aim_conn_t *conn) +faim_export unsigned long aim_bos_reqrate(struct aim_session_t *sess, + struct aim_conn_t *conn) { return aim_genericreq_n(sess, conn, 0x0001, 0x0006); } @@ -390,8 +394,8 @@ * Rate Information Response Acknowledge. * */ -u_long aim_bos_ackrateresp(struct aim_session_t *sess, - struct aim_conn_t *conn) +faim_export unsigned long aim_bos_ackrateresp(struct aim_session_t *sess, + struct aim_conn_t *conn) { struct command_tx_struct *newpacket; int packlen = 20, i=0; @@ -407,7 +411,10 @@ i += aimutil_put16(newpacket->data+i, 0x0003); i += aimutil_put16(newpacket->data+i, 0x0004); i += aimutil_put16(newpacket->data+i, 0x0005); - + + newpacket->commandlen = i; + newpacket->lock = 0; + aim_tx_enqueue(sess, newpacket); return (sess->snac_nextid); @@ -422,9 +429,9 @@ * Bit 2: Allows other AIM users to see how long you've been a member. * */ -u_long aim_bos_setprivacyflags(struct aim_session_t *sess, - struct aim_conn_t *conn, - u_long flags) +faim_export unsigned long aim_bos_setprivacyflags(struct aim_session_t *sess, + struct aim_conn_t *conn, + u_long flags) { return aim_genericreq_l(sess, conn, 0x0001, 0x0014, &flags); } @@ -436,14 +443,14 @@ * because aparently it uses SNAC flags. * */ -u_long aim_bos_reqpersonalinfo(struct aim_session_t *sess, - struct aim_conn_t *conn) +faim_export unsigned long aim_bos_reqpersonalinfo(struct aim_session_t *sess, + struct aim_conn_t *conn) { return aim_genericreq_n(sess, conn, 0x0001, 0x000e); } -u_long aim_setversions(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) { struct command_tx_struct *newpacket; int i; @@ -497,6 +504,8 @@ i += aimutil_put16(newpacket->data+i, 0x0003); /* version */ } #endif + + newpacket->commandlen = i; newpacket->lock = 0; aim_tx_enqueue(sess, newpacket); @@ -510,7 +519,7 @@ * Service request. * */ -u_long aim_bos_reqservice(struct aim_session_t *sess, +faim_export unsigned long aim_bos_reqservice(struct aim_session_t *sess, struct aim_conn_t *conn, u_short serviceid) { @@ -524,8 +533,8 @@ * the connection alive. Its not real necessary. * */ -u_long aim_bos_nop(struct aim_session_t *sess, - struct aim_conn_t *conn) +faim_export unsigned long aim_bos_nop(struct aim_session_t *sess, + struct aim_conn_t *conn) { return aim_genericreq_n(sess, conn, 0x0001, 0x0016); } @@ -536,8 +545,8 @@ * Request BOS rights. * */ -u_long aim_bos_reqrights(struct aim_session_t *sess, - struct aim_conn_t *conn) +faim_export unsigned long aim_bos_reqrights(struct aim_session_t *sess, + struct aim_conn_t *conn) { return aim_genericreq_n(sess, conn, 0x0009, 0x0002); } @@ -548,8 +557,8 @@ * Request Buddy List rights. * */ -u_long aim_bos_reqbuddyrights(struct aim_session_t *sess, - struct aim_conn_t *conn) +faim_export unsigned long aim_bos_reqbuddyrights(struct aim_session_t *sess, + struct aim_conn_t *conn) { return aim_genericreq_n(sess, conn, 0x0003, 0x0002); } @@ -564,7 +573,7 @@ * returns -1 on error (couldn't alloc packet), next snacid on success. * */ -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, char *destsn, int anon) { struct command_tx_struct *newpacket; int curbyte; @@ -592,15 +601,13 @@ return (sess->snac_nextid++); } - - /* * aim_debugconn_sendconnect() * * For aimdebugd. If you don't know what it is, you don't want to. */ -u_long aim_debugconn_sendconnect(struct aim_session_t *sess, - struct aim_conn_t *conn) +faim_export unsigned long aim_debugconn_sendconnect(struct aim_session_t *sess, + struct aim_conn_t *conn) { return aim_genericreq_n(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_DEBUGCONN_CONNECT); } @@ -617,9 +624,9 @@ * back to the single. I don't see any advantage to doing it either way. * */ -u_long aim_genericreq_n(struct aim_session_t *sess, - struct aim_conn_t *conn, - u_short family, u_short subtype) +faim_internal unsigned long aim_genericreq_n(struct aim_session_t *sess, + struct aim_conn_t *conn, + u_short family, u_short subtype) { struct command_tx_struct *newpacket; @@ -638,9 +645,10 @@ * * */ -u_long aim_genericreq_l(struct aim_session_t *sess, - struct aim_conn_t *conn, - u_short family, u_short subtype, u_long *longdata) +faim_internal unsigned long aim_genericreq_l(struct aim_session_t *sess, + struct aim_conn_t *conn, + u_short family, u_short subtype, + u_long *longdata) { struct command_tx_struct *newpacket; u_long newlong; @@ -664,9 +672,10 @@ return (sess->snac_nextid++); } -u_long aim_genericreq_s(struct aim_session_t *sess, - struct aim_conn_t *conn, - u_short family, u_short subtype, u_short *shortdata) +faim_internal unsigned long aim_genericreq_s(struct aim_session_t *sess, + struct aim_conn_t *conn, + u_short family, u_short subtype, + u_short *shortdata) { struct command_tx_struct *newpacket; u_short newshort; @@ -696,8 +705,8 @@ * Request Location services rights. * */ -u_long aim_bos_reqlocaterights(struct aim_session_t *sess, - struct aim_conn_t *conn) +faim_export unsigned long aim_bos_reqlocaterights(struct aim_session_t *sess, + struct aim_conn_t *conn) { return aim_genericreq_n(sess, conn, 0x0002, 0x0002); } @@ -708,8 +717,8 @@ * Request ICBM parameter information. * */ -u_long aim_bos_reqicbmparaminfo(struct aim_session_t *sess, - struct aim_conn_t *conn) +faim_export unsigned long aim_bos_reqicbmparaminfo(struct aim_session_t *sess, + struct aim_conn_t *conn) { return aim_genericreq_n(sess, conn, 0x0004, 0x0004); } @@ -717,8 +726,8 @@ /* * Add ICBM parameter? Huh? */ -unsigned long aim_addicbmparam(struct aim_session_t *sess, - struct aim_conn_t *conn) +faim_export unsigned long aim_addicbmparam(struct aim_session_t *sess, + struct aim_conn_t *conn) { struct command_tx_struct *newpacket; int packlen = 10+16, i=0; diff -r 38ffd1faa31a -r e1da6a6ec42b libfaim/aim_rxqueue.c --- a/libfaim/aim_rxqueue.c Tue Sep 12 17:56:39 2000 +0000 +++ b/libfaim/aim_rxqueue.c Tue Sep 12 20:21:36 2000 +0000 @@ -7,7 +7,10 @@ */ #include + +#ifndef _WIN32 #include +#endif /* * Since not all implementations support MSG_WAITALL, define @@ -18,7 +21,7 @@ * take more for a badly fragmented packet. * */ -static int aim_recv(int fd, void *buf, size_t count) +faim_internal int aim_recv(int fd, void *buf, size_t count) { #ifdef MSG_WAITALL return recv(fd, buf, count, MSG_WAITALL); @@ -28,7 +31,7 @@ left = count; while (left) { - ret = read(fd, ((unsigned char *)buf)+cur, left); + ret = recv(fd, ((unsigned char *)buf)+cur, left, 0); if (ret == -1) return -1; if (ret == 0) diff -r 38ffd1faa31a -r e1da6a6ec42b libfaim/aim_tlv.c --- a/libfaim/aim_tlv.c Tue Sep 12 17:56:39 2000 +0000 +++ b/libfaim/aim_tlv.c Tue Sep 12 20:21:36 2000 +0000 @@ -349,7 +349,7 @@ return curbyte; } -faim_internal int aim_puttlv_str(u_char *buf, u_short t, u_short l, char *v) +faim_internal int aim_puttlv_str(u_char *buf, u_short t, int l, char *v) { int curbyte; diff -r 38ffd1faa31a -r e1da6a6ec42b libfaim/aim_txqueue.c --- a/libfaim/aim_txqueue.c Tue Sep 12 17:56:39 2000 +0000 +++ b/libfaim/aim_txqueue.c Tue Sep 12 20:21:36 2000 +0000 @@ -7,6 +7,10 @@ #include +#ifndef _WIN32 +#include +#endif + /* * Allocate a new tx frame. * @@ -19,7 +23,7 @@ * chan = channel for OSCAR, hdrtype for OFT * */ -faim_internal 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 char framing, int chan, struct aim_conn_t *conn, int datalen) { struct command_tx_struct *new; @@ -286,7 +290,7 @@ * since OFT allows us to do the data in a different write (yay!). */ faim_mutex_lock(&cur->conn->active); - if ( (u_int)write(cur->conn->fd, curPacket, buflen) != buflen) { + if (send(cur->conn->fd, curPacket, buflen, 0) != buflen) { faim_mutex_unlock(&cur->conn->active); cur->sent = 1; aim_conn_kill(sess, &cur->conn); @@ -294,7 +298,7 @@ } if ((cur->hdrtype == AIM_FRAMETYPE_OFT) && cur->commandlen) { - if (write(cur->conn->fd, cur->data, cur->commandlen) != cur->commandlen) { + if (send(cur->conn->fd, cur->data, cur->commandlen, 0) != (int)cur->commandlen) { /* * Theres nothing we can do about this since we've already sent the * header! The connection is unstable. diff -r 38ffd1faa31a -r e1da6a6ec42b libfaim/faim/aim.h --- a/libfaim/faim/aim.h Tue Sep 12 17:56:39 2000 +0000 +++ b/libfaim/faim/aim.h Tue Sep 12 20:21:36 2000 +0000 @@ -60,7 +60,8 @@ #ifdef _WIN32 #define sleep Sleep -#define strlen(x) (int)strlen(x) /* win32 has a unsigned size_t */ +#define socklen_t int /* this must be a POSIXy thing */ +#define snprintf _snprintf /* I'm not sure whats wrong with Microsoft here */ #endif #if defined(mach) && defined(__APPLE__) @@ -73,7 +74,7 @@ #define faim_shortfunc inline #endif -#if defined(_WIN32) +#if defined(_WIN32) && !defined(WIN32_STATIC) /* * For a win32 DLL, we define WIN32_INDLL if this file * is included while compiling the DLL. If its not @@ -386,7 +387,7 @@ 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_puttlv_str(u_char *buf, u_short t, int 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); @@ -400,7 +401,7 @@ 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); +faim_export unsigned long aim_debugconn_sendconnect(struct aim_session_t *sess, struct aim_conn_t *conn); int aim_logoff(struct aim_session_t *); @@ -409,9 +410,9 @@ typedef int (*rxcallback_t)(struct aim_session_t *, struct command_rx_struct *, ...); int aim_register_callbacks(rxcallback_t *); -u_long aim_genericreq_n(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype); -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 *); +faim_internal unsigned long aim_genericreq_n(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype); +faim_internal unsigned long aim_genericreq_l(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype, u_long *); +faim_internal unsigned long aim_genericreq_s(struct aim_session_t *, struct aim_conn_t *conn, u_short family, u_short subtype, u_short *); faim_internal struct aim_fileheader_t *aim_oft_getfh(unsigned char *hdr); @@ -426,13 +427,14 @@ 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); +faim_internal int aim_recv(int fd, void *buf, size_t count); 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 *, ...); faim_internal int aim_get_command_rendezvous(struct aim_session_t *sess, struct aim_conn_t *conn); -faim_internal 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 char 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)) @@ -498,25 +500,25 @@ #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 *); -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); -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); -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); +faim_export int aim_send_warning(struct aim_session_t *sess, struct aim_conn_t *conn, char *destsn, int anon); +faim_export unsigned long aim_bos_nop(struct aim_session_t *, struct aim_conn_t *); +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_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_ackrateresp(struct aim_session_t *, struct aim_conn_t *); +faim_export unsigned long aim_bos_setprivacyflags(struct aim_session_t *, struct aim_conn_t *, u_long); +faim_export unsigned long aim_bos_reqpersonalinfo(struct aim_session_t *, struct aim_conn_t *); +faim_export unsigned long aim_bos_reqservice(struct aim_session_t *, struct aim_conn_t *, u_short); +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_internal struct aim_fileheader_t *aim_getlisting(struct aim_session_t*); faim_internal int aim_listenestablish(u_short); @@ -552,7 +554,7 @@ 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, ...); +faim_internal int aim_parse_bosrights(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); faim_export struct aim_conn_t * aim_directim_initiate(struct aim_session_t *, struct aim_conn_t *, struct aim_directim_priv *, char *); diff -r 38ffd1faa31a -r e1da6a6ec42b libfaim/faim/faimconfig.h --- a/libfaim/faim/faimconfig.h Tue Sep 12 17:56:39 2000 +0000 +++ b/libfaim/faim/faimconfig.h Tue Sep 12 20:21:36 2000 +0000 @@ -103,6 +103,13 @@ */ #define FAIM_SNAC_HASH_SIZE 16 +/* + * If building on Win32,define WIN32_STATIC if you don't want + * to compile libfaim as a DLL (and instead link it right into + * your app). + */ +#define WIN32_STATIC + #endif /* __FAIMCONFIG_H__ */ diff -r 38ffd1faa31a -r e1da6a6ec42b libfaim/md5.c --- a/libfaim/md5.c Tue Sep 12 17:56:39 2000 +0000 +++ b/libfaim/md5.c Tue Sep 12 20:21:36 2000 +0000 @@ -21,7 +21,7 @@ ghost@aladdin.com */ -/*$Id: md5.c 751 2000-08-22 23:38:47Z warmenhoven $ */ +/*$Id: md5.c 899 2000-09-12 20:21:36Z warmenhoven $ */ /* Independent implementation of MD5 (RFC 1321). @@ -39,6 +39,7 @@ */ #include "md5.h" +#include #ifdef TEST /*