changeset 22829:ab2322195dab

Minor changes... mostly whitespace related. Also changed some functions in family_admin.c to be void instead of returning the same int every time, and fixed a tiny memleak in family_admin.c. Oh, I think there was a variable in family_icbm.c that was being redeclared inside of a block--functionally it was fine, but it could have led to confusion.
author Mark Doliner <mark@kingant.net>
date Mon, 05 May 2008 09:22:46 +0000
parents 61e0bcbf31ab
children 26b9735a34ae
files libpurple/protocols/oscar/family_admin.c libpurple/protocols/oscar/family_bart.c libpurple/protocols/oscar/family_chat.c libpurple/protocols/oscar/family_feedbag.c libpurple/protocols/oscar/family_icbm.c libpurple/protocols/oscar/family_icq.c libpurple/protocols/oscar/family_locate.c libpurple/protocols/oscar/family_odir.c libpurple/protocols/oscar/family_oservice.c libpurple/protocols/oscar/family_userlookup.c libpurple/protocols/oscar/flap_connection.c libpurple/protocols/oscar/oscar.h
diffstat 12 files changed, 66 insertions(+), 79 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/family_admin.c	Mon May 05 04:54:37 2008 +0000
+++ b/libpurple/protocols/oscar/family_admin.c	Mon May 05 09:22:46 2008 +0000
@@ -28,16 +28,15 @@
 
 #include "oscar.h"
 
-/*
+/**
  * Subtype 0x0002 - Request a bit of account info.
  *
  * Info should be one of the following:
  * 0x0001 - Screen name formatting
  * 0x0011 - Email address
  * 0x0013 - Unknown
- *
  */
-int
+void
 aim_admin_getinfo(OscarData *od, FlapConnection *conn, guint16 info)
 {
 	ByteStream bs;
@@ -48,22 +47,19 @@
 	byte_stream_put16(&bs, info);
 	byte_stream_put16(&bs, 0x0000);
 
-	snacid = aim_cachesnac(od, 0x0007, 0x0002, 0x0000, NULL, 0);	
-	flap_connection_send_snac(od, conn, 0x0007, 0x0002, 0x0000, snacid, &bs);	
+	snacid = aim_cachesnac(od, 0x0007, 0x0002, 0x0000, NULL, 0);
+	flap_connection_send_snac(od, conn, 0x0007, 0x0002, 0x0000, snacid, &bs);
 
 	byte_stream_destroy(&bs);
-
-	return 0;
 }
 
-/*
+/**
  * Subtypes 0x0003 and 0x0005 - Parse account info.
  *
  * Called in reply to both an information request (subtype 0x0002) and
  * an information change (subtype 0x0004).
- *
  */
-static int
+static void
 infochange(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
 {
 	aim_rxcallback_t userfunc;
@@ -112,15 +108,12 @@
 	g_free(sn);
 	g_free(url);
 	g_free(email);
-
-	return 1;
 }
 
-/*
+/**
  * Subtype 0x0004 - Set screenname formatting.
- *
  */
-int
+void
 aim_admin_setnick(OscarData *od, FlapConnection *conn, const char *newnick)
 {
 	ByteStream bs;
@@ -138,15 +131,12 @@
 	flap_connection_send_snac(od, conn, 0x0007, 0x0004, 0x0000, snacid, &bs);
 
 	byte_stream_destroy(&bs);
-
-	return 0;
 }
 
-/*
+/**
  * Subtype 0x0004 - Change password.
- *
  */
-int
+void
 aim_admin_changepasswd(OscarData *od, FlapConnection *conn, const char *newpw, const char *curpw)
 {
 	ByteStream bs;
@@ -167,14 +157,13 @@
 	snacid = aim_cachesnac(od, 0x0007, 0x0004, 0x0000, NULL, 0);
 	flap_connection_send_snac(od, conn, 0x0007, 0x0004, 0x0000, snacid, &bs);
 
-	return 0;
+	byte_stream_destroy(&bs);
 }
 
-/*
+/**
  * Subtype 0x0004 - Change email address.
- *
  */
-int
+void
 aim_admin_setemail(OscarData *od, FlapConnection *conn, const char *newemail)
 {
 	ByteStream bs;
@@ -192,8 +181,6 @@
 	flap_connection_send_snac(od, conn, 0x0007, 0x0004, 0x0000, snacid, &bs);
 
 	byte_stream_destroy(&bs);
-
-	return 0;
 }
 
 /*
@@ -210,9 +197,8 @@
 	aim_genericreq_n(od, conn, 0x0007, 0x0006);
 }
 
-/*
+/**
  * Subtype 0x0007 - Account confirmation request acknowledgement.
- *
  */
 static int
 accountconfirm(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
@@ -238,9 +224,10 @@
 static int
 snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
 {
-	if ((snac->subtype == 0x0003) || (snac->subtype == 0x0005))
-		return infochange(od, conn, mod, frame, snac, bs);
-	else if (snac->subtype == 0x0007)
+	if ((snac->subtype == 0x0003) || (snac->subtype == 0x0005)) {
+		infochange(od, conn, mod, frame, snac, bs);
+		return 1;
+	} else if (snac->subtype == 0x0007)
 		return accountconfirm(od, conn, mod, frame, snac, bs);
 
 	return 0;
--- a/libpurple/protocols/oscar/family_bart.c	Mon May 05 04:54:37 2008 +0000
+++ b/libpurple/protocols/oscar/family_bart.c	Mon May 05 09:22:46 2008 +0000
@@ -57,9 +57,9 @@
 
 	snacid = aim_cachesnac(od, 0x0010, 0x0002, 0x0000, NULL, 0);
 	flap_connection_send_snac(od, conn, 0x0010, 0x0002, 0x0000, snacid, &bs);
-	
+
 	byte_stream_destroy(&bs);
-	
+
 	return 0;
 }
 
--- a/libpurple/protocols/oscar/family_chat.c	Mon May 05 04:54:37 2008 +0000
+++ b/libpurple/protocols/oscar/family_chat.c	Mon May 05 09:22:46 2008 +0000
@@ -435,7 +435,7 @@
 	flap_connection_send_snac(od, conn, 0x000e, 0x0005, 0x0000, snacid, &bs);
 
 	byte_stream_destroy(&bs);
-	
+
 	return 0;
 }
 
--- a/libpurple/protocols/oscar/family_feedbag.c	Mon May 05 04:54:37 2008 +0000
+++ b/libpurple/protocols/oscar/family_feedbag.c	Mon May 05 09:22:46 2008 +0000
@@ -1690,7 +1690,7 @@
 	if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG)) || !sn)
 		return -EINVAL;
 
-	byte_stream_new(&bs, 1+strlen(sn)+2+(msg ? strlen(msg)+1 : 0)+2);
+	byte_stream_new(&bs, 1+strlen(sn) + 2+(msg ? strlen(msg)+1 : 0) + 2);
 
 	/* Screen name */
 	byte_stream_put8(&bs, strlen(sn));
@@ -1764,7 +1764,7 @@
 	if (!od || !(conn = flap_connection_findbygroup(od, SNAC_FAMILY_FEEDBAG)) || !sn)
 		return -EINVAL;
 
-	byte_stream_new(&bs, 1+strlen(sn) + 2+(msg ? (strlen(msg)+1) : 0) + 2);
+	byte_stream_new(&bs, 1+strlen(sn) + 2+(msg ? strlen(msg)+1 : 0) + 2);
 
 	/* Screen name */
 	byte_stream_put8(&bs, strlen(sn));
@@ -1864,7 +1864,7 @@
 	flap_connection_send_snac(od, conn, SNAC_FAMILY_FEEDBAG, SNAC_SUBTYPE_FEEDBAG_SENDAUTHREP, 0x0000, snacid, &bs);
 
 	byte_stream_destroy(&bs);
-	
+
 	return 0;
 }
 
--- a/libpurple/protocols/oscar/family_icbm.c	Mon May 05 04:54:37 2008 +0000
+++ b/libpurple/protocols/oscar/family_icbm.c	Mon May 05 09:22:46 2008 +0000
@@ -184,9 +184,9 @@
 
 	snacid = aim_cachesnac(od, 0x0004, 0x0002, 0x0000, NULL, 0);
 	flap_connection_send_snac(od, conn, 0x0004, 0x0002, 0x0000, snacid, &bs);
-	
+
 	byte_stream_destroy(&bs);
-	
+
 	return 0;
 }
 
@@ -520,7 +520,7 @@
 	aim_tlvlist_free(outer_tlvlist);
 
 	flap_connection_send_snac(od, conn, 0x0004, 0x0006, 0x0000, snacid, &bs);
-	
+
 	byte_stream_destroy(&bs);
 
 	return 0;
@@ -592,7 +592,7 @@
 	flap_connection_send_snac(od, conn, 0x0004, 0x0006, 0x0000, snacid, &bs);
 
 	byte_stream_destroy(&bs);
-	
+
 	return 0;
 }
 
@@ -685,7 +685,7 @@
 	flap_connection_send_snac(od, conn, 0x0004, 0x0006, 0x0000, snacid, &bs);
 
 	byte_stream_destroy(&bs);
-	
+
 	return 0;
 }
 
@@ -728,7 +728,7 @@
 	aim_tlvlist_write(&hdrbs, &inner_tlvlist);
 
 	aim_tlvlist_add_raw(&outer_tlvlist, 0x0005, byte_stream_curpos(&hdrbs), hdrbs.data);
-	g_free(hdrbs.data);
+	byte_stream_destroy(&hdrbs);
 
 	aim_tlvlist_write(&bs, &outer_tlvlist);
 
@@ -772,7 +772,7 @@
 
 	flap_connection_send_snac(od, conn, 0x0004, 0x0006, 0x0000, snacid, &bs);
 
-	byte_stream_destroy(&bs);	
+	byte_stream_destroy(&bs);
 }
 
 /**
@@ -945,20 +945,20 @@
 
 	if (filename != NULL)
 	{
-		ByteStream bs;
+		ByteStream inner_bs;
 
 		/* Begin TLV t(2711) */
-		byte_stream_new(&bs, 2+2+4+strlen(filename)+1);
-		byte_stream_put16(&bs, (numfiles > 1) ? 0x0002 : 0x0001);
-		byte_stream_put16(&bs, numfiles);
-		byte_stream_put32(&bs, size);
+		byte_stream_new(&inner_bs, 2+2+4+strlen(filename)+1);
+		byte_stream_put16(&inner_bs, (numfiles > 1) ? 0x0002 : 0x0001);
+		byte_stream_put16(&inner_bs, numfiles);
+		byte_stream_put32(&inner_bs, size);
 
 		/* Filename - NULL terminated, for some odd reason */
-		byte_stream_putstr(&bs, filename);
-		byte_stream_put8(&bs, 0x00);
-
-		aim_tlvlist_add_raw(&inner_tlvlist, 0x2711, bs.len, bs.data);
-		byte_stream_destroy(&bs);
+		byte_stream_putstr(&inner_bs, filename);
+		byte_stream_put8(&inner_bs, 0x00);
+
+		aim_tlvlist_add_raw(&inner_tlvlist, 0x2711, inner_bs.len, inner_bs.data);
+		byte_stream_destroy(&inner_bs);
 		/* End TLV t(2711) */
 	}
 
@@ -1163,7 +1163,7 @@
 	flap_connection_send_snac(od, conn, 0x0004, 0x0006, 0x0000, snacid, &bs);
 
 	byte_stream_destroy(&bs);
-	
+
 	return 0;
 }
 
@@ -1232,7 +1232,7 @@
 	flap_connection_send_snac(od, conn, 0x0004, 0x0006, 0x0000, snacid, &bs);
 
 	byte_stream_destroy(&bs);
-	
+
 	return 0;
 }
 
@@ -2339,7 +2339,7 @@
 	aim_tlvlist_free(tlvlist);
 
 	flap_connection_send_snac(od, conn, 0x0004, 0x000b, 0x0000, snacid, &bs);
-	
+
 	byte_stream_destroy(&bs);
 
 	return 0;
@@ -2716,7 +2716,7 @@
 	flap_connection_send_snac(od, conn, 0x0004, 0x0014, 0x0000, snacid, &bs);
 
 	byte_stream_destroy(&bs);
-	
+
 	return 0;
 }
 
--- a/libpurple/protocols/oscar/family_icq.c	Mon May 05 04:54:37 2008 +0000
+++ b/libpurple/protocols/oscar/family_icq.c	Mon May 05 09:22:46 2008 +0000
@@ -260,9 +260,9 @@
 	byte_stream_putle32(&bs, atoi(uin));
 
 	flap_connection_send_snac(od, conn, 0x0015, 0x0002, 0x0000, snacid, &bs);
-	
+
 	byte_stream_destroy(&bs);
-	
+
 	/* Keep track of this request and the ICQ number and request ID */
 	info = (struct aim_icq_info *)g_new0(struct aim_icq_info, 1);
 	info->reqid = snacid;
@@ -343,9 +343,9 @@
 	byte_stream_putraw(&bs, (guint8 *)xml, strlen(xml) + 1);
 
 	flap_connection_send_snac(od, conn, 0x0015, 0x0002, 0x0000, snacid, &bs);
-	
+
 	byte_stream_destroy(&bs);
-	
+
 	return 0;
 }
 #endif
--- a/libpurple/protocols/oscar/family_locate.c	Mon May 05 04:54:37 2008 +0000
+++ b/libpurple/protocols/oscar/family_locate.c	Mon May 05 09:22:46 2008 +0000
@@ -1353,7 +1353,7 @@
 	aim_tlvlist_free(tlvlist);
 
 	flap_connection_send_snac(od, conn, 0x0002, 0x000f, 0x0000, snacid, &bs);
-	
+
 	byte_stream_destroy(&bs);
 	return 0;
 }
--- a/libpurple/protocols/oscar/family_odir.c	Mon May 05 04:54:37 2008 +0000
+++ b/libpurple/protocols/oscar/family_odir.c	Mon May 05 09:22:46 2008 +0000
@@ -130,7 +130,7 @@
 	flap_connection_send_snac(od, conn, 0x000f, 0x0002, 0x0000, snacid, &bs);
 
 	byte_stream_destroy(&bs);
-	
+
 	return 0;
 }
 
@@ -165,9 +165,9 @@
 
 	snacid = aim_cachesnac(od, 0x000f, 0x0002, 0x0000, NULL, 0);
 	flap_connection_send_snac(od, conn, 0x000f, 0x0002, 0x0000, snacid, &bs);
-	
+
 	byte_stream_destroy(&bs);
-	
+
 	return 0;
 }
 
--- a/libpurple/protocols/oscar/family_oservice.c	Mon May 05 04:54:37 2008 +0000
+++ b/libpurple/protocols/oscar/family_oservice.c	Mon May 05 09:22:46 2008 +0000
@@ -56,7 +56,7 @@
 
 	snacid = aim_cachesnac(od, 0x0001, 0x0002, 0x0000, NULL, 0);
 	flap_connection_send_snac(od, conn, 0x0001, 0x0002, 0x0000, snacid, &bs);
-	
+
 	byte_stream_destroy(&bs);
 }
 
@@ -150,7 +150,7 @@
 	flap_connection_send_snac(od, conn, 0x0001, 0x0004, 0x0000, snacid, &bs);
 
 	byte_stream_destroy(&bs);
-	
+
 	return 0;
 }
 
@@ -392,7 +392,7 @@
 	snacid = aim_cachesnac(od, 0x0001, 0x0008, 0x0000, NULL, 0);
 	flap_connection_send_snac(od, conn, 0x0001, 0x0008, 0x0000, snacid, &bs);
 
-	byte_stream_destroy(&bs);	
+	byte_stream_destroy(&bs);
 }
 
 /* Subtype 0x0009 - Delete Rate Parameter */
@@ -415,7 +415,7 @@
 	snacid = aim_cachesnac(od, 0x0001, 0x0009, 0x0000, NULL, 0);
 	flap_connection_send_snac(od, conn, 0x0001, 0x0009, 0x0000, snacid, &bs);
 
-	byte_stream_destroy(&bs);	
+	byte_stream_destroy(&bs);
 }
 
 /* Subtype 0x000a - Rate Change */
@@ -865,7 +865,7 @@
 	flap_connection_send_snac(od, conn, 0x0001, 0x001e, 0x0000, snacid, &bs);
 
 	byte_stream_destroy(&bs);
-	
+
 	return 0;
 }
 
@@ -1016,7 +1016,7 @@
 	flap_connection_send_snac(od, conn, 0x0001, 0x0020, 0x0000, snacid, &bs);
 
 	byte_stream_destroy(&bs);
-	
+
 	return 0;
 }
 
--- a/libpurple/protocols/oscar/family_userlookup.c	Mon May 05 04:54:37 2008 +0000
+++ b/libpurple/protocols/oscar/family_userlookup.c	Mon May 05 09:22:46 2008 +0000
@@ -78,7 +78,7 @@
 	flap_connection_send_snac(od, conn, 0x000a, 0x0002, 0x0000, snacid, &bs);
 
 	byte_stream_destroy(&bs);
-	
+
 	return 0;
 }
 
--- a/libpurple/protocols/oscar/flap_connection.c	Mon May 05 04:54:37 2008 +0000
+++ b/libpurple/protocols/oscar/flap_connection.c	Mon May 05 09:22:46 2008 +0000
@@ -115,7 +115,7 @@
 	conn = data;
 	gettimeofday(&now, NULL);
 
-	purple_debug_info("oscar", "Attempting to send %i queued SNACs for %p\n", g_queue_get_length(conn->queued_snacs), conn);
+	purple_debug_info("oscar", "Attempting to send %u queued SNACs for %p\n", g_queue_get_length(conn->queued_snacs), conn);
 	while (!g_queue_is_empty(conn->queued_snacs))
 	{
 		QueuedSnac *queued_snac;
@@ -201,7 +201,7 @@
 			rateclass->last.tv_usec = now.tv_usec;
 		}
 	} else {
-		purple_debug_warning("oscar", "No rate class found for family %u subtype %u\n", family, subtype);
+		purple_debug_warning("oscar", "No rate class found for family %hu subtype %hu\n", family, subtype);
 	}
 
 	if (enqueue)
--- a/libpurple/protocols/oscar/oscar.h	Mon May 05 04:54:37 2008 +0000
+++ b/libpurple/protocols/oscar/oscar.h	Mon May 05 09:22:46 2008 +0000
@@ -1350,11 +1350,11 @@
 
 /* 0x0017 - family_auth.c */
 void aim_sendcookie(OscarData *, FlapConnection *, const guint16 length, const guint8 *);
-int aim_admin_changepasswd(OscarData *, FlapConnection *, const char *newpw, const char *curpw);
+void aim_admin_changepasswd(OscarData *, FlapConnection *, const char *newpw, const char *curpw);
 void aim_admin_reqconfirm(OscarData *od, FlapConnection *conn);
-int aim_admin_getinfo(OscarData *od, FlapConnection *conn, guint16 info);
-int aim_admin_setemail(OscarData *od, FlapConnection *conn, const char *newemail);
-int aim_admin_setnick(OscarData *od, FlapConnection *conn, const char *newnick);
+void aim_admin_getinfo(OscarData *od, FlapConnection *conn, guint16 info);
+void aim_admin_setemail(OscarData *od, FlapConnection *conn, const char *newemail);
+void aim_admin_setnick(OscarData *od, FlapConnection *conn, const char *newnick);