changeset 5927:04dc7fe68889

[gaim-migrate @ 6367] Another crisp patch from Ryan McCabe (odin). This one makes libfaim act less sucky in the event of some weird connection problems (read: rare shizzle). Also some header and compile warning cleanup. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 20 Jun 2003 04:16:23 +0000
parents 6c22d37c6a3c
children 395c7f769e05
files src/protocols/oscar/aim.h src/protocols/oscar/aim_internal.h src/protocols/oscar/auth.c src/protocols/oscar/bos.c src/protocols/oscar/buddylist.c src/protocols/oscar/chat.c src/protocols/oscar/ft.c src/protocols/oscar/info.c src/protocols/oscar/rxhandlers.c src/protocols/oscar/rxqueue.c src/protocols/oscar/util.c
diffstat 11 files changed, 33 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/aim.h	Fri Jun 20 03:55:56 2003 +0000
+++ b/src/protocols/oscar/aim.h	Fri Jun 20 04:16:23 2003 +0000
@@ -547,7 +547,7 @@
 
 faim_export int aim_conn_setlatency(aim_conn_t *conn, int newval);
 
-faim_export int aim_conn_addhandler(aim_session_t *, aim_conn_t *conn, u_short family, u_short type, aim_rxcallback_t newhandler, u_short flags);
+faim_export int aim_conn_addhandler(aim_session_t *, aim_conn_t *conn, fu16_t family, fu16_t type, aim_rxcallback_t newhandler, fu16_t flags);
 faim_export int aim_clearhandlers(aim_conn_t *conn);
 
 faim_export aim_conn_t *aim_conn_findbygroup(aim_session_t *sess, fu16_t group);
@@ -556,6 +556,7 @@
 faim_export aim_conn_t *aim_newconn(aim_session_t *, int type, const char *dest);
 faim_export int aim_conngetmaxfd(aim_session_t *);
 faim_export aim_conn_t *aim_select(aim_session_t *, struct timeval *, int *);
+faim_export int aim_conn_in_sess(aim_session_t *sess, aim_conn_t *conn);
 faim_export int aim_conn_isready(aim_conn_t *);
 faim_export int aim_conn_setstatus(aim_conn_t *, int);
 faim_export int aim_conn_completeconnect(aim_session_t *sess, aim_conn_t *conn);
@@ -1377,18 +1378,18 @@
  * their use.
  *
  */
-#define aimutil_put8(buf, data) ((*(buf) = (u_char)(data)&0xff),1)
+#define aimutil_put8(buf, data) ((*(buf) = (fu8_t)(data)&0xff),1)
 #define aimutil_get8(buf) ((*(buf))&0xff)
 #define aimutil_put16(buf, data) ( \
-		(*(buf) = (u_char)((data)>>8)&0xff), \
-		(*((buf)+1) = (u_char)(data)&0xff),  \
+		(*(buf) = (fu8_t)((data)>>8)&0xff), \
+		(*((buf)+1) = (fu8_t)(data)&0xff),  \
 		2)
 #define aimutil_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff))
 #define aimutil_put32(buf, data) ( \
-		(*((buf)) = (u_char)((data)>>24)&0xff), \
-		(*((buf)+1) = (u_char)((data)>>16)&0xff), \
-		(*((buf)+2) = (u_char)((data)>>8)&0xff), \
-		(*((buf)+3) = (u_char)(data)&0xff), \
+		(*((buf)) = (fu8_t)((data)>>24)&0xff), \
+		(*((buf)+1) = (fu8_t)((data)>>16)&0xff), \
+		(*((buf)+2) = (fu8_t)((data)>>8)&0xff), \
+		(*((buf)+3) = (fu8_t)(data)&0xff), \
 		4)
 #define aimutil_get32(buf) ((((*(buf))<<24)&0xff000000) + \
 		(((*((buf)+1))<<16)&0x00ff0000) + \
@@ -1423,7 +1424,7 @@
 		(((*((buf)+3)) << 24) & 0xff000000))
 
 
-faim_export int aimutil_putstr(u_char *, const char *, int);
+faim_export int aimutil_putstr(char *, const char *, int);
 faim_export fu16_t aimutil_iconsum(const fu8_t *buf, int buflen);
 faim_export int aim_util_getlocalip(fu8_t *ip);
 faim_export int aimutil_tokslen(char *toSearch, int index, char dl);
--- a/src/protocols/oscar/aim_internal.h	Fri Jun 20 03:55:56 2003 +0000
+++ b/src/protocols/oscar/aim_internal.h	Fri Jun 20 04:16:23 2003 +0000
@@ -96,7 +96,7 @@
 faim_internal int aim_rxdispatch_rendezvous(aim_session_t *sess, aim_frame_t *fr);
 
 /* rxhandlers.c */
-faim_internal aim_rxcallback_t aim_callhandler(aim_session_t *sess, aim_conn_t *conn, u_short family, u_short type);
+faim_internal aim_rxcallback_t aim_callhandler(aim_session_t *sess, aim_conn_t *conn, fu16_t family, fu16_t type);
 faim_internal int aim_callhandler_noparam(aim_session_t *sess, aim_conn_t *conn, fu16_t family, fu16_t type, aim_frame_t *ptr);
 faim_internal int aim_parse_unknown(aim_session_t *, aim_frame_t *, ...);
 faim_internal void aim_clonehandlers(aim_session_t *sess, aim_conn_t *dest, aim_conn_t *src);
--- a/src/protocols/oscar/auth.c	Fri Jun 20 03:55:56 2003 +0000
+++ b/src/protocols/oscar/auth.c	Fri Jun 20 04:16:23 2003 +0000
@@ -11,7 +11,7 @@
 
 #include "md5.h"
 
-static int aim_encode_password(const char *password, unsigned char *encoded);
+static int aim_encode_password(const char *password, fu8_t *encoded);
 
 /* 
  * This just pushes the passed cookie onto the passed connection, without
@@ -157,7 +157,7 @@
 	aim_frame_t *fr;
 	aim_tlvlist_t *tl = NULL;
 	int passwdlen;
-	char *password_encoded;
+	fu8_t *password_encoded;
 
 	passwdlen = strlen(password);
 	if (!(password_encoded = (char *)malloc(passwdlen+1)))
--- a/src/protocols/oscar/bos.c	Fri Jun 20 03:55:56 2003 +0000
+++ b/src/protocols/oscar/bos.c	Fri Jun 20 04:16:23 2003 +0000
@@ -6,6 +6,8 @@
 #define FAIM_INTERNAL
 #include <aim.h>
 
+#include <string.h>
+
 /* Subtype 0x0002 - Request BOS rights. */
 faim_export int aim_bos_reqrights(aim_session_t *sess, aim_conn_t *conn)
 {
--- a/src/protocols/oscar/buddylist.c	Fri Jun 20 03:55:56 2003 +0000
+++ b/src/protocols/oscar/buddylist.c	Fri Jun 20 04:16:23 2003 +0000
@@ -6,6 +6,8 @@
 #define FAIM_INTERNAL
 #include <aim.h>
 
+#include <string.h>
+
 /*
  * Subtype 0x0002 - Request rights.
  *
--- a/src/protocols/oscar/chat.c	Fri Jun 20 03:55:56 2003 +0000
+++ b/src/protocols/oscar/chat.c	Fri Jun 20 04:16:23 2003 +0000
@@ -6,6 +6,8 @@
 #define FAIM_INTERNAL
 #include <aim.h> 
 
+#include <string.h>
+
 /* Stored in the ->priv of chat connections */
 struct chatconnpriv {
 	fu16_t exchange;
--- a/src/protocols/oscar/ft.c	Fri Jun 20 03:55:56 2003 +0000
+++ b/src/protocols/oscar/ft.c	Fri Jun 20 04:16:23 2003 +0000
@@ -47,6 +47,7 @@
 #include <aim.h>
 
 #ifndef _WIN32
+#include <stdio.h>
 #include <netdb.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
--- a/src/protocols/oscar/info.c	Fri Jun 20 03:55:56 2003 +0000
+++ b/src/protocols/oscar/info.c	Fri Jun 20 04:16:23 2003 +0000
@@ -242,7 +242,7 @@
 } aim_caps[] = {
 
 	/*
-	 * These are mostly in ascending numerical order.
+	 * These are in ascending numerical order.
 	 */
 	{AIM_CAPS_ICHAT,
 	 {0x09, 0x46, 0x00, 0x00, 0x4c, 0x7f, 0x11, 0xd1, 
--- a/src/protocols/oscar/rxhandlers.c	Fri Jun 20 03:55:56 2003 +0000
+++ b/src/protocols/oscar/rxhandlers.c	Fri Jun 20 04:16:23 2003 +0000
@@ -14,7 +14,7 @@
 	fu16_t family;
 	fu16_t type;
 	aim_rxcallback_t handler;
-	u_short flags;
+	fu16_t flags;
 	struct aim_rxcblist_s *next;
 };
 
--- a/src/protocols/oscar/rxqueue.c	Fri Jun 20 03:55:56 2003 +0000
+++ b/src/protocols/oscar/rxqueue.c	Fri Jun 20 04:16:23 2003 +0000
@@ -182,9 +182,16 @@
 	 * Rendezvous (client to client) connections do not speak FLAP, so this 
 	 * function will break on them.
 	 */
-	if (conn->type == AIM_CONN_TYPE_RENDEZVOUS)
-		payloadlen = aim_get_command_rendezvous(sess, conn, newrx);
-	else if (conn->type == AIM_CONN_TYPE_LISTENER) {
+	if (conn->type == AIM_CONN_TYPE_RENDEZVOUS) {
+		int ret = aim_get_command_rendezvous(sess, conn, newrx);
+
+		if (ret < 0) {
+			free(newrx);
+			return -1;
+		}
+
+		payloadlen = ret;
+	} else if (conn->type == AIM_CONN_TYPE_LISTENER) {
 		faimdprintf(sess, 0, "AIM_CONN_TYPE_LISTENER on fd %d\n", conn->fd);
 		free(newrx);
 		return -1;
--- a/src/protocols/oscar/util.c	Fri Jun 20 03:55:56 2003 +0000
+++ b/src/protocols/oscar/util.c	Fri Jun 20 04:16:23 2003 +0000
@@ -29,7 +29,7 @@
 	return;
 }
 
-faim_export int aimutil_putstr(u_char *dest, const char *src, int len)
+faim_export int aimutil_putstr(char *dest, const char *src, int len)
 {
 	memcpy(dest, src, len);
 	return len;