Index: protocols/oscar/admin.c
===================================================================
--- protocols/oscar/admin.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/admin.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -28,15 +28,18 @@
 			len = aimbs_get16(bs);
 
-			if ((type == 0x0011) || (type == 0x0004))
+			if ((type == 0x0011) || (type == 0x0004)) {
 				str = 1;
-
-			if (str)
-				val = (guint8 *)aimbs_getstr(bs, len);
-			else
+			}
+
+			if (str) {
+				val = (guint8 *) aimbs_getstr(bs, len);
+			} else {
 				val = aimbs_getraw(bs, len);
+			}
 
 			/* XXX fix so its only called once for the entire packet */
-			if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+			if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 				userfunc(sess, rx, (snac->subtype == 0x0005) ? 1 : 0, perms, type, len, val, str);
+			}
 
 			g_free(val);
@@ -49,5 +52,6 @@
 }
 
-static int accountconfirm(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
+static int accountconfirm(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac,
+                          aim_bstream_t *bs)
 {
 	aim_rxcallback_t userfunc;
@@ -56,6 +60,7 @@
 	status = aimbs_get16(bs);
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		return userfunc(sess, rx, status);
+	}
 
 	return 0;
@@ -65,8 +70,9 @@
 {
 
-	if ((snac->subtype == 0x0003) || (snac->subtype == 0x0005))
+	if ((snac->subtype == 0x0003) || (snac->subtype == 0x0005)) {
 		return infochange(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x0007)
+	} else if (snac->subtype == 0x0007) {
 		return accountconfirm(sess, mod, rx, snac, bs);
+	}
 
 	return 0;
@@ -79,5 +85,5 @@
 	mod->version = 0x0001;
 	mod->toolid = AIM_TOOL_NEWWIN;
-	mod->toolversion = 0x0629; 
+	mod->toolversion = 0x0629;
 	mod->flags = 0;
 	strncpy(mod->name, "admin", sizeof(mod->name));
@@ -93,6 +99,7 @@
 	aim_snacid_t snacid;
 
-	if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+4+strlen(curpw)+4+strlen(newpw))))
-		return -ENOMEM;
+	if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + strlen(curpw) + 4 + strlen(newpw)))) {
+		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0);
@@ -100,8 +107,8 @@
 
 	/* new password TLV t(0002) */
-	aim_addtlvtochain_raw(&tl, 0x0002, strlen(newpw), (guint8 *)newpw);
+	aim_addtlvtochain_raw(&tl, 0x0002, strlen(newpw), (guint8 *) newpw);
 
 	/* current password TLV t(0012) */
-	aim_addtlvtochain_raw(&tl, 0x0012, strlen(curpw), (guint8 *)curpw);
+	aim_addtlvtochain_raw(&tl, 0x0012, strlen(curpw), (guint8 *) curpw);
 
 	aim_writetlvchain(&tx->data, &tl);
@@ -114,5 +121,5 @@
 
 /*
- * Request account confirmation. 
+ * Request account confirmation.
  *
  * This will cause an email to be sent to the address associated with
@@ -131,5 +138,5 @@
  * The only known valid tag is 0x0011 (email address).
  *
- */ 
+ */
 int aim_admin_getinfo(aim_session_t *sess, aim_conn_t *conn, guint16 info)
 {
@@ -137,6 +144,7 @@
 	aim_snacid_t snacid;
 
-	if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 14)))
-		return -ENOMEM;
+	if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 14))) {
+		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, 0x0002, 0x0002, 0x0000, NULL, 0);
@@ -157,15 +165,16 @@
 	aim_tlvlist_t *tl = NULL;
 
-	if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(newemail))))
-		return -ENOMEM;
+	if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 2 + 2 + strlen(newemail)))) {
+		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0);
 	aim_putsnac(&tx->data, 0x0007, 0x0004, 0x0000, snacid);
 
-	aim_addtlvtochain_raw(&tl, 0x0011, strlen(newemail), (guint8 *)newemail);
-	
+	aim_addtlvtochain_raw(&tl, 0x0011, strlen(newemail), (guint8 *) newemail);
+
 	aim_writetlvchain(&tx->data, &tl);
 	aim_freetlvchain(&tl);
-	
+
 	aim_tx_enqueue(sess, tx);
 
@@ -179,18 +188,19 @@
 	aim_tlvlist_t *tl = NULL;
 
-	if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(newnick))))
-		return -ENOMEM;
+	if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 2 + 2 + strlen(newnick)))) {
+		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, 0x0007, 0x0004, 0x0000, NULL, 0);
 	aim_putsnac(&tx->data, 0x0007, 0x0004, 0x0000, snacid);
 
-	aim_addtlvtochain_raw(&tl, 0x0001, strlen(newnick), (guint8 *)newnick);
-	
+	aim_addtlvtochain_raw(&tl, 0x0001, strlen(newnick), (guint8 *) newnick);
+
 	aim_writetlvchain(&tx->data, &tl);
 	aim_freetlvchain(&tl);
-	
-	aim_tx_enqueue(sess, tx);
-
-
-	return 0;
-}
+
+	aim_tx_enqueue(sess, tx);
+
+
+	return 0;
+}
Index: protocols/oscar/admin.h
===================================================================
--- protocols/oscar/admin.h	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/admin.h	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -6,5 +6,5 @@
 /*
  * SNAC Family: Administrative Services.
- */ 
+ */
 #define AIM_CB_ADM_ERROR 0x0001
 #define AIM_CB_ADM_INFOCHANGE_REPLY 0x0005
Index: protocols/oscar/aim.h
===================================================================
--- protocols/oscar/aim.h	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/aim.h	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -1,3 +1,3 @@
-/* 
+/*
  * Main libfaim header.  Must be included in client for prototypes/macros.
  *
@@ -29,9 +29,9 @@
 
 #if defined(mach) && defined(__APPLE__)
-#define gethostbyname(x) gethostbyname2(x, AF_INET) 
+#define gethostbyname(x) gethostbyname2(x, AF_INET)
 #endif
 
-/* 
- * Current Maximum Length for Screen Names (not including NULL) 
+/*
+ * Current Maximum Length for Screen Names (not including NULL)
  *
  * Currently only names up to 16 characters can be registered
@@ -53,5 +53,5 @@
  *
  * XXX: the real limit is the total SNAC size at 8192. Fix this.
- * 
+ *
  */
 #define MAXMSGLEN 7987
@@ -67,5 +67,5 @@
  *
  * This is actually defined by the protocol to be
- * dynamic, but I have yet to see due cause to 
+ * dynamic, but I have yet to see due cause to
  * define it dynamically here.  Maybe later.
  *
@@ -81,8 +81,8 @@
 
 /*
- * Default Authorizer server name and TCP port for the OSCAR farm.  
+ * Default Authorizer server name and TCP port for the OSCAR farm.
  *
  * You shouldn't need to change this unless you're writing
- * your own server. 
+ * your own server.
  *
  * Note that only one server is needed to start the whole
@@ -107,5 +107,5 @@
 
 /*
- * Client info.  Filled in by the client and passed in to 
+ * Client info.  Filled in by the client and passed in to
  * aim_send_login().  The information ends up getting passed to OSCAR
  * through the initial login command.
@@ -124,42 +124,42 @@
 
 #define AIM_CLIENTINFO_KNOWNGOOD_3_5_1670 { \
-	"AOL Instant Messenger (SM), version 3.5.1670/WIN32", \
-	0x0004, \
-	0x0003, \
-	0x0005, \
-	0x0000, \
-	0x0686, \
-	"us", \
-	"en", \
+		"AOL Instant Messenger (SM), version 3.5.1670/WIN32", \
+		0x0004, \
+		0x0003, \
+		0x0005, \
+		0x0000, \
+		0x0686, \
+		"us", \
+		"en", \
 }
 
 #define AIM_CLIENTINFO_KNOWNGOOD_4_1_2010 { \
-	  "AOL Instant Messenger (SM), version 4.1.2010/WIN32", \
-	  0x0004, \
-	  0x0004, \
-	  0x0001, \
-	  0x0000, \
-	  0x07da, \
-	  "us", \
-	  "en", \
+		"AOL Instant Messenger (SM), version 4.1.2010/WIN32", \
+		0x0004, \
+		0x0004, \
+		0x0001, \
+		0x0000, \
+		0x07da, \
+		"us", \
+		"en", \
 }
 
 #define AIM_CLIENTINFO_KNOWNGOOD_5_1_3036 { \
-	"AOL Instant Messenger, version 5.1.3036/WIN32", \
-	0x0109, \
-	0x0005, \
-	0x0001, \
-	0x0000, \
-	0x0bdc, \
-	"us", \
-	"en", \
+		"AOL Instant Messenger, version 5.1.3036/WIN32", \
+		0x0109, \
+		0x0005, \
+		0x0001, \
+		0x0000, \
+		0x0bdc, \
+		"us", \
+		"en", \
 }
 
 /*
  * I would make 4.1.2010 the default, but they seem to have found
- * an alternate way of breaking that one. 
+ * an alternate way of breaking that one.
  *
  * 3.5.1670 should work fine, however, you will be subjected to the
- * memory test, which may require you to have a WinAIM binary laying 
+ * memory test, which may require you to have a WinAIM binary laying
  * around. (see login.c::memrequest())
  */
@@ -171,6 +171,6 @@
 #endif
 
-/* 
- * These could be arbitrary, but its easier to use the actual AIM values 
+/*
+ * These could be arbitrary, but its easier to use the actual AIM values
  */
 #define AIM_CONN_TYPE_AUTH          0x0007
@@ -207,9 +207,9 @@
 #define AIM_MTYPE_CONTACTS  0x13
 #define AIM_MTYPE_PLUGIN    0x1A
-#define AIM_MTYPE_AUTOAWAY	0xE8
-#define AIM_MTYPE_AUTOBUSY	0xE9
-#define AIM_MTYPE_AUTONA	0xEA
-#define AIM_MTYPE_AUTODND	0xEB
-#define AIM_MTYPE_AUTOFFC	0xEC
+#define AIM_MTYPE_AUTOAWAY      0xE8
+#define AIM_MTYPE_AUTOBUSY      0xE9
+#define AIM_MTYPE_AUTONA        0xEA
+#define AIM_MTYPE_AUTODND       0xEB
+#define AIM_MTYPE_AUTOFFC       0xEC
 
 typedef struct aim_conn_s {
@@ -222,5 +222,5 @@
 	void *internal; /* internal conn-specific libfaim data */
 	time_t lastactivity; /* time of last transmit */
-	int forcedlatency; 
+	int forcedlatency;
 	void *handlerlist;
 	void *sessv; /* pointer to parent session */
@@ -252,12 +252,12 @@
 	guint8 hdrtype; /* defines which piece of the union to use */
 	union {
-		struct { 
+		struct {
 			guint8 type;
-			flap_seqnum_t seqnum;     
+			flap_seqnum_t seqnum;
 		} flap;
 	} hdr;
-	aim_bstream_t data;	/* payload stream */
-	guint8 handled;		/* 0 = new, !0 = been handled */
-	guint8 nofree;		/* 0 = free data on purge, 1 = only unlink */
+	aim_bstream_t data;     /* payload stream */
+	guint8 handled;         /* 0 = new, !0 = been handled */
+	guint8 nofree;          /* 0 = free data on purge, 1 = only unlink */
 	aim_conn_t *conn;  /* the connection it came in on... */
 	struct aim_frame_s *next;
@@ -273,5 +273,5 @@
 
 /*
- * AIM Session: The main client-data interface.  
+ * AIM Session: The main client-data interface.
  *
  */
@@ -281,8 +281,8 @@
 
 	/* Our screen name. */
-	char sn[MAXSNLEN+1];
+	char sn[MAXSNLEN + 1];
 
 	/*
-	 * Pointer to anything the client wants to 
+	 * Pointer to anything the client wants to
 	 * explicitly associate with this session.
 	 *
@@ -314,8 +314,8 @@
 	 * I/O.  I don't suggest that you use libfaim's internal I/O.
 	 * Its really bad and the API/event model is quirky at best.
-	 *  
+	 *
 	 */
-	aim_frame_t *queue_outgoing;   
-	aim_frame_t *queue_incoming; 
+	aim_frame_t *queue_outgoing;
+	aim_frame_t *queue_incoming;
 
 	/*
@@ -330,5 +330,5 @@
 
 	/*
-	 * Outstanding snac handling 
+	 * Outstanding snac handling
 	 *
 	 * XXX: Should these be per-connection? -mid
@@ -384,5 +384,5 @@
  */
 typedef struct {
-	char sn[MAXSNLEN+1];
+	char sn[MAXSNLEN + 1];
 	guint16 warnlevel;
 	guint16 idletime;
@@ -390,5 +390,5 @@
 	guint32 membersince;
 	guint32 onlinesince;
-	guint32 sessionlen; 
+	guint32 sessionlen;
 	guint32 capabilities;
 	struct {
@@ -410,19 +410,19 @@
 #define AIM_USERINFO_PRESENT_SESSIONLEN   0x00000100
 
-#define AIM_FLAG_UNCONFIRMED 	0x0001 /* "damned transients" */
-#define AIM_FLAG_ADMINISTRATOR	0x0002
-#define AIM_FLAG_AOL		0x0004
-#define AIM_FLAG_OSCAR_PAY	0x0008
-#define AIM_FLAG_FREE 		0x0010
-#define AIM_FLAG_AWAY		0x0020
-#define AIM_FLAG_ICQ		0x0040
-#define AIM_FLAG_WIRELESS	0x0080
-#define AIM_FLAG_UNKNOWN100	0x0100
-#define AIM_FLAG_UNKNOWN200	0x0200
+#define AIM_FLAG_UNCONFIRMED    0x0001 /* "damned transients" */
+#define AIM_FLAG_ADMINISTRATOR  0x0002
+#define AIM_FLAG_AOL            0x0004
+#define AIM_FLAG_OSCAR_PAY      0x0008
+#define AIM_FLAG_FREE           0x0010
+#define AIM_FLAG_AWAY           0x0020
+#define AIM_FLAG_ICQ            0x0040
+#define AIM_FLAG_WIRELESS       0x0080
+#define AIM_FLAG_UNKNOWN100     0x0100
+#define AIM_FLAG_UNKNOWN200     0x0200
 #define AIM_FLAG_ACTIVEBUDDY    0x0400
-#define AIM_FLAG_UNKNOWN800	0x0800
+#define AIM_FLAG_UNKNOWN800     0x0800
 #define AIM_FLAG_ABINTERNAL     0x1000
 
-#define AIM_FLAG_ALLUSERS	0x001f
+#define AIM_FLAG_ALLUSERS       0x001f
 
 /*
@@ -468,5 +468,6 @@
 int aim_addtlvtochain_caps(aim_tlvlist_t **list, const guint16 t, const guint32 caps);
 int aim_addtlvtochain_noval(aim_tlvlist_t **list, const guint16 type);
-int aim_addtlvtochain_chatroom(aim_tlvlist_t **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance);
+int aim_addtlvtochain_chatroom(aim_tlvlist_t **list, guint16 type, guint16 exchange, const char *roomname,
+                               guint16 instance);
 int aim_addtlvtochain_userinfo(aim_tlvlist_t **list, guint16 type, aim_userinfo_t *ui);
 int aim_addtlvtochain_frozentlvlist(aim_tlvlist_t **list, guint16 type, aim_tlvlist_t **tl);
@@ -543,5 +544,6 @@
 void aim_conn_kill(aim_session_t *sess, aim_conn_t **deadconn);
 
-int aim_conn_addhandler(aim_session_t *, aim_conn_t *conn, u_short family, u_short type, aim_rxcallback_t newhandler, u_short flags);
+int aim_conn_addhandler(aim_session_t *, aim_conn_t *conn, u_short family, u_short type, aim_rxcallback_t newhandler,
+                        u_short flags);
 int aim_clearhandlers(aim_conn_t *conn);
 
@@ -558,5 +560,5 @@
 
 typedef void (*faim_debugging_callback_t)(aim_session_t *sess, int level, const char *format, va_list va);
-int aim_setdebuggingcb(aim_session_t *sess, faim_debugging_callback_t);
+int aim_setdebuggingcb(aim_session_t * sess, faim_debugging_callback_t);
 void aim_session_init(aim_session_t *, guint32 flags, int debuglevel);
 void aim_session_kill(aim_session_t *);
@@ -618,5 +620,6 @@
 /* aim_im.c */
 
-aim_conn_t *aim_sendfile_initiate(aim_session_t *, const char *destsn, const char *filename, guint16 numfiles, guint32 totsize);
+aim_conn_t *aim_sendfile_initiate(aim_session_t *, const char *destsn, const char *filename, guint16 numfiles,
+                                  guint32 totsize);
 
 aim_conn_t *aim_getfile_initiate(aim_session_t *sess, aim_conn_t *conn, const char *destsn);
@@ -653,27 +656,29 @@
 #define AIM_TRANSFER_DENY_DECLINE 0x0001
 #define AIM_TRANSFER_DENY_NOTACCEPTING 0x0002
-aim_conn_t *aim_accepttransfer(aim_session_t *sess, aim_conn_t *conn, const char *sn, const guint8 *cookie, const guint8 *ip, guint16 listingfiles, guint16 listingtotsize, guint16 listingsize, guint32 listingchecksum, guint16 rendid);
+aim_conn_t *aim_accepttransfer(aim_session_t *sess, aim_conn_t *conn, const char *sn, const guint8 *cookie,
+                               const guint8 *ip, guint16 listingfiles, guint16 listingtotsize, guint16 listingsize,
+                               guint32 listingchecksum, guint16 rendid);
 
 int aim_getinfo(aim_session_t *, aim_conn_t *, const char *, unsigned short);
 
-#define AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED	0x00000001
-#define AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED	0x00000002
+#define AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED       0x00000001
+#define AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED    0x00000002
 
 /* This is what the server will give you if you don't set them yourself. */
 #define AIM_IMPARAM_DEFAULTS { \
-	0, \
-	AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \
-	512, /* !! Note how small this is. */ \
-	(99.9)*10, (99.9)*10, \
-	1000 /* !! And how large this is. */ \
+		0, \
+		AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \
+		512, /* !! Note how small this is. */ \
+		(99.9) * 10, (99.9) * 10, \
+		1000 /* !! And how large this is. */ \
 }
 
 /* This is what most AIM versions use. */
 #define AIM_IMPARAM_REASONABLE { \
-	0, \
-	AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \
-	8000, \
-	(99.9)*10, (99.9)*10, \
-	0 \
+		0, \
+		AIM_IMPARAM_FLAG_CHANMSGS_ALLOWED | AIM_IMPARAM_FLAG_MISSEDCALLS_ENABLED, \
+		8000, \
+		(99.9) * 10, (99.9) * 10, \
+		0 \
 }
 
@@ -716,8 +721,8 @@
 };
 
-#define AIM_CHATFLAGS_NOREFLECT 	0x0001
-#define AIM_CHATFLAGS_AWAY      	0x0002
-#define AIM_CHATFLAGS_UNICODE		0x0004
-#define AIM_CHATFLAGS_ISO_8859_1	0x0008
+#define AIM_CHATFLAGS_NOREFLECT         0x0001
+#define AIM_CHATFLAGS_AWAY              0x0002
+#define AIM_CHATFLAGS_UNICODE           0x0004
+#define AIM_CHATFLAGS_ISO_8859_1        0x0008
 
 int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, guint16 flags, const char *msg, int msglen);
@@ -726,5 +731,6 @@
 int aim_chatnav_reqrights(aim_session_t *sess, aim_conn_t *conn);
 
-int aim_chat_invite(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *msg, guint16 exchange, const char *roomname, guint16 instance);
+int aim_chat_invite(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *msg, guint16 exchange,
+                    const char *roomname, guint16 instance);
 
 int aim_chatnav_createroom(aim_session_t *sess, aim_conn_t *conn, const char *name, guint16 exchange);
@@ -738,48 +744,48 @@
  *
  */
-#define aimutil_put8(buf, data) ((*(buf) = (u_char)(data)&0xff),1)
-#define aimutil_get8(buf) ((*(buf))&0xff)
+#define aimutil_put8(buf, data) ((*(buf) = (u_char) (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),  \
-		2)
-#define aimutil_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff))
+	        (*(buf) = (u_char) ((data) >> 8) & 0xff), \
+	        (*((buf) + 1) = (u_char) (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), \
-		4)
-#define aimutil_get32(buf) ((((*(buf))<<24)&0xff000000) + \
-		(((*((buf)+1))<<16)&0x00ff0000) + \
-		(((*((buf)+2))<< 8)&0x0000ff00) + \
-		(((*((buf)+3)    )&0x000000ff)))
+	        (*((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), \
+	        4)
+#define aimutil_get32(buf) ((((*(buf)) << 24) & 0xff000000) + \
+	                    (((*((buf) + 1)) << 16) & 0x00ff0000) + \
+	                    (((*((buf) + 2)) << 8) & 0x0000ff00) + \
+	                    (((*((buf) + 3)) & 0x000000ff)))
 
 /* Little-endian versions (damn ICQ) */
 #define aimutil_putle8(buf, data) ( \
-		(*(buf) = (unsigned char)(data) & 0xff), \
-		1)
+	        (*(buf) = (unsigned char) (data) & 0xff), \
+	        1)
 #define aimutil_getle8(buf) ( \
-		(*(buf)) & 0xff \
-		)
+	        (*(buf)) & 0xff \
+	        )
 #define aimutil_putle16(buf, data) ( \
-		(*((buf)+0) = (unsigned char)((data) >> 0) & 0xff),  \
-		(*((buf)+1) = (unsigned char)((data) >> 8) & 0xff), \
-		2)
+	        (*((buf) + 0) = (unsigned char) ((data) >> 0) & 0xff),  \
+	        (*((buf) + 1) = (unsigned char) ((data) >> 8) & 0xff), \
+	        2)
 #define aimutil_getle16(buf) ( \
-		(((*((buf)+0)) << 0) & 0x00ff) + \
-		(((*((buf)+1)) << 8) & 0xff00) \
-		)
+	        (((*((buf) + 0)) << 0) & 0x00ff) + \
+	        (((*((buf) + 1)) << 8) & 0xff00) \
+	        )
 #define aimutil_putle32(buf, data) ( \
-		(*((buf)+0) = (unsigned char)((data) >>  0) & 0xff), \
-		(*((buf)+1) = (unsigned char)((data) >>  8) & 0xff), \
-		(*((buf)+2) = (unsigned char)((data) >> 16) & 0xff), \
-		(*((buf)+3) = (unsigned char)((data) >> 24) & 0xff), \
-		4)
+	        (*((buf) + 0) = (unsigned char) ((data) >>  0) & 0xff), \
+	        (*((buf) + 1) = (unsigned char) ((data) >>  8) & 0xff), \
+	        (*((buf) + 2) = (unsigned char) ((data) >> 16) & 0xff), \
+	        (*((buf) + 3) = (unsigned char) ((data) >> 24) & 0xff), \
+	        4)
 #define aimutil_getle32(buf) ( \
-		(((*((buf)+0)) <<  0) & 0x000000ff) + \
-		(((*((buf)+1)) <<  8) & 0x0000ff00) + \
-		(((*((buf)+2)) << 16) & 0x00ff0000) + \
-		(((*((buf)+3)) << 24) & 0xff000000))
+	        (((*((buf) + 0)) <<  0) & 0x000000ff) + \
+	        (((*((buf) + 1)) <<  8) & 0x0000ff00) + \
+	        (((*((buf) + 2)) << 16) & 0x00ff0000) + \
+	        (((*((buf) + 3)) << 24) & 0xff000000))
 
 
@@ -797,5 +803,5 @@
 /*
  * SNAC Family: Ack.
- * 
+ *
  * Not really a family, but treating it as one really
  * helps it fit into the libfaim callback structure better.
@@ -806,5 +812,5 @@
 /*
  * SNAC Family: General.
- */ 
+ */
 #define AIM_CB_GEN_ERROR 0x0001
 #define AIM_CB_GEN_CLIENTREADY 0x0002
@@ -831,5 +837,5 @@
 /*
  * SNAC Family: Advertisement Services
- */ 
+ */
 #define AIM_CB_ADS_ERROR 0x0001
 #define AIM_CB_ADS_DEFAULT 0xffff
@@ -840,5 +846,5 @@
  * See non-SNAC note below.
  */
-#define AIM_CB_OFT_DIRECTIMCONNECTREQ 0x0001/* connect request -- actually an OSCAR CAP*/
+#define AIM_CB_OFT_DIRECTIMCONNECTREQ 0x0001 /* connect request -- actually an OSCAR CAP*/
 #define AIM_CB_OFT_DIRECTIMINCOMING 0x0002
 #define AIM_CB_OFT_DIRECTIMDISCONNECT 0x0003
@@ -869,5 +875,5 @@
  * the SNAC-centered libfaim callback structure.
  *
- */ 
+ */
 #define AIM_CB_SPECIAL_AUTHSUCCESS 0x0001
 #define AIM_CB_SPECIAL_AUTHOTHER 0x0002
Index: protocols/oscar/aim_internal.h
===================================================================
--- protocols/oscar/aim_internal.h	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/aim_internal.h	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -22,6 +22,7 @@
 	guint16 toolversion;
 	guint16 flags;
-	char name[AIM_MODULENAME_MAXLEN+1];
-	int (*snachandler)(aim_session_t *sess, struct aim_module_s *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs);
+	char name[AIM_MODULENAME_MAXLEN + 1];
+	int (*snachandler)(aim_session_t *sess, struct aim_module_s *mod, aim_frame_t *rx, aim_modsnac_t *snac,
+	                   aim_bstream_t *bs);
 	void (*shutdown)(aim_session_t *sess, struct aim_module_s *mod);
 	void *priv;
@@ -107,10 +108,11 @@
 
 void aim_initsnachash(aim_session_t *sess);
-aim_snacid_t aim_cachesnac(aim_session_t *sess, const guint16 family, const guint16 type, const guint16 flags, const void *data, const int datalen);
+aim_snacid_t aim_cachesnac(aim_session_t *sess, const guint16 family, const guint16 type, const guint16 flags,
+                           const void *data, const int datalen);
 aim_snac_t *aim_remsnac(aim_session_t *, aim_snacid_t id);
 void aim_cleansnacs(aim_session_t *, int maxage);
 int aim_putsnac(aim_bstream_t *, guint16 family, guint16 type, guint16 flags, aim_snacid_t id);
 
-int aim_oft_buildheader(unsigned char *,struct aim_fileheader_t *);
+int aim_oft_buildheader(unsigned char *, struct aim_fileheader_t *);
 
 int aim_parse_unknown(aim_session_t *, aim_frame_t *, ...);
@@ -138,5 +140,5 @@
 };
 
-/* 
+/*
  * In SNACland, the terms 'family' and 'group' are synonymous -- the former
  * is my term, the latter is AOL's.
@@ -170,7 +172,7 @@
  * This is inside every connection.  But it is a void * to anything
  * outside of libfaim.  It should remain that way.  It's called data
- * abstraction.  Maybe you've heard of it.  (Probably not if you're a 
+ * abstraction.  Maybe you've heard of it.  (Probably not if you're a
  * libfaim user.)
- * 
+ *
  */
 typedef struct aim_conn_inside_s {
Index: protocols/oscar/auth.c
===================================================================
--- protocols/oscar/auth.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/auth.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -4,5 +4,5 @@
  */
 
-#include <aim.h> 
+#include <aim.h>
 
 #include "md5.h"
@@ -10,5 +10,5 @@
 static int aim_encode_password(const char *password, unsigned char *encoded);
 
-/* 
+/*
  * This just pushes the passed cookie onto the passed connection, without
  * the SNAC header or any of that.
@@ -23,9 +23,10 @@
 	aim_tlvlist_t *tl = NULL;
 
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x0001, 4+2+2+AIM_COOKIELEN)))
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x0001, 4 + 2 + 2 + AIM_COOKIELEN))) {
 		return -ENOMEM;
+	}
 
 	aimbs_put32(&fr->data, 0x00000001);
-	aim_addtlvtochain_raw(&tl, 0x0006, AIM_COOKIELEN, chipsahoy);	
+	aim_addtlvtochain_raw(&tl, 0x0006, AIM_COOKIELEN, chipsahoy);
 	aim_writetlvchain(&fr->data, &tl);
 	aim_freetlvchain(&tl);
@@ -48,6 +49,7 @@
 	aim_frame_t *fr;
 
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x01, 4)))
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x01, 4))) {
 		return -ENOMEM;
+	}
 
 	aimbs_put32(&fr->data, 0x00000001);
@@ -95,22 +97,23 @@
 	aim_frame_t fr;
 	aim_rxcallback_t userfunc;
-	
+
 	sess->flags &= ~AIM_SESS_FLAGS_SNACLOGIN;
 	sess->flags |= AIM_SESS_FLAGS_XORLOGIN;
 
 	fr.conn = conn;
-	
-	if ((userfunc = aim_callhandler(sess, conn, 0x0017, 0x0007)))
+
+	if ((userfunc = aim_callhandler(sess, conn, 0x0017, 0x0007))) {
 		userfunc(sess, &fr, "");
-
-	return 0;
-}
-
-/*
- * In AIM 3.5 protocol, the first stage of login is to request login from the 
- * Authorizer, passing it the screen name for verification.  If the name is 
- * invalid, a 0017/0003 is spit back, with the standard error contents.  If 
- * valid, a 0017/0007 comes back, which is the signal to send it the main 
- * login command (0017/0002). 
+	}
+
+	return 0;
+}
+
+/*
+ * In AIM 3.5 protocol, the first stage of login is to request login from the
+ * Authorizer, passing it the screen name for verification.  If the name is
+ * invalid, a 0017/0003 is spit back, with the standard error contents.  If
+ * valid, a 0017/0007 comes back, which is the signal to send it the main
+ * login command (0017/0002).
  *
  */
@@ -121,10 +124,12 @@
 	aim_tlvlist_t *tl = NULL;
 	struct im_connection *ic = sess->aux_data;
-	
-	if (!sess || !conn || !sn)
+
+	if (!sess || !conn || !sn) {
 		return -EINVAL;
-
-	if (g_ascii_isdigit(sn[0]) && set_getbool(&ic->acc->set, "old_icq_auth"))
+	}
+
+	if (g_ascii_isdigit(sn[0]) && set_getbool(&ic->acc->set, "old_icq_auth")) {
 		return goddamnicq(sess, conn, sn);
+	}
 
 	sess->flags |= AIM_SESS_FLAGS_SNACLOGIN;
@@ -132,11 +137,12 @@
 	aim_sendflapver(sess, conn);
 
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(sn))))
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 2 + 2 + strlen(sn)))) {
 		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, 0x0017, 0x0006, 0x0000, NULL, 0);
 	aim_putsnac(&fr->data, 0x0017, 0x0006, 0x0000, snacid);
 
-	aim_addtlvtochain_raw(&tl, 0x0001, strlen(sn), (guint8 *)sn);
+	aim_addtlvtochain_raw(&tl, 0x0001, strlen(sn), (guint8 *) sn);
 	aim_writetlvchain(&fr->data, &tl);
 	aim_freetlvchain(&tl);
@@ -152,13 +158,14 @@
 static int goddamnicq2(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *password)
 {
-	static const char clientstr[] = {"ICQ Inc. - Product of ICQ (TM) 2001b.5.17.1.3642.85"};
-	static const char lang[] = {"en"};
-	static const char country[] = {"us"};
+	static const char clientstr[] = { "ICQ Inc. - Product of ICQ (TM) 2001b.5.17.1.3642.85" };
+	static const char lang[] = { "en" };
+	static const char country[] = { "us" };
 	aim_frame_t *fr;
 	aim_tlvlist_t *tl = NULL;
 	guint8 *password_encoded;
 
-	if (!(password_encoded = (guint8 *) g_malloc(strlen(password))))
+	if (!(password_encoded = (guint8 *) g_malloc(strlen(password)))) {
 		return -ENOMEM;
+	}
 
 	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x01, 1152))) {
@@ -170,7 +177,7 @@
 
 	aimbs_put32(&fr->data, 0x00000001);
-	aim_addtlvtochain_raw(&tl, 0x0001, strlen(sn), (guint8 *)sn);
+	aim_addtlvtochain_raw(&tl, 0x0001, strlen(sn), (guint8 *) sn);
 	aim_addtlvtochain_raw(&tl, 0x0002, strlen(password), password_encoded);
-	aim_addtlvtochain_raw(&tl, 0x0003, strlen(clientstr), (guint8 *)clientstr);
+	aim_addtlvtochain_raw(&tl, 0x0003, strlen(clientstr), (guint8 *) clientstr);
 	aim_addtlvtochain16(&tl, 0x0016, 0x010a); /* cliend ID */
 	aim_addtlvtochain16(&tl, 0x0017, 0x0005); /* major version */
@@ -179,6 +186,6 @@
 	aim_addtlvtochain16(&tl, 0x001a, 0x0e3a); /* build */
 	aim_addtlvtochain32(&tl, 0x0014, 0x00000055); /* distribution chan */
-	aim_addtlvtochain_raw(&tl, 0x000f, strlen(lang), (guint8 *)lang);
-	aim_addtlvtochain_raw(&tl, 0x000e, strlen(country), (guint8 *)country);
+	aim_addtlvtochain_raw(&tl, 0x000f, strlen(lang), (guint8 *) lang);
+	aim_addtlvtochain_raw(&tl, 0x000e, strlen(country), (guint8 *) country);
 
 	aim_writetlvchain(&fr->data, &tl);
@@ -194,5 +201,5 @@
 /*
  * send_login(int socket, char *sn, char *password)
- *  
+ *
  * This is the initial login request packet.
  *
@@ -249,5 +256,5 @@
  *   build  = 0x0013
  *   unknown= (not sent)
- *   
+ *
  * AIM for Linux 1.1.112:
  *   clientstring = "AOL Instant Messenger (SM)"
@@ -261,5 +268,6 @@
  *
  */
-int aim_send_login(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *password, struct client_info_s *ci, const char *key)
+int aim_send_login(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *password,
+                   struct client_info_s *ci, const char *key)
 {
 	aim_frame_t *fr;
@@ -268,6 +276,7 @@
 	aim_snacid_t snacid;
 
-	if (!ci || !sn || !password)
+	if (!ci || !sn || !password) {
 		return -EINVAL;
+	}
 
 	/*
@@ -276,15 +285,17 @@
 	 *
 	 */
-	if (sess->flags & AIM_SESS_FLAGS_XORLOGIN)
+	if (sess->flags & AIM_SESS_FLAGS_XORLOGIN) {
 		return goddamnicq2(sess, conn, sn, password);
-
-
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152)))
+	}
+
+
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152))) {
 		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, 0x0017, 0x0002, 0x0000, NULL, 0);
 	aim_putsnac(&fr->data, 0x0017, 0x0002, 0x0000, snacid);
 
-	aim_addtlvtochain_raw(&tl, 0x0001, strlen(sn), (guint8 *)sn);
+	aim_addtlvtochain_raw(&tl, 0x0001, strlen(sn), (guint8 *) sn);
 
 	aim_encode_password_md5(password, key, digest);
@@ -295,13 +306,14 @@
 	 */
 
-	if (ci->clientstring)
-		aim_addtlvtochain_raw(&tl, 0x0003, strlen(ci->clientstring), (guint8 *)ci->clientstring);
-	aim_addtlvtochain16(&tl, 0x0016, (guint16)ci->clientid);
-	aim_addtlvtochain16(&tl, 0x0017, (guint16)ci->major);
-	aim_addtlvtochain16(&tl, 0x0018, (guint16)ci->minor);
-	aim_addtlvtochain16(&tl, 0x0019, (guint16)ci->point);
-	aim_addtlvtochain16(&tl, 0x001a, (guint16)ci->build);
-	aim_addtlvtochain_raw(&tl, 0x000e, strlen(ci->country), (guint8 *)ci->country);
-	aim_addtlvtochain_raw(&tl, 0x000f, strlen(ci->lang), (guint8 *)ci->lang);
+	if (ci->clientstring) {
+		aim_addtlvtochain_raw(&tl, 0x0003, strlen(ci->clientstring), (guint8 *) ci->clientstring);
+	}
+	aim_addtlvtochain16(&tl, 0x0016, (guint16) ci->clientid);
+	aim_addtlvtochain16(&tl, 0x0017, (guint16) ci->major);
+	aim_addtlvtochain16(&tl, 0x0018, (guint16) ci->minor);
+	aim_addtlvtochain16(&tl, 0x0019, (guint16) ci->point);
+	aim_addtlvtochain16(&tl, 0x001a, (guint16) ci->build);
+	aim_addtlvtochain_raw(&tl, 0x000e, strlen(ci->country), (guint8 *) ci->country);
+	aim_addtlvtochain_raw(&tl, 0x000f, strlen(ci->lang), (guint8 *) ci->lang);
 
 	/*
@@ -314,5 +326,5 @@
 
 	aim_freetlvchain(&tl);
-	
+
 	aim_tx_enqueue(sess, fr);
 
@@ -324,9 +336,9 @@
 	md5_state_t state;
 
-	md5_init(&state);	
-	md5_append(&state, (const md5_byte_t *)key, strlen(key));
-	md5_append(&state, (const md5_byte_t *)password, strlen(password));
-	md5_append(&state, (const md5_byte_t *)AIM_MD5_STRING, strlen(AIM_MD5_STRING));
-	md5_finish(&state, (md5_byte_t *)digest);
+	md5_init(&state);
+	md5_append(&state, (const md5_byte_t *) key, strlen(key));
+	md5_append(&state, (const md5_byte_t *) password, strlen(password));
+	md5_append(&state, (const md5_byte_t *) AIM_MD5_STRING, strlen(AIM_MD5_STRING));
+	md5_finish(&state, (md5_byte_t *) digest);
 
 	return 0;
@@ -345,5 +357,5 @@
  *
  * The encoding_table seems to be a fixed set of values.  We'll
- * hope it doesn't change over time!  
+ * hope it doesn't change over time!
  *
  * This is only used for the XOR method, not the better MD5 method.
@@ -353,5 +365,5 @@
 {
 	guint8 encoding_table[] = {
-	/* v2.1 table, also works for ICQ */
+		/* v2.1 table, also works for ICQ */
 		0xf3, 0x26, 0x81, 0xc4,
 		0x39, 0x86, 0xdb, 0x92,
@@ -361,6 +373,7 @@
 	int i;
 
-	for (i = 0; i < strlen(password); i++)
+	for (i = 0; i < strlen(password); i++) {
 		encoded[i] = (password[i] ^ encoding_table[i]);
+	}
 
 	return 0;
@@ -370,5 +383,5 @@
  * This is sent back as a general response to the login command.
  * It can be either an error or a success, depending on the
- * precense of certain TLVs.  
+ * precense of certain TLVs.
  *
  * The client should check the value passed as errorcode. If
@@ -404,14 +417,17 @@
 	 * have an error url.
 	 */
-	if (aim_gettlv(tlvlist, 0x0008, 1)) 
+	if (aim_gettlv(tlvlist, 0x0008, 1)) {
 		info.errorcode = aim_gettlv16(tlvlist, 0x0008, 1);
-	if (aim_gettlv(tlvlist, 0x0004, 1))
+	}
+	if (aim_gettlv(tlvlist, 0x0004, 1)) {
 		info.errorurl = aim_gettlv_str(tlvlist, 0x0004, 1);
+	}
 
 	/*
 	 * BOS server address.
 	 */
-	if (aim_gettlv(tlvlist, 0x0005, 1))
+	if (aim_gettlv(tlvlist, 0x0005, 1)) {
 		info.bosip = aim_gettlv_str(tlvlist, 0x0005, 1);
+	}
 
 	/*
@@ -430,6 +446,7 @@
 	 *   Not available for ICQ logins.
 	 */
-	if (aim_gettlv(tlvlist, 0x0011, 1))
+	if (aim_gettlv(tlvlist, 0x0011, 1)) {
 		info.email = aim_gettlv_str(tlvlist, 0x0011, 1);
+	}
 
 	/*
@@ -445,32 +462,44 @@
 	 *
 	 */
-	if (aim_gettlv(tlvlist, 0x0013, 1))
+	if (aim_gettlv(tlvlist, 0x0013, 1)) {
 		info.regstatus = aim_gettlv16(tlvlist, 0x0013, 1);
-
-	if (aim_gettlv(tlvlist, 0x0040, 1))
+	}
+
+	if (aim_gettlv(tlvlist, 0x0040, 1)) {
 		info.latestbeta.build = aim_gettlv32(tlvlist, 0x0040, 1);
-	if (aim_gettlv(tlvlist, 0x0041, 1))
+	}
+	if (aim_gettlv(tlvlist, 0x0041, 1)) {
 		info.latestbeta.url = aim_gettlv_str(tlvlist, 0x0041, 1);
-	if (aim_gettlv(tlvlist, 0x0042, 1))
+	}
+	if (aim_gettlv(tlvlist, 0x0042, 1)) {
 		info.latestbeta.info = aim_gettlv_str(tlvlist, 0x0042, 1);
-	if (aim_gettlv(tlvlist, 0x0043, 1))
+	}
+	if (aim_gettlv(tlvlist, 0x0043, 1)) {
 		info.latestbeta.name = aim_gettlv_str(tlvlist, 0x0043, 1);
-	if (aim_gettlv(tlvlist, 0x0048, 1))
+	}
+	if (aim_gettlv(tlvlist, 0x0048, 1)) {
 		; /* no idea what this is */
 
-	if (aim_gettlv(tlvlist, 0x0044, 1))
+	}
+	if (aim_gettlv(tlvlist, 0x0044, 1)) {
 		info.latestrelease.build = aim_gettlv32(tlvlist, 0x0044, 1);
-	if (aim_gettlv(tlvlist, 0x0045, 1))
+	}
+	if (aim_gettlv(tlvlist, 0x0045, 1)) {
 		info.latestrelease.url = aim_gettlv_str(tlvlist, 0x0045, 1);
-	if (aim_gettlv(tlvlist, 0x0046, 1))
+	}
+	if (aim_gettlv(tlvlist, 0x0046, 1)) {
 		info.latestrelease.info = aim_gettlv_str(tlvlist, 0x0046, 1);
-	if (aim_gettlv(tlvlist, 0x0047, 1))
+	}
+	if (aim_gettlv(tlvlist, 0x0047, 1)) {
 		info.latestrelease.name = aim_gettlv_str(tlvlist, 0x0047, 1);
-	if (aim_gettlv(tlvlist, 0x0049, 1))
+	}
+	if (aim_gettlv(tlvlist, 0x0049, 1)) {
 		; /* no idea what this is */
 
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac ? snac->family : 0x0017, snac ? snac->subtype : 0x0003)))
+	}
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac ? snac->family : 0x0017, snac ? snac->subtype : 0x0003))) {
 		ret = userfunc(sess, rx, &info);
+	}
 
 	g_free(info.sn);
@@ -506,8 +535,9 @@
 	keystr = aimbs_getstr(bs, keylen);
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, keystr);
-
-	g_free(keystr); 
+	}
+
+	g_free(keystr);
 
 	return ret;
@@ -517,8 +547,9 @@
 {
 
-	if (snac->subtype == 0x0003)
+	if (snac->subtype == 0x0003) {
 		return parse(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x0007)
+	} else if (snac->subtype == 0x0007) {
 		return keyparse(sess, mod, rx, snac, bs);
+	}
 
 	return 0;
Index: protocols/oscar/bos.c
===================================================================
--- protocols/oscar/bos.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/bos.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -16,6 +16,6 @@
 	int ret = 0;
 
-	/* 
-	 * TLVs follow 
+	/*
+	 * TLVs follow
 	 */
 	tlvlist = aim_readtlvchain(bs);
@@ -24,22 +24,25 @@
 	 * TLV type 0x0001: Maximum number of buddies on permit list.
 	 */
-	if (aim_gettlv(tlvlist, 0x0001, 1))
+	if (aim_gettlv(tlvlist, 0x0001, 1)) {
 		maxpermits = aim_gettlv16(tlvlist, 0x0001, 1);
+	}
 
 	/*
 	 * TLV type 0x0002: Maximum number of buddies on deny list.
 	 */
-	if (aim_gettlv(tlvlist, 0x0002, 1)) 
+	if (aim_gettlv(tlvlist, 0x0002, 1)) {
 		maxdenies = aim_gettlv16(tlvlist, 0x0002, 1);
+	}
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, maxpermits, maxdenies);
+	}
 
 	aim_freetlvchain(&tlvlist);
 
-	return ret;  
+	return ret;
 }
 
-/* 
+/*
  * Set group permisson mask (group 9, type 4)
  *
@@ -59,6 +62,7 @@
 {
 
-	if (snac->subtype == 0x0003)
+	if (snac->subtype == 0x0003) {
 		return rights(sess, mod, rx, snac, bs);
+	}
 
 	return 0;
Index: protocols/oscar/bos.h
===================================================================
--- protocols/oscar/bos.h	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/bos.h	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -6,5 +6,5 @@
 /*
  * SNAC Family: Misc BOS Services.
- */ 
+ */
 #define AIM_CB_BOS_ERROR 0x0001
 #define AIM_CB_BOS_RIGHTSQUERY 0x0002
Index: protocols/oscar/buddylist.c
===================================================================
--- protocols/oscar/buddylist.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/buddylist.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -18,6 +18,7 @@
 	aim_extractuserinfo(sess, bs, &userinfo);
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		return userfunc(sess, rx, &userinfo);
+	}
 
 	return 0;
@@ -31,6 +32,6 @@
 	int ret = 0;
 
-	/* 
-	 * TLVs follow 
+	/*
+	 * TLVs follow
 	 */
 	tlvlist = aim_readtlvchain(bs);
@@ -39,6 +40,7 @@
 	 * TLV type 0x0001: Maximum number of buddies.
 	 */
-	if (aim_gettlv(tlvlist, 0x0001, 1))
+	if (aim_gettlv(tlvlist, 0x0001, 1)) {
 		maxbuddies = aim_gettlv16(tlvlist, 0x0001, 1);
+	}
 
 	/*
@@ -48,8 +50,9 @@
 	 * list.  (This is called the "reverse list" by a certain
 	 * other IM protocol.)
-	 * 
+	 *
 	 */
-	if (aim_gettlv(tlvlist, 0x0002, 1))
+	if (aim_gettlv(tlvlist, 0x0002, 1)) {
 		maxwatchers = aim_gettlv16(tlvlist, 0x0002, 1);
+	}
 
 	/*
@@ -59,10 +62,11 @@
 	 */
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, maxbuddies, maxwatchers);
+	}
 
 	aim_freetlvchain(&tlvlist);
 
-	return ret;  
+	return ret;
 }
 
@@ -70,8 +74,9 @@
 {
 
-	if (snac->subtype == 0x0003)
+	if (snac->subtype == 0x0003) {
 		return rights(sess, mod, rx, snac, bs);
-	else if ((snac->subtype == 0x000b) || (snac->subtype == 0x000c))
+	} else if ((snac->subtype == 0x000b) || (snac->subtype == 0x000c)) {
 		return buddychange(sess, mod, rx, snac, bs);
+	}
 
 	return 0;
Index: protocols/oscar/buddylist.h
===================================================================
--- protocols/oscar/buddylist.h	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/buddylist.h	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -6,5 +6,5 @@
 /*
  * SNAC Family: Buddy List Management Services.
- */ 
+ */
 #define AIM_CB_BUD_ERROR 0x0001
 #define AIM_CB_BUD_REQRIGHTS 0x0002
Index: protocols/oscar/chat.c
===================================================================
--- protocols/oscar/chat.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/chat.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -6,5 +6,5 @@
  */
 
-#include <aim.h> 
+#include <aim.h>
 #include <glib.h>
 #include "info.h"
@@ -19,8 +19,9 @@
 void aim_conn_kill_chat(aim_session_t *sess, aim_conn_t *conn)
 {
-	struct chatconnpriv *ccp = (struct chatconnpriv *)conn->priv;
-
-	if (ccp)
+	struct chatconnpriv *ccp = (struct chatconnpriv *) conn->priv;
+
+	if (ccp) {
 		g_free(ccp->name);
+	}
 	g_free(ccp);
 
@@ -38,8 +39,8 @@
  *                                 and displays the message as normal.)
  *
- * XXX convert this to use tlvchains 
+ * XXX convert this to use tlvchains
  */
 int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, guint16 flags, const char *msg, int msglen)
-{   
+{
 	int i;
 	aim_frame_t *fr;
@@ -49,9 +50,11 @@
 	aim_tlvlist_t *otl = NULL, *itl = NULL;
 
-	if (!sess || !conn || !msg || (msglen <= 0))
+	if (!sess || !conn || !msg || (msglen <= 0)) {
 		return 0;
-
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152)))
+	}
+
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152))) {
 		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, 0x000e, 0x0005, 0x0000, NULL, 0);
@@ -59,5 +62,5 @@
 
 
-	/* 
+	/*
 	 * Generate a random message cookie.
 	 *
@@ -66,7 +69,8 @@
 	 *
 	 */
-	for (i = 0; i < sizeof(ckstr); i++)
-		(void) aimutil_put8(ckstr+i, (guint8) rand());
-	
+	for (i = 0; i < sizeof(ckstr); i++) {
+		(void) aimutil_put8(ckstr + i, (guint8) rand());
+	}
+
 
 	cookie = aim_mkcookie(ckstr, AIM_COOKIETYPE_CHAT, NULL);
@@ -75,10 +79,11 @@
 	aim_cachecookie(sess, cookie);
 
-	for (i = 0; i < sizeof(ckstr); i++)
+	for (i = 0; i < sizeof(ckstr); i++) {
 		aimbs_put8(&fr->data, ckstr[i]);
-
-
-	/*
-	 * Channel ID. 
+	}
+
+
+	/*
+	 * Channel ID.
 	 */
 	aimbs_put16(&fr->data, 0x0003);
@@ -93,13 +98,15 @@
 	 * Type 6: Reflect
 	 */
-	if (!(flags & AIM_CHATFLAGS_NOREFLECT))
+	if (!(flags & AIM_CHATFLAGS_NOREFLECT)) {
 		aim_addtlvtochain_noval(&otl, 0x0006);
+	}
 
 	/*
 	 * Type 7: Autoresponse
 	 */
-	if (flags & AIM_CHATFLAGS_AWAY)
+	if (flags & AIM_CHATFLAGS_AWAY) {
 		aim_addtlvtochain_noval(&otl, 0x0007);
-	
+	}
+
 	/* [WvG] This wasn't there originally, but we really should send
 	         the right charset flags, as we also do with normal
@@ -107,17 +114,17 @@
 	/*
 	if (flags & AIM_CHATFLAGS_UNICODE)
-		aimbs_put16(&fr->data, 0x0002);
+	        aimbs_put16(&fr->data, 0x0002);
 	else if (flags & AIM_CHATFLAGS_ISO_8859_1)
-		aimbs_put16(&fr->data, 0x0003);
+	        aimbs_put16(&fr->data, 0x0003);
 	else
-		aimbs_put16(&fr->data, 0x0000);
-	
+	        aimbs_put16(&fr->data, 0x0000);
+
 	aimbs_put16(&fr->data, 0x0000);
 	*/
-	
+
 	/*
 	 * SubTLV: Type 1: Message
 	 */
-	aim_addtlvtochain_raw(&itl, 0x0001, strlen(msg), (guint8 *)msg);
+	aim_addtlvtochain_raw(&itl, 0x0001, strlen(msg), (guint8 *) msg);
 
 	/*
@@ -125,14 +132,14 @@
 	 *
 	 * This could include other information... We just
-	 * put in a message TLV however.  
-	 * 
+	 * put in a message TLV however.
+	 *
 	 */
 	aim_addtlvtochain_frozentlvlist(&otl, 0x0005, &itl);
 
 	aim_writetlvchain(&fr->data, &otl);
-	
+
 	aim_freetlvchain(&itl);
 	aim_freetlvchain(&otl);
-	
+
 	aim_tx_enqueue(sess, fr);
 
@@ -141,7 +148,7 @@
 
 /*
- * Join a room of name roomname.  This is the first step to joining an 
- * already created room.  It's basically a Service Request for 
- * family 0x000e, with a little added on to specify the exchange and room 
+ * Join a room of name roomname.  This is the first step to joining an
+ * already created room.  It's basically a Service Request for
+ * family 0x000e, with a little added on to specify the exchange and room
  * name.
  */
@@ -152,10 +159,12 @@
 	aim_tlvlist_t *tl = NULL;
 	struct chatsnacinfo csi;
-	
-	if (!sess || !conn || !roomname || !strlen(roomname))
+
+	if (!sess || !conn || !roomname || !strlen(roomname)) {
 		return -EINVAL;
-
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 512)))
+	}
+
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 512))) {
 		return -ENOMEM;
+	}
 
 	memset(&csi, 0, sizeof(csi));
@@ -178,5 +187,5 @@
 	aim_tx_enqueue(sess, fr);
 
-	return 0; 
+	return 0;
 }
 
@@ -185,6 +194,7 @@
 	int namelen;
 
-	if (!bs || !outinfo)
+	if (!bs || !outinfo) {
 		return 0;
+	}
 
 	outinfo->exchange = aimbs_get16(bs);
@@ -199,5 +209,6 @@
  * conn must be a BOS connection!
  */
-int aim_chat_invite(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *msg, guint16 exchange, const char *roomname, guint16 instance)
+int aim_chat_invite(aim_session_t *sess, aim_conn_t *conn, const char *sn, const char *msg, guint16 exchange,
+                    const char *roomname, guint16 instance)
 {
 	int i;
@@ -211,15 +222,20 @@
 	int hdrlen;
 	aim_bstream_t hdrbs;
-	
-	if (!sess || !conn || !sn || !msg || !roomname)
+
+	if (!sess || !conn || !sn || !msg || !roomname) {
 		return -EINVAL;
-
-	if (conn->type != AIM_CONN_TYPE_BOS)
+	}
+
+	if (conn->type != AIM_CONN_TYPE_BOS) {
 		return -EINVAL;
-
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152+strlen(sn)+strlen(roomname)+strlen(msg))))
+	}
+
+	if (!(fr =
+	              aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152 + strlen(sn) + strlen(roomname) +
+	                         strlen(msg)))) {
 		return -ENOMEM;
-
-	snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, sn, strlen(sn)+1);
+	}
+
+	snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, sn, strlen(sn) + 1);
 	aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid);
 
@@ -228,6 +244,7 @@
 	 * Cookie
 	 */
-	for (i = 0; i < sizeof(ckstr); i++)
+	for (i = 0; i < sizeof(ckstr); i++) {
 		(void) aimutil_put8(ckstr, (guint8) rand());
+	}
 
 	/* XXX should be uncached by an unwritten 'invite accept' handler */
@@ -239,11 +256,13 @@
 	}
 
-	if ((cookie = aim_mkcookie(ckstr, AIM_COOKIETYPE_INVITE, priv)))
+	if ((cookie = aim_mkcookie(ckstr, AIM_COOKIETYPE_INVITE, priv))) {
 		aim_cachecookie(sess, cookie);
-	else
+	} else {
 		g_free(priv);
-
-	for (i = 0; i < sizeof(ckstr); i++)
+	}
+
+	for (i = 0; i < sizeof(ckstr); i++) {
 		aimbs_put8(&fr->data, ckstr[i]);
+	}
 
 
@@ -257,5 +276,5 @@
 	 */
 	aimbs_put8(&fr->data, strlen(sn));
-	aimbs_putraw(&fr->data, (guint8 *)sn, strlen(sn));
+	aimbs_putraw(&fr->data, (guint8 *) sn, strlen(sn));
 
 	/*
@@ -266,11 +285,11 @@
 	 * Sigh.  AOL was rather inconsistent right here.  So we have
 	 * to play some minor tricks.  Right inside the type 5 is some
-	 * raw data, followed by a series of TLVs.  
-	 *
-	 */
-	hdrlen = 2+8+16+6+4+4+strlen(msg)+4+2+1+strlen(roomname)+2;
+	 * raw data, followed by a series of TLVs.
+	 *
+	 */
+	hdrlen = 2 + 8 + 16 + 6 + 4 + 4 + strlen(msg) + 4 + 2 + 1 + strlen(roomname) + 2;
 	hdr = g_malloc(hdrlen);
 	aim_bstream_init(&hdrbs, hdr, hdrlen);
-	
+
 	aimbs_put16(&hdrbs, 0x0000); /* Unknown! */
 	aimbs_putraw(&hdrbs, ckstr, sizeof(ckstr)); /* I think... */
@@ -279,8 +298,8 @@
 	aim_addtlvtochain16(&itl, 0x000a, 0x0001);
 	aim_addtlvtochain_noval(&itl, 0x000f);
-	aim_addtlvtochain_raw(&itl, 0x000c, strlen(msg), (guint8 *)msg);
+	aim_addtlvtochain_raw(&itl, 0x000c, strlen(msg), (guint8 *) msg);
 	aim_addtlvtochain_chatroom(&itl, 0x2711, exchange, roomname, instance);
 	aim_writetlvchain(&hdrbs, &itl);
-	
+
 	aim_addtlvtochain_raw(&otl, 0x0005, aim_bstream_curpos(&hdrbs), hdr);
 
@@ -290,5 +309,5 @@
 	aim_freetlvchain(&itl);
 	aim_freetlvchain(&otl);
-	
+
 	aim_tx_enqueue(sess, fr);
 
@@ -334,5 +353,5 @@
 	/*
 	 * Everything else are TLVs.
-	 */ 
+	 */
 	tlvlist = aim_readtlvchain(bs);
 
@@ -340,17 +359,19 @@
 	 * TLV type 0x006a is the room name in Human Readable Form.
 	 */
-	if (aim_gettlv(tlvlist, 0x006a, 1))
+	if (aim_gettlv(tlvlist, 0x006a, 1)) {
 		roomname = aim_gettlv_str(tlvlist, 0x006a, 1);
+	}
 
 	/*
 	 * Type 0x006f: Number of occupants.
 	 */
-	if (aim_gettlv(tlvlist, 0x006f, 1))
+	if (aim_gettlv(tlvlist, 0x006f, 1)) {
 		usercount = aim_gettlv16(tlvlist, 0x006f, 1);
+	}
 
 	/*
 	 * Type 0x0073:  Occupant list.
 	 */
-	if (aim_gettlv(tlvlist, 0x0073, 1)) {	
+	if (aim_gettlv(tlvlist, 0x0073, 1)) {
 		int curoccupant = 0;
 		aim_tlv_t *tmptlv;
@@ -364,49 +385,57 @@
 		aim_bstream_init(&occbs, tmptlv->value, tmptlv->length);
 
-		while (curoccupant < usercount)
+		while (curoccupant < usercount) {
 			aim_extractuserinfo(sess, &occbs, &userinfo[curoccupant++]);
-	}
-
-	/* 
+		}
+	}
+
+	/*
 	 * Type 0x00c9: Flags. (AIM_CHATROOM_FLAG)
 	 */
-	if (aim_gettlv(tlvlist, 0x00c9, 1))
+	if (aim_gettlv(tlvlist, 0x00c9, 1)) {
 		flags = aim_gettlv16(tlvlist, 0x00c9, 1);
-
-	/* 
+	}
+
+	/*
 	 * Type 0x00ca: Creation time (4 bytes)
 	 */
-	if (aim_gettlv(tlvlist, 0x00ca, 1))
+	if (aim_gettlv(tlvlist, 0x00ca, 1)) {
 		creationtime = aim_gettlv32(tlvlist, 0x00ca, 1);
-
-	/* 
+	}
+
+	/*
 	 * Type 0x00d1: Maximum Message Length
 	 */
-	if (aim_gettlv(tlvlist, 0x00d1, 1))
+	if (aim_gettlv(tlvlist, 0x00d1, 1)) {
 		maxmsglen = aim_gettlv16(tlvlist, 0x00d1, 1);
-
-	/* 
+	}
+
+	/*
 	 * Type 0x00d2: Unknown. (2 bytes)
 	 */
-	if (aim_gettlv(tlvlist, 0x00d2, 1))
+	if (aim_gettlv(tlvlist, 0x00d2, 1)) {
 		unknown_d2 = aim_gettlv16(tlvlist, 0x00d2, 1);
-
-	/* 
+	}
+
+	/*
 	 * Type 0x00d3: Room Description
 	 */
-	if (aim_gettlv(tlvlist, 0x00d3, 1))
+	if (aim_gettlv(tlvlist, 0x00d3, 1)) {
 		roomdesc = aim_gettlv_str(tlvlist, 0x00d3, 1);
+	}
 
 	/*
 	 * Type 0x000d4: Unknown (flag only)
 	 */
-	if (aim_gettlv(tlvlist, 0x000d4, 1))
+	if (aim_gettlv(tlvlist, 0x000d4, 1)) {
 		;
-
-	/* 
+	}
+
+	/*
 	 * Type 0x00d5: Unknown. (1 byte)
 	 */
-	if (aim_gettlv(tlvlist, 0x00d5, 1))
+	if (aim_gettlv(tlvlist, 0x00d5, 1)) {
 		unknown_d5 = aim_gettlv8(tlvlist, 0x00d5, 1);
+	}
 
 
@@ -414,45 +443,50 @@
 	 * Type 0x00d6: Encoding 1 ("us-ascii")
 	 */
-	if (aim_gettlv(tlvlist, 0x000d6, 1))
+	if (aim_gettlv(tlvlist, 0x000d6, 1)) {
 		;
-	
+	}
+
 	/*
 	 * Type 0x00d7: Language 1 ("en")
 	 */
-	if (aim_gettlv(tlvlist, 0x000d7, 1))
+	if (aim_gettlv(tlvlist, 0x000d7, 1)) {
 		;
+	}
 
 	/*
 	 * Type 0x00d8: Encoding 2 ("us-ascii")
 	 */
-	if (aim_gettlv(tlvlist, 0x000d8, 1))
+	if (aim_gettlv(tlvlist, 0x000d8, 1)) {
 		;
-	
+	}
+
 	/*
 	 * Type 0x00d9: Language 2 ("en")
 	 */
-	if (aim_gettlv(tlvlist, 0x000d9, 1))
+	if (aim_gettlv(tlvlist, 0x000d9, 1)) {
 		;
+	}
 
 	/*
 	 * Type 0x00da: Maximum visible message length
 	 */
-	if (aim_gettlv(tlvlist, 0x000da, 1))
+	if (aim_gettlv(tlvlist, 0x000da, 1)) {
 		maxvisiblemsglen = aim_gettlv16(tlvlist, 0x00da, 1);
+	}
 
 	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess,
-				rx, 
-				&roominfo,
-				roomname,
-				usercount,
-				userinfo,	
-				roomdesc,
-				flags,
-				creationtime,
-				maxmsglen,
-				unknown_d2,
-				unknown_d5,
-				maxvisiblemsglen);
+		               rx,
+		               &roominfo,
+		               roomname,
+		               usercount,
+		               userinfo,
+		               roomdesc,
+		               flags,
+		               creationtime,
+		               maxmsglen,
+		               unknown_d2,
+		               unknown_d5,
+		               maxvisiblemsglen);
 	}
 
@@ -466,5 +500,6 @@
 }
 
-static int userlistchange(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
+static int userlistchange(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac,
+                          aim_bstream_t *bs)
 {
 	aim_userinfo_t *userinfo = NULL;
@@ -475,9 +510,10 @@
 		curcount++;
 		userinfo = g_realloc(userinfo, curcount * sizeof(aim_userinfo_t));
-		aim_extractuserinfo(sess, bs, &userinfo[curcount-1]);
-	}
-
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+		aim_extractuserinfo(sess, bs, &userinfo[curcount - 1]);
+	}
+
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, curcount, userinfo);
+	}
 
 	g_free(userinfo);
@@ -487,5 +523,5 @@
 
 /*
- * We could probably include this in the normal ICBM parsing 
+ * We could probably include this in the normal ICBM parsing
  * code as channel 0x0003, however, since only the start
  * would be the same, we might as well do it here.
@@ -507,10 +543,10 @@
  *         message string
  *       possibly others
- *  
+ *
  */
 static int incomingmsg(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
 {
 	aim_userinfo_t userinfo;
-	aim_rxcallback_t userfunc;	
+	aim_rxcallback_t userfunc;
 	int ret = 0;
 	guint8 *cookie;
@@ -549,5 +585,5 @@
 
 	/*
-	 * Start parsing TLVs right away. 
+	 * Start parsing TLVs right away.
 	 */
 	otl = aim_readtlvchain(bs);
@@ -567,9 +603,10 @@
 
 	/*
-	 * Type 0x0001: If present, it means it was a message to the 
+	 * Type 0x0001: If present, it means it was a message to the
 	 * room (as opposed to a whisper).
 	 */
-	if (aim_gettlv(otl, 0x0001, 1))
+	if (aim_gettlv(otl, 0x0001, 1)) {
 		;
+	}
 
 	/*
@@ -585,15 +622,17 @@
 		itl = aim_readtlvchain(&tbs);
 
-		/* 
+		/*
 		 * Type 0x0001: Message.
-		 */	
-		if (aim_gettlv(itl, 0x0001, 1))
+		 */
+		if (aim_gettlv(itl, 0x0001, 1)) {
 			msg = aim_gettlv_str(itl, 0x0001, 1);
-
-		aim_freetlvchain(&itl); 
-	}
-
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+		}
+
+		aim_freetlvchain(&itl);
+	}
+
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, &userinfo, msg);
+	}
 
 	g_free(cookie);
@@ -607,10 +646,11 @@
 {
 
-	if (snac->subtype == 0x0002)
+	if (snac->subtype == 0x0002) {
 		return infoupdate(sess, mod, rx, snac, bs);
-	else if ((snac->subtype == 0x0003) || (snac->subtype == 0x0004))
+	} else if ((snac->subtype == 0x0003) || (snac->subtype == 0x0004)) {
 		return userlistchange(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x0006)
+	} else if (snac->subtype == 0x0006) {
 		return incomingmsg(sess, mod, rx, snac, bs);
+	}
 
 	return 0;
Index: protocols/oscar/chat.h
===================================================================
--- protocols/oscar/chat.h	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/chat.h	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -6,5 +6,5 @@
 /*
  * SNAC Family: Chat Services
- */ 
+ */
 #define AIM_CB_CHT_ERROR 0x0001
 #define AIM_CB_CHT_ROOMINFOUPDATE 0x0002
Index: protocols/oscar/chatnav.c
===================================================================
--- protocols/oscar/chatnav.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/chatnav.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -3,5 +3,5 @@
  *
  * [The ChatNav(igation) service does various things to keep chat
- *  alive.  It provides room information, room searching and creating, 
+ *  alive.  It provides room information, room searching and creating,
  *  as well as giving users the right ("permission") to use chat.]
  *
@@ -21,13 +21,14 @@
 int aim_chatnav_createroom(aim_session_t *sess, aim_conn_t *conn, const char *name, guint16 exchange)
 {
-	static const char ck[] = {"create"};
-	static const char lang[] = {"en"};
-	static const char charset[] = {"us-ascii"};
+	static const char ck[] = { "create" };
+	static const char lang[] = { "en" };
+	static const char charset[] = { "us-ascii" };
 	aim_frame_t *fr;
 	aim_snacid_t snacid;
 	aim_tlvlist_t *tl = NULL;
 
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152)))
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152))) {
 		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, 0x000d, 0x0008, 0x0000, NULL, 0);
@@ -40,5 +41,5 @@
 	 * This looks to be a big hack.  You'll note that this entire
 	 * SNAC is just a room info structure, but the hard room name,
-	 * here, is set to "create".  
+	 * here, is set to "create".
 	 *
 	 * Either this goes on the "list of questions concerning
@@ -49,9 +50,9 @@
 	 */
 	aimbs_put8(&fr->data, strlen(ck));
-	aimbs_putraw(&fr->data, (guint8 *)ck, strlen(ck));
-
-	/* 
+	aimbs_putraw(&fr->data, (guint8 *) ck, strlen(ck));
+
+	/*
 	 * instance
-	 * 
+	 *
 	 * Setting this to 0xffff apparently assigns the last instance.
 	 *
@@ -62,7 +63,7 @@
 	aimbs_put8(&fr->data, 0x01);
 
-	aim_addtlvtochain_raw(&tl, 0x00d3, strlen(name), (guint8 *)name);
-	aim_addtlvtochain_raw(&tl, 0x00d6, strlen(charset), (guint8 *)charset);
-	aim_addtlvtochain_raw(&tl, 0x00d7, strlen(lang), (guint8 *)lang);
+	aim_addtlvtochain_raw(&tl, 0x00d3, strlen(name), (guint8 *) name);
+	aim_addtlvtochain_raw(&tl, 0x00d6, strlen(charset), (guint8 *) charset);
+	aim_addtlvtochain_raw(&tl, 0x00d7, strlen(lang), (guint8 *) lang);
 
 	/* tlvcount */
@@ -77,5 +78,6 @@
 }
 
-static int parseinfo_perms(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs, aim_snac_t *snac2)
+static int parseinfo_perms(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac,
+                           aim_bstream_t *bs, aim_snac_t *snac2)
 {
 	aim_rxcallback_t userfunc;
@@ -89,18 +91,19 @@
 	tlvlist = aim_readtlvchain(bs);
 
-	/* 
+	/*
 	 * Type 0x0002: Maximum concurrent rooms.
-	 */ 
-	if (aim_gettlv(tlvlist, 0x0002, 1))
+	 */
+	if (aim_gettlv(tlvlist, 0x0002, 1)) {
 		maxrooms = aim_gettlv8(tlvlist, 0x0002, 1);
-
-	/* 
+	}
+
+	/*
 	 * Type 0x0003: Exchange information
 	 *
 	 * There can be any number of these, each one
-	 * representing another exchange.  
-	 * 
-	 */
-	for (curexchange = 0; ((exchangetlv = aim_gettlv(tlvlist, 0x0003, curexchange+1))); ) {
+	 * representing another exchange.
+	 *
+	 */
+	for (curexchange = 0; ((exchangetlv = aim_gettlv(tlvlist, 0x0003, curexchange + 1))); ) {
 		aim_bstream_t tbs;
 
@@ -112,8 +115,8 @@
 
 		/* exchange number */
-		exchanges[curexchange-1].number = aimbs_get16(&tbs);
+		exchanges[curexchange - 1].number = aimbs_get16(&tbs);
 		innerlist = aim_readtlvchain(&tbs);
 
-		/* 
+		/*
 		 * Type 0x000a: Unknown.
 		 *
@@ -121,24 +124,28 @@
 		 *
 		 */
-		if (aim_gettlv(innerlist, 0x000a, 1))
-			;
-
-		/* 
+		if (aim_gettlv(innerlist, 0x000a, 1)) {
+			;
+		}
+
+		/*
 		 * Type 0x000d: Unknown.
 		 */
-		if (aim_gettlv(innerlist, 0x000d, 1))
-			;
-
-		/* 
+		if (aim_gettlv(innerlist, 0x000d, 1)) {
+			;
+		}
+
+		/*
 		 * Type 0x0004: Unknown
 		 */
-		if (aim_gettlv(innerlist, 0x0004, 1))
-			;
-
-		/* 
+		if (aim_gettlv(innerlist, 0x0004, 1)) {
+			;
+		}
+
+		/*
 		 * Type 0x0002: Unknown
 		 */
-		if (aim_gettlv(innerlist, 0x0002, 1))
-			;
+		if (aim_gettlv(innerlist, 0x0002, 1)) {
+			;
+		}
 
 		/*
@@ -150,45 +157,52 @@
 		 * 8 Occupant Peek Allowed
 		 *
-		 */ 
-		if (aim_gettlv(innerlist, 0x00c9, 1))
-			exchanges[curexchange-1].flags = aim_gettlv16(innerlist, 0x00c9, 1);
-		      
-		/*
-		 * Type 0x00ca: Creation Date 
-		 */
-		if (aim_gettlv(innerlist, 0x00ca, 1))
-			;
-		      
+		 */
+		if (aim_gettlv(innerlist, 0x00c9, 1)) {
+			exchanges[curexchange - 1].flags = aim_gettlv16(innerlist, 0x00c9, 1);
+		}
+
+		/*
+		 * Type 0x00ca: Creation Date
+		 */
+		if (aim_gettlv(innerlist, 0x00ca, 1)) {
+			;
+		}
+
 		/*
 		 * Type 0x00d0: Mandatory Channels?
 		 */
-		if (aim_gettlv(innerlist, 0x00d0, 1))
-			;
+		if (aim_gettlv(innerlist, 0x00d0, 1)) {
+			;
+		}
 
 		/*
 		 * Type 0x00d1: Maximum Message length
 		 */
-		if (aim_gettlv(innerlist, 0x00d1, 1))
-			;
+		if (aim_gettlv(innerlist, 0x00d1, 1)) {
+			;
+		}
 
 		/*
 		 * Type 0x00d2: Maximum Occupancy?
 		 */
-		if (aim_gettlv(innerlist, 0x00d2, 1))	
-			;
+		if (aim_gettlv(innerlist, 0x00d2, 1)) {
+			;
+		}
 
 		/*
 		 * Type 0x00d3: Exchange Description
 		 */
-		if (aim_gettlv(innerlist, 0x00d3, 1))	
-			exchanges[curexchange-1].name = aim_gettlv_str(innerlist, 0x00d3, 1);
-		else
-			exchanges[curexchange-1].name = NULL;
+		if (aim_gettlv(innerlist, 0x00d3, 1)) {
+			exchanges[curexchange - 1].name = aim_gettlv_str(innerlist, 0x00d3, 1);
+		} else {
+			exchanges[curexchange - 1].name = NULL;
+		}
 
 		/*
 		 * Type 0x00d4: Exchange Description URL
 		 */
-		if (aim_gettlv(innerlist, 0x00d4, 1))	
-			;
+		if (aim_gettlv(innerlist, 0x00d4, 1)) {
+			;
+		}
 
 		/*
@@ -198,5 +212,5 @@
 		 * 1  Room creation allowed
 		 * 2  Exchange creation allowed
-		 * 
+		 *
 		 */
 		if (aim_gettlv(innerlist, 0x00d5, 1)) {
@@ -206,39 +220,44 @@
 		/*
 		 * Type 0x00d6: Character Set (First Time)
-		 */	      
-		if (aim_gettlv(innerlist, 0x00d6, 1))	
-			exchanges[curexchange-1].charset1 = aim_gettlv_str(innerlist, 0x00d6, 1);
-		else
-			exchanges[curexchange-1].charset1 = NULL;
-		      
+		 */
+		if (aim_gettlv(innerlist, 0x00d6, 1)) {
+			exchanges[curexchange - 1].charset1 = aim_gettlv_str(innerlist, 0x00d6, 1);
+		} else {
+			exchanges[curexchange - 1].charset1 = NULL;
+		}
+
 		/*
 		 * Type 0x00d7: Language (First Time)
-		 */	      
-		if (aim_gettlv(innerlist, 0x00d7, 1))	
-			exchanges[curexchange-1].lang1 = aim_gettlv_str(innerlist, 0x00d7, 1);
-		else
-			exchanges[curexchange-1].lang1 = NULL;
+		 */
+		if (aim_gettlv(innerlist, 0x00d7, 1)) {
+			exchanges[curexchange - 1].lang1 = aim_gettlv_str(innerlist, 0x00d7, 1);
+		} else {
+			exchanges[curexchange - 1].lang1 = NULL;
+		}
 
 		/*
 		 * Type 0x00d8: Character Set (Second Time)
-		 */	      
-		if (aim_gettlv(innerlist, 0x00d8, 1))	
-			exchanges[curexchange-1].charset2 = aim_gettlv_str(innerlist, 0x00d8, 1);
-		else
-			exchanges[curexchange-1].charset2 = NULL;
+		 */
+		if (aim_gettlv(innerlist, 0x00d8, 1)) {
+			exchanges[curexchange - 1].charset2 = aim_gettlv_str(innerlist, 0x00d8, 1);
+		} else {
+			exchanges[curexchange - 1].charset2 = NULL;
+		}
 
 		/*
 		 * Type 0x00d9: Language (Second Time)
-		 */	      
-		if (aim_gettlv(innerlist, 0x00d9, 1))	
-			exchanges[curexchange-1].lang2 = aim_gettlv_str(innerlist, 0x00d9, 1);
-		else
-			exchanges[curexchange-1].lang2 = NULL;
-		      
+		 */
+		if (aim_gettlv(innerlist, 0x00d9, 1)) {
+			exchanges[curexchange - 1].lang2 = aim_gettlv_str(innerlist, 0x00d9, 1);
+		} else {
+			exchanges[curexchange - 1].lang2 = NULL;
+		}
+
 		/*
 		 * Type 0x00da: Unknown
 		 */
-		if (aim_gettlv(innerlist, 0x00da, 1))	
-			;
+		if (aim_gettlv(innerlist, 0x00da, 1)) {
+			;
+		}
 
 		aim_freetlvchain(&innerlist);
@@ -248,6 +267,7 @@
 	 * Call client.
 	 */
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, snac2->type, maxrooms, curexchange, exchanges);
+	}
 
 	for (curexchange--; curexchange >= 0; curexchange--) {
@@ -264,5 +284,6 @@
 }
 
-static int parseinfo_create(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs, aim_snac_t *snac2)
+static int parseinfo_create(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac,
+                            aim_bstream_t *bs, aim_snac_t *snac2)
 {
 	aim_rxcallback_t userfunc;
@@ -281,5 +302,5 @@
 	if (!(bigblock = aim_gettlv(tlvlist, 0x0004, 1))) {
 		imcb_error(sess->aux_data, "no bigblock in top tlv in create room response");
-	
+
 		aim_freetlvchain(&tlvlist);
 		return 0;
@@ -305,27 +326,35 @@
 	innerlist = aim_readtlvchain(&bbbs);
 
-	if (aim_gettlv(innerlist, 0x006a, 1))
+	if (aim_gettlv(innerlist, 0x006a, 1)) {
 		fqcn = aim_gettlv_str(innerlist, 0x006a, 1);
-
-	if (aim_gettlv(innerlist, 0x00c9, 1))
+	}
+
+	if (aim_gettlv(innerlist, 0x00c9, 1)) {
 		flags = aim_gettlv16(innerlist, 0x00c9, 1);
-
-	if (aim_gettlv(innerlist, 0x00ca, 1))
+	}
+
+	if (aim_gettlv(innerlist, 0x00ca, 1)) {
 		createtime = aim_gettlv32(innerlist, 0x00ca, 1);
-
-	if (aim_gettlv(innerlist, 0x00d1, 1))
+	}
+
+	if (aim_gettlv(innerlist, 0x00d1, 1)) {
 		maxmsglen = aim_gettlv16(innerlist, 0x00d1, 1);
-
-	if (aim_gettlv(innerlist, 0x00d2, 1))
+	}
+
+	if (aim_gettlv(innerlist, 0x00d2, 1)) {
 		maxoccupancy = aim_gettlv16(innerlist, 0x00d2, 1);
-
-	if (aim_gettlv(innerlist, 0x00d3, 1))
+	}
+
+	if (aim_gettlv(innerlist, 0x00d3, 1)) {
 		name = aim_gettlv_str(innerlist, 0x00d3, 1);
-
-	if (aim_gettlv(innerlist, 0x00d5, 1))
+	}
+
+	if (aim_gettlv(innerlist, 0x00d5, 1)) {
 		createperms = aim_gettlv8(innerlist, 0x00d5, 1);
+	}
 
 	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
-		ret = userfunc(sess, rx, snac2->type, fqcn, instance, exchange, flags, createtime, maxmsglen, maxoccupancy, createperms, unknown, name, ck);
+		ret = userfunc(sess, rx, snac2->type, fqcn, instance, exchange, flags, createtime, maxmsglen,
+		               maxoccupancy, createperms, unknown, name, ck);
 	}
 
@@ -340,5 +369,5 @@
 
 /*
- * Since multiple things can trigger this callback, we must lookup the 
+ * Since multiple things can trigger this callback, we must lookup the
  * snacid to determine the original snac subtype that was called.
  *
@@ -350,5 +379,5 @@
  *    Nav Short Desc = 8
  *    Nav Instance Info = 16
- * And then everything is really asynchronous.  There is no specific 
+ * And then everything is really asynchronous.  There is no specific
  * attachment of a response to a create room request, for example.  Creating
  * the room yields no different a response than requesting the room's info.
@@ -373,18 +402,25 @@
 	 * We now know what the original SNAC subtype was.
 	 */
-	if (snac2->type == 0x0002) /* request chat rights */
+	if (snac2->type == 0x0002) { /* request chat rights */
 		ret = parseinfo_perms(sess, mod, rx, snac, bs, snac2);
-	else if (snac2->type == 0x0003) {} /* request exchange info */
-	else if (snac2->type == 0x0004) {} /* request room info */
-	else if (snac2->type == 0x0005) {} /* request more room info */
-	else if (snac2->type == 0x0006) {} /* request occupant list */
-	else if (snac2->type == 0x0007) {} /* search for a room */
-	else if (snac2->type == 0x0008) /* create room */
+	} else if (snac2->type == 0x0003) {
+	}                                  /* request exchange info */
+	else if (snac2->type == 0x0004) {
+	}                                  /* request room info */
+	else if (snac2->type == 0x0005) {
+	}                                  /* request more room info */
+	else if (snac2->type == 0x0006) {
+	}                                  /* request occupant list */
+	else if (snac2->type == 0x0007) {
+	}                                  /* search for a room */
+	else if (snac2->type == 0x0008) { /* create room */
 		ret = parseinfo_create(sess, mod, rx, snac, bs, snac2);
-	else
+	} else {
 		imcb_error(sess->aux_data, "unknown request subtype");
-
-	if (snac2)
+	}
+
+	if (snac2) {
 		g_free(snac2->data);
+	}
 	g_free(snac2);
 
@@ -395,6 +431,7 @@
 {
 
-	if (snac->subtype == 0x0009)
+	if (snac->subtype == 0x0009) {
 		return parseinfo(sess, mod, rx, snac, bs);
+	}
 
 	return 0;
Index: protocols/oscar/chatnav.h
===================================================================
--- protocols/oscar/chatnav.h	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/chatnav.h	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -6,5 +6,5 @@
 /*
  * SNAC Family: Chat Navigation Services
- */ 
+ */
 #define AIM_CB_CTN_ERROR 0x0001
 #define AIM_CB_CTN_CREATE 0x0008
Index: protocols/oscar/conn.c
===================================================================
--- protocols/oscar/conn.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/conn.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -7,5 +7,5 @@
  */
 
-#include <aim.h> 
+#include <aim.h>
 #include "sock.h"
 
@@ -15,9 +15,9 @@
  * In OSCAR, every connection has a set of SNAC groups associated
  * with it.  These are the groups that you can send over this connection
- * without being guarenteed a "Not supported" SNAC error.  
- *
- * The grand theory of things says that these associations transcend 
+ * without being guarenteed a "Not supported" SNAC error.
+ *
+ * The grand theory of things says that these associations transcend
  * what libfaim calls "connection types" (conn->type).  You can probably
- * see the elegance here, but since I want to revel in it for a bit, you 
+ * see the elegance here, but since I want to revel in it for a bit, you
  * get to hear it all spelled out.
  *
@@ -25,5 +25,5 @@
  * of your modules has just given you a SNAC of the group 0x0004 to send
  * you.  Maybe an IM destined for some twit in Greenland.  So you start
- * at the top of your connection list, looking for a connection that 
+ * at the top of your connection list, looking for a connection that
  * claims to support group 0x0004.  You find one.  Why, that neat BOS
  * connection of yours can do that.  So you send it on its way.
@@ -43,6 +43,6 @@
  * that connection.  One of the first things you get from this new server
  * is a message saying that indeed it does support the group you were looking
- * for.  So you continue and send rate confirmation and all that.  
- * 
+ * for.  So you continue and send rate confirmation and all that.
+ *
  * Then you remember you had that SNAC to send, and now you have a means to
  * do it, and you do, and everyone is happy.  Except the Greenlander, who is
@@ -57,5 +57,5 @@
  * to make libfaim work that way.  It would take a fair amount of effort,
  * and probably some client API changes as well.  (Whenever I don't want
- * to do something, I just say it would change the client API.  Then I 
+ * to do something, I just say it would change the client API.  Then I
  * instantly have a couple of supporters of not doing it.)
  *
@@ -69,9 +69,10 @@
 void aim_conn_addgroup(aim_conn_t *conn, guint16 group)
 {
-	aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside;
+	aim_conn_inside_t *ins = (aim_conn_inside_t *) conn->inside;
 	struct snacgroup *sg;
 
-	if (!(sg = g_malloc(sizeof(struct snacgroup))))
+	if (!(sg = g_malloc(sizeof(struct snacgroup)))) {
 		return;
+	}
 
 	sg->group = group;
@@ -88,10 +89,11 @@
 
 	for (cur = sess->connlist; cur; cur = cur->next) {
-		aim_conn_inside_t *ins = (aim_conn_inside_t *)cur->inside;
+		aim_conn_inside_t *ins = (aim_conn_inside_t *) cur->inside;
 		struct snacgroup *sg;
 
 		for (sg = ins->groups; sg; sg = sg->next) {
-			if (sg->group == group)
+			if (sg->group == group) {
 				return cur;
+			}
 		}
 	}
@@ -150,6 +152,7 @@
 	aim_tx_cleanqueue(sess, *deadconn);
 
-	if ((*deadconn)->fd != -1) 
+	if ((*deadconn)->fd != -1) {
 		aim_conn_close(*deadconn);
+	}
 
 	/*
@@ -158,15 +161,17 @@
 	 * ->internal instead.
 	 */
-	if ((*deadconn)->priv)
+	if ((*deadconn)->priv) {
 		g_free((*deadconn)->priv);
+	}
 
 	/*
 	 * This will free ->internal if it necessary...
 	 */
-	if ((*deadconn)->type == AIM_CONN_TYPE_CHAT)
+	if ((*deadconn)->type == AIM_CONN_TYPE_CHAT) {
 		aim_conn_kill_chat(sess, *deadconn);
+	}
 
 	if ((*deadconn)->inside) {
-		aim_conn_inside_t *inside = (aim_conn_inside_t *)(*deadconn)->inside;
+		aim_conn_inside_t *inside = (aim_conn_inside_t *) (*deadconn)->inside;
 
 		connkill_snacgroups(&inside->groups);
@@ -218,6 +223,7 @@
 {
 
-	if (!deadconn)
+	if (!deadconn) {
 		return;
+	}
 
 	deadconn->fd = -1;
@@ -245,8 +251,9 @@
 	aim_conn_t *newconn;
 
-	if (!(newconn = g_new0(aim_conn_t,1))) 	
+	if (!(newconn = g_new0(aim_conn_t, 1))) {
 		return NULL;
-
-	if (!(newconn->inside = g_new0(aim_conn_inside_t,1))) {
+	}
+
+	if (!(newconn->inside = g_new0(aim_conn_inside_t, 1))) {
 		g_free(newconn);
 		return NULL;
@@ -274,6 +281,7 @@
 	aim_conn_t *cur, **prev;
 
-	if (!deadconn || !*deadconn)	
+	if (!deadconn || !*deadconn) {
 		return;
+	}
 
 	for (prev = &sess->connlist; (cur = *prev); ) {
@@ -285,7 +293,8 @@
 	}
 
-	if (!cur)
+	if (!cur) {
 		return; /* oops */
 
+	}
 	connkill_real(sess, &cur);
 
@@ -299,5 +308,5 @@
  * Close (but not free) a connection.
  *
- * This leaves everything untouched except for clearing the 
+ * This leaves everything untouched except for clearing the
  * handler list and setting the fd to -1 (used to recognize
  * dead connections).  It will also remove cookies if necessary.
@@ -307,9 +316,11 @@
 {
 
-	if (deadconn->fd >= 3)
+	if (deadconn->fd >= 3) {
 		closesocket(deadconn->fd);
+	}
 	deadconn->fd = -1;
-	if (deadconn->handlerlist)
+	if (deadconn->handlerlist) {
 		aim_clearhandlers(deadconn);
+	}
 
 	return;
@@ -321,5 +332,5 @@
  * @type: Type of connection to look for
  *
- * Searches for a connection of the specified type in the 
+ * Searches for a connection of the specified type in the
  * specified session.  Returns the first connection of that
  * type found.
@@ -333,7 +344,8 @@
 
 	for (cur = sess->connlist; cur; cur = cur->next) {
-		if ((cur->type == type) && 
-				!(cur->status & AIM_CONN_STATUS_INPROGRESS))
+		if ((cur->type == type) &&
+		    !(cur->status & AIM_CONN_STATUS_INPROGRESS)) {
 			break;
+		}
 	}
 
@@ -346,6 +358,7 @@
 
 	for (cur = sess->connlist; cur; cur = cur->next) {
-		if (cur->type == type)
+		if (cur->type == type) {
 			break;
+		}
 	}
 
@@ -361,5 +374,5 @@
  * Opens a new connection to the specified dest host of specified
  * type, using the proxy settings if available.  If @host is %NULL,
- * the connection is allocated and returned, but no connection 
+ * the connection is allocated and returned, but no connection
  * is made.
  *
@@ -374,8 +387,9 @@
 	int i;
 
-	if (!(connstruct = aim_conn_getnext(sess)))
+	if (!(connstruct = aim_conn_getnext(sess))) {
 		return NULL;
-
-	connstruct->sessv = (void *)sess;
+	}
+
+	connstruct->sessv = (void *) sess;
 	connstruct->type = type;
 
@@ -386,21 +400,21 @@
 	}
 
-	/* 
-	 * As of 23 Jul 1999, AOL now sends the port number, preceded by a 
-	 * colon, in the BOS redirect.  This fatally breaks all previous 
+	/*
+	 * As of 23 Jul 1999, AOL now sends the port number, preceded by a
+	 * colon, in the BOS redirect.  This fatally breaks all previous
 	 * libfaims.  Bad, bad AOL.
 	 *
-	 * We put this here to catch every case. 
+	 * We put this here to catch every case.
 	 *
 	 */
 
-	for(i = 0; i < (int)strlen(dest); i++) {
+	for (i = 0; i < (int) strlen(dest); i++) {
 		if (dest[i] == ':') {
-			port = atoi(&(dest[i+1]));
+			port = atoi(&(dest[i + 1]));
 			break;
 		}
 	}
 
-	host = (char *)g_malloc(i+1);
+	host = (char *) g_malloc(i + 1);
 	strncpy(host, dest, i);
 	host[i] = '\0';
@@ -421,5 +435,5 @@
  *
  * This is my lame attempt at overcoming not understanding the rate
- * limiting. 
+ * limiting.
  *
  * XXX: This should really be replaced with something that scales and
@@ -430,6 +444,7 @@
 {
 
-	if (!conn)
+	if (!conn) {
 		return -1;
+	}
 
 	conn->forcedlatency = newval;
@@ -451,6 +466,7 @@
 {
 
-	if (!sess)
+	if (!sess) {
 		return;
+	}
 
 	memset(sess, 0, sizeof(aim_session_t));
@@ -471,5 +487,5 @@
 	sess->ssi.revision = 0;
 	sess->ssi.items = NULL;
-	sess->ssi.timestamp = (time_t)0;
+	sess->ssi.timestamp = (time_t) 0;
 
 	sess->locate.userinfo = NULL;
@@ -487,11 +503,12 @@
 	 * Default to SNAC login unless XORLOGIN is explicitly set.
 	 */
-	if (!(flags & AIM_SESS_FLAGS_XORLOGIN))
+	if (!(flags & AIM_SESS_FLAGS_XORLOGIN)) {
 		sess->flags |= AIM_SESS_FLAGS_SNACLOGIN;
+	}
 	sess->flags |= flags;
 
 	/*
 	 * This must always be set.  Default to the queue-based
-	 * version for back-compatibility.  
+	 * version for back-compatibility.
 	 */
 	aim_tx_setenqueue(sess, AIM_TX_QUEUED, NULL);
@@ -548,9 +565,11 @@
 	aim_rxcallback_t userfunc;
 
-	if (!conn || (conn->fd == -1))
+	if (!conn || (conn->fd == -1)) {
 		return -1;
-
-	if (!(conn->status & AIM_CONN_STATUS_INPROGRESS))
+	}
+
+	if (!(conn->status & AIM_CONN_STATUS_INPROGRESS)) {
 		return -1;
+	}
 
 	FD_ZERO(&fds);
@@ -561,5 +580,5 @@
 	tv.tv_usec = 0;
 
-	if ((res = select(conn->fd+1, &fds, &wfds, NULL, &tv)) == -1) {
+	if ((res = select(conn->fd + 1, &fds, &wfds, NULL, &tv)) == -1) {
 		error = errno;
 		aim_conn_close(conn);
@@ -568,11 +587,12 @@
 	} else if (res == 0) {
 		return 0; /* hasn't really completed yet... */
-	} 
+	}
 
 	if (FD_ISSET(conn->fd, &fds) || FD_ISSET(conn->fd, &wfds)) {
 		socklen_t len = sizeof(error);
 
-		if (getsockopt(conn->fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0)
+		if (getsockopt(conn->fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
 			error = errno;
+		}
 	}
 
@@ -587,6 +607,7 @@
 	conn->status &= ~AIM_CONN_STATUS_INPROGRESS;
 
-	if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNCOMPLETE)))
+	if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNCOMPLETE))) {
 		userfunc(sess, NULL, conn);
+	}
 
 	/* Flush out the queues if there was something waiting for this conn  */
@@ -599,8 +620,9 @@
 {
 
-	if (!conn)
+	if (!conn) {
 		return NULL;
-
-	return (aim_session_t *)conn->sessv;
+	}
+
+	return (aim_session_t *) conn->sessv;
 }
 
@@ -624,5 +646,5 @@
  *
  * No-op.  WinAIM 4.x sends these _every minute_ to keep
- * the connection alive.  
+ * the connection alive.
  */
 int aim_flap_nop(aim_session_t *sess, aim_conn_t *conn)
@@ -630,6 +652,7 @@
 	aim_frame_t *fr;
 
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x05, 0)))
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x05, 0))) {
 		return -ENOMEM;
+	}
 
 	aim_tx_enqueue(sess, fr);
Index: protocols/oscar/icq.c
===================================================================
--- protocols/oscar/icq.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/icq.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -14,11 +14,13 @@
 	int bslen;
 
-	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015)))
+	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) {
 		return -EINVAL;
+	}
 
 	bslen = 2 + 4 + 2 + 2;
 
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen)))
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) {
 		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0);
@@ -46,11 +48,13 @@
 	int bslen;
 
-	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015)))
+	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) {
 		return -EINVAL;
+	}
 
 	bslen = 2 + 4 + 2 + 2;
 
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen)))
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) {
 		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0);
@@ -73,80 +77,87 @@
 int aim_icq_getallinfo(aim_session_t *sess, const char *uin)
 {
-        aim_conn_t *conn;
-        aim_frame_t *fr;
-        aim_snacid_t snacid;
-        int bslen;
-        struct aim_icq_info *info;
-
-        if (!uin || uin[0] < '0' || uin[0] > '9')
-                return -EINVAL;
-
-        if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015)))
-                return -EINVAL;
-
-        bslen = 2 + 4 + 2 + 2 + 2 + 4;
-
-        if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen)))
-                return -ENOMEM;
-
-        snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0);
-        aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid);
-
-        /* For simplicity, don't bother using a tlvlist */
-        aimbs_put16(&fr->data, 0x0001);
-        aimbs_put16(&fr->data, bslen);
-
-        aimbs_putle16(&fr->data, bslen - 2);
-        aimbs_putle32(&fr->data, atoi(sess->sn));
-        aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */
-        aimbs_putle16(&fr->data, snacid); /* eh. */
-        aimbs_putle16(&fr->data, 0x04b2); /* shrug. */
-        aimbs_putle32(&fr->data, atoi(uin));
-
-        aim_tx_enqueue(sess, fr);
-
-        /* Keep track of this request and the ICQ number and request ID */
-        info = g_new0(struct aim_icq_info, 1);
-        info->reqid = snacid;
-        info->uin = atoi(uin);
-        info->next = sess->icq_info;
-        sess->icq_info = info;
-
-        return 0;
-}
-
-static void aim_icq_freeinfo(struct aim_icq_info *info) {
-        int i;
-
-        if (!info)
-                return;
-        g_free(info->nick);
-        g_free(info->first);
-        g_free(info->last);
-        g_free(info->email);
-        g_free(info->homecity);
-        g_free(info->homestate);
-        g_free(info->homephone);
-        g_free(info->homefax);
-        g_free(info->homeaddr);
-        g_free(info->mobile);
-        g_free(info->homezip);
-        g_free(info->personalwebpage);
-        if (info->email2)
-                for (i = 0; i < info->numaddresses; i++)
-                        g_free(info->email2[i]);
-        g_free(info->email2);
-        g_free(info->workcity);
-        g_free(info->workstate);
-        g_free(info->workphone);
-        g_free(info->workfax);
-        g_free(info->workaddr);
-        g_free(info->workzip);
-        g_free(info->workcompany);
-        g_free(info->workdivision);
-        g_free(info->workposition);
-        g_free(info->workwebpage);
-        g_free(info->info);
-        g_free(info);
+	aim_conn_t *conn;
+	aim_frame_t *fr;
+	aim_snacid_t snacid;
+	int bslen;
+	struct aim_icq_info *info;
+
+	if (!uin || uin[0] < '0' || uin[0] > '9') {
+		return -EINVAL;
+	}
+
+	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0015))) {
+		return -EINVAL;
+	}
+
+	bslen = 2 + 4 + 2 + 2 + 2 + 4;
+
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4 + bslen))) {
+		return -ENOMEM;
+	}
+
+	snacid = aim_cachesnac(sess, 0x0015, 0x0002, 0x0000, NULL, 0);
+	aim_putsnac(&fr->data, 0x0015, 0x0002, 0x0000, snacid);
+
+	/* For simplicity, don't bother using a tlvlist */
+	aimbs_put16(&fr->data, 0x0001);
+	aimbs_put16(&fr->data, bslen);
+
+	aimbs_putle16(&fr->data, bslen - 2);
+	aimbs_putle32(&fr->data, atoi(sess->sn));
+	aimbs_putle16(&fr->data, 0x07d0); /* I command thee. */
+	aimbs_putle16(&fr->data, snacid); /* eh. */
+	aimbs_putle16(&fr->data, 0x04b2); /* shrug. */
+	aimbs_putle32(&fr->data, atoi(uin));
+
+	aim_tx_enqueue(sess, fr);
+
+	/* Keep track of this request and the ICQ number and request ID */
+	info = g_new0(struct aim_icq_info, 1);
+	info->reqid = snacid;
+	info->uin = atoi(uin);
+	info->next = sess->icq_info;
+	sess->icq_info = info;
+
+	return 0;
+}
+
+static void aim_icq_freeinfo(struct aim_icq_info *info)
+{
+	int i;
+
+	if (!info) {
+		return;
+	}
+	g_free(info->nick);
+	g_free(info->first);
+	g_free(info->last);
+	g_free(info->email);
+	g_free(info->homecity);
+	g_free(info->homestate);
+	g_free(info->homephone);
+	g_free(info->homefax);
+	g_free(info->homeaddr);
+	g_free(info->mobile);
+	g_free(info->homezip);
+	g_free(info->personalwebpage);
+	if (info->email2) {
+		for (i = 0; i < info->numaddresses; i++) {
+			g_free(info->email2[i]);
+		}
+	}
+	g_free(info->email2);
+	g_free(info->workcity);
+	g_free(info->workstate);
+	g_free(info->workphone);
+	g_free(info->workfax);
+	g_free(info->workaddr);
+	g_free(info->workzip);
+	g_free(info->workcompany);
+	g_free(info->workdivision);
+	g_free(info->workposition);
+	g_free(info->workwebpage);
+	g_free(info->info);
+	g_free(info);
 }
 
@@ -192,6 +203,7 @@
 		msg.msg = aimbs_getstr(&qbs, msglen);
 
-		if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG)))
+		if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSG))) {
 			ret = userfunc(sess, rx, &msg);
+		}
 
 		g_free(msg.msg);
@@ -200,6 +212,7 @@
 		aim_rxcallback_t userfunc;
 
-		if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSGCOMPLETE)))
+		if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_OFFLINEMSGCOMPLETE))) {
 			ret = userfunc(sess, rx);
+		}
 	} else if (cmd == 0x07da) { /* information */
 		guint16 subtype;
@@ -211,5 +224,7 @@
 
 		/* find another data from the same request */
-		for (info = sess->icq_info; info && (info->reqid != reqid); info = info->next);
+		for (info = sess->icq_info; info && (info->reqid != reqid); info = info->next) {
+			;
+		}
 
 		if (!info) {
@@ -221,104 +236,107 @@
 
 		switch (subtype) {
-			case 0x00a0: { /* hide ip status */
-							 /* nothing */
-						 } break;
-			case 0x00aa: { /* password change status */
-							 /* nothing */
-						 } break;
-			case 0x00c8: { /* general and "home" information */
-							 info->nick = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->first = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->last = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->email = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->homecity = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->homestate = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->homephone = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->homefax = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->homeaddr = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->mobile = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->homezip = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->homecountry = aimbs_getle16(&qbs);
-							 /* 0x0a 00 02 00 */
-							 /* 1 byte timezone? */
-							 /* 1 byte hide email flag? */
-						 } break;
-			case 0x00dc: { /* personal information */
-							 info->age = aimbs_getle8(&qbs);
-							 info->unknown = aimbs_getle8(&qbs);
-							 info->gender = aimbs_getle8(&qbs);
-							 info->personalwebpage = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->birthyear = aimbs_getle16(&qbs);
-							 info->birthmonth = aimbs_getle8(&qbs);
-							 info->birthday = aimbs_getle8(&qbs);
-							 info->language1 = aimbs_getle8(&qbs);
-							 info->language2 = aimbs_getle8(&qbs);
-							 info->language3 = aimbs_getle8(&qbs);
-							 /* 0x00 00 01 00 00 01 00 00 00 00 00 */
-						 } break;
-			case 0x00d2: { /* work information */
-							 info->workcity = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->workstate = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->workphone = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->workfax = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->workaddr = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->workzip = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->workcountry = aimbs_getle16(&qbs);
-							 info->workcompany = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->workdivision = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->workposition = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 aim_bstream_advance(&qbs, 2); /* 0x01 00 */
-							 info->workwebpage = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-						 } break;
-			case 0x00e6: { /* additional personal information */
-							 info->info = aimbs_getstr(&qbs, aimbs_getle16(&qbs)-1);
-						 } break;
-			case 0x00eb: { /* email address(es) */
-							 int i;
-							 info->numaddresses = aimbs_getle16(&qbs);
-							 info->email2 = g_new0(char *, info->numaddresses);
-							 for (i = 0; i < info->numaddresses; i++) {
-								 info->email2[i] = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-								 if (i+1 != info->numaddresses)
-									 aim_bstream_advance(&qbs, 1); /* 0x00 */
-							 }
-						 } break;
-			case 0x00f0: { /* personal interests */
-						 } break;
-			case 0x00fa: { /* past background and current organizations */
-						 } break;
-			case 0x0104: { /* alias info */
-							 info->nick = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->first = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->last = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 aim_bstream_advance(&qbs, aimbs_getle16(&qbs));
-							 /* email address? */
-							 /* Then 0x00 02 00 */
-						 } break;
-			case 0x010e: { /* unknown */
-							 /* 0x00 00 */
-						 } break;
-
-			case 0x019a: { /* simple info */
-							 aim_bstream_advance(&qbs, 2);
-							 info->uin = aimbs_getle32(&qbs);
-							 info->nick = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->first = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->last = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 info->email = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
-							 /* Then 0x00 02 00 00 00 00 00 */
-						 } break;
+		case 0x00a0: {         /* hide ip status */
+			/* nothing */
+		} break;
+		case 0x00aa: {         /* password change status */
+			/* nothing */
+		} break;
+		case 0x00c8: {         /* general and "home" information */
+			info->nick = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->first = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->last = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->email = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->homecity = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->homestate = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->homephone = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->homefax = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->homeaddr = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->mobile = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->homezip = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->homecountry = aimbs_getle16(&qbs);
+			/* 0x0a 00 02 00 */
+			/* 1 byte timezone? */
+			/* 1 byte hide email flag? */
+		} break;
+		case 0x00dc: {         /* personal information */
+			info->age = aimbs_getle8(&qbs);
+			info->unknown = aimbs_getle8(&qbs);
+			info->gender = aimbs_getle8(&qbs);
+			info->personalwebpage = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->birthyear = aimbs_getle16(&qbs);
+			info->birthmonth = aimbs_getle8(&qbs);
+			info->birthday = aimbs_getle8(&qbs);
+			info->language1 = aimbs_getle8(&qbs);
+			info->language2 = aimbs_getle8(&qbs);
+			info->language3 = aimbs_getle8(&qbs);
+			/* 0x00 00 01 00 00 01 00 00 00 00 00 */
+		} break;
+		case 0x00d2: {         /* work information */
+			info->workcity = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->workstate = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->workphone = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->workfax = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->workaddr = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->workzip = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->workcountry = aimbs_getle16(&qbs);
+			info->workcompany = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->workdivision = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->workposition = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			aim_bstream_advance(&qbs, 2);                                  /* 0x01 00 */
+			info->workwebpage = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+		} break;
+		case 0x00e6: {         /* additional personal information */
+			info->info = aimbs_getstr(&qbs, aimbs_getle16(&qbs) - 1);
+		} break;
+		case 0x00eb: {         /* email address(es) */
+			int i;
+			info->numaddresses = aimbs_getle16(&qbs);
+			info->email2 = g_new0(char *, info->numaddresses);
+			for (i = 0; i < info->numaddresses; i++) {
+				info->email2[i] = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+				if (i + 1 != info->numaddresses) {
+					aim_bstream_advance(&qbs, 1);                                  /* 0x00 */
+				}
+			}
+		} break;
+		case 0x00f0: {         /* personal interests */
+		} break;
+		case 0x00fa: {         /* past background and current organizations */
+		} break;
+		case 0x0104: {         /* alias info */
+			info->nick = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->first = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->last = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			aim_bstream_advance(&qbs, aimbs_getle16(&qbs));
+			/* email address? */
+			/* Then 0x00 02 00 */
+		} break;
+		case 0x010e: {         /* unknown */
+			/* 0x00 00 */
+		} break;
+
+		case 0x019a: {         /* simple info */
+			aim_bstream_advance(&qbs, 2);
+			info->uin = aimbs_getle32(&qbs);
+			info->nick = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->first = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->last = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			info->email = aimbs_getstr(&qbs, aimbs_getle16(&qbs));
+			/* Then 0x00 02 00 00 00 00 00 */
+		} break;
 		} /* End switch statement */
 
 
 		if (!(snac->flags & 0x0001)) {
-			if (subtype != 0x0104)
-				if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_INFO)))
+			if (subtype != 0x0104) {
+				if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_INFO))) {
 					ret = userfunc(sess, rx, info);
-
-			/* Bitlbee - not supported, yet 
+				}
+			}
+
+			/* Bitlbee - not supported, yet
 			if (info->uin && info->nick)
-				if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_ALIAS)))
-					ret = userfunc(sess, rx, info);
+			        if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_ICQ, AIM_CB_ICQ_ALIAS)))
+			                ret = userfunc(sess, rx, info);
 			*/
 
@@ -327,7 +345,10 @@
 			} else {
 				struct aim_icq_info *cur;
-				for (cur=sess->icq_info; (cur->next && (cur->next!=info)); cur=cur->next);
-				if (cur->next)
+				for (cur = sess->icq_info; (cur->next && (cur->next != info)); cur = cur->next) {
+					;
+				}
+				if (cur->next) {
 					cur->next = cur->next->next;
+				}
 			}
 			aim_icq_freeinfo(info);
@@ -343,6 +364,7 @@
 {
 
-	if (snac->subtype == 0x0003)
+	if (snac->subtype == 0x0003) {
 		return icqresponse(sess, mod, rx, snac, bs);
+	}
 
 	return 0;
Index: protocols/oscar/icq.h
===================================================================
--- protocols/oscar/icq.h	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/icq.h	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -8,5 +8,5 @@
  *
  * Most of these are actually special.
- */ 
+ */
 #define AIM_CB_ICQ_ERROR 0x0001
 #define AIM_CB_ICQ_OFFLINEMSG 0x00f0
@@ -33,59 +33,59 @@
 
 struct aim_icq_info {
-        gushort reqid;
+	gushort reqid;
 
-        /* simple */
-        guint32 uin;
+	/* simple */
+	guint32 uin;
 
-        /* general and "home" information (0x00c8) */
-        char *nick;
-        char *first;
-        char *last;
-        char *email;
-        char *homecity;
-        char *homestate;
-        char *homephone;
-        char *homefax;
-        char *homeaddr;
-        char *mobile;
-        char *homezip;
-        gushort homecountry;
+	/* general and "home" information (0x00c8) */
+	char *nick;
+	char *first;
+	char *last;
+	char *email;
+	char *homecity;
+	char *homestate;
+	char *homephone;
+	char *homefax;
+	char *homeaddr;
+	char *mobile;
+	char *homezip;
+	gushort homecountry;
 /*      guchar timezone;
         guchar hideemail; */
 
-        /* personal (0x00dc) */
-        guchar age;
-        guchar unknown;
-        guchar gender;
-        char *personalwebpage;
-        gushort birthyear;
-        guchar birthmonth;
-        guchar birthday;
-        guchar language1;
-        guchar language2;
-        guchar language3;
+	/* personal (0x00dc) */
+	guchar age;
+	guchar unknown;
+	guchar gender;
+	char *personalwebpage;
+	gushort birthyear;
+	guchar birthmonth;
+	guchar birthday;
+	guchar language1;
+	guchar language2;
+	guchar language3;
 
-        /* work (0x00d2) */
-        char *workcity;
-        char *workstate;
-        char *workphone;
-        char *workfax;
-        char *workaddr;
-        char *workzip;
-        gushort workcountry;
-        char *workcompany;
-        char *workdivision;
-        char *workposition;
-        char *workwebpage;
+	/* work (0x00d2) */
+	char *workcity;
+	char *workstate;
+	char *workphone;
+	char *workfax;
+	char *workaddr;
+	char *workzip;
+	gushort workcountry;
+	char *workcompany;
+	char *workdivision;
+	char *workposition;
+	char *workwebpage;
 
-        /* additional personal information (0x00e6) */
-        char *info;
+	/* additional personal information (0x00e6) */
+	char *info;
 
-        /* email (0x00eb) */
-        gushort numaddresses;
-        char **email2;
+	/* email (0x00eb) */
+	gushort numaddresses;
+	char **email2;
 
-        /* we keep track of these in a linked list because we're 1337 */
-        struct aim_icq_info *next;
+	/* we keep track of these in a linked list because we're 1337 */
+	struct aim_icq_info *next;
 };
 
Index: protocols/oscar/im.c
===================================================================
--- protocols/oscar/im.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/im.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -25,5 +25,5 @@
 
 /*
- * Send an ICBM (instant message).  
+ * Send an ICBM (instant message).
  *
  *
@@ -39,10 +39,10 @@
  *                        what you're doing.
  *   AIM_IMFLAGS_ISO_8859_1 -- The message contains the ASCII8 subset
- *                        known as ISO-8859-1.  
+ *                        known as ISO-8859-1.
  *
  * Generally, you should use the lowest encoding possible to send
  * your message.  If you only use basic punctuation and the generic
  * Latin alphabet, use ASCII7 (no flags).  If you happen to use non-ASCII7
- * characters, but they are all clearly defined in ISO-8859-1, then 
+ * characters, but they are all clearly defined in ISO-8859-1, then
  * use that.  Keep in mind that not all characters in the PC ASCII8
  * character set are defined in the ISO standard. For those cases (most
@@ -56,7 +56,7 @@
  * of the clients I use can parse those messages (and besides that,
  * wchars are difficult and non-portable to handle in most UNIX environments).
- * If you really need to include special characters, use the HTML UNICODE 
- * entities.  These are of the form &#2026; where 2026 is the hex 
- * representation of the UNICODE index (in this case, UNICODE 
+ * If you really need to include special characters, use the HTML UNICODE
+ * entities.  These are of the form &#2026; where 2026 is the hex
+ * representation of the UNICODE index (in this case, UNICODE
  * "Horizontal Ellipsis", or 133 in in ASCII8).
  *
@@ -64,6 +64,6 @@
  * in all of libfaim, it is written with performance in mind.  As such,
  * it is not as clear as it could be in respect to how this message is
- * supposed to be layed out. Most obviously, tlvlists should be used 
- * instead of writing out the bytes manually. 
+ * supposed to be layed out. Most obviously, tlvlists should be used
+ * instead of writing out the bytes manually.
  *
  * XXX more precise verification that we never send SNACs larger than 8192
@@ -81,19 +81,24 @@
 	aim_snacid_t snacid;
 
-	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)))
+	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004))) {
 		return -EINVAL;
-
-	if (!args)
+	}
+
+	if (!args) {
 		return -EINVAL;
+	}
 
 	if (args->flags & AIM_IMFLAGS_MULTIPART) {
-		if (args->mpmsg->numparts <= 0)
+		if (args->mpmsg->numparts <= 0) {
 			return -EINVAL;
+		}
 	} else {
-		if (!args->msg || (args->msglen <= 0))
+		if (!args->msg || (args->msglen <= 0)) {
 			return -EINVAL;
-
-		if (args->msglen >= MAXMSGLEN)
+		}
+
+		if (args->msglen >= MAXMSGLEN) {
 			return -E2BIG;
+		}
 	}
 
@@ -101,8 +106,9 @@
 	msgtlvlen = 1 + 1; /* 0501 */
 
-	if (args->flags & AIM_IMFLAGS_CUSTOMFEATURES)
+	if (args->flags & AIM_IMFLAGS_CUSTOMFEATURES) {
 		msgtlvlen += 2 + args->featureslen;
-	else
+	} else {
 		msgtlvlen += 2 + sizeof(deffeatures);
+	}
 
 	if (args->flags & AIM_IMFLAGS_MULTIPART) {
@@ -120,22 +126,24 @@
 
 
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, msgtlvlen+128)))
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, msgtlvlen + 128))) {
 		return -ENOMEM;
-
-	/* XXX should be optional */	
-	snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, args->destsn, strlen(args->destsn)+1);
+	}
+
+	/* XXX should be optional */
+	snacid = aim_cachesnac(sess, 0x0004, 0x0006, 0x0000, args->destsn, strlen(args->destsn) + 1);
 	aim_putsnac(&fr->data, 0x0004, 0x0006, 0x0000, snacid);
 
-	/* 
-	 * Generate a random message cookie 
-	 *
-	 * We could cache these like we do SNAC IDs.  (In fact, it 
-	 * might be a good idea.)  In the message error functions, 
-	 * the 8byte message cookie is returned as well as the 
+	/*
+	 * Generate a random message cookie
+	 *
+	 * We could cache these like we do SNAC IDs.  (In fact, it
+	 * might be a good idea.)  In the message error functions,
+	 * the 8byte message cookie is returned as well as the
 	 * SNAC ID.
 	 *
 	 */
-	for (i = 0; i < 8; i++)
+	for (i = 0; i < 8; i++) {
 		aimbs_put8(&fr->data, (guint8) rand());
+	}
 
 	/*
@@ -148,5 +156,5 @@
 	 */
 	aimbs_put8(&fr->data, strlen(args->destsn));
-	aimbs_putraw(&fr->data, (guint8 *)args->destsn, strlen(args->destsn));
+	aimbs_putraw(&fr->data, (guint8 *) args->destsn, strlen(args->destsn));
 
 	/*
@@ -157,5 +165,5 @@
 
 	/*
-	 * Features 
+	 * Features
 	 *
 	 */
@@ -186,5 +194,5 @@
 		aimbs_put16(&fr->data, 0x0101);
 
-		/* 
+		/*
 		 * Message block length.
 		 */
@@ -200,10 +208,11 @@
 
 		} else {
-			if (args->flags & AIM_IMFLAGS_UNICODE)
+			if (args->flags & AIM_IMFLAGS_UNICODE) {
 				aimbs_put16(&fr->data, 0x0002);
-			else if (args->flags & AIM_IMFLAGS_ISO_8859_1)
+			} else if (args->flags & AIM_IMFLAGS_ISO_8859_1) {
 				aimbs_put16(&fr->data, 0x0003);
-			else
+			} else {
 				aimbs_put16(&fr->data, 0x0000);
+			}
 
 			aimbs_put16(&fr->data, 0x0000);
@@ -213,9 +222,9 @@
 		 * Message.  Not terminated.
 		 */
-		aimbs_putraw(&fr->data, (guint8 *)args->msg, args->msglen);
-	}
-
-	/*
-	 * Set the Request Acknowledge flag.  
+		aimbs_putraw(&fr->data, (guint8 *) args->msg, args->msglen);
+	}
+
+	/*
+	 * Set the Request Acknowledge flag.
 	 */
 	if (args->flags & AIM_IMFLAGS_ACK) {
@@ -259,12 +268,13 @@
 	aim_tx_enqueue(sess, fr);
 
-	if (!(sess->flags & AIM_SESS_FLAGS_DONTTIMEOUTONICBM))
+	if (!(sess->flags & AIM_SESS_FLAGS_DONTTIMEOUTONICBM)) {
 		aim_cleansnacs(sess, 60); /* clean out SNACs over 60sec old */
 
+	}
 	return 0;
 }
 
 /*
- * Simple wrapper for aim_send_im_ext() 
+ * Simple wrapper for aim_send_im_ext()
  *
  * You cannot use aim_send_im if you need the HASICON flag.  You must
@@ -300,62 +310,64 @@
  */
 int aim_send_im_ch2_statusmessage(aim_session_t *sess, const char *sender, const guint8 *cookie,
-        const char *message, const guint8 state, const guint16 dc)
-{
-    aim_conn_t *conn;
-    aim_frame_t *fr;
-    aim_snacid_t snacid;
-
-    if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)))
-                return -EINVAL;
-        
-    if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 
-					10+8+2+1+strlen(sender)+2+0x1d+0x10+9+strlen(message)+1)))
-                return -ENOMEM;
-
-    snacid = aim_cachesnac(sess, 0x0004, 0x000b, 0x0000, NULL, 0);
-    aim_putsnac(&fr->data, 0x0004, 0x000b, 0x0000, snacid);
-    
-    aimbs_putraw(&fr->data, cookie, 8);
-    
-    aimbs_put16(&fr->data, 0x0002); /* channel */
-    aimbs_put8(&fr->data, strlen(sender));
-    aimbs_putraw(&fr->data, (guint8 *)sender, strlen(sender));
-
-    aimbs_put16(&fr->data, 0x0003); /* reason: channel specific */
-
-    aimbs_putle16(&fr->data, 0x001b); /* length of data SEQ1 */
-    aimbs_putle16(&fr->data, 0x0008); /* protocol version */
-
-    aimbs_putle32(&fr->data, 0x0000); /* no plugin -> 16 times 0x00 */ 
-    aimbs_putle32(&fr->data, 0x0000); 
-    aimbs_putle32(&fr->data, 0x0000); 
-    aimbs_putle32(&fr->data, 0x0000);
-
-    aimbs_putle16(&fr->data, 0x0000); /* unknown */
-    aimbs_putle32(&fr->data, 0x0003); /* client features */
-    aimbs_putle8(&fr->data, 0x00); /* unknown */
-    aimbs_putle16(&fr->data, dc); /* Sequence number?  XXX - This should decrement by 1 with each request */
-    /* end of SEQ1 */
-
-    aimbs_putle16(&fr->data, 0x000e); /* Length of SEQ2 */
-    aimbs_putle16(&fr->data, dc); /* Sequence number? same as above
-                                       * XXX - This should decrement by 1 with each request */
-    aimbs_putle32(&fr->data, 0x00000000); /* Unknown */
-    aimbs_putle32(&fr->data, 0x00000000); /* Unknown */
-    aimbs_putle32(&fr->data, 0x00000000); /* Unknown */
-    /* end of SEQ2 */
-
-    /* now for the real fun */
-    aimbs_putle8(&fr->data, state); /* away state */
-    aimbs_putle8(&fr->data, 0x03); /* msg-flag: 03 for states */
-    aimbs_putle16(&fr->data, 0x0000); /* status code ? */
-    aimbs_putle16(&fr->data, 0x0000); /* priority code */
-    aimbs_putle16(&fr->data, strlen(message) + 1); /* message length + termination */
-    aimbs_putraw(&fr->data, (guint8 *) message, strlen(message) + 1); /* null terminated string */
-    
-    aim_tx_enqueue(sess, fr);
-
-
-    return 0;
+                                  const char *message, const guint8 state, const guint16 dc)
+{
+	aim_conn_t *conn;
+	aim_frame_t *fr;
+	aim_snacid_t snacid;
+
+	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004))) {
+		return -EINVAL;
+	}
+
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02,
+	                      10 + 8 + 2 + 1 + strlen(sender) + 2 + 0x1d + 0x10 + 9 + strlen(message) + 1))) {
+		return -ENOMEM;
+	}
+
+	snacid = aim_cachesnac(sess, 0x0004, 0x000b, 0x0000, NULL, 0);
+	aim_putsnac(&fr->data, 0x0004, 0x000b, 0x0000, snacid);
+
+	aimbs_putraw(&fr->data, cookie, 8);
+
+	aimbs_put16(&fr->data, 0x0002); /* channel */
+	aimbs_put8(&fr->data, strlen(sender));
+	aimbs_putraw(&fr->data, (guint8 *) sender, strlen(sender));
+
+	aimbs_put16(&fr->data, 0x0003); /* reason: channel specific */
+
+	aimbs_putle16(&fr->data, 0x001b); /* length of data SEQ1 */
+	aimbs_putle16(&fr->data, 0x0008); /* protocol version */
+
+	aimbs_putle32(&fr->data, 0x0000); /* no plugin -> 16 times 0x00 */
+	aimbs_putle32(&fr->data, 0x0000);
+	aimbs_putle32(&fr->data, 0x0000);
+	aimbs_putle32(&fr->data, 0x0000);
+
+	aimbs_putle16(&fr->data, 0x0000); /* unknown */
+	aimbs_putle32(&fr->data, 0x0003); /* client features */
+	aimbs_putle8(&fr->data, 0x00); /* unknown */
+	aimbs_putle16(&fr->data, dc); /* Sequence number?  XXX - This should decrement by 1 with each request */
+	/* end of SEQ1 */
+
+	aimbs_putle16(&fr->data, 0x000e); /* Length of SEQ2 */
+	aimbs_putle16(&fr->data, dc); /* Sequence number? same as above
+	                               * XXX - This should decrement by 1 with each request */
+	aimbs_putle32(&fr->data, 0x00000000); /* Unknown */
+	aimbs_putle32(&fr->data, 0x00000000); /* Unknown */
+	aimbs_putle32(&fr->data, 0x00000000); /* Unknown */
+	/* end of SEQ2 */
+
+	/* now for the real fun */
+	aimbs_putle8(&fr->data, state); /* away state */
+	aimbs_putle8(&fr->data, 0x03); /* msg-flag: 03 for states */
+	aimbs_putle16(&fr->data, 0x0000); /* status code ? */
+	aimbs_putle16(&fr->data, 0x0000); /* priority code */
+	aimbs_putle16(&fr->data, strlen(message) + 1); /* message length + termination */
+	aimbs_putraw(&fr->data, (guint8 *) message, strlen(message) + 1); /* null terminated string */
+
+	aim_tx_enqueue(sess, fr);
+
+
+	return 0;
 }
 
@@ -375,6 +387,7 @@
 
 	/* ICBM Cookie. */
-	for (i = 0; i < 8; i++)
+	for (i = 0; i < 8; i++) {
 		aimbs_get8(bs);
+	}
 
 	/* Channel ID */
@@ -391,8 +404,10 @@
 	tlvlist = aim_readtlvchain(bs);
 
-	if (aim_gettlv(tlvlist, 0x0003, 1))
+	if (aim_gettlv(tlvlist, 0x0003, 1)) {
 		icbmflags |= AIM_IMFLAGS_ACK;
-	if (aim_gettlv(tlvlist, 0x0004, 1))
+	}
+	if (aim_gettlv(tlvlist, 0x0004, 1)) {
 		icbmflags |= AIM_IMFLAGS_AWAY;
+	}
 
 	if ((msgblock = aim_gettlv(tlvlist, 0x0002, 1))) {
@@ -404,6 +419,7 @@
 		aimbs_get8(&mbs);
 		aimbs_get8(&mbs);
-		for (featurelen = aimbs_get16(&mbs); featurelen; featurelen--)
+		for (featurelen = aimbs_get16(&mbs); featurelen; featurelen--) {
 			aimbs_get8(&mbs);
+		}
 		aimbs_get8(&mbs);
 		aimbs_get8(&mbs);
@@ -417,6 +433,7 @@
 	}
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, channel, sn, msg, icbmflags, flag1, flag2);
+	}
 
 	g_free(sn);
@@ -430,5 +447,5 @@
  *
  * Not only do AIM ICBM's support multiple channels.  Not only do they
- * support multiple character sets.  But they support multiple character 
+ * support multiple character sets.  But they support multiple character
  * sets / encodings within the same ICBM.
  *
@@ -436,5 +453,5 @@
  * seem utterly unnecessary by today's standards.  In fact, there is only
  * one client still in popular use that still uses this method: AOL for the
- * Macintosh, Version 5.0.  Obscure, yes, I know.  
+ * Macintosh, Version 5.0.  Obscure, yes, I know.
  *
  * In modern (non-"legacy") clients, if the user tries to send a character
@@ -444,5 +461,5 @@
  * Multipart messages prevent this wasted space by allowing the client to
  * only send the characters in UNICODE that need to be sent that way, and
- * the rest of the message can be sent in whatever the native character 
+ * the rest of the message can be sent in whatever the native character
  * set is (probably ASCII).
  *
@@ -471,10 +488,12 @@
 }
 
-static int mpmsg_addsection(aim_session_t *sess, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, guint8 *data, guint16 datalen)
-{
-	aim_mpmsg_section_t *sec; 
-	
-	if (!(sec = g_new0(aim_mpmsg_section_t,1)))
+static int mpmsg_addsection(aim_session_t *sess, aim_mpmsg_t *mpm, guint16 charset, guint16 charsubset, guint8 *data,
+                            guint16 datalen)
+{
+	aim_mpmsg_section_t *sec;
+
+	if (!(sec = g_new0(aim_mpmsg_section_t, 1))) {
 		return -1;
+	}
 
 	sec->charset = charset;
@@ -484,11 +503,12 @@
 	sec->next = NULL;
 
-	if (!mpm->parts)
+	if (!mpm->parts) {
 		mpm->parts = sec;
-	else {
+	} else {
 		aim_mpmsg_section_t *cur;
 
-		for (cur = mpm->parts; cur->next; cur = cur->next)
+		for (cur = mpm->parts; cur->next; cur = cur->next) {
 			;
+		}
 		cur->next = sec;
 	}
@@ -505,5 +525,5 @@
 	for (cur = mpm->parts; cur; ) {
 		aim_mpmsg_section_t *tmp;
-		
+
 		tmp = cur->next;
 		g_free(cur->data);
@@ -511,5 +531,5 @@
 		cur = tmp;
 	}
-	
+
 	mpm->numparts = 0;
 	mpm->parts = NULL;
@@ -519,5 +539,5 @@
 
 /*
- * Start by building the multipart structures, then pick the first 
+ * Start by building the multipart structures, then pick the first
  * human-readable section and stuff it into args->msg so no one gets
  * suspicious.
@@ -569,5 +589,5 @@
 		 */
 		msgbuf = aimbs_getstr(&mbs, msglen);
-		mpmsg_addsection(sess, &args->mpmsg, flag1, flag2, (guint8 *)msgbuf, (guint16) msglen);
+		mpmsg_addsection(sess, &args->mpmsg, flag1, flag2, (guint8 *) msgbuf, (guint16) msglen);
 
 	} /* while */
@@ -590,6 +610,7 @@
 		for (sec = args->mpmsg.parts; sec; sec = sec->next) {
 
-			if (sec->charset != charsetpri[i])
+			if (sec->charset != charsetpri[i]) {
 				continue;
+			}
 
 			/* Great. We found one.  Fill it in. */
@@ -599,33 +620,36 @@
 
 			/* Set up the simple flags */
-			if (args->charset == 0x0000)
+			if (args->charset == 0x0000) {
 				; /* ASCII */
-			else if (args->charset == 0x0002)
+			} else if (args->charset == 0x0002) {
 				args->icbmflags |= AIM_IMFLAGS_UNICODE;
-			else if (args->charset == 0x0003)
+			} else if (args->charset == 0x0003) {
 				args->icbmflags |= AIM_IMFLAGS_ISO_8859_1;
-			else if (args->charset == 0xffff)
+			} else if (args->charset == 0xffff) {
 				; /* no encoding (yeep!) */
 
-			if (args->charsubset == 0x0000)
+			}
+			if (args->charsubset == 0x0000) {
 				; /* standard subencoding? */
-			else if (args->charsubset == 0x000b)
+			} else if (args->charsubset == 0x000b) {
 				args->icbmflags |= AIM_IMFLAGS_SUBENC_MACINTOSH;
-			else if (args->charsubset == 0xffff)
+			} else if (args->charsubset == 0xffff) {
 				; /* no subencoding */
+			}
 #if 0
-			/* XXX this isn't really necesary... */	
-			if (	((args.flag1 != 0x0000) &&
-				 (args.flag1 != 0x0002) &&
-				 (args.flag1 != 0x0003) &&
-				 (args.flag1 != 0xffff)) ||
-				((args.flag2 != 0x0000) &&
-				 (args.flag2 != 0x000b) &&
-				 (args.flag2 != 0xffff))) {
-				faimdprintf(sess, 0, "icbm: **warning: encoding flags are being used! {%04x, %04x}\n", args.flag1, args.flag2);
+			/* XXX this isn't really necesary... */
+			if (((args.flag1 != 0x0000) &&
+			     (args.flag1 != 0x0002) &&
+			     (args.flag1 != 0x0003) &&
+			     (args.flag1 != 0xffff)) ||
+			    ((args.flag2 != 0x0000) &&
+			     (args.flag2 != 0x000b) &&
+			     (args.flag2 != 0xffff))) {
+				faimdprintf(sess, 0, "icbm: **warning: encoding flags are being used! {%04x, %04x}\n",
+				            args.flag1, args.flag2);
 			}
 #endif
 
-			args->msg = (char *)sec->data;
+			args->msg = (char *) sec->data;
 			args->msglen = sec->datalen;
 
@@ -642,5 +666,6 @@
 }
 
-static int incomingim_ch1(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, guint16 channel, aim_userinfo_t *userinfo, aim_bstream_t *bs, guint8 *cookie)
+static int incomingim_ch1(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, guint16 channel,
+                          aim_userinfo_t *userinfo, aim_bstream_t *bs, guint8 *cookie)
 {
 	guint16 type, length;
@@ -690,5 +715,6 @@
 			 * blocks...
 			 */
-			incomingim_ch1_parsemsgs(sess, bs->data + bs->offset /* XXX evil!!! */, length - 2 - 2 - args.featureslen, &args);
+			incomingim_ch1_parsemsgs(sess, bs->data + bs->offset /* XXX evil!!! */,
+			                         length - 2 - 2 - args.featureslen, &args);
 
 		} else if (type == 0x0003) { /* Server Ack Requested */
@@ -720,8 +746,9 @@
 			 * You really shouldn't advertise a zero-length icon
 			 * anyway.
-			 * 
+			 *
 			 */
-			if (args.iconlen)
+			if (args.iconlen) {
 				args.icbmflags |= AIM_IMFLAGS_HASICON;
+			}
 
 		} else if (type == 0x0009) {
@@ -750,6 +777,7 @@
 
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, channel, userinfo, &args);
+	}
 
 	aim_mpmsg_free(sess, &args.mpmsg);
@@ -769,5 +797,6 @@
 }
 
-static void incomingim_ch2_chat(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args, aim_bstream_t *servdata)
+static void incomingim_ch2_chat(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac,
+                                aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args, aim_bstream_t *servdata)
 {
 
@@ -775,8 +804,9 @@
 	 * Chat room info.
 	 */
-	if (servdata)
+	if (servdata) {
 		aim_chat_readroominfo(servdata, &args->info.chat.roominfo);
-
-	args->destructor = (void *)incomingim_ch2_chat_free;
+	}
+
+	args->destructor = (void *) incomingim_ch2_chat_free;
 
 	return;
@@ -786,5 +816,5 @@
 {
 
-	g_free((char *)args->info.rtfmsg.rtfmsg);
+	g_free((char *) args->info.rtfmsg.rtfmsg);
 
 	return;
@@ -792,5 +822,5 @@
 
 /*
- * The relationship between AIM_CAPS_ICQSERVERRELAY and AIM_CAPS_ICQRTF is 
+ * The relationship between AIM_CAPS_ICQSERVERRELAY and AIM_CAPS_ICQRTF is
  * kind of odd. This sends the client ICQRTF since that is all that I've seen
  * SERVERRELAY used for.
@@ -801,70 +831,74 @@
  *
  */
-static void incomingim_ch2_icqserverrelay(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args, aim_bstream_t *servdata)
+static void incomingim_ch2_icqserverrelay(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac,
+                                          aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args,
+                                          aim_bstream_t *servdata)
 {
 	guint16 hdrlen, msglen, dc;
 	guint8 msgtype;
-    guint8 *plugin;
-    int i = 0, tmp = 0;
-    struct im_connection *ic = sess->aux_data;
-
-    /* at the moment we just can deal with requests, not with cancel or accept */
-    if (args->status != 0) return;
+	guint8 *plugin;
+	int i = 0, tmp = 0;
+	struct im_connection *ic = sess->aux_data;
+
+	/* at the moment we just can deal with requests, not with cancel or accept */
+	if (args->status != 0) {
+		return;
+	}
 
 	hdrlen = aimbs_getle16(servdata);
 
-    aim_bstream_advance(servdata, 0x02); /* protocol version */
-    plugin = aimbs_getraw(servdata, 0x10); /* following data is a message or 
-                                              something plugin specific */
-    /* as there is no plugin handling, just skip the rest */
-    aim_bstream_advance(servdata, hdrlen - 0x12);
+	aim_bstream_advance(servdata, 0x02); /* protocol version */
+	plugin = aimbs_getraw(servdata, 0x10); /* following data is a message or
+	                                      something plugin specific */
+	/* as there is no plugin handling, just skip the rest */
+	aim_bstream_advance(servdata, hdrlen - 0x12);
 
 	hdrlen = aimbs_getle16(servdata);
-    dc = aimbs_getle16(servdata); /* save the sequence number */
+	dc = aimbs_getle16(servdata); /* save the sequence number */
 	aim_bstream_advance(servdata, hdrlen - 0x02);
 
-    /* TODO is it a message or something for a plugin? */
-    for (i = 0; i < 0x10; i++) {
-        tmp |= plugin[i];
-    }
-
-    if (!tmp) { /* message follows */
-
-        msgtype = aimbs_getle8(servdata);
-        aimbs_getle8(servdata); /* msgflags */
-
-        aim_bstream_advance(servdata, 0x04); /* status code and priority code */
-
-        msglen = aimbs_getle16(servdata); /* message string length */
-	args->info.rtfmsg.rtfmsg = aimbs_getstr(servdata, msglen);
-
-        switch(msgtype) {
-            case AIM_MTYPE_PLAIN:
-
-                args->info.rtfmsg.fgcolor = aimbs_getle32(servdata);
-                args->info.rtfmsg.bgcolor = aimbs_getle32(servdata);
-
-                hdrlen = aimbs_getle32(servdata);
-                aim_bstream_advance(servdata, hdrlen);
-
-                /* XXX This is such a hack. */
-                args->reqclass = AIM_CAPS_ICQRTF;
-                break;
-
-            case AIM_MTYPE_AUTOAWAY: 
-            case AIM_MTYPE_AUTOBUSY:
-            case AIM_MTYPE_AUTONA:
-            case AIM_MTYPE_AUTODND:
-            case AIM_MTYPE_AUTOFFC:
-	    case 0x9c:	/* ICQ 5 seems to send this */
-                aim_send_im_ch2_statusmessage(sess, userinfo->sn, args->cookie,
-                        ic->away ? ic->away : "", sess->aim_icq_state, dc);
-                break;
-
-        }
-    } /* message or plugin specific */
-
-    g_free(plugin);
-	args->destructor = (void *)incomingim_ch2_icqserverrelay_free;
+	/* TODO is it a message or something for a plugin? */
+	for (i = 0; i < 0x10; i++) {
+		tmp |= plugin[i];
+	}
+
+	if (!tmp) { /* message follows */
+
+		msgtype = aimbs_getle8(servdata);
+		aimbs_getle8(servdata); /* msgflags */
+
+		aim_bstream_advance(servdata, 0x04); /* status code and priority code */
+
+		msglen = aimbs_getle16(servdata); /* message string length */
+		args->info.rtfmsg.rtfmsg = aimbs_getstr(servdata, msglen);
+
+		switch (msgtype) {
+		case AIM_MTYPE_PLAIN:
+
+			args->info.rtfmsg.fgcolor = aimbs_getle32(servdata);
+			args->info.rtfmsg.bgcolor = aimbs_getle32(servdata);
+
+			hdrlen = aimbs_getle32(servdata);
+			aim_bstream_advance(servdata, hdrlen);
+
+			/* XXX This is such a hack. */
+			args->reqclass = AIM_CAPS_ICQRTF;
+			break;
+
+		case AIM_MTYPE_AUTOAWAY:
+		case AIM_MTYPE_AUTOBUSY:
+		case AIM_MTYPE_AUTONA:
+		case AIM_MTYPE_AUTODND:
+		case AIM_MTYPE_AUTOFFC:
+		case 0x9c: /* ICQ 5 seems to send this */
+			aim_send_im_ch2_statusmessage(sess, userinfo->sn, args->cookie,
+			                              ic->away ? ic->away : "", sess->aim_icq_state, dc);
+			break;
+
+		}
+	} /* message or plugin specific */
+
+	g_free(plugin);
+	args->destructor = (void *) incomingim_ch2_icqserverrelay_free;
 
 	return;
@@ -873,5 +907,6 @@
 typedef void (*ch2_args_destructor_t)(aim_session_t *sess, struct aim_incomingim_ch2_args *args);
 
-static int incomingim_ch2(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, guint16 channel, aim_userinfo_t *userinfo, aim_tlvlist_t *tlvlist, guint8 *cookie)
+static int incomingim_ch2(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, guint16 channel,
+                          aim_userinfo_t *userinfo, aim_tlvlist_t *tlvlist, guint8 *cookie)
 {
 	aim_rxcallback_t userfunc;
@@ -883,12 +918,12 @@
 	int ret = 0;
 
-	char clientip1[30] = {""};
-	char clientip2[30] = {""};
-	char verifiedip[30] = {""};
+	char clientip1[30] = { "" };
+	char clientip2[30] = { "" };
+	char verifiedip[30] = { "" };
 
 	memset(&args, 0, sizeof(args));
 
 	/*
-	 * There's another block of TLVs embedded in the type 5 here. 
+	 * There's another block of TLVs embedded in the type 5 here.
 	 */
 	block1 = aim_gettlv(tlvlist, 0x0005, 1);
@@ -899,5 +934,5 @@
 	 *
 	 * 0 is a request, 1 is a deny (?), 2 is an accept
-	 */ 
+	 */
 	args.status = aimbs_get16(&bbs);
 
@@ -906,6 +941,7 @@
 	 */
 	cookie2 = aimbs_getraw(&bbs, 8);
-	if (memcmp(cookie, cookie2, 8) != 0) 
+	if (memcmp(cookie, cookie2, 8) != 0) {
 		imcb_error(sess->aux_data, "rend: warning cookies don't match!");
+	}
 	memcpy(args.cookie, cookie2, 8);
 	g_free(cookie2);
@@ -917,5 +953,5 @@
 	args.reqclass = aim_getcap(sess, &bbs, 0x10);
 
-	/* 
+	/*
 	 * What follows may be TLVs or nothing, depending on the
 	 * purpose of the message.
@@ -934,8 +970,8 @@
 
 		g_snprintf(clientip1, sizeof(clientip1), "%d.%d.%d.%d",
-				aimutil_get8(iptlv->value+0),
-				aimutil_get8(iptlv->value+1),
-				aimutil_get8(iptlv->value+2),
-				aimutil_get8(iptlv->value+3));
+		           aimutil_get8(iptlv->value + 0),
+		           aimutil_get8(iptlv->value + 1),
+		           aimutil_get8(iptlv->value + 2),
+		           aimutil_get8(iptlv->value + 3));
 	}
 
@@ -949,8 +985,8 @@
 
 		g_snprintf(clientip2, sizeof(clientip2), "%d.%d.%d.%d",
-				aimutil_get8(iptlv->value+0),
-				aimutil_get8(iptlv->value+1),
-				aimutil_get8(iptlv->value+2),
-				aimutil_get8(iptlv->value+3));
+		           aimutil_get8(iptlv->value + 0),
+		           aimutil_get8(iptlv->value + 1),
+		           aimutil_get8(iptlv->value + 2),
+		           aimutil_get8(iptlv->value + 3));
 	}
 
@@ -966,8 +1002,8 @@
 
 		g_snprintf(verifiedip, sizeof(verifiedip), "%d.%d.%d.%d",
-				aimutil_get8(iptlv->value+0),
-				aimutil_get8(iptlv->value+1),
-				aimutil_get8(iptlv->value+2),
-				aimutil_get8(iptlv->value+3));
+		           aimutil_get8(iptlv->value + 0),
+		           aimutil_get8(iptlv->value + 1),
+		           aimutil_get8(iptlv->value + 2),
+		           aimutil_get8(iptlv->value + 3));
 	}
 
@@ -975,45 +1011,55 @@
 	 * Port number for something.
 	 */
-	if (aim_gettlv(list2, 0x0005, 1))
+	if (aim_gettlv(list2, 0x0005, 1)) {
 		args.port = aim_gettlv16(list2, 0x0005, 1);
+	}
 
 	/*
 	 * Error code.
 	 */
-	if (aim_gettlv(list2, 0x000b, 1))
+	if (aim_gettlv(list2, 0x000b, 1)) {
 		args.errorcode = aim_gettlv16(list2, 0x000b, 1);
+	}
 
 	/*
 	 * Invitation message / chat description.
 	 */
-	if (aim_gettlv(list2, 0x000c, 1))
+	if (aim_gettlv(list2, 0x000c, 1)) {
 		args.msg = aim_gettlv_str(list2, 0x000c, 1);
+	}
 
 	/*
 	 * Character set.
 	 */
-	if (aim_gettlv(list2, 0x000d, 1))
+	if (aim_gettlv(list2, 0x000d, 1)) {
 		args.encoding = aim_gettlv_str(list2, 0x000d, 1);
-	
+	}
+
 	/*
 	 * Language.
 	 */
-	if (aim_gettlv(list2, 0x000e, 1))
+	if (aim_gettlv(list2, 0x000e, 1)) {
 		args.language = aim_gettlv_str(list2, 0x000e, 1);
+	}
 
 	/* Unknown -- two bytes = 0x0001 */
-	if (aim_gettlv(list2, 0x000a, 1))
+	if (aim_gettlv(list2, 0x000a, 1)) {
 		;
+	}
 
 	/* Unknown -- no value */
-	if (aim_gettlv(list2, 0x000f, 1))
+	if (aim_gettlv(list2, 0x000f, 1)) {
 		;
-
-	if (strlen(clientip1))
-		args.clientip = (char *)clientip1;
-	if (strlen(clientip2))
-		args.clientip2 = (char *)clientip2;
-	if (strlen(verifiedip))
-		args.verifiedip = (char *)verifiedip;
+	}
+
+	if (strlen(clientip1)) {
+		args.clientip = (char *) clientip1;
+	}
+	if (strlen(clientip2)) {
+		args.clientip2 = (char *) clientip2;
+	}
+	if (strlen(verifiedip)) {
+		args.verifiedip = (char *) verifiedip;
+	}
 
 	/*
@@ -1029,20 +1075,23 @@
 	}
 
-	if (args.reqclass & AIM_CAPS_ICQSERVERRELAY)
+	if (args.reqclass & AIM_CAPS_ICQSERVERRELAY) {
 		incomingim_ch2_icqserverrelay(sess, mod, rx, snac, userinfo, &args, sdbsptr);
-	else if (args.reqclass & AIM_CAPS_CHAT)
+	} else if (args.reqclass & AIM_CAPS_CHAT) {
 		incomingim_ch2_chat(sess, mod, rx, snac, userinfo, &args, sdbsptr);
-
-
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	}
+
+
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, channel, userinfo, &args);
-
-
-	if (args.destructor)
-		((ch2_args_destructor_t)args.destructor)(sess, &args);
-
-	g_free((char *)args.msg);
-	g_free((char *)args.encoding);
-	g_free((char *)args.language);
+	}
+
+
+	if (args.destructor) {
+		((ch2_args_destructor_t) args.destructor)(sess, &args);
+	}
+
+	g_free((char *) args.msg);
+	g_free((char *) args.encoding);
+	g_free((char *) args.language);
 
 	aim_freetlvchain(&list2);
@@ -1051,5 +1100,6 @@
 }
 
-static int incomingim_ch4(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, guint16 channel, aim_userinfo_t *userinfo, aim_tlvlist_t *tlvlist, guint8 *cookie)
+static int incomingim_ch4(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, guint16 channel,
+                          aim_userinfo_t *userinfo, aim_tlvlist_t *tlvlist, guint8 *cookie)
 {
 	aim_bstream_t meat;
@@ -1062,14 +1112,16 @@
 	 * Make a bstream for the meaty part.  Yum.  Meat.
 	 */
-	if (!(block = aim_gettlv(tlvlist, 0x0005, 1)))
+	if (!(block = aim_gettlv(tlvlist, 0x0005, 1))) {
 		return -1;
+	}
 	aim_bstream_init(&meat, block->value, block->length);
 
 	args.uin = aimbs_getle32(&meat);
 	args.type = aimbs_getle16(&meat);
-	args.msg = (char *)aimbs_getraw(&meat, aimbs_getle16(&meat));
-
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	args.msg = (char *) aimbs_getraw(&meat, aimbs_getle16(&meat));
+
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, channel, userinfo, &args);
+	}
 
 	g_free(args.msg);
@@ -1101,14 +1153,15 @@
 	 * Read ICBM Cookie.  And throw away.
 	 */
-	for (i = 0; i < 8; i++)
+	for (i = 0; i < 8; i++) {
 		cookie[i] = aimbs_get8(bs);
+	}
 
 	/*
 	 * Channel ID.
 	 *
-	 * Channel 0x0001 is the message channel.  There are 
+	 * Channel 0x0001 is the message channel.  There are
 	 * other channels for things called "rendevous"
 	 * which represent chat and some of the other new
-	 * features of AIM2/3/3.5. 
+	 * features of AIM2/3/3.5.
 	 *
 	 * Channel 0x0002 is the Rendevous channel, which
@@ -1116,5 +1169,5 @@
 	 * connection negotiations come from.
 	 *
-	 * Channel 0x0004 is used for ICQ authorization, or 
+	 * Channel 0x0004 is used for ICQ authorization, or
 	 * possibly any system notice.
 	 *
@@ -1131,10 +1184,10 @@
 	 * aim_extractuserinfo() returns the number of bytes used by the
 	 * userinfo tlvs, so you can start reading the rest of them right
-	 * afterward.  
+	 * afterward.
 	 *
 	 * That also means that TLV types can be duplicated between the
 	 * userinfo block and the rest of the message, however there should
 	 * never be two TLVs of the same type in one block.
-	 * 
+	 *
 	 */
 	aim_extractuserinfo(sess, bs, &userinfo);
@@ -1155,5 +1208,5 @@
 
 		/*
-		 * Read block of TLVs (not including the userinfo data).  All 
+		 * Read block of TLVs (not including the userinfo data).  All
 		 * further data is derived from what is parsed here.
 		 */
@@ -1191,6 +1244,7 @@
 	aim_conn_t *conn;
 
-	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)))
+	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004))) {
 		return -EINVAL;
+	}
 
 	return aim_genericreq_n(sess, conn, 0x0004, 0x0004);
@@ -1201,5 +1255,5 @@
  * I definitly recommend sending this.  If you don't, you'll be stuck
  * with the rather unreasonable defaults.  You don't want those.  Send this.
- * 
+ *
  */
 int aim_seticbmparam(aim_session_t *sess, struct aim_icbmparameters *params)
@@ -1209,12 +1263,15 @@
 	aim_snacid_t snacid;
 
-	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004)))
+	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0004))) {
 		return -EINVAL;
-
-	if (!params)
+	}
+
+	if (!params) {
 		return -EINVAL;
-
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+16)))
+	}
+
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 16))) {
 		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, 0x0004, 0x0002, 0x0000, NULL, 0);
@@ -1225,8 +1282,8 @@
 
 	/* These are all read-write */
-	aimbs_put32(&fr->data, params->flags); 
+	aimbs_put32(&fr->data, params->flags);
 	aimbs_put16(&fr->data, params->maxmsglen);
-	aimbs_put16(&fr->data, params->maxsenderwarn); 
-	aimbs_put16(&fr->data, params->maxrecverwarn); 
+	aimbs_put16(&fr->data, params->maxsenderwarn);
+	aimbs_put16(&fr->data, params->maxrecverwarn);
 	aimbs_put32(&fr->data, params->minmsginterval);
 
@@ -1247,7 +1304,8 @@
 	params.maxrecverwarn = aimbs_get16(bs);
 	params.minmsginterval = aimbs_get32(bs);
-	
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		return userfunc(sess, rx, &params);
+	}
 
 	return 0;
@@ -1261,5 +1319,5 @@
 	aim_userinfo_t userinfo;
 
-	while (aim_bstream_empty(bs)) {	
+	while (aim_bstream_empty(bs)) {
 
 		channel = aimbs_get16(bs);
@@ -1268,6 +1326,7 @@
 		reason = aimbs_get16(bs);
 
-		if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
-			 ret = userfunc(sess, rx, channel, &userinfo, nummissed, reason);
+		if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
+			ret = userfunc(sess, rx, channel, &userinfo, nummissed, reason);
+		}
 	}
 
@@ -1276,8 +1335,9 @@
 
 /*
- * Receive the response from an ICQ status message request.  This contains the 
+ * Receive the response from an ICQ status message request.  This contains the
  * ICQ status message.  Go figure.
  */
-static int clientautoresp(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
+static int clientautoresp(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac,
+                          aim_bstream_t *bs)
 {
 	int ret = 0;
@@ -1294,54 +1354,56 @@
 
 	switch (reason) {
-		case 0x0003: { /* ICQ status message.  Maybe other stuff too, you never know with these people. */
-			guint8 statusmsgtype, *msg;
-			guint16 len;
-			guint32 state;
-
-			len = aimbs_getle16(bs); /* Should be 0x001b */
-			aim_bstream_advance(bs, len); /* Unknown */
-
-			len = aimbs_getle16(bs); /* Should be 0x000e */
-			aim_bstream_advance(bs, len); /* Unknown */
-
-			statusmsgtype = aimbs_getle8(bs);
-			switch (statusmsgtype) {
-				case 0xe8:
-					state = AIM_ICQ_STATE_AWAY;
-					break;
-				case 0xe9:
-					state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY;
-					break;
-				case 0xea:
-					state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_OUT;
-					break;
-				case 0xeb:
-					state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY;
-					break;
-				case 0xec:
-					state = AIM_ICQ_STATE_CHAT;
-					break;
-				default:
-					state = 0;
-					break;
-			}
-
-			aimbs_getle8(bs); /* Unknown - 0x03 Maybe this means this is an auto-reply */
-			aimbs_getle16(bs); /* Unknown - 0x0000 */
-			aimbs_getle16(bs); /* Unknown - 0x0000 */
-
-			len = aimbs_getle16(bs);
-			msg = aimbs_getraw(bs, len);
-
-			if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
-				ret = userfunc(sess, rx, channel, sn, reason, state, msg);
-
-			g_free(msg);
-		} break;
-
-		default: {
-			if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
-				ret = userfunc(sess, rx, channel, sn, reason);
-		} break;
+	case 0x0003: {         /* ICQ status message.  Maybe other stuff too, you never know with these people. */
+		guint8 statusmsgtype, *msg;
+		guint16 len;
+		guint32 state;
+
+		len = aimbs_getle16(bs);         /* Should be 0x001b */
+		aim_bstream_advance(bs, len);         /* Unknown */
+
+		len = aimbs_getle16(bs);         /* Should be 0x000e */
+		aim_bstream_advance(bs, len);         /* Unknown */
+
+		statusmsgtype = aimbs_getle8(bs);
+		switch (statusmsgtype) {
+		case 0xe8:
+			state = AIM_ICQ_STATE_AWAY;
+			break;
+		case 0xe9:
+			state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY;
+			break;
+		case 0xea:
+			state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_OUT;
+			break;
+		case 0xeb:
+			state = AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_DND | AIM_ICQ_STATE_BUSY;
+			break;
+		case 0xec:
+			state = AIM_ICQ_STATE_CHAT;
+			break;
+		default:
+			state = 0;
+			break;
+		}
+
+		aimbs_getle8(bs);         /* Unknown - 0x03 Maybe this means this is an auto-reply */
+		aimbs_getle16(bs);         /* Unknown - 0x0000 */
+		aimbs_getle16(bs);         /* Unknown - 0x0000 */
+
+		len = aimbs_getle16(bs);
+		msg = aimbs_getraw(bs, len);
+
+		if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
+			ret = userfunc(sess, rx, channel, sn, reason, state, msg);
+		}
+
+		g_free(msg);
+	} break;
+
+	default: {
+		if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
+			ret = userfunc(sess, rx, channel, sn, reason);
+		}
+	} break;
 	} /* end switch */
 
@@ -1365,6 +1427,7 @@
 	sn = aimbs_getstr(bs, snlen);
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, type, sn);
+	}
 
 	g_free(sn);
@@ -1377,5 +1440,5 @@
  * Subtype 0x0014 - Send a mini typing notification (mtn) packet.
  *
- * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer, 
+ * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer,
  * and Gaim 0.60 and newer.
  *
@@ -1387,12 +1450,15 @@
 	aim_snacid_t snacid;
 
-	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0002)))
+	if (!sess || !(conn = aim_conn_findbygroup(sess, 0x0002))) {
 		return -EINVAL;
-
-	if (!sn)
+	}
+
+	if (!sn) {
 		return -EINVAL;
-
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+11+strlen(sn)+2)))
+	}
+
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 11 + strlen(sn) + 2))) {
 		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, 0x0004, 0x0014, 0x0000, NULL, 0);
@@ -1417,5 +1483,5 @@
 	 */
 	aimbs_put8(&fr->data, strlen(sn));
-	aimbs_putraw(&fr->data, (const guint8*)sn, strlen(sn));
+	aimbs_putraw(&fr->data, (const guint8 *) sn, strlen(sn));
 
 	/*
@@ -1432,5 +1498,5 @@
  * Subtype 0x0014 - Receive a mini typing notification (mtn) packet.
  *
- * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer, 
+ * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer,
  * and Gaim 0.60 and newer.
  *
@@ -1450,6 +1516,7 @@
 	type2 = aimbs_get16(bs);
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, type1, sn, type2);
+	}
 
 	g_free(sn);
@@ -1461,18 +1528,19 @@
 {
 
-	if (snac->subtype == 0x0005)
+	if (snac->subtype == 0x0005) {
 		return paraminfo(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x0006)
+	} else if (snac->subtype == 0x0006) {
 		return outgoingim(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x0007)
+	} else if (snac->subtype == 0x0007) {
 		return incomingim(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x000a)
+	} else if (snac->subtype == 0x000a) {
 		return missedcall(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x000b)
+	} else if (snac->subtype == 0x000b) {
 		return clientautoresp(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x000c)
+	} else if (snac->subtype == 0x000c) {
 		return msgack(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x0014)
+	} else if (snac->subtype == 0x0014) {
 		return mtn_receive(sess, mod, rx, snac, bs);
+	}
 
 	return 0;
Index: protocols/oscar/im.h
===================================================================
--- protocols/oscar/im.h	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/im.h	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -6,5 +6,5 @@
 /*
  * SNAC Family: Messaging Services.
- */ 
+ */
 #define AIM_CB_MSG_ERROR 0x0001
 #define AIM_CB_MSG_PARAMINFO 0x0005
@@ -17,16 +17,16 @@
 #define AIM_CB_MSG_DEFAULT 0xffff
 
-#define AIM_IMFLAGS_AWAY		0x0001 /* mark as an autoreply */
-#define AIM_IMFLAGS_ACK			0x0002 /* request a receipt notice */
-#define AIM_IMFLAGS_UNICODE		0x0004
-#define AIM_IMFLAGS_ISO_8859_1		0x0008
-#define AIM_IMFLAGS_BUDDYREQ		0x0010 /* buddy icon requested */
-#define AIM_IMFLAGS_HASICON		0x0020 /* already has icon */
-#define AIM_IMFLAGS_SUBENC_MACINTOSH	0x0040 /* damn that Steve Jobs! */
-#define AIM_IMFLAGS_CUSTOMFEATURES 	0x0080 /* features field present */
-#define AIM_IMFLAGS_EXTDATA		0x0100
-#define AIM_IMFLAGS_CUSTOMCHARSET	0x0200 /* charset fields set */
-#define AIM_IMFLAGS_MULTIPART		0x0400 /* ->mpmsg section valid */
-#define AIM_IMFLAGS_OFFLINE		0x0800 /* send to offline user */
+#define AIM_IMFLAGS_AWAY                0x0001 /* mark as an autoreply */
+#define AIM_IMFLAGS_ACK                 0x0002 /* request a receipt notice */
+#define AIM_IMFLAGS_UNICODE             0x0004
+#define AIM_IMFLAGS_ISO_8859_1          0x0008
+#define AIM_IMFLAGS_BUDDYREQ            0x0010 /* buddy icon requested */
+#define AIM_IMFLAGS_HASICON             0x0020 /* already has icon */
+#define AIM_IMFLAGS_SUBENC_MACINTOSH    0x0040 /* damn that Steve Jobs! */
+#define AIM_IMFLAGS_CUSTOMFEATURES      0x0080 /* features field present */
+#define AIM_IMFLAGS_EXTDATA             0x0100
+#define AIM_IMFLAGS_CUSTOMCHARSET       0x0200 /* charset fields set */
+#define AIM_IMFLAGS_MULTIPART           0x0400 /* ->mpmsg section valid */
+#define AIM_IMFLAGS_OFFLINE             0x0800 /* send to offline user */
 
 /*
@@ -84,5 +84,5 @@
 /*
  * This information is provided in the Incoming ICBM callback for
- * Channel 1 ICBM's.  
+ * Channel 1 ICBM's.
  *
  * Note that although CUSTOMFEATURES and CUSTOMCHARSET say they
@@ -100,5 +100,5 @@
 	aim_mpmsg_t mpmsg;
 	guint32 icbmflags; /* some flags apply only to ->msg, not all mpmsg */
-	
+
 	/* Only provided if message has a human-readable section */
 	char *msg;
@@ -179,5 +179,6 @@
 
 int aim_im_sendmtn(aim_session_t *sess, guint16 type1, const char *sn, guint16 type2);
-int aim_send_im_ch2_statusmessage(aim_session_t *sess, const char *sender, const guint8 *cookie, const char *message, const guint8 state, const guint16 dc);
+int aim_send_im_ch2_statusmessage(aim_session_t *sess, const char *sender, const guint8 *cookie, const char *message,
+                                  const guint8 state, const guint16 dc);
 
 #endif /* __OSCAR_IM_H__ */
Index: protocols/oscar/info.c
===================================================================
--- protocols/oscar/info.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/info.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -3,5 +3,5 @@
  *
  * The functions here are responsible for requesting and parsing information-
- * gathering SNACs.  Or something like that. 
+ * gathering SNACs.  Or something like that.
  *
  */
@@ -11,5 +11,5 @@
 
 struct aim_priv_inforeq {
-	char sn[MAXSNLEN+1];
+	char sn[MAXSNLEN + 1];
 	guint16 infotype;
 };
@@ -21,18 +21,20 @@
 	aim_snacid_t snacid;
 
-	if (!sess || !conn || !sn)
+	if (!sess || !conn || !sn) {
 		return -EINVAL;
-
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 12+1+strlen(sn))))
+	}
+
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 12 + 1 + strlen(sn)))) {
 		return -ENOMEM;
+	}
 
 	strncpy(privdata.sn, sn, sizeof(privdata.sn));
 	privdata.infotype = infotype;
 	snacid = aim_cachesnac(sess, 0x0002, 0x0005, 0x0000, &privdata, sizeof(struct aim_priv_inforeq));
-	
+
 	aim_putsnac(&fr->data, 0x0002, 0x0005, 0x0000, snacid);
 	aimbs_put16(&fr->data, infotype);
 	aimbs_put8(&fr->data, strlen(sn));
-	aimbs_putraw(&fr->data, (guint8 *)sn, strlen(sn));
+	aimbs_putraw(&fr->data, (guint8 *) sn, strlen(sn));
 
 	aim_tx_enqueue(sess, fr);
@@ -42,5 +44,5 @@
 
 /*
- * Capability blocks. 
+ * Capability blocks.
  *
  * These are CLSIDs. They should actually be of the form:
@@ -59,103 +61,103 @@
 	 * Chat is oddball.
 	 */
-	{AIM_CAPS_CHAT,
-	 {0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1, 
-	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
+	{ AIM_CAPS_CHAT,
+	  { 0x74, 0x8f, 0x24, 0x20, 0x62, 0x87, 0x11, 0xd1,
+	    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 } },
 
 	/*
 	 * These are mostly in order.
 	 */
-	{AIM_CAPS_VOICE,
-	 {0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1, 
-	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
-
-	{AIM_CAPS_SENDFILE,
-	 {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1, 
-	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
+	{ AIM_CAPS_VOICE,
+	  { 0x09, 0x46, 0x13, 0x41, 0x4c, 0x7f, 0x11, 0xd1,
+	    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 } },
+
+	{ AIM_CAPS_SENDFILE,
+	  { 0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1,
+	    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 } },
 
 	/*
 	 * Advertised by the EveryBuddy client.
 	 */
-	{AIM_CAPS_ICQ,
-	 {0x09, 0x46, 0x13, 0x44, 0x4c, 0x7f, 0x11, 0xd1, 
-	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
-
-	{AIM_CAPS_IMIMAGE,
-	 {0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1, 
-	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
-
-	{AIM_CAPS_BUDDYICON,
-	 {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1, 
-	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
-
-	{AIM_CAPS_SAVESTOCKS,
-	 {0x09, 0x46, 0x13, 0x47, 0x4c, 0x7f, 0x11, 0xd1,
-	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
-
-	{AIM_CAPS_GETFILE,
-	 {0x09, 0x46, 0x13, 0x48, 0x4c, 0x7f, 0x11, 0xd1,
-	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
-
-    /*
-     * Client supports channel 2 extended, TLV(0x2711) based messages.
-     * Currently used only by ICQ clients. ICQ clients and clones use this GUID
-     * as message format sign. Trillian client use another GUID in channel 2
-     * messages to implement its own message format (trillian doesn't use
-     * TLV(x2711) in SecureIM channel 2 messages!).
-     */
-	{AIM_CAPS_ICQSERVERRELAY,
-	 {0x09, 0x46, 0x13, 0x49, 0x4c, 0x7f, 0x11, 0xd1,
-	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
-
-	/*
-	 * Indeed, there are two of these.  The former appears to be correct, 
-	 * but in some versions of winaim, the second one is set.  Either they 
-	 * forgot to fix endianness, or they made a typo. It really doesn't 
+	{ AIM_CAPS_ICQ,
+	  { 0x09, 0x46, 0x13, 0x44, 0x4c, 0x7f, 0x11, 0xd1,
+	    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 } },
+
+	{ AIM_CAPS_IMIMAGE,
+	  { 0x09, 0x46, 0x13, 0x45, 0x4c, 0x7f, 0x11, 0xd1,
+	    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 } },
+
+	{ AIM_CAPS_BUDDYICON,
+	  { 0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1,
+	    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 } },
+
+	{ AIM_CAPS_SAVESTOCKS,
+	  { 0x09, 0x46, 0x13, 0x47, 0x4c, 0x7f, 0x11, 0xd1,
+	    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 } },
+
+	{ AIM_CAPS_GETFILE,
+	  { 0x09, 0x46, 0x13, 0x48, 0x4c, 0x7f, 0x11, 0xd1,
+	    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 } },
+
+	/*
+	 * Client supports channel 2 extended, TLV(0x2711) based messages.
+	 * Currently used only by ICQ clients. ICQ clients and clones use this GUID
+	 * as message format sign. Trillian client use another GUID in channel 2
+	 * messages to implement its own message format (trillian doesn't use
+	 * TLV(x2711) in SecureIM channel 2 messages!).
+	 */
+	{ AIM_CAPS_ICQSERVERRELAY,
+	  { 0x09, 0x46, 0x13, 0x49, 0x4c, 0x7f, 0x11, 0xd1,
+	    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 } },
+
+	/*
+	 * Indeed, there are two of these.  The former appears to be correct,
+	 * but in some versions of winaim, the second one is set.  Either they
+	 * forgot to fix endianness, or they made a typo. It really doesn't
 	 * matter which.
 	 */
-	{AIM_CAPS_GAMES,
-	 {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1,
-	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
-	{AIM_CAPS_GAMES2,
-	 {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1,
-	  0x22, 0x82, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
-
-	{AIM_CAPS_SENDBUDDYLIST,
-	 {0x09, 0x46, 0x13, 0x4b, 0x4c, 0x7f, 0x11, 0xd1,
-	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
-
-	{AIM_CAPS_UTF8,
-	 {0x09, 0x46, 0x13, 0x4E, 0x4C, 0x7F, 0x11, 0xD1,
-	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
-
-	{AIM_CAPS_ICQRTF,
-	 {0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34, 
-	  0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x92}},
-
-	{AIM_CAPS_ICQUNKNOWN,
-	 {0x2e, 0x7a, 0x64, 0x75, 0xfa, 0xdf, 0x4d, 0xc8,
-	  0x88, 0x6f, 0xea, 0x35, 0x95, 0xfd, 0xb6, 0xdf}},
-
-	{AIM_CAPS_EMPTY,
-	 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
-
-	{AIM_CAPS_TRILLIANCRYPT,
-	 {0xf2, 0xe7, 0xc7, 0xf4, 0xfe, 0xad, 0x4d, 0xfb,
-	  0xb2, 0x35, 0x36, 0x79, 0x8b, 0xdf, 0x00, 0x00}},
-
-	{AIM_CAPS_APINFO, 
-     {0xAA, 0x4A, 0x32, 0xB5, 0xF8, 0x84, 0x48, 0xc6,
-      0xA3, 0xD7, 0x8C, 0x50, 0x97, 0x19, 0xFD, 0x5B}},
-
-	{AIM_CAPS_INTEROP,
-	 {0x09, 0x46, 0x13, 0x4d, 0x4c, 0x7f, 0x11, 0xd1,
-	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
-
-	{AIM_CAPS_ICHAT,
-	 {0x09, 0x46, 0x00, 0x00, 0x4c, 0x7f, 0x11, 0xd1, 
-	  0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
-
-	{AIM_CAPS_LAST}
+	{ AIM_CAPS_GAMES,
+	  { 0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1,
+	    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 } },
+	{ AIM_CAPS_GAMES2,
+	  { 0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1,
+	    0x22, 0x82, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 } },
+
+	{ AIM_CAPS_SENDBUDDYLIST,
+	  { 0x09, 0x46, 0x13, 0x4b, 0x4c, 0x7f, 0x11, 0xd1,
+	    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 } },
+
+	{ AIM_CAPS_UTF8,
+	  { 0x09, 0x46, 0x13, 0x4E, 0x4C, 0x7F, 0x11, 0xD1,
+	    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 } },
+
+	{ AIM_CAPS_ICQRTF,
+	  { 0x97, 0xb1, 0x27, 0x51, 0x24, 0x3c, 0x43, 0x34,
+	    0xad, 0x22, 0xd6, 0xab, 0xf7, 0x3f, 0x14, 0x92 } },
+
+	{ AIM_CAPS_ICQUNKNOWN,
+	  { 0x2e, 0x7a, 0x64, 0x75, 0xfa, 0xdf, 0x4d, 0xc8,
+	    0x88, 0x6f, 0xea, 0x35, 0x95, 0xfd, 0xb6, 0xdf } },
+
+	{ AIM_CAPS_EMPTY,
+	  { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
+
+	{ AIM_CAPS_TRILLIANCRYPT,
+	  { 0xf2, 0xe7, 0xc7, 0xf4, 0xfe, 0xad, 0x4d, 0xfb,
+	    0xb2, 0x35, 0x36, 0x79, 0x8b, 0xdf, 0x00, 0x00 } },
+
+	{ AIM_CAPS_APINFO,
+	  { 0xAA, 0x4A, 0x32, 0xB5, 0xF8, 0x84, 0x48, 0xc6,
+	    0xA3, 0xD7, 0x8C, 0x50, 0x97, 0x19, 0xFD, 0x5B } },
+
+	{ AIM_CAPS_INTEROP,
+	  { 0x09, 0x46, 0x13, 0x4d, 0x4c, 0x7f, 0x11, 0xd1,
+	    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 } },
+
+	{ AIM_CAPS_ICHAT,
+	  { 0x09, 0x46, 0x00, 0x00, 0x4c, 0x7f, 0x11, 0xd1,
+	    0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00 } },
+
+	{ AIM_CAPS_LAST }
 };
 
@@ -163,5 +165,5 @@
  * This still takes a length parameter even with a bstream because capabilities
  * are not naturally bounded.
- * 
+ *
  */
 guint32 aim_getcap(aim_session_t *sess, aim_bstream_t *bs, int len)
@@ -190,10 +192,10 @@
 			/*REMOVEME :-)
 			g_strdup_printf("unknown capability: {%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
-					cap[0], cap[1], cap[2], cap[3],
-					cap[4], cap[5],
-					cap[6], cap[7],
-					cap[8], cap[9],
-					cap[10], cap[11], cap[12], cap[13],
-					cap[14], cap[15]);
+			                cap[0], cap[1], cap[2], cap[3],
+			                cap[4], cap[5],
+			                cap[6], cap[7],
+			                cap[8], cap[9],
+			                cap[10], cap[11], cap[12], cap[13],
+			                cap[14], cap[15]);
 			*/
 		}
@@ -209,14 +211,17 @@
 	int i;
 
-	if (!bs)
+	if (!bs) {
 		return -EINVAL;
+	}
 
 	for (i = 0; aim_bstream_empty(bs); i++) {
 
-		if (aim_caps[i].flag == AIM_CAPS_LAST)
+		if (aim_caps[i].flag == AIM_CAPS_LAST) {
 			break;
-
-		if (caps & aim_caps[i].flag)
+		}
+
+		if (caps & aim_caps[i].flag) {
 			aimbs_putraw(bs, aim_caps[i].data, 0x10);
+		}
 
 	}
@@ -226,5 +231,5 @@
 
 /*
- * AIM is fairly regular about providing user info.  This is a generic 
+ * AIM is fairly regular about providing user info.  This is a generic
  * routine to extract it in its standard form.
  */
@@ -234,6 +239,7 @@
 	guint8 snlen;
 
-	if (!bs || !outinfo)
+	if (!bs || !outinfo) {
 		return -EINVAL;
+	}
 
 	/* Clear out old data first */
@@ -241,9 +247,9 @@
 
 	/*
-	 * Screen name.  Stored as an unterminated string prepended with a 
+	 * Screen name.  Stored as an unterminated string prepended with a
 	 * byte containing its length.
 	 */
 	snlen = aimbs_get8(bs);
-	aimbs_getrawbuf(bs, (guint8 *)outinfo->sn, snlen);
+	aimbs_getrawbuf(bs, (guint8 *) outinfo->sn, snlen);
 
 	/*
@@ -253,10 +259,10 @@
 
 	/*
-	 * TLV Count. Unsigned short representing the number of 
+	 * TLV Count. Unsigned short representing the number of
 	 * Type-Length-Value triples that follow.
 	 */
 	tlvcnt = aimbs_get16(bs);
 
-	/* 
+	/*
 	 * Parse out the Type-Length-Value triples as they're found.
 	 */
@@ -273,5 +279,5 @@
 			/*
 			 * Type = 0x0001: User flags
-			 * 
+			 *
 			 * Specified as any of the following ORed together:
 			 *      0x0001  Trial (user less than 60days)
@@ -279,5 +285,5 @@
 			 *      0x0004  AOL Main Service user
 			 *      0x0008  Unknown bit 4
-			 *      0x0010  Free (AIM) user 
+			 *      0x0010  Free (AIM) user
 			 *      0x0020  Away
 			 *      0x0400  ActiveBuddy
@@ -289,5 +295,5 @@
 		} else if (type == 0x0002) {
 			/*
-			 * Type = 0x0002: Member-Since date. 
+			 * Type = 0x0002: Member-Since date.
 			 *
 			 * The time/date that the user originally registered for
@@ -301,5 +307,5 @@
 			 * Type = 0x0003: On-Since date.
 			 *
-			 * The time/date that the user started their current 
+			 * The time/date that the user started their current
 			 * session, stored in time_t format.
 			 */
@@ -311,9 +317,9 @@
 			 * Type = 0x0004: Idle time.
 			 *
-			 * Number of seconds since the user actively used the 
+			 * Number of seconds since the user actively used the
 			 * service.
 			 *
 			 * Note that the client tells the server when to start
-			 * counting idle times, so this may or may not be 
+			 * counting idle times, so this may or may not be
 			 * related to reality.
 			 */
@@ -325,5 +331,5 @@
 			 * Type = 0x0006: ICQ Online Status
 			 *
-			 * ICQ's Away/DND/etc "enriched" status. Some decoding 
+			 * ICQ's Away/DND/etc "enriched" status. Some decoding
 			 * of values done by Scott <darkagl@pcnet.com>
 			 */
@@ -343,5 +349,5 @@
 
 		} else if (type == 0x000c) {
-			/* 
+			/*
 			 * Type = 0x000c
 			 *
@@ -379,5 +385,5 @@
 			 * Type = 0x0010: Session Length. (AOL)
 			 *
-			 * The duration, in seconds, of the user's current 
+			 * The duration, in seconds, of the user's current
 			 * session.
 			 *
@@ -393,5 +399,5 @@
 			/*
 			 * Reaching here indicates that either AOL has
-			 * added yet another TLV for us to deal with, 
+			 * added yet another TLV for us to deal with,
 			 * or the parsing has gone Terribly Wrong.
 			 *
@@ -429,9 +435,11 @@
 	tlvlist = aim_readtlvchain(bs);
 
-	if (aim_gettlv(tlvlist, 0x0001, 1))
+	if (aim_gettlv(tlvlist, 0x0001, 1)) {
 		maxsiglen = aim_gettlv16(tlvlist, 0x0001, 1);
-
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	}
+
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, maxsiglen);
+	}
 
 	aim_freetlvchain(&tlvlist);
@@ -459,9 +467,9 @@
 	}
 
-	inforeq = (struct aim_priv_inforeq *)origsnac->data;
+	inforeq = (struct aim_priv_inforeq *) origsnac->data;
 
 	if ((inforeq->infotype != AIM_GETINFO_GENERALINFO) &&
-			(inforeq->infotype != AIM_GETINFO_AWAYMESSAGE) &&
-			(inforeq->infotype != AIM_GETINFO_CAPABILITIES)) {
+	    (inforeq->infotype != AIM_GETINFO_AWAYMESSAGE) &&
+	    (inforeq->infotype != AIM_GETINFO_CAPABILITIES)) {
 		imcb_error(sess->aux_data, "unknown infotype in request!");
 		return 0;
@@ -472,5 +480,5 @@
 	tlvlist = aim_readtlvchain(bs);
 
-	/* 
+	/*
 	 * Depending on what informational text was requested, different
 	 * TLVs will appear here.
@@ -481,5 +489,5 @@
 	if (inforeq->infotype == AIM_GETINFO_GENERALINFO) {
 		text_encoding = aim_gettlv_str(tlvlist, 0x0001, 1);
-		if((tlv = aim_gettlv(tlvlist, 0x0002, 1))) {
+		if ((tlv = aim_gettlv(tlvlist, 0x0002, 1))) {
 			text = g_new0(char, tlv->length);
 			memcpy(text, tlv->value, tlv->length);
@@ -488,5 +496,5 @@
 	} else if (inforeq->infotype == AIM_GETINFO_AWAYMESSAGE) {
 		text_encoding = aim_gettlv_str(tlvlist, 0x0003, 1);
-		if((tlv = aim_gettlv(tlvlist, 0x0004, 1))) {
+		if ((tlv = aim_gettlv(tlvlist, 0x0004, 1))) {
 			text = g_new0(char, tlv->length);
 			memcpy(text, tlv->value, tlv->length);
@@ -506,6 +514,7 @@
 	}
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, &userinfo, inforeq->infotype, text_encoding, text, text_length);
+	}
 
 	g_free(text_encoding);
@@ -514,6 +523,7 @@
 	aim_freetlvchain(&tlvlist);
 
-	if (origsnac)
+	if (origsnac) {
 		g_free(origsnac->data);
+	}
 	g_free(origsnac);
 
@@ -524,8 +534,9 @@
 {
 
-	if (snac->subtype == 0x0003)
+	if (snac->subtype == 0x0003) {
 		return rights(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x0006)
+	} else if (snac->subtype == 0x0006) {
 		return userinfo(sess, mod, rx, snac, bs);
+	}
 
 	return 0;
Index: protocols/oscar/info.h
===================================================================
--- protocols/oscar/info.h	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/info.h	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -6,5 +6,5 @@
 /*
  * SNAC Family: Location Services.
- */ 
+ */
 #define AIM_CB_LOC_ERROR 0x0001
 #define AIM_CB_LOC_REQRIGHTS 0x0002
@@ -29,6 +29,6 @@
 #define AIM_CAPS_ICQ            0x00000400
 #define AIM_CAPS_APINFO         0x00000800
-#define AIM_CAPS_ICQRTF	        0x00001000
-#define AIM_CAPS_EMPTY	        0x00002000
+#define AIM_CAPS_ICQRTF         0x00001000
+#define AIM_CAPS_EMPTY          0x00002000
 #define AIM_CAPS_ICQSERVERRELAY 0x00004000
 #define AIM_CAPS_ICQUNKNOWN     0x00008000
Index: protocols/oscar/misc.c
===================================================================
--- protocols/oscar/misc.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/misc.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -7,20 +7,20 @@
  * Other things...
  *
- *   - Idle setting 
- * 
- *
- */
-
-#include <aim.h> 
-
-/* 
+ *   - Idle setting
+ *
+ *
+ */
+
+#include <aim.h>
+
+/*
  * aim_bos_setprofile(profile)
  *
  * Gives BOS your profile.
- * 
+ *
  */
 int aim_bos_setprofile(aim_session_t *sess, aim_conn_t *conn, const char *profile, const char *awaymsg, guint32 caps)
 {
-	static const char defencoding[] = {"text/aolrtf; charset=\"utf-8\""};
+	static const char defencoding[] = { "text/aolrtf; charset=\"utf-8\"" };
 	aim_frame_t *fr;
 	aim_tlvlist_t *tl = NULL;
@@ -29,6 +29,6 @@
 	/* Build to packet first to get real length */
 	if (profile) {
-		aim_addtlvtochain_raw(&tl, 0x0001, strlen(defencoding), (guint8 *)defencoding);
-		aim_addtlvtochain_raw(&tl, 0x0002, strlen(profile), (guint8 *)profile);
+		aim_addtlvtochain_raw(&tl, 0x0001, strlen(defencoding), (guint8 *) defencoding);
+		aim_addtlvtochain_raw(&tl, 0x0002, strlen(profile), (guint8 *) profile);
 	}
 
@@ -43,17 +43,19 @@
 	if (awaymsg) {
 		if (strlen(awaymsg)) {
-			aim_addtlvtochain_raw(&tl, 0x0003, strlen(defencoding), (guint8 *)defencoding);
-			aim_addtlvtochain_raw(&tl, 0x0004, strlen(awaymsg), (guint8 *)awaymsg);
-		} else
+			aim_addtlvtochain_raw(&tl, 0x0003, strlen(defencoding), (guint8 *) defencoding);
+			aim_addtlvtochain_raw(&tl, 0x0004, strlen(awaymsg), (guint8 *) awaymsg);
+		} else {
 			aim_addtlvtochain_noval(&tl, 0x0004);
+		}
 	}
 
 	aim_addtlvtochain_caps(&tl, 0x0005, caps);
 
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + aim_sizetlvchain(&tl))))
-		return -ENOMEM;
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + aim_sizetlvchain(&tl)))) {
+		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, 0x0002, 0x0004, 0x0000, NULL, 0);
-	
+
 	aim_putsnac(&fr->data, 0x0002, 0x004, 0x0000, snacid);
 	aim_writetlvchain(&fr->data, &tl);
@@ -93,6 +95,7 @@
 	aim_snacid_t snacid = 0x00000000;
 
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10)))
-		return -ENOMEM;
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10))) {
+		return -ENOMEM;
+	}
 
 	aim_putsnac(&fr->data, family, subtype, 0x0000, snacid);
@@ -108,6 +111,7 @@
 	aim_snacid_t snacid;
 
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10)))
-		return -ENOMEM;
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10))) {
+		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, family, subtype, 0x0000, NULL, 0);
@@ -124,9 +128,11 @@
 	aim_snacid_t snacid;
 
-	if (!longdata)
+	if (!longdata) {
 		return aim_genericreq_n(sess, conn, family, subtype);
-
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+4)))
-		return -ENOMEM; 
+	}
+
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 4))) {
+		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, family, subtype, 0x0000, NULL, 0);
@@ -145,9 +151,11 @@
 	aim_snacid_t snacid;
 
-	if (!shortdata)
+	if (!shortdata) {
 		return aim_genericreq_n(sess, conn, family, subtype);
-
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2)))
-		return -ENOMEM; 
+	}
+
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 2))) {
+		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, family, subtype, 0x0000, NULL, 0);
@@ -185,12 +193,15 @@
 	snac2 = aim_remsnac(sess, snac->id);
 
-	if (aim_bstream_empty(bs))
+	if (aim_bstream_empty(bs)) {
 		error = aimbs_get16(bs);
-
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	}
+
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, error, snac2 ? snac2->data : NULL);
-
-	if (snac2)
+	}
+
+	if (snac2) {
 		g_free(snac2->data);
+	}
 	g_free(snac2);
 
@@ -201,11 +212,12 @@
 {
 
-	if (snac->subtype == 0x0001)
+	if (snac->subtype == 0x0001) {
 		return generror(sess, mod, rx, snac, bs);
-	else if ((snac->family == 0xffff) && (snac->subtype == 0xffff)) {
+	} else if ((snac->family == 0xffff) && (snac->subtype == 0xffff)) {
 		aim_rxcallback_t userfunc;
 
-		if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+		if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 			return userfunc(sess, rx);
+		}
 	}
 
Index: protocols/oscar/msgcookie.c
===================================================================
--- protocols/oscar/msgcookie.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/msgcookie.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -2,5 +2,5 @@
  * Cookie Caching stuff. Adam wrote this, apparently just some
  * derivatives of n's SNAC work. I cleaned it up, added comments.
- * 
+ *
  */
 
@@ -26,5 +26,5 @@
  * returns -1 on error, 0 on append, 1 on update.  the cookie you pass
  * in may be free'd, so don't count on its value after calling this!
- * 
+ *
  */
 int aim_cachecookie(aim_session_t *sess, aim_msgcookie_t *cookie)
@@ -32,16 +32,18 @@
 	aim_msgcookie_t *newcook;
 
-	if (!sess || !cookie)
+	if (!sess || !cookie) {
 		return -EINVAL;
+	}
 
 	newcook = aim_checkcookie(sess, cookie->cookie, cookie->type);
-	
+
 	if (newcook == cookie) {
 		newcook->addtime = time(NULL);
 		return 1;
-	} else if (newcook)
+	} else if (newcook) {
 		aim_cookie_free(sess, newcook);
+	}
 
-	cookie->addtime = time(NULL);  
+	cookie->addtime = time(NULL);
 
 	cookie->next = sess->msgcookies;
@@ -65,10 +67,11 @@
 	aim_msgcookie_t *cur, **prev;
 
-	if (!cookie || !sess->msgcookies)
+	if (!cookie || !sess->msgcookies) {
 		return NULL;
+	}
 
 	for (prev = &sess->msgcookies; (cur = *prev); ) {
-		if ((cur->type == type) && 
-				(memcmp(cur->cookie, cookie, 8) == 0)) {
+		if ((cur->type == type) &&
+		    (memcmp(cur->cookie, cookie, 8) == 0)) {
 			*prev = cur->next;
 			return cur;
@@ -90,13 +93,15 @@
  *
  */
-aim_msgcookie_t *aim_mkcookie(guint8 *c, int type, void *data) 
+aim_msgcookie_t *aim_mkcookie(guint8 *c, int type, void *data)
 {
 	aim_msgcookie_t *cookie;
 
-	if (!c)
+	if (!c) {
 		return NULL;
+	}
 
-	if (!(cookie = g_new0(aim_msgcookie_t,1)))
+	if (!(cookie = g_new0(aim_msgcookie_t, 1))) {
 		return NULL;
+	}
 
 	cookie->data = data;
@@ -123,7 +128,8 @@
 
 	for (cur = sess->msgcookies; cur; cur = cur->next) {
-		if ((cur->type == type) && 
-				(memcmp(cur->cookie, cookie, 8) == 0))
-			return cur;   
+		if ((cur->type == type) &&
+		    (memcmp(cur->cookie, cookie, 8) == 0)) {
+			return cur;
+		}
 	}
 
@@ -144,16 +150,18 @@
  *
  */
-int aim_cookie_free(aim_session_t *sess, aim_msgcookie_t *cookie) 
+int aim_cookie_free(aim_session_t *sess, aim_msgcookie_t *cookie)
 {
 	aim_msgcookie_t *cur, **prev;
 
-	if (!sess || !cookie)
+	if (!sess || !cookie) {
 		return -EINVAL;
+	}
 
 	for (prev = &sess->msgcookies; (cur = *prev); ) {
-		if (cur == cookie)
+		if (cur == cookie) {
 			*prev = cur->next;
-		else
+		} else {
 			prev = &cur->next;
+		}
 	}
 
@@ -162,3 +170,3 @@
 
 	return 0;
-} 
+}
Index: protocols/oscar/oscar.c
===================================================================
--- protocols/oscar/oscar.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/oscar.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -50,10 +50,10 @@
 #define USEROPT_AUTHPORT  1
 
-#define UC_AOL		0x02
-#define UC_ADMIN	0x04
-#define UC_UNCONFIRMED	0x08
-#define UC_NORMAL	0x10
-#define UC_AB		0x20
-#define UC_WIRELESS	0x40
+#define UC_AOL          0x02
+#define UC_ADMIN        0x04
+#define UC_UNCONFIRMED  0x08
+#define UC_NORMAL       0x10
+#define UC_AB           0x20
+#define UC_WIRELESS     0x40
 
 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3"
@@ -62,5 +62,5 @@
 
 #define BUF_LEN 2048
-#define BUF_LONG ( BUF_LEN * 2 )
+#define BUF_LONG (BUF_LEN * 2)
 
 /* Don't know if support for UTF8 is really working. For now it's UTF16 here.
@@ -68,5 +68,5 @@
 
 static int gaim_caps = AIM_CAPS_INTEROP | AIM_CAPS_ICHAT | AIM_CAPS_ICQSERVERRELAY | AIM_CAPS_CHAT;
-static guint8 gaim_features[] = {0x01, 0x01, 0x01, 0x02};
+static guint8 gaim_features[] = { 0x01, 0x01, 0x01, 0x02 };
 
 struct oscar_data {
@@ -94,5 +94,5 @@
 	gboolean icq;
 	GSList *evilhack;
-	
+
 	GHashTable *ips;
 
@@ -139,11 +139,17 @@
 };
 
-static char *extract_name(const char *name) {
+static char *extract_name(const char *name)
+{
 	char *tmp;
 	int i, j;
 	char *x = strchr(name, '-');
-	if (!x) return g_strdup(name);
+
+	if (!x) {
+		return g_strdup(name);
+	}
 	x = strchr(++x, '-');
-	if (!x) return g_strdup(name);
+	if (!x) {
+		return g_strdup(name);
+	}
 	tmp = g_strdup(++x);
 
@@ -156,5 +162,5 @@
 		strncpy(hex, x + ++i, 2); hex[2] = 0;
 		i++;
-		tmp[j++] = (char)strtol(hex, NULL, 16);
+		tmp[j++] = (char) strtol(hex, NULL, 16);
 	}
 
@@ -164,12 +170,14 @@
 
 static struct chat_connection *find_oscar_chat_by_conn(struct im_connection *ic,
-							aim_conn_t *conn) {
-	GSList *g = ((struct oscar_data *)ic->proto_data)->oscar_chats;
+                                                       aim_conn_t *conn)
+{
+	GSList *g = ((struct oscar_data *) ic->proto_data)->oscar_chats;
 	struct chat_connection *c = NULL;
 
 	while (g) {
-		c = (struct chat_connection *)g->data;
-		if (c->conn == conn)
+		c = (struct chat_connection *) g->data;
+		if (c->conn == conn) {
 			break;
+		}
 		g = g->next;
 		c = NULL;
@@ -179,39 +187,39 @@
 }
 
-static int gaim_parse_auth_resp  (aim_session_t *, aim_frame_t *, ...);
-static int gaim_parse_login      (aim_session_t *, aim_frame_t *, ...);
-static int gaim_parse_logout     (aim_session_t *, aim_frame_t *, ...);
-static int gaim_handle_redirect  (aim_session_t *, aim_frame_t *, ...);
-static int gaim_parse_oncoming   (aim_session_t *, aim_frame_t *, ...);
-static int gaim_parse_offgoing   (aim_session_t *, aim_frame_t *, ...);
+static int gaim_parse_auth_resp(aim_session_t *, aim_frame_t *, ...);
+static int gaim_parse_login(aim_session_t *, aim_frame_t *, ...);
+static int gaim_parse_logout(aim_session_t *, aim_frame_t *, ...);
+static int gaim_handle_redirect(aim_session_t *, aim_frame_t *, ...);
+static int gaim_parse_oncoming(aim_session_t *, aim_frame_t *, ...);
+static int gaim_parse_offgoing(aim_session_t *, aim_frame_t *, ...);
 static int gaim_parse_incoming_im(aim_session_t *, aim_frame_t *, ...);
-static int gaim_parse_misses     (aim_session_t *, aim_frame_t *, ...);
-static int gaim_parse_motd       (aim_session_t *, aim_frame_t *, ...);
-static int gaim_chatnav_info     (aim_session_t *, aim_frame_t *, ...);
-static int gaim_chat_join        (aim_session_t *, aim_frame_t *, ...);
-static int gaim_chat_leave       (aim_session_t *, aim_frame_t *, ...);
-static int gaim_chat_info_update (aim_session_t *, aim_frame_t *, ...);
+static int gaim_parse_misses(aim_session_t *, aim_frame_t *, ...);
+static int gaim_parse_motd(aim_session_t *, aim_frame_t *, ...);
+static int gaim_chatnav_info(aim_session_t *, aim_frame_t *, ...);
+static int gaim_chat_join(aim_session_t *, aim_frame_t *, ...);
+static int gaim_chat_leave(aim_session_t *, aim_frame_t *, ...);
+static int gaim_chat_info_update(aim_session_t *, aim_frame_t *, ...);
 static int gaim_chat_incoming_msg(aim_session_t *, aim_frame_t *, ...);
-static int gaim_parse_ratechange (aim_session_t *, aim_frame_t *, ...);
-static int gaim_bosrights        (aim_session_t *, aim_frame_t *, ...);
-static int conninitdone_bos      (aim_session_t *, aim_frame_t *, ...);
-static int conninitdone_admin    (aim_session_t *, aim_frame_t *, ...);
-static int conninitdone_chat     (aim_session_t *, aim_frame_t *, ...);
-static int conninitdone_chatnav  (aim_session_t *, aim_frame_t *, ...);
-static int gaim_parse_msgerr     (aim_session_t *, aim_frame_t *, ...);
+static int gaim_parse_ratechange(aim_session_t *, aim_frame_t *, ...);
+static int gaim_bosrights(aim_session_t *, aim_frame_t *, ...);
+static int conninitdone_bos(aim_session_t *, aim_frame_t *, ...);
+static int conninitdone_admin(aim_session_t *, aim_frame_t *, ...);
+static int conninitdone_chat(aim_session_t *, aim_frame_t *, ...);
+static int conninitdone_chatnav(aim_session_t *, aim_frame_t *, ...);
+static int gaim_parse_msgerr(aim_session_t *, aim_frame_t *, ...);
 static int gaim_parse_locaterights(aim_session_t *, aim_frame_t *, ...);
 static int gaim_parse_buddyrights(aim_session_t *, aim_frame_t *, ...);
-static int gaim_parse_locerr     (aim_session_t *, aim_frame_t *, ...);
-static int gaim_icbm_param_info  (aim_session_t *, aim_frame_t *, ...);
-static int gaim_parse_genericerr (aim_session_t *, aim_frame_t *, ...);
-static int gaim_selfinfo         (aim_session_t *, aim_frame_t *, ...);
-static int gaim_offlinemsg       (aim_session_t *, aim_frame_t *, ...);
-static int gaim_offlinemsgdone   (aim_session_t *, aim_frame_t *, ...);
-static int gaim_ssi_parserights  (aim_session_t *, aim_frame_t *, ...);
-static int gaim_ssi_parselist    (aim_session_t *, aim_frame_t *, ...);
-static int gaim_ssi_parseack     (aim_session_t *, aim_frame_t *, ...);
-static int gaim_parsemtn         (aim_session_t *, aim_frame_t *, ...);
-static int gaim_icqinfo          (aim_session_t *, aim_frame_t *, ...);
-static int gaim_parseaiminfo     (aim_session_t *, aim_frame_t *, ...);
+static int gaim_parse_locerr(aim_session_t *, aim_frame_t *, ...);
+static int gaim_icbm_param_info(aim_session_t *, aim_frame_t *, ...);
+static int gaim_parse_genericerr(aim_session_t *, aim_frame_t *, ...);
+static int gaim_selfinfo(aim_session_t *, aim_frame_t *, ...);
+static int gaim_offlinemsg(aim_session_t *, aim_frame_t *, ...);
+static int gaim_offlinemsgdone(aim_session_t *, aim_frame_t *, ...);
+static int gaim_ssi_parserights(aim_session_t *, aim_frame_t *, ...);
+static int gaim_ssi_parselist(aim_session_t *, aim_frame_t *, ...);
+static int gaim_ssi_parseack(aim_session_t *, aim_frame_t *, ...);
+static int gaim_parsemtn(aim_session_t *, aim_frame_t *, ...);
+static int gaim_icqinfo(aim_session_t *, aim_frame_t *, ...);
+static int gaim_parseaiminfo(aim_session_t *, aim_frame_t *, ...);
 
 static char *msgerrreason[] = {
@@ -268,6 +276,7 @@
 
 static gboolean oscar_callback(gpointer data, gint source,
-				b_input_condition condition) {
-	aim_conn_t *conn = (aim_conn_t *)data;
+                               b_input_condition condition)
+{
+	aim_conn_t *conn = (aim_conn_t *) data;
 	aim_session_t *sess = aim_conn_getsess(conn);
 	struct im_connection *ic = sess ? sess->aux_data : NULL;
@@ -278,21 +287,22 @@
 		return FALSE;
 	}
-      
+
 	if (!g_slist_find(get_connections(), ic)) {
-		/* oh boy. this is probably bad. i guess the only thing we 
+		/* oh boy. this is probably bad. i guess the only thing we
 		 * can really do is return? */
 		return FALSE;
 	}
 
-	odata = (struct oscar_data *)ic->proto_data;
+	odata = (struct oscar_data *) ic->proto_data;
 
 	if (condition & B_EV_IO_READ) {
 		if (aim_get_command(odata->sess, conn) >= 0) {
 			aim_rxdispatch(odata->sess);
-                               if (odata->killme)
-                                       imc_logout(ic, !odata->no_reconnect);
+			if (odata->killme) {
+				imc_logout(ic, !odata->no_reconnect);
+			}
 		} else {
 			if ((conn->type == AIM_CONN_TYPE_BOS) ||
-				   !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) {
+			    !(aim_getconn_type(odata->sess, AIM_CONN_TYPE_BOS))) {
 				imcb_error(ic, _("Disconnected."));
 				imc_logout(ic, TRUE);
@@ -300,6 +310,7 @@
 				struct chat_connection *c = find_oscar_chat_by_conn(ic, conn);
 				c->conn = NULL;
-				if (c->inpa > 0)
+				if (c->inpa > 0) {
 					b_event_remove(c->inpa);
+				}
 				c->inpa = 0;
 				c->fd = -1;
@@ -307,6 +318,7 @@
 				imcb_error(sess->aux_data, _("You have been disconnected from chat room %s."), c->name);
 			} else if (conn->type == AIM_CONN_TYPE_CHATNAV) {
-				if (odata->cnpa > 0)
+				if (odata->cnpa > 0) {
 					b_event_remove(odata->cnpa);
+				}
 				odata->cnpa = 0;
 				while (odata->create_rooms) {
@@ -314,5 +326,5 @@
 					g_free(cr->name);
 					odata->create_rooms =
-						g_slist_remove(odata->create_rooms, cr);
+					        g_slist_remove(odata->create_rooms, cr);
 					g_free(cr);
 					imcb_error(sess->aux_data, _("Chat is currently unavailable"));
@@ -320,6 +332,7 @@
 				aim_conn_kill(odata->sess, &conn);
 			} else if (conn->type == AIM_CONN_TYPE_AUTH) {
-				if (odata->paspa > 0)
+				if (odata->paspa > 0) {
 					b_event_remove(odata->paspa);
+				}
 				odata->paspa = 0;
 				aim_conn_kill(odata->sess, &conn);
@@ -332,5 +345,5 @@
 		return FALSE;
 	}
-		
+
 	return TRUE;
 }
@@ -360,6 +373,6 @@
 	aim_conn_completeconnect(sess, conn);
 	ic->inpa = b_input_add(conn->fd, B_EV_IO_READ,
-			oscar_callback, conn);
-	
+	                       oscar_callback, conn);
+
 	return FALSE;
 }
@@ -369,24 +382,25 @@
 	set_t *s;
 	gboolean icq = g_ascii_isdigit(acc->user[0]);
-	
+
 	if (icq) {
 		set_add(&acc->set, "ignore_auth_requests", "false", set_eval_bool, acc);
 		set_add(&acc->set, "old_icq_auth", "false", set_eval_bool, acc);
 	}
-	
+
 	s = set_add(&acc->set, "server",
 	            icq ? AIM_DEFAULT_LOGIN_SERVER_ICQ
-	                : AIM_DEFAULT_LOGIN_SERVER_AIM, set_eval_account, acc);
+		    : AIM_DEFAULT_LOGIN_SERVER_AIM, set_eval_account, acc);
 	s->flags |= SET_NOSAVE | ACC_SET_OFFLINE_ONLY;
-	
+
 	if (icq) {
 		s = set_add(&acc->set, "web_aware", "false", set_eval_bool, acc);
 		s->flags |= ACC_SET_OFFLINE_ONLY;
 	}
-	
+
 	acc->flags |= ACC_FLAG_AWAY_MESSAGE;
 }
 
-static void oscar_login(account_t *acc) {
+static void oscar_login(account_t *acc)
+{
 	aim_session_t *sess;
 	aim_conn_t *conn;
@@ -394,8 +408,9 @@
 	struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1);
 
-	if (g_ascii_isdigit(acc->user[0]))
+	if (g_ascii_isdigit(acc->user[0])) {
 		odata->icq = TRUE;
-	else
+	} else {
 		ic->flags |= OPT_DOES_HTML;
+	}
 
 	sess = g_new0(aim_session_t, 1);
@@ -415,5 +430,5 @@
 		return;
 	}
-	
+
 	imcb_log(ic, _("Signon: %s"), ic->acc->user);
 
@@ -432,11 +447,13 @@
 }
 
-static void oscar_logout(struct im_connection *ic) {
-	struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
-	
+static void oscar_logout(struct im_connection *ic)
+{
+	struct oscar_data *odata = (struct oscar_data *) ic->proto_data;
+
 	while (odata->oscar_chats) {
 		struct chat_connection *n = odata->oscar_chats->data;
-		if (n->inpa > 0)
+		if (n->inpa > 0) {
 			b_event_remove(n->inpa);
+		}
 		g_free(n->name);
 		g_free(n->show);
@@ -450,18 +467,25 @@
 		g_free(cr);
 	}
-	if (odata->ips)
+	if (odata->ips) {
 		g_hash_table_destroy(odata->ips);
-	if (odata->email)
+	}
+	if (odata->email) {
 		g_free(odata->email);
-	if (odata->newp)
+	}
+	if (odata->newp) {
 		g_free(odata->newp);
-	if (odata->oldp)
+	}
+	if (odata->oldp) {
 		g_free(odata->oldp);
-	if (ic->inpa > 0)
+	}
+	if (ic->inpa > 0) {
 		b_event_remove(ic->inpa);
-	if (odata->cnpa > 0)
+	}
+	if (odata->cnpa > 0) {
 		b_event_remove(odata->cnpa);
-	if (odata->paspa > 0)
+	}
+	if (odata->paspa > 0) {
 		b_event_remove(odata->paspa);
+	}
 	aim_session_kill(odata->sess);
 	g_free(odata->sess);
@@ -471,5 +495,6 @@
 }
 
-static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition cond) {
+static gboolean oscar_bos_connect(gpointer data, gint source, b_input_condition cond)
+{
 	struct im_connection *ic = data;
 	struct oscar_data *odata;
@@ -494,11 +519,12 @@
 	aim_conn_completeconnect(sess, bosconn);
 	ic->inpa = b_input_add(bosconn->fd, B_EV_IO_READ,
-			oscar_callback, bosconn);
+	                       oscar_callback, bosconn);
 	imcb_log(ic, _("Connection established, cookie sent"));
-	
+
 	return FALSE;
 }
 
-static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...) {
+static int gaim_parse_auth_resp(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	va_list ap;
 	struct aim_authresp_info *info;
@@ -507,5 +533,6 @@
 
 	struct im_connection *ic = sess->aux_data;
-        struct oscar_data *od = ic->proto_data;
+	struct oscar_data *od = ic->proto_data;
+
 	port = AIM_LOGIN_PORT;
 
@@ -521,9 +548,10 @@
 			{
 				int max = od->icq ? 8 : 16;
-				if (strlen(ic->acc->pass) > max)
+				if (strlen(ic->acc->pass) > max) {
 					imcb_log(ic, "Note that the maximum password "
 					         "length supported by this protocol is "
 					         "%d characters, try logging in using "
 					         "a shorter password.", max);
+				}
 			}
 //			plugin_event(event_error, (void *)980, 0, 0, 0);
@@ -536,5 +564,7 @@
 			/* connecting too frequently */
 			od->no_reconnect = TRUE;
-			imcb_error(ic, _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
+			imcb_error(ic,
+			           _(
+			                   "You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer."));
 			break;
 		case 0x1c:
@@ -589,8 +619,8 @@
 	aim_conn_addhandler(sess, bosconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR, gaim_parse_logout, 0);
 
-	((struct oscar_data *)ic->proto_data)->conn = bosconn;
-	for (i = 0; i < (int)strlen(info->bosip); i++) {
+	((struct oscar_data *) ic->proto_data)->conn = bosconn;
+	for (i = 0; i < (int) strlen(info->bosip); i++) {
 		if (info->bosip[i] == ':') {
-			port = atoi(&(info->bosip[i+1]));
+			port = atoi(&(info->bosip[i + 1]));
 			break;
 		}
@@ -614,7 +644,8 @@
 #define AIM_MAX_FILE_SIZE 98304
 
-static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...) {
+static int gaim_parse_login(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 #if 0
-	struct client_info_s info = {"gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b};
+	struct client_info_s info = { "gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b };
 #else
 	struct client_info_s info = AIM_CLIENTINFO_KNOWNGOOD;
@@ -633,5 +664,6 @@
 }
 
-static int gaim_parse_logout(aim_session_t *sess, aim_frame_t *fr, ...) {
+static int gaim_parse_logout(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	struct im_connection *ic = sess->aux_data;
 	struct oscar_data *odata = ic->proto_data;
@@ -642,13 +674,13 @@
 	code = va_arg(ap, int);
 	va_end(ap);
-	
-	imcb_error( ic, "Connection aborted by server: %s", code == 1 ?
-	                "someone else logged in with your account" :
-	                "unknown reason" );
-	
+
+	imcb_error(ic, "Connection aborted by server: %s", code == 1 ?
+	           "someone else logged in with your account" :
+	           "unknown reason");
+
 	/* Tell BitlBee to disable auto_reconnect if code == 1, since that
 	   means a concurrent login somewhere else. */
 	odata->no_reconnect = code == 1;
-	
+
 	/* DO NOT log out here! Just tell the callback to do it. */
 	odata->killme = TRUE;
@@ -657,5 +689,6 @@
 }
 
-static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...) {
+static int conninitdone_chat(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	struct im_connection *ic = sess->aux_data;
 	struct chat_connection *chatcon;
@@ -673,10 +706,11 @@
 	chatcon = find_oscar_chat_by_conn(ic, fr->conn);
 	chatcon->id = id;
-	
+
 	c = bee_chat_by_title(ic->bee, ic, chatcon->show);
-	if (c && !c->data)
+	if (c && !c->data) {
 		chatcon->cnv = c;
-	else
+	} else {
 		chatcon->cnv = imcb_chat_new(ic, chatcon->show);
+	}
 	chatcon->cnv->data = chatcon;
 
@@ -684,5 +718,6 @@
 }
 
-static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...) {
+static int conninitdone_chatnav(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 
 	aim_conn_addhandler(sess, fr->conn, AIM_CB_FAM_CTN, AIM_CB_CTN_ERROR, gaim_parse_genericerr, 0);
@@ -696,5 +731,6 @@
 }
 
-static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condition cond) {
+static gboolean oscar_chatnav_connect(gpointer data, gint source, b_input_condition cond)
+{
 	struct im_connection *ic = data;
 	struct oscar_data *odata;
@@ -718,6 +754,6 @@
 	aim_conn_completeconnect(sess, tstconn);
 	odata->cnpa = b_input_add(tstconn->fd, B_EV_IO_READ,
-					oscar_callback, tstconn);
-	
+	                          oscar_callback, tstconn);
+
 	return FALSE;
 }
@@ -746,6 +782,6 @@
 	aim_conn_completeconnect(sess, tstconn);
 	odata->paspa = b_input_add(tstconn->fd, B_EV_IO_READ,
-				oscar_callback, tstconn);
-	
+	                           oscar_callback, tstconn);
+
 	return FALSE;
 }
@@ -781,13 +817,14 @@
 	aim_conn_completeconnect(sess, ccon->conn);
 	ccon->inpa = b_input_add(tstconn->fd,
-			B_EV_IO_READ,
-			oscar_callback, tstconn);
+	                         B_EV_IO_READ,
+	                         oscar_callback, tstconn);
 	odata->oscar_chats = g_slist_append(odata->oscar_chats, ccon);
-	
+
 	return FALSE;
 }
 
 /* Hrmph. I don't know how to make this look better. --mid */
-static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...) {
+static int gaim_handle_redirect(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	va_list ap;
 	struct aim_redirect_data *redir;
@@ -803,7 +840,7 @@
 
 	port = AIM_LOGIN_PORT;
-	for (i = 0; i < (int)strlen(redir->ip); i++) {
+	for (i = 0; i < (int) strlen(redir->ip); i++) {
 		if (redir->ip[i] == ':') {
-			port = atoi(&(redir->ip[i+1]));
+			port = atoi(&(redir->ip[i + 1]));
 			break;
 		}
@@ -811,5 +848,5 @@
 	host = g_strndup(redir->ip, i);
 
-	switch(redir->group) {
+	switch (redir->group) {
 	case 0x7: /* Authorizer */
 		tstconn = aim_newconn(sess, AIM_CONN_TYPE_AUTH, NULL);
@@ -818,5 +855,6 @@
 			return 1;
 		}
-		aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_admin, 0);
+		aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_admin,
+		                    0);
 //		aim_conn_addhandler(sess, tstconn, 0x0007, 0x0003, gaim_info_change, 0);
 //		aim_conn_addhandler(sess, tstconn, 0x0007, 0x0005, gaim_info_change, 0);
@@ -838,5 +876,6 @@
 			return 1;
 		}
-		aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chatnav, 0);
+		aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE,
+		                    conninitdone_chatnav, 0);
 
 		tstconn->status |= AIM_CONN_STATUS_INPROGRESS;
@@ -850,5 +889,5 @@
 		break;
 	case 0xe: /* Chat */
-		{
+	{
 		struct chat_connection *ccon;
 
@@ -859,5 +898,6 @@
 		}
 
-		aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chat, 0);
+		aim_conn_addhandler(sess, tstconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE, conninitdone_chat,
+		                    0);
 
 		ccon = g_new0(struct chat_connection, 1);
@@ -869,5 +909,5 @@
 		ccon->instance = redir->chat.instance;
 		ccon->show = extract_name(redir->chat.room);
-		
+
 		ccon->conn->status |= AIM_CONN_STATUS_INPROGRESS;
 		ccon->conn->fd = proxy_connect(host, port, oscar_chat_connect, ccon);
@@ -881,6 +921,6 @@
 		}
 		aim_sendcookie(sess, tstconn, redir->cookie);
-		}
-		break;
+	}
+	break;
 	default: /* huh? */
 		break;
@@ -891,5 +931,6 @@
 }
 
-static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...) {
+static int gaim_parse_oncoming(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	struct im_connection *ic = sess->aux_data;
 	struct oscar_data *od = ic->proto_data;
@@ -900,4 +941,5 @@
 
 	va_list ap;
+
 	va_start(ap, fr);
 	info = va_arg(ap, aim_userinfo_t *);
@@ -905,44 +947,50 @@
 
 	if ((!od->icq) && (info->present & AIM_USERINFO_PRESENT_FLAGS)) {
-		if (info->flags & AIM_FLAG_AWAY)
+		if (info->flags & AIM_FLAG_AWAY) {
 			flags |= OPT_AWAY;
-	}
-	
+		}
+	}
+
 	/* Maybe this should be done just for AIM contacts, not sure. */
-	if (info->flags & AIM_FLAG_WIRELESS)
+	if (info->flags & AIM_FLAG_WIRELESS) {
 		flags |= OPT_MOBILE;
-	
+	}
+
 	if (info->present & AIM_USERINFO_PRESENT_ICQEXTSTATUS) {
 		if (!(info->icqinfo.status & AIM_ICQ_STATE_CHAT) &&
-		      (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) {
+		    (info->icqinfo.status != AIM_ICQ_STATE_NORMAL)) {
 			flags |= OPT_AWAY;
 		}
-		
-		if( info->icqinfo.status & AIM_ICQ_STATE_DND )
+
+		if (info->icqinfo.status & AIM_ICQ_STATE_DND) {
 			state_string = "Do Not Disturb";
-		else if( info->icqinfo.status & AIM_ICQ_STATE_OUT )
+		} else if (info->icqinfo.status & AIM_ICQ_STATE_OUT) {
 			state_string = "Not Available";
-		else if( info->icqinfo.status & AIM_ICQ_STATE_BUSY )
+		} else if (info->icqinfo.status & AIM_ICQ_STATE_BUSY) {
 			state_string = "Occupied";
-		else if( info->icqinfo.status & AIM_ICQ_STATE_INVISIBLE )
+		} else if (info->icqinfo.status & AIM_ICQ_STATE_INVISIBLE) {
 			state_string = "Invisible";
+		}
 	}
 
 	if (info->present & AIM_USERINFO_PRESENT_IDLE) {
 		time(&time_idle);
-		time_idle -= info->idletime*60;
-	}
-
-	if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN)
+		time_idle -= info->idletime * 60;
+	}
+
+	if (info->present & AIM_USERINFO_PRESENT_SESSIONLEN) {
 		signon = time(NULL) - info->sessionlen;
+	}
 
 	if (info->present & AIM_USERINFO_PRESENT_ICQIPADDR) {
 		uint32_t *uin = g_new0(uint32_t, 1);
-		
-		if (od->ips == NULL)
+
+		if (od->ips == NULL) {
 			od->ips = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, NULL);
-		
-		if (sscanf(info->sn, "%d", uin) == 1)
+		}
+
+		if (sscanf(info->sn, "%d", uin) == 1) {
 			g_hash_table_insert(od->ips, uin, (gpointer) (long) info->icqinfo.ipaddr);
+		}
 	}
 
@@ -955,5 +1003,6 @@
 }
 
-static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...) {
+static int gaim_parse_offgoing(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	aim_userinfo_t *info;
 	va_list ap;
@@ -964,25 +1013,29 @@
 	va_end(ap);
 
-	imcb_buddy_status(ic, normalize(info->sn), 0, NULL, NULL );
-
-	return 1;
-}
-
-static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch1_args *args) {
+	imcb_buddy_status(ic, normalize(info->sn), 0, NULL, NULL);
+
+	return 1;
+}
+
+static int incomingim_chan1(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo,
+                            struct aim_incomingim_ch1_args *args)
+{
 	char *tmp = g_malloc(BUF_LONG + 1);
 	struct im_connection *ic = sess->aux_data;
 	int flags = 0;
-	
-	if (args->icbmflags & AIM_IMFLAGS_AWAY)
+
+	if (args->icbmflags & AIM_IMFLAGS_AWAY) {
 		flags |= OPT_AWAY;
-	
+	}
+
 	if ((args->icbmflags & AIM_IMFLAGS_UNICODE) || (args->icbmflags & AIM_IMFLAGS_ISO_8859_1)) {
 		char *src;
-		
-		if (args->icbmflags & AIM_IMFLAGS_UNICODE)
+
+		if (args->icbmflags & AIM_IMFLAGS_UNICODE) {
 			src = "UCS-2BE";
-		else
+		} else {
 			src = "ISO8859-1";
-		
+		}
+
 		/* Try to use iconv first to convert the message to UTF8 - which is what BitlBee expects */
 		if (do_iconv(src, "UTF-8", args->msg, tmp, args->msglen, BUF_LONG) >= 0) {
@@ -990,14 +1043,14 @@
 		} else if (args->icbmflags & AIM_IMFLAGS_UNICODE) {
 			int i;
-			
+
 			for (i = 0, tmp[0] = '\0'; i < args->msglen; i += 2) {
 				unsigned short uni;
-				
-				uni = ((args->msg[i] & 0xff) << 8) | (args->msg[i+1] & 0xff);
-	
+
+				uni = ((args->msg[i] & 0xff) << 8) | (args->msg[i + 1] & 0xff);
+
 				if ((uni < 128) || ((uni >= 160) && (uni <= 255))) { /* ISO 8859-1 */
-					g_snprintf(tmp+strlen(tmp), BUF_LONG-strlen(tmp), "%c", uni);
+					g_snprintf(tmp + strlen(tmp), BUF_LONG - strlen(tmp), "%c", uni);
 				} else { /* something else, do UNICODE entity */
-					g_snprintf(tmp+strlen(tmp), BUF_LONG-strlen(tmp), "&#%04x;", uni);
+					g_snprintf(tmp + strlen(tmp), BUF_LONG - strlen(tmp), "&#%04x;", uni);
 				}
 			}
@@ -1009,18 +1062,18 @@
 	} else {
 		aim_mpmsg_section_t *part;
-		
+
 		*tmp = 0;
 		for (part = args->mpmsg.parts; part; part = part->next) {
 			if (part->data) {
-				g_strlcat(tmp, (char*) part->data, BUF_LONG);
+				g_strlcat(tmp, (char *) part->data, BUF_LONG);
 				g_strlcat(tmp, "\n", BUF_LONG);
 			}
 		}
 	}
-	
+
 	strip_linefeed(tmp);
 	imcb_buddy_msg(ic, normalize(userinfo->sn), tmp, flags, 0);
 	g_free(tmp);
-	
+
 	return 1;
 }
@@ -1028,10 +1081,13 @@
 void oscar_accept_chat(void *data);
 void oscar_reject_chat(void *data);
-	
-static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) {
+
+static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo,
+                            struct aim_incomingim_ch2_args *args)
+{
 	struct im_connection *ic = sess->aux_data;
 
-	if (args->status != AIM_RENDEZVOUS_PROPOSE)
+	if (args->status != AIM_RENDEZVOUS_PROPOSE) {
 		return 1;
+	}
 
 	if (args->reqclass & AIM_CAPS_CHAT) {
@@ -1051,12 +1107,13 @@
 		inv->exchange = *exch;
 		inv->name = g_strdup(name);
-		
+
 		imcb_ask(ic, txt, inv, oscar_accept_chat, oscar_reject_chat);
-	
-		if (name)
+
+		if (name) {
 			g_free(name);
+		}
 	} else if (args->reqclass & AIM_CAPS_ICQRTF) {
 		// TODO: constify
-		char text[strlen(args->info.rtfmsg.rtfmsg)+1];
+		char text[strlen(args->info.rtfmsg.rtfmsg) + 1];
 		strncpy(text, args->info.rtfmsg.rtfmsg, sizeof(text));
 		imcb_buddy_msg(ic, normalize(userinfo->sn), text, 0, 0);
@@ -1066,9 +1123,10 @@
 }
 
-static void gaim_icq_authgrant(void *data_) {
+static void gaim_icq_authgrant(void *data_)
+{
 	struct icq_auth *data = data_;
 	char *uin;
-	struct oscar_data *od = (struct oscar_data *)data->ic->proto_data;
-	
+	struct oscar_data *od = (struct oscar_data *) data->ic->proto_data;
+
 	uin = g_strdup_printf("%u", data->uin);
 	aim_ssi_auth_reply(od->sess, od->conn, uin, 1, "");
@@ -1076,14 +1134,15 @@
 	// aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message);
 	imcb_ask_add(data->ic, uin, NULL);
-	
+
 	g_free(uin);
 	g_free(data);
 }
 
-static void gaim_icq_authdeny(void *data_) {
+static void gaim_icq_authdeny(void *data_)
+{
 	struct icq_auth *data = data_;
 	char *uin, *message;
-	struct oscar_data *od = (struct oscar_data *)data->ic->proto_data;
-	
+	struct oscar_data *od = (struct oscar_data *) data->ic->proto_data;
+
 	uin = g_strdup_printf("%u", data->uin);
 	message = g_strdup_printf("No reason given.");
@@ -1091,5 +1150,5 @@
 	// aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHDENIED, message);
 	g_free(message);
-	
+
 	g_free(uin);
 	g_free(data);
@@ -1099,18 +1158,22 @@
  * For when other people ask you for authorization
  */
-static void gaim_icq_authask(struct im_connection *ic, guint32 uin, char *msg) {
+static void gaim_icq_authask(struct im_connection *ic, guint32 uin, char *msg)
+{
 	struct icq_auth *data;
 	char *reason = NULL;
 	char *dialog_msg;
 
-	if (set_getbool(&ic->acc->set, "ignore_auth_requests"))
+	if (set_getbool(&ic->acc->set, "ignore_auth_requests")) {
 		return;
-	
+	}
+
 	data = g_new(struct icq_auth, 1);
 
-	if (strlen(msg) > 6)
+	if (strlen(msg) > 6) {
 		reason = msg + 6;
-	
-	dialog_msg = g_strdup_printf("The user %u wants to add you to their buddy list for the following reason: %s", uin, reason ? reason : "No reason given.");
+	}
+
+	dialog_msg = g_strdup_printf("The user %u wants to add you to their buddy list for the following reason: %s",
+	                             uin, reason ? reason : "No reason given.");
 	data->ic = ic;
 	data->uin = uin;
@@ -1119,62 +1182,68 @@
 }
 
-static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args) {
+static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo,
+                            struct aim_incomingim_ch4_args *args)
+{
 	struct im_connection *ic = sess->aux_data;
 
 	switch (args->type) {
-		case 0x0001: { /* An almost-normal instant message.  Mac ICQ sends this.  It's peculiar. */
-			char *uin, *message;
-			uin = g_strdup_printf("%u", args->uin);
-			message = g_strdup(args->msg);
-			strip_linefeed(message);
-			imcb_buddy_msg(ic, normalize(uin), message, 0, 0);
-			g_free(uin);
-			g_free(message);
-		} break;
-
-		case 0x0004: { /* Someone sent you a URL */
-		  	char *uin, *message;
-			char **m;
-	
-			uin = g_strdup_printf("%u", args->uin);
-			m = g_strsplit(args->msg, "\376", 2);
-
-			if ((strlen(m[0]) != 0)) {
-			  message = g_strjoinv(" -- ", m);
-			} else {
-			  message = m[1];
-			}
-
-			strip_linefeed(message);
-			imcb_buddy_msg(ic, normalize(uin), message, 0, 0);
-			g_free(uin);
-			g_free(m);
-			g_free(message);
-		} break;
-		
-		case 0x0006: { /* Someone requested authorization */
-			gaim_icq_authask(ic, args->uin, args->msg);
-		} break;
-
-		case 0x0007: { /* Someone has denied you authorization */
-			imcb_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") );
-		} break;
-
-		case 0x0008: { /* Someone has granted you authorization */
-			imcb_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", args->uin, args->msg ? args->msg : _("No reason given.") );
-		} break;
-
-		case 0x0012: {
-			/* Ack for authorizing/denying someone.  Or possibly an ack for sending any system notice */
-		} break;
-
-		default: {;
-		} break;
-	}
-
-	return 1;
-}
-
-static int gaim_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...) {
+	case 0x0001: {         /* An almost-normal instant message.  Mac ICQ sends this.  It's peculiar. */
+		char *uin, *message;
+		uin = g_strdup_printf("%u", args->uin);
+		message = g_strdup(args->msg);
+		strip_linefeed(message);
+		imcb_buddy_msg(ic, normalize(uin), message, 0, 0);
+		g_free(uin);
+		g_free(message);
+	} break;
+
+	case 0x0004: {         /* Someone sent you a URL */
+		char *uin, *message;
+		char **m;
+
+		uin = g_strdup_printf("%u", args->uin);
+		m = g_strsplit(args->msg, "\376", 2);
+
+		if ((strlen(m[0]) != 0)) {
+			message = g_strjoinv(" -- ", m);
+		} else {
+			message = m[1];
+		}
+
+		strip_linefeed(message);
+		imcb_buddy_msg(ic, normalize(uin), message, 0, 0);
+		g_free(uin);
+		g_free(m);
+		g_free(message);
+	} break;
+
+	case 0x0006: {         /* Someone requested authorization */
+		gaim_icq_authask(ic, args->uin, args->msg);
+	} break;
+
+	case 0x0007: {         /* Someone has denied you authorization */
+		imcb_log(sess->aux_data,
+		         "The user %u has denied your request to add them to your contact list for the following reason:\n%s", args->uin,
+		         args->msg ? args->msg : _("No reason given."));
+	} break;
+
+	case 0x0008: {         /* Someone has granted you authorization */
+		imcb_log(sess->aux_data,
+		         "The user %u has granted your request to add them to your contact list for the following reason:\n%s", args->uin,
+		         args->msg ? args->msg : _("No reason given."));
+	} break;
+
+	case 0x0012: {
+		/* Ack for authorizing/denying someone.  Or possibly an ack for sending any system notice */
+	} break;
+
+	default: {; } break;
+	}
+
+	return 1;
+}
+
+static int gaim_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	int channel, ret = 0;
 	aim_userinfo_t *userinfo;
@@ -1186,24 +1255,23 @@
 
 	switch (channel) {
-		case 1: { /* standard message */
-			struct aim_incomingim_ch1_args *args;
-			args = va_arg(ap, struct aim_incomingim_ch1_args *);
-			ret = incomingim_chan1(sess, fr->conn, userinfo, args);
-		} break;
-
-		case 2: { /* rendevous */
-			struct aim_incomingim_ch2_args *args;
-			args = va_arg(ap, struct aim_incomingim_ch2_args *);
-			ret = incomingim_chan2(sess, fr->conn, userinfo, args);
-		} break;
-
-		case 4: { /* ICQ */
-			struct aim_incomingim_ch4_args *args;
-			args = va_arg(ap, struct aim_incomingim_ch4_args *);
-			ret = incomingim_chan4(sess, fr->conn, userinfo, args);
-		} break;
-
-		default: {;
-		} break;
+	case 1: {         /* standard message */
+		struct aim_incomingim_ch1_args *args;
+		args = va_arg(ap, struct aim_incomingim_ch1_args *);
+		ret = incomingim_chan1(sess, fr->conn, userinfo, args);
+	} break;
+
+	case 2: {         /* rendevous */
+		struct aim_incomingim_ch2_args *args;
+		args = va_arg(ap, struct aim_incomingim_ch2_args *);
+		ret = incomingim_chan2(sess, fr->conn, userinfo, args);
+	} break;
+
+	case 4: {         /* ICQ */
+		struct aim_incomingim_ch4_args *args;
+		args = va_arg(ap, struct aim_incomingim_ch4_args *);
+		ret = incomingim_chan4(sess, fr->conn, userinfo, args);
+	} break;
+
+	default: {; } break;
 	}
 
@@ -1213,5 +1281,6 @@
 }
 
-static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...) {
+static int gaim_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	va_list ap;
 	guint16 nummissed, reason;
@@ -1221,82 +1290,84 @@
 	va_arg(ap, unsigned int); /* chan */
 	userinfo = va_arg(ap, aim_userinfo_t *);
-	nummissed = (guint16)va_arg(ap, unsigned int);
-	reason = (guint16)va_arg(ap, unsigned int);
+	nummissed = (guint16) va_arg(ap, unsigned int);
+	reason = (guint16) va_arg(ap, unsigned int);
 	va_end(ap);
 
-	switch(reason) {
-		case 0:
-			/* Invalid (0) */
-			imcb_error(sess->aux_data,
-				   nummissed == 1 ? 
-				   _("You missed %d message from %s because it was invalid.") :
-				   _("You missed %d messages from %s because they were invalid."),
-				   nummissed,
-				   userinfo->sn);
-			break;
-		case 1:
-			/* Message too large */
-			imcb_error(sess->aux_data,
-				   nummissed == 1 ?
-				   _("You missed %d message from %s because it was too large.") :
-				   _("You missed %d messages from %s because they were too large."),
-				   nummissed,
-				   userinfo->sn);
-			break;
-		case 2:
-			/* Rate exceeded */
-			imcb_error(sess->aux_data,
-				   nummissed == 1 ? 
-				   _("You missed %d message from %s because the rate limit has been exceeded.") :
-				   _("You missed %d messages from %s because the rate limit has been exceeded."),
-				   nummissed,
-				   userinfo->sn);
-			break;
-		case 3:
-			/* Evil Sender */
-			imcb_error(sess->aux_data,
-				   nummissed == 1 ?
-				   _("You missed %d message from %s because it was too evil.") : 
-				   _("You missed %d messages from %s because they are too evil."),
-				   nummissed,
-				   userinfo->sn);
-			break;
-		case 4:
-			/* Evil Receiver */
-			imcb_error(sess->aux_data,
-				   nummissed == 1 ? 
-				   _("You missed %d message from %s because you are too evil.") :
-				   _("You missed %d messages from %s because you are too evil."),
-				   nummissed,
-				   userinfo->sn);
-			break;
-		default:
-			imcb_error(sess->aux_data,
-				   nummissed == 1 ? 
-				   _("You missed %d message from %s for unknown reasons.") :
-				   _("You missed %d messages from %s for unknown reasons."),
-				   nummissed,
-				   userinfo->sn);
-			break;
-	}
-
-	return 1;
-}
-
-static int gaim_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...) {
+	switch (reason) {
+	case 0:
+		/* Invalid (0) */
+		imcb_error(sess->aux_data,
+		           nummissed == 1 ?
+		           _("You missed %d message from %s because it was invalid.") :
+		           _("You missed %d messages from %s because they were invalid."),
+		           nummissed,
+		           userinfo->sn);
+		break;
+	case 1:
+		/* Message too large */
+		imcb_error(sess->aux_data,
+		           nummissed == 1 ?
+		           _("You missed %d message from %s because it was too large.") :
+		           _("You missed %d messages from %s because they were too large."),
+		           nummissed,
+		           userinfo->sn);
+		break;
+	case 2:
+		/* Rate exceeded */
+		imcb_error(sess->aux_data,
+		           nummissed == 1 ?
+		           _("You missed %d message from %s because the rate limit has been exceeded.") :
+		           _("You missed %d messages from %s because the rate limit has been exceeded."),
+		           nummissed,
+		           userinfo->sn);
+		break;
+	case 3:
+		/* Evil Sender */
+		imcb_error(sess->aux_data,
+		           nummissed == 1 ?
+		           _("You missed %d message from %s because it was too evil.") :
+		           _("You missed %d messages from %s because they are too evil."),
+		           nummissed,
+		           userinfo->sn);
+		break;
+	case 4:
+		/* Evil Receiver */
+		imcb_error(sess->aux_data,
+		           nummissed == 1 ?
+		           _("You missed %d message from %s because you are too evil.") :
+		           _("You missed %d messages from %s because you are too evil."),
+		           nummissed,
+		           userinfo->sn);
+		break;
+	default:
+		imcb_error(sess->aux_data,
+		           nummissed == 1 ?
+		           _("You missed %d message from %s for unknown reasons.") :
+		           _("You missed %d messages from %s for unknown reasons."),
+		           nummissed,
+		           userinfo->sn);
+		break;
+	}
+
+	return 1;
+}
+
+static int gaim_parse_genericerr(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	va_list ap;
 	guint16 reason;
 
 	va_start(ap, fr);
-	reason = (guint16)va_arg(ap, unsigned int);
+	reason = (guint16) va_arg(ap, unsigned int);
 	va_end(ap);
 
 	imcb_error(sess->aux_data, _("SNAC threw error: %s"),
-	          reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error");
-
-	return 1;
-}
-
-static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...) {
+	           reason < msgerrreasonlen ? msgerrreason[reason] : "Unknown error");
+
+	return 1;
+}
+
+static int gaim_parse_msgerr(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	va_list ap;
 	char *destn;
@@ -1304,15 +1375,16 @@
 
 	va_start(ap, fr);
-	reason = (guint16)va_arg(ap, unsigned int);
+	reason = (guint16) va_arg(ap, unsigned int);
 	destn = va_arg(ap, char *);
 	va_end(ap);
 
 	imcb_error(sess->aux_data, _("Your message to %s did not get sent: %s"), destn,
-			(reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown"));
-
-	return 1;
-}
-
-static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...) {
+	           (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown"));
+
+	return 1;
+}
+
+static int gaim_parse_locerr(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	va_list ap;
 	char *destn;
@@ -1320,82 +1392,86 @@
 
 	va_start(ap, fr);
-	reason = (guint16)va_arg(ap, unsigned int);
+	reason = (guint16) va_arg(ap, unsigned int);
 	destn = va_arg(ap, char *);
 	va_end(ap);
 
 	imcb_error(sess->aux_data, _("User information for %s unavailable: %s"), destn,
-			(reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown"));
-
-	return 1;
-}
-
-static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...) {
+	           (reason < msgerrreasonlen) ? msgerrreason[reason] : _("Reason unknown"));
+
+	return 1;
+}
+
+static int gaim_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	guint16 id;
 	va_list ap;
 
 	va_start(ap, fr);
-	id  = (guint16)va_arg(ap, unsigned int);
+	id  = (guint16) va_arg(ap, unsigned int);
 	va_arg(ap, char *); /* msg */
 	va_end(ap);
 
-	if (id < 4)
+	if (id < 4) {
 		imcb_error(sess->aux_data, _("Your connection may be lost."));
-
-	return 1;
-}
-
-static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...) {
+	}
+
+	return 1;
+}
+
+static int gaim_chatnav_info(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	va_list ap;
 	guint16 type;
 	struct im_connection *ic = sess->aux_data;
-	struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
+	struct oscar_data *odata = (struct oscar_data *) ic->proto_data;
 
 	va_start(ap, fr);
-	type = (guint16)va_arg(ap, unsigned int);
-
-	switch(type) {
-		case 0x0002: {
-			va_arg(ap, unsigned int); /* maxrooms */
-			va_arg(ap, int); /* exchangecount */
-			va_arg(ap, struct aim_chat_exchangeinfo *); /* exchanges */
-			va_end(ap);
-
-			while (odata->create_rooms) {
-				struct create_room *cr = odata->create_rooms->data;
-				aim_chatnav_createroom(sess, fr->conn, cr->name, cr->exchange);
-				g_free(cr->name);
-				odata->create_rooms = g_slist_remove(odata->create_rooms, cr);
-				g_free(cr);
-			}
-			}
-			break;
-		case 0x0008: {
-			char *ck;
-			guint16 instance, exchange;
-
-			va_arg(ap, char *); /* fqcn */
-			instance = (guint16)va_arg(ap, unsigned int);
-			exchange = (guint16)va_arg(ap, unsigned int);
-			va_arg(ap, unsigned int); /* flags */
-			va_arg(ap, guint32); /* createtime */
-			va_arg(ap, unsigned int); /* maxmsglen */
-			va_arg(ap, unsigned int); /* maxoccupancy */
-			va_arg(ap, int); /* createperms */
-			va_arg(ap, unsigned int); /* unknown */
-			va_arg(ap, char *); /* name */
-			ck = va_arg(ap, char *);
-			va_end(ap);
-
-			aim_chat_join(odata->sess, odata->conn, exchange, ck, instance);
-			}
-			break;
-		default:
-			va_end(ap);
-			break;
-	}
-	return 1;
-}
-
-static int gaim_chat_join(aim_session_t *sess, aim_frame_t *fr, ...) {
+	type = (guint16) va_arg(ap, unsigned int);
+
+	switch (type) {
+	case 0x0002: {
+		va_arg(ap, unsigned int);         /* maxrooms */
+		va_arg(ap, int);         /* exchangecount */
+		va_arg(ap, struct aim_chat_exchangeinfo *);         /* exchanges */
+		va_end(ap);
+
+		while (odata->create_rooms) {
+			struct create_room *cr = odata->create_rooms->data;
+			aim_chatnav_createroom(sess, fr->conn, cr->name, cr->exchange);
+			g_free(cr->name);
+			odata->create_rooms = g_slist_remove(odata->create_rooms, cr);
+			g_free(cr);
+		}
+	}
+	break;
+	case 0x0008: {
+		char *ck;
+		guint16 instance, exchange;
+
+		va_arg(ap, char *);         /* fqcn */
+		instance = (guint16) va_arg(ap, unsigned int);
+		exchange = (guint16) va_arg(ap, unsigned int);
+		va_arg(ap, unsigned int);         /* flags */
+		va_arg(ap, guint32);         /* createtime */
+		va_arg(ap, unsigned int);         /* maxmsglen */
+		va_arg(ap, unsigned int);         /* maxoccupancy */
+		va_arg(ap, int);         /* createperms */
+		va_arg(ap, unsigned int);         /* unknown */
+		va_arg(ap, char *);         /* name */
+		ck = va_arg(ap, char *);
+		va_end(ap);
+
+		aim_chat_join(odata->sess, odata->conn, exchange, ck, instance);
+	}
+	break;
+	default:
+		va_end(ap);
+		break;
+	}
+	return 1;
+}
+
+static int gaim_chat_join(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	va_list ap;
 	int count, i;
@@ -1411,14 +1487,17 @@
 
 	c = find_oscar_chat_by_conn(g, fr->conn);
-	if (!c)
+	if (!c) {
 		return 1;
-
-	for (i = 0; i < count; i++)
+	}
+
+	for (i = 0; i < count; i++) {
 		imcb_chat_add_buddy(c->cnv, normalize(info[i].sn));
-
-	return 1;
-}
-
-static int gaim_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...) {
+	}
+
+	return 1;
+}
+
+static int gaim_chat_leave(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	va_list ap;
 	int count, i;
@@ -1434,14 +1513,17 @@
 
 	c = find_oscar_chat_by_conn(g, fr->conn);
-	if (!c)
+	if (!c) {
 		return 1;
-
-	for (i = 0; i < count; i++)
+	}
+
+	for (i = 0; i < count; i++) {
 		imcb_chat_remove_buddy(c->cnv, normalize(info[i].sn), NULL);
-
-	return 1;
-}
-
-static int gaim_chat_info_update(aim_session_t *sess, aim_frame_t *fr, ...) {
+	}
+
+	return 1;
+}
+
+static int gaim_chat_info_update(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	va_list ap;
 	guint16 maxmsglen, maxvisiblemsglen;
@@ -1457,8 +1539,8 @@
 	va_arg(ap, int); /* unknown_c9 */
 	va_arg(ap, unsigned long); /* creationtime */
-	maxmsglen = (guint16)va_arg(ap, int);
+	maxmsglen = (guint16) va_arg(ap, int);
 	va_arg(ap, int); /* unknown_d2 */
 	va_arg(ap, int); /* unknown_d5 */
-	maxvisiblemsglen = (guint16)va_arg(ap, int);
+	maxvisiblemsglen = (guint16) va_arg(ap, int);
 	va_end(ap);
 
@@ -1469,5 +1551,6 @@
 }
 
-static int gaim_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...) {
+static int gaim_chat_incoming_msg(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	va_list ap;
 	aim_userinfo_t *info;
@@ -1489,12 +1572,13 @@
 }
 
-static int gaim_parse_ratechange(aim_session_t *sess, aim_frame_t *fr, ...) {
+static int gaim_parse_ratechange(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 #if 0
 	static const char *codes[5] = {
 		"invalid",
-		 "change",
-		 "warning",
-		 "limit",
-		 "limit cleared",
+		"change",
+		"warning",
+		"limit",
+		"limit cleared",
 	};
 #endif
@@ -1503,13 +1587,13 @@
 	guint32 windowsize, clear, currentavg;
 
-	va_start(ap, fr); 
-	code = (guint16)va_arg(ap, unsigned int);
+	va_start(ap, fr);
+	code = (guint16) va_arg(ap, unsigned int);
 	va_arg(ap, unsigned int); /* rateclass */
-	windowsize = (guint32)va_arg(ap, unsigned long);
-	clear = (guint32)va_arg(ap, unsigned long);
+	windowsize = (guint32) va_arg(ap, unsigned long);
+	clear = (guint32) va_arg(ap, unsigned long);
 	va_arg(ap, unsigned long); /* alert */
 	va_arg(ap, unsigned long); /* limit */
 	va_arg(ap, unsigned long); /* disconnect */
-	currentavg = (guint32)va_arg(ap, unsigned long);
+	currentavg = (guint32) va_arg(ap, unsigned long);
 	va_arg(ap, unsigned long); /* maxavg */
 	va_end(ap);
@@ -1517,12 +1601,13 @@
 	/* XXX fix these values */
 	if (code == AIM_RATE_CODE_CHANGE) {
-		if (currentavg >= clear)
+		if (currentavg >= clear) {
 			aim_conn_setlatency(fr->conn, 0);
+		}
 	} else if (code == AIM_RATE_CODE_WARNING) {
-		aim_conn_setlatency(fr->conn, windowsize/4);
+		aim_conn_setlatency(fr->conn, windowsize / 4);
 	} else if (code == AIM_RATE_CODE_LIMIT) {
 		imcb_error(sess->aux_data, _("The last message was not sent because you are over the rate limit. "
-			  "Please wait 10 seconds and try again."));
-		aim_conn_setlatency(fr->conn, windowsize/2);
+		                             "Please wait 10 seconds and try again."));
+		aim_conn_setlatency(fr->conn, windowsize / 2);
 	} else if (code == AIM_RATE_CODE_CLEARLIMIT) {
 		aim_conn_setlatency(fr->conn, 0);
@@ -1532,9 +1617,11 @@
 }
 
-static int gaim_selfinfo(aim_session_t *sess, aim_frame_t *fr, ...) {
-	return 1;
-}
-
-static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...) {
+static int gaim_selfinfo(aim_session_t *sess, aim_frame_t *fr, ...)
+{
+	return 1;
+}
+
+static int conninitdone_bos(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 
 	aim_reqpersonalinfo(sess, fr->conn);
@@ -1547,10 +1634,11 @@
 	aim_bos_setgroupperm(sess, fr->conn, AIM_FLAG_ALLUSERS);
 	aim_bos_setprivacyflags(sess, fr->conn, AIM_PRIVFLAGS_ALLOWIDLE |
-						     AIM_PRIVFLAGS_ALLOWMEMBERSINCE);
-
-	return 1;
-}
-
-static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...) {
+	                        AIM_PRIVFLAGS_ALLOWMEMBERSINCE);
+
+	return 1;
+}
+
+static int conninitdone_admin(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	struct im_connection *ic = sess->aux_data;
 	struct oscar_data *od = ic->proto_data;
@@ -1589,5 +1677,6 @@
 }
 
-static int gaim_icbm_param_info(aim_session_t *sess, aim_frame_t *fr, ...) {
+static int gaim_icbm_param_info(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	struct aim_icbmparameters *params;
 	va_list ap;
@@ -1612,5 +1701,5 @@
 	guint16 maxsiglen;
 	struct im_connection *ic = sess->aux_data;
-	struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
+	struct oscar_data *odata = (struct oscar_data *) ic->proto_data;
 
 	va_start(ap, fr);
@@ -1618,5 +1707,5 @@
 	va_end(ap);
 
-	odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint)maxsiglen;
+	odata->rights.maxsiglen = odata->rights.maxawaymsglen = (guint) maxsiglen;
 
 	/* FIXME: It seems we're not really using this, and it broke now that
@@ -1624,38 +1713,40 @@
 	aim_bos_setprofile(sess, fr->conn, ic->user->user_info, NULL, gaim_caps);
 	*/
-	
-	return 1;
-}
-
-static int gaim_parse_buddyrights(aim_session_t *sess, aim_frame_t *fr, ...) {
+
+	return 1;
+}
+
+static int gaim_parse_buddyrights(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	va_list ap;
 	guint16 maxbuddies, maxwatchers;
 	struct im_connection *ic = sess->aux_data;
-	struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
+	struct oscar_data *odata = (struct oscar_data *) ic->proto_data;
 
 	va_start(ap, fr);
-	maxbuddies = (guint16)va_arg(ap, unsigned int);
-	maxwatchers = (guint16)va_arg(ap, unsigned int);
+	maxbuddies = (guint16) va_arg(ap, unsigned int);
+	maxwatchers = (guint16) va_arg(ap, unsigned int);
 	va_end(ap);
 
-	odata->rights.maxbuddies = (guint)maxbuddies;
-	odata->rights.maxwatchers = (guint)maxwatchers;
-
-	return 1;
-}
-
-static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...) {
+	odata->rights.maxbuddies = (guint) maxbuddies;
+	odata->rights.maxwatchers = (guint) maxwatchers;
+
+	return 1;
+}
+
+static int gaim_bosrights(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	guint16 maxpermits, maxdenies;
 	va_list ap;
 	struct im_connection *ic = sess->aux_data;
-	struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
+	struct oscar_data *odata = (struct oscar_data *) ic->proto_data;
 
 	va_start(ap, fr);
-	maxpermits = (guint16)va_arg(ap, unsigned int);
-	maxdenies = (guint16)va_arg(ap, unsigned int);
+	maxpermits = (guint16) va_arg(ap, unsigned int);
+	maxdenies = (guint16) va_arg(ap, unsigned int);
 	va_end(ap);
 
-	odata->rights.maxpermits = (guint)maxpermits;
-	odata->rights.maxdenies = (guint)maxdenies;
+	odata->rights.maxpermits = (guint) maxpermits;
+	odata->rights.maxdenies = (guint) maxdenies;
 
 	aim_clientready(sess, fr->conn);
@@ -1669,5 +1760,6 @@
 }
 
-static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...) {
+static int gaim_offlinemsg(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	va_list ap;
 	struct aim_icq_offlinemsg *msg;
@@ -1679,54 +1771,57 @@
 
 	switch (msg->type) {
-		case 0x0001: { /* Basic offline message */
-			char sender[32];
-			char *dialog_msg = g_strdup(msg->msg);
-			time_t t = get_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0);
-			g_snprintf(sender, sizeof(sender), "%u", msg->sender);
-			strip_linefeed(dialog_msg);
-			imcb_buddy_msg(ic, normalize(sender), dialog_msg, 0, t);
-			g_free(dialog_msg);
-		} break;
-
-		case 0x0004: { /* Someone sent you a URL */
-		  	char sender[32];
-		  	char *dialog_msg;
-			char **m;
-
-			time_t t = get_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0);
-			g_snprintf(sender, sizeof(sender), "%u", msg->sender);
-
-			m = g_strsplit(msg->msg, "\376", 2);
-
-			if ((strlen(m[0]) != 0)) {
-			  dialog_msg = g_strjoinv(" -- ", m);
-			} else {
-			  dialog_msg = m[1];
-			}
-
-			strip_linefeed(dialog_msg);
-			imcb_buddy_msg(ic, normalize(sender), dialog_msg, 0, t);
-			g_free(dialog_msg);
-			g_free(m);
-		} break;
-		
-		case 0x0006: { /* Authorization request */
-			gaim_icq_authask(ic, msg->sender, msg->msg);
-		} break;
-
-		case 0x0007: { /* Someone has denied you authorization */
-			imcb_log(sess->aux_data, "The user %u has denied your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") );
-		} break;
-
-		case 0x0008: { /* Someone has granted you authorization */
-			imcb_log(sess->aux_data, "The user %u has granted your request to add them to your contact list for the following reason:\n%s", msg->sender, msg->msg ? msg->msg : _("No reason given.") );
-		} break;
-
-		case 0x0012: {
-			/* Ack for authorizing/denying someone.  Or possibly an ack for sending any system notice */
-		} break;
-
-		default: {;
-		}
+	case 0x0001: {         /* Basic offline message */
+		char sender[32];
+		char *dialog_msg = g_strdup(msg->msg);
+		time_t t = get_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0);
+		g_snprintf(sender, sizeof(sender), "%u", msg->sender);
+		strip_linefeed(dialog_msg);
+		imcb_buddy_msg(ic, normalize(sender), dialog_msg, 0, t);
+		g_free(dialog_msg);
+	} break;
+
+	case 0x0004: {         /* Someone sent you a URL */
+		char sender[32];
+		char *dialog_msg;
+		char **m;
+
+		time_t t = get_time(msg->year, msg->month, msg->day, msg->hour, msg->minute, 0);
+		g_snprintf(sender, sizeof(sender), "%u", msg->sender);
+
+		m = g_strsplit(msg->msg, "\376", 2);
+
+		if ((strlen(m[0]) != 0)) {
+			dialog_msg = g_strjoinv(" -- ", m);
+		} else {
+			dialog_msg = m[1];
+		}
+
+		strip_linefeed(dialog_msg);
+		imcb_buddy_msg(ic, normalize(sender), dialog_msg, 0, t);
+		g_free(dialog_msg);
+		g_free(m);
+	} break;
+
+	case 0x0006: {         /* Authorization request */
+		gaim_icq_authask(ic, msg->sender, msg->msg);
+	} break;
+
+	case 0x0007: {         /* Someone has denied you authorization */
+		imcb_log(sess->aux_data,
+		         "The user %u has denied your request to add them to your contact list for the following reason:\n%s", msg->sender,
+		         msg->msg ? msg->msg : _("No reason given."));
+	} break;
+
+	case 0x0008: {         /* Someone has granted you authorization */
+		imcb_log(sess->aux_data,
+		         "The user %u has granted your request to add them to your contact list for the following reason:\n%s", msg->sender,
+		         msg->msg ? msg->msg : _("No reason given."));
+	} break;
+
+	case 0x0012: {
+		/* Ack for authorizing/denying someone.  Or possibly an ack for sending any system notice */
+	} break;
+
+	default: {; }
 	}
 
@@ -1740,12 +1835,16 @@
 }
 
-static void oscar_keepalive(struct im_connection *ic) {
-	struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
+static void oscar_keepalive(struct im_connection *ic)
+{
+	struct oscar_data *odata = (struct oscar_data *) ic->proto_data;
+
 	aim_flap_nop(odata->sess, odata->conn);
 }
 
-static int oscar_buddy_msg(struct im_connection *ic, char *name, char *message, int imflags) {
-	struct oscar_data *odata = (struct oscar_data *)ic->proto_data;
+static int oscar_buddy_msg(struct im_connection *ic, char *name, char *message, int imflags)
+{
+	struct oscar_data *odata = (struct oscar_data *) ic->proto_data;
 	int ret = 0, len = strlen(message);
+
 	if (imflags & OPT_AWAY) {
 		ret = aim_send_im(odata->sess, name, AIM_IMFLAGS_AWAY, message);
@@ -1753,12 +1852,15 @@
 		struct aim_sendimext_args args;
 		char *s;
-		
+
 		args.flags = AIM_IMFLAGS_ACK;
-		if (odata->icq)
+		if (odata->icq) {
 			args.flags |= AIM_IMFLAGS_OFFLINE;
-		for (s = message; *s; s++)
-			if (*s & 128)
+		}
+		for (s = message; *s; s++) {
+			if (*s & 128) {
 				break;
-		
+			}
+		}
+
 		/* Message contains high ASCII chars, time for some translation! */
 		if (*s) {
@@ -1774,5 +1876,5 @@
 			} else {
 				/* OOF, translation failed... Oh well.. */
-				g_free( s );
+				g_free(s);
 				s = message;
 			}
@@ -1780,28 +1882,31 @@
 			s = message;
 		}
-		
+
 		args.features = gaim_features;
 		args.featureslen = sizeof(gaim_features);
-		
+
 		args.destsn = name;
 		args.msg    = s;
 		args.msglen = len;
-		
+
 		ret = aim_send_im_ext(odata->sess, &args);
-		
+
 		if (s != message) {
 			g_free(s);
 		}
 	}
-	if (ret >= 0)
+	if (ret >= 0) {
 		return 1;
+	}
 	return ret;
 }
 
-static void oscar_get_info(struct im_connection *g, char *name) {
-	struct oscar_data *odata = (struct oscar_data *)g->proto_data;
-	if (odata->icq)
+static void oscar_get_info(struct im_connection *g, char *name)
+{
+	struct oscar_data *odata = (struct oscar_data *) g->proto_data;
+
+	if (odata->icq) {
 		aim_icq_getallinfo(odata->sess, name);
-	else {
+	} else {
 		aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_AWAYMESSAGE);
 		aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_GENERALINFO);
@@ -1809,22 +1914,26 @@
 }
 
-static void oscar_get_away(struct im_connection *g, char *who) {
-	struct oscar_data *odata = (struct oscar_data *)g->proto_data;
+static void oscar_get_away(struct im_connection *g, char *who)
+{
+	struct oscar_data *odata = (struct oscar_data *) g->proto_data;
+
 	if (odata->icq) {
 		/** FIXME(wilmer): Hmm, lost the ability to get away msgs here, do we care to get that back?
 		struct buddy *budlight = imcb_find_buddy(g, who);
 		if (budlight)
-			if ((budlight->uc & 0xff80) >> 7)
-				if (budlight->caps & AIM_CAPS_ICQSERVERRELAY)
-					aim_send_im_ch2_geticqmessage(odata->sess, who, (budlight->uc & 0xff80) >> 7);
+		        if ((budlight->uc & 0xff80) >> 7)
+		                if (budlight->caps & AIM_CAPS_ICQSERVERRELAY)
+		                        aim_send_im_ch2_geticqmessage(odata->sess, who, (budlight->uc & 0xff80) >> 7);
 		*/
-	} else
+	} else {
 		aim_getinfo(odata->sess, odata->conn, who, AIM_GETINFO_AWAYMESSAGE);
+	}
 }
 
 static void oscar_set_away_aim(struct im_connection *ic, struct oscar_data *od, const char *state, const char *message)
 {
-	if (state == NULL)
+	if (state == NULL) {
 		state = "";
+	}
 
 	if (!g_strcasecmp(state, _("Visible"))) {
@@ -1838,6 +1947,7 @@
 	}
 
-	if (od->rights.maxawaymsglen == 0)
+	if (od->rights.maxawaymsglen == 0) {
 		imcb_error(ic, "oscar_set_away_aim called before locate rights received");
+	}
 
 	aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
@@ -1852,5 +1962,6 @@
 
 	if (strlen(message) > od->rights.maxawaymsglen) {
-		imcb_error(ic, "Maximum away message length of %d bytes exceeded, truncating", od->rights.maxawaymsglen);
+		imcb_error(ic, "Maximum away message length of %d bytes exceeded, truncating",
+		           od->rights.maxawaymsglen);
 	}
 
@@ -1905,5 +2016,5 @@
 		ic->away = g_strdup(msg);
 	} else {
-	 	if (no_message) {
+		if (no_message) {
 			aim_setextstatus(od->sess, od->conn, AIM_ICQ_STATE_NORMAL);
 		} else {
@@ -1919,34 +2030,46 @@
 static void oscar_set_away(struct im_connection *ic, char *state, char *message)
 {
-	struct oscar_data *od = (struct oscar_data *)ic->proto_data;
+	struct oscar_data *od = (struct oscar_data *) ic->proto_data;
 
 	oscar_set_away_aim(ic, od, state, message);
-	if (od->icq)
+	if (od->icq) {
 		oscar_set_away_icq(ic, od, state, message);
+	}
 
 	return;
 }
 
-static void oscar_add_buddy(struct im_connection *g, char *name, char *group) {
-	struct oscar_data *odata = (struct oscar_data *)g->proto_data;
+static void oscar_add_buddy(struct im_connection *g, char *name, char *group)
+{
+	struct oscar_data *odata = (struct oscar_data *) g->proto_data;
 	bee_user_t *bu;
-	
-	if (group && (bu = bee_user_by_handle(g->bee, g, name)) && bu->group)
+
+	if (group && (bu = bee_user_by_handle(g->bee, g, name)) && bu->group) {
 		aim_ssi_movebuddy(odata->sess, odata->conn, bu->group->name, group, name);
-	else
+	} else {
 		aim_ssi_addbuddies(odata->sess, odata->conn, group ? : OSCAR_GROUP, &name, 1, 0);
-}
-
-static void oscar_remove_buddy(struct im_connection *g, char *name, char *group) {
-	struct oscar_data *odata = (struct oscar_data *)g->proto_data;
+	}
+}
+
+static void oscar_remove_buddy(struct im_connection *g, char *name, char *group)
+{
+	struct oscar_data *odata = (struct oscar_data *) g->proto_data;
 	struct aim_ssi_item *ssigroup;
-	while ((ssigroup = aim_ssi_itemlist_findparent(odata->sess->ssi.items, name)) && !aim_ssi_delbuddies(odata->sess, odata->conn, ssigroup->name, &name, 1));
-}
-
-static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...) {
-	return 1;
-}
-
-static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...) {
+
+	while ((ssigroup =
+	                aim_ssi_itemlist_findparent(odata->sess->ssi.items,
+	                                            name)) &&
+	       !aim_ssi_delbuddies(odata->sess, odata->conn, ssigroup->name, &name, 1)) {
+		;
+	}
+}
+
+static int gaim_ssi_parserights(aim_session_t *sess, aim_frame_t *fr, ...)
+{
+	return 1;
+}
+
+static int gaim_ssi_parselist(aim_session_t *sess, aim_frame_t *fr, ...)
+{
 	struct im_connection *ic = sess->aux_data;
 	struct aim_ssi_item *curitem, *curgroup = NULL;
@@ -1956,170 +2079,183 @@
 	/* Add from server list to local list */
 	tmp = 0;
-	for (curitem=sess->ssi.items; curitem; curitem=curitem->next) {
+	for (curitem = sess->ssi.items; curitem; curitem = curitem->next) {
 		nrm = curitem->name ? normalize(curitem->name) : NULL;
-		
+
 		switch (curitem->type) {
-			case 0x0000: /* Buddy */
-				if ((curitem->name) && (!imcb_buddy_by_handle(ic, nrm))) {
-					char *realname = NULL;
-
-					if (curitem->data && aim_gettlv(curitem->data, 0x0131, 1))
-						    realname = aim_gettlv_str(curitem->data, 0x0131, 1);
-					
-					imcb_add_buddy(ic, nrm, curgroup ? (curgroup->gid == curitem->gid ? curgroup->name : NULL) : NULL);
-					
-					if (realname) {
-						imcb_buddy_nick_hint(ic, nrm, realname);
-						imcb_rename_buddy(ic, nrm, realname);
-						g_free(realname);
-					}
+		case 0x0000:         /* Buddy */
+			if ((curitem->name) && (!imcb_buddy_by_handle(ic, nrm))) {
+				char *realname = NULL;
+
+				if (curitem->data && aim_gettlv(curitem->data, 0x0131, 1)) {
+					realname = aim_gettlv_str(curitem->data, 0x0131, 1);
 				}
-				break;
-
-			case 0x0001: /* Group */
-				curgroup = curitem;
-				break;
-
-			case 0x0002: /* Permit buddy */
-				if (curitem->name) {
-					GSList *list;
-					for (list=ic->permit; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
-					if (!list) {
-						char *name;
-						name = g_strdup(nrm);
-						ic->permit = g_slist_append(ic->permit, name);
-						tmp++;
-					}
+
+				imcb_add_buddy(ic, nrm,
+				               curgroup ? (curgroup->gid ==
+				                           curitem->gid ? curgroup->name : NULL) : NULL);
+
+				if (realname) {
+					imcb_buddy_nick_hint(ic, nrm, realname);
+					imcb_rename_buddy(ic, nrm, realname);
+					g_free(realname);
 				}
-				break;
-
-			case 0x0003: /* Deny buddy */
-				if (curitem->name) {
-					GSList *list;
-					for (list=ic->deny; (list && aim_sncmp(curitem->name, list->data)); list=list->next);
-					if (!list) {
-						char *name;
-						name = g_strdup(nrm);
-						ic->deny = g_slist_append(ic->deny, name);
-						tmp++;
-					}
+			}
+			break;
+
+		case 0x0001:         /* Group */
+			curgroup = curitem;
+			break;
+
+		case 0x0002:         /* Permit buddy */
+			if (curitem->name) {
+				GSList *list;
+				for (list = ic->permit; (list && aim_sncmp(curitem->name, list->data));
+				     list = list->next) {
+					;
 				}
-				break;
-
-			case 0x0004: /* Permit/deny setting */
-				if (curitem->data) {
-					guint8 permdeny;
-					if ((permdeny = aim_ssi_getpermdeny(sess->ssi.items)) && (permdeny != ic->permdeny)) {
-						ic->permdeny = permdeny;
-						tmp++;
-					}
+				if (!list) {
+					char *name;
+					name = g_strdup(nrm);
+					ic->permit = g_slist_append(ic->permit, name);
+					tmp++;
 				}
-				break;
-
-			case 0x0005: /* Presence setting */
-				/* We don't want to change Gaim's setting because it applies to all accounts */
-				break;
+			}
+			break;
+
+		case 0x0003:         /* Deny buddy */
+			if (curitem->name) {
+				GSList *list;
+				for (list = ic->deny;
+				     (list && aim_sncmp(curitem->name, list->data)); list = list->next) {
+					;
+				}
+				if (!list) {
+					char *name;
+					name = g_strdup(nrm);
+					ic->deny = g_slist_append(ic->deny, name);
+					tmp++;
+				}
+			}
+			break;
+
+		case 0x0004:         /* Permit/deny setting */
+			if (curitem->data) {
+				guint8 permdeny;
+				if ((permdeny = aim_ssi_getpermdeny(sess->ssi.items)) && (permdeny != ic->permdeny)) {
+					ic->permdeny = permdeny;
+					tmp++;
+				}
+			}
+			break;
+
+		case 0x0005:         /* Presence setting */
+			/* We don't want to change Gaim's setting because it applies to all accounts */
+			break;
 		} /* End of switch on curitem->type */
 	} /* End of for loop */
 
 	aim_ssi_enable(sess, fr->conn);
-	
+
 	/* Request offline messages, now that the buddy list is complete. */
 	aim_icq_reqofflinemsgs(sess);
-	
+
 	/* Now that we have a buddy list, we can tell BitlBee that we're online. */
 	imcb_connected(ic);
-	
-	return 1;
-}
-
-static int gaim_ssi_parseack( aim_session_t *sess, aim_frame_t *fr, ... )
+
+	return 1;
+}
+
+static int gaim_ssi_parseack(aim_session_t *sess, aim_frame_t *fr, ...)
 {
 	aim_snac_t *origsnac;
 	va_list ap;
 
-	va_start( ap, fr );
-	origsnac = va_arg( ap, aim_snac_t * );
-	va_end( ap );
-	
-	if( origsnac && origsnac->family == AIM_CB_FAM_SSI && origsnac->type == AIM_CB_SSI_ADD && origsnac->data )
-	{
-		int i, st, count = aim_bstream_empty( &fr->data );
+	va_start(ap, fr);
+	origsnac = va_arg(ap, aim_snac_t *);
+	va_end(ap);
+
+	if (origsnac && origsnac->family == AIM_CB_FAM_SSI && origsnac->type == AIM_CB_SSI_ADD && origsnac->data) {
+		int i, st, count = aim_bstream_empty(&fr->data);
 		char *list;
-		
-		if( count & 1 )
-		{
+
+		if (count & 1) {
 			/* Hmm, the length should be even... */
-			imcb_error( sess->aux_data, "Received SSI ACK package with non-even length");
-			return( 0 );
+			imcb_error(sess->aux_data, "Received SSI ACK package with non-even length");
+			return(0);
 		}
 		count >>= 1;
-		
+
 		list = (char *) origsnac->data;
-		for( i = 0; i < count; i ++ )
-		{
-			struct aim_ssi_item *ssigroup = aim_ssi_itemlist_findparent( sess->ssi.items, list );
+		for (i = 0; i < count; i++) {
+			struct aim_ssi_item *ssigroup = aim_ssi_itemlist_findparent(sess->ssi.items, list);
 			char *group = ssigroup ? ssigroup->name : NULL;
-			
-			st = aimbs_get16( &fr->data );
-			if( st == 0x00 )
-			{
-				imcb_add_buddy( sess->aux_data, normalize(list), group );
+
+			st = aimbs_get16(&fr->data);
+			if (st == 0x00) {
+				imcb_add_buddy(sess->aux_data, normalize(list), group);
+			} else if (st == 0x0E) {
+				imcb_log(sess->aux_data,
+				         "Buddy %s can't be added without authorization, requesting authorization",
+				         list);
+
+				aim_ssi_auth_request(sess, fr->conn, list, "");
+				aim_ssi_addbuddies(sess, fr->conn, OSCAR_GROUP, &list, 1, 1);
+			} else if (st == 0x0A) {
+				imcb_error(sess->aux_data, "Buddy %s is already in your list", list);
+			} else {
+				imcb_error(sess->aux_data, "Error while adding buddy: 0x%04x", st);
 			}
-			else if( st == 0x0E )
-			{
-				imcb_log( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list );
-				
-				aim_ssi_auth_request( sess, fr->conn, list, "" );
-				aim_ssi_addbuddies( sess, fr->conn, OSCAR_GROUP, &list, 1, 1 );
-			}
-			else if( st == 0x0A )
-			{
-				imcb_error( sess->aux_data, "Buddy %s is already in your list", list );
-			}
-			else
-			{
-				imcb_error( sess->aux_data, "Error while adding buddy: 0x%04x", st );
-			}
-			list += strlen( list ) + 1;
-		}
-	}
-	
-	return( 1 );
-}
-
-static void oscar_add_permit(struct im_connection *ic, char *who) {
-	struct oscar_data *od = (struct oscar_data *)ic->proto_data;
+			list += strlen(list) + 1;
+		}
+	}
+
+	return(1);
+}
+
+static void oscar_add_permit(struct im_connection *ic, char *who)
+{
+	struct oscar_data *od = (struct oscar_data *) ic->proto_data;
+
 	if (od->icq) {
 		aim_ssi_auth_reply(od->sess, od->conn, who, 1, "");
 	} else {
-		if (od->sess->ssi.received_data)
+		if (od->sess->ssi.received_data) {
 			aim_ssi_addpord(od->sess, od->conn, &who, 1, AIM_SSI_TYPE_PERMIT);
-	}
-}
-
-static void oscar_add_deny(struct im_connection *ic, char *who) {
-	struct oscar_data *od = (struct oscar_data *)ic->proto_data;
+		}
+	}
+}
+
+static void oscar_add_deny(struct im_connection *ic, char *who)
+{
+	struct oscar_data *od = (struct oscar_data *) ic->proto_data;
+
 	if (od->icq) {
 		aim_ssi_auth_reply(od->sess, od->conn, who, 0, "");
 	} else {
-		if (od->sess->ssi.received_data)
+		if (od->sess->ssi.received_data) {
 			aim_ssi_addpord(od->sess, od->conn, &who, 1, AIM_SSI_TYPE_DENY);
-	}
-}
-
-static void oscar_rem_permit(struct im_connection *ic, char *who) {
-	struct oscar_data *od = (struct oscar_data *)ic->proto_data;
+		}
+	}
+}
+
+static void oscar_rem_permit(struct im_connection *ic, char *who)
+{
+	struct oscar_data *od = (struct oscar_data *) ic->proto_data;
+
 	if (!od->icq) {
-		if (od->sess->ssi.received_data)
+		if (od->sess->ssi.received_data) {
 			aim_ssi_delpord(od->sess, od->conn, &who, 1, AIM_SSI_TYPE_PERMIT);
-	}
-}
-
-static void oscar_rem_deny(struct im_connection *ic, char *who) {
-	struct oscar_data *od = (struct oscar_data *)ic->proto_data;
+		}
+	}
+}
+
+static void oscar_rem_deny(struct im_connection *ic, char *who)
+{
+	struct oscar_data *od = (struct oscar_data *) ic->proto_data;
+
 	if (!od->icq) {
-		if (od->sess->ssi.received_data)
+		if (od->sess->ssi.received_data) {
 			aim_ssi_delpord(od->sess, od->conn, &who, 1, AIM_SSI_TYPE_DENY);
+		}
 	}
 }
@@ -2159,12 +2295,13 @@
 	va_end(ap);
 
-	if (!info->uin)
+	if (!info->uin) {
 		return 0;
+	}
 
 	str = g_string_sized_new(512);
 	g_snprintf(who, sizeof(who), "%u", info->uin);
 
-	g_string_printf(str, "%s: %s - %s: %s", _("UIN"), who, _("Nick"), 
-	info->nick ? info->nick : "-");
+	g_string_printf(str, "%s: %s - %s: %s", _("UIN"), who, _("Nick"),
+	                info->nick ? info->nick : "-");
 	g_string_append_printf(str, "\n%s: %s", _("First Name"), info->first);
 	g_string_append_printf(str, "\n%s: %s", _("Last Name"), info->last);
@@ -2181,13 +2318,14 @@
 	}
 	g_string_append_printf(str, "\n%s: %s", _("Mobile Phone"), info->mobile);
-	if (info->gender != 0)
-		g_string_append_printf(str, "\n%s: %s", _("Gender"), info->gender==1 ? _("Female") : _("Male"));
+	if (info->gender != 0) {
+		g_string_append_printf(str, "\n%s: %s", _("Gender"), info->gender == 1 ? _("Female") : _("Male"));
+	}
 	if (info->birthyear || info->birthmonth || info->birthday) {
 		char date[30];
 		struct tm tm;
 		memset(&tm, 0, sizeof(struct tm));
-		tm.tm_mday = (int)info->birthday;
-		tm.tm_mon = (int)info->birthmonth-1;
-		tm.tm_year = (int)info->birthyear%100;
+		tm.tm_mday = (int) info->birthday;
+		tm.tm_mon = (int) info->birthmonth - 1;
+		tm.tm_year = (int) info->birthyear % 100;
 		strftime(date, sizeof(date), "%Y-%m-%d", &tm);
 		g_string_append_printf(str, "\n%s: %s", _("Birthday"), date);
@@ -2200,17 +2338,23 @@
 	g_string_append_printf(str, "\n%s: %s", _("Personal Web Page"), info->personalwebpage);
 	if (info->info && info->info[0]) {
-		g_string_sprintfa(str, "\n%s:\n%s\n%s", _("Additional Information"), 
-		info->info, _("End of Additional Information"));
+		g_string_sprintfa(str, "\n%s:\n%s\n%s", _("Additional Information"),
+		                  info->info, _("End of Additional Information"));
 	}
 	g_string_append_c(str, '\n');
-	if ((info->homeaddr && (info->homeaddr[0])) || (info->homecity && info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) {
+	if ((info->homeaddr &&
+	     (info->homeaddr[0])) ||
+	    (info->homecity &&
+	     info->homecity[0]) || (info->homestate && info->homestate[0]) || (info->homezip && info->homezip[0])) {
 		g_string_append_printf(str, "%s:", _("Home Address"));
 		g_string_append_printf(str, "\n%s: %s", _("Address"), info->homeaddr);
 		g_string_append_printf(str, "\n%s: %s", _("City"), info->homecity);
-		g_string_append_printf(str, "\n%s: %s", _("State"), info->homestate); 
+		g_string_append_printf(str, "\n%s: %s", _("State"), info->homestate);
 		g_string_append_printf(str, "\n%s: %s", _("Zip Code"), info->homezip);
 		g_string_append_c(str, '\n');
 	}
-	if ((info->workaddr && info->workaddr[0]) || (info->workcity && info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) {
+	if ((info->workaddr &&
+	     info->workaddr[0]) ||
+	    (info->workcity &&
+	     info->workcity[0]) || (info->workstate && info->workstate[0]) || (info->workzip && info->workzip[0])) {
 		g_string_append_printf(str, "%s:", _("Work Address"));
 		g_string_append_printf(str, "\n%s: %s", _("Address"), info->workaddr);
@@ -2220,5 +2364,9 @@
 		g_string_append_c(str, '\n');
 	}
-	if ((info->workcompany && info->workcompany[0]) || (info->workdivision && info->workdivision[0]) || (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) {
+	if ((info->workcompany &&
+	     info->workcompany[0]) ||
+	    (info->workdivision &&
+	     info->workdivision[0]) ||
+	    (info->workposition && info->workposition[0]) || (info->workwebpage && info->workwebpage[0])) {
 		g_string_append_printf(str, "%s:", _("Work Information"));
 		g_string_append_printf(str, "\n%s: %s", _("Company"), info->workcompany);
@@ -2247,7 +2395,6 @@
 	/* Make sure encoding begins with charset= */
 	if (strncmp(encoding, "text/plain; charset=", 20) &&
-		strncmp(encoding, "text/aolrtf; charset=", 21) &&
-		strncmp(encoding, "text/x-aolrtf; charset=", 23))
-	{
+	    strncmp(encoding, "text/aolrtf; charset=", 21) &&
+	    strncmp(encoding, "text/x-aolrtf; charset=", 23)) {
 		return NULL;
 	}
@@ -2256,8 +2403,9 @@
 	end = strrchr(encoding, '"');
 
-	if ((begin == NULL) || (end == NULL) || (begin >= end))
+	if ((begin == NULL) || (end == NULL) || (begin >= end)) {
 		return NULL;
-
-	ret = g_strndup(begin+1, (end-1) - begin);
+	}
+
+	ret = g_strndup(begin + 1, (end - 1) - begin);
 
 	return ret;
@@ -2288,5 +2436,5 @@
 	 */
 	if (*utf8 == 0) {
-	    strncpy(utf8, text, textlen);
+		strncpy(utf8, text, textlen);
 	}
 
@@ -2312,11 +2460,12 @@
 	va_end(ap);
 
-	if(text_encoding)
+	if (text_encoding) {
 		extracted_encoding = oscar_encoding_extract(text_encoding);
-	if(infotype == AIM_GETINFO_GENERALINFO) {
+	}
+	if (infotype == AIM_GETINFO_GENERALINFO) {
 		/*Display idle time*/
 		char buff[256];
 		struct tm idletime;
-		if(userinfo->idletime) {
+		if (userinfo->idletime) {
 			memset(&idletime, 0, sizeof(struct tm));
 			idletime.tm_mday = (userinfo->idletime / 60) / 24;
@@ -2327,6 +2476,6 @@
 			imcb_log(ic, "%s: %s", _("Idle Time"), buff);
 		}
-		
-		if(text) {
+
+		if (text) {
 			utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length);
 			imcb_log(ic, "%s\n%s", _("User Info"), utf8);
@@ -2334,5 +2483,5 @@
 			imcb_log(ic, _("No user info available."));
 		}
-	} else if(infotype == AIM_GETINFO_AWAYMESSAGE && userinfo->flags & AIM_FLAG_AWAY) {
+	} else if (infotype == AIM_GETINFO_AWAYMESSAGE && userinfo->flags & AIM_FLAG_AWAY) {
 		utf8 = oscar_encoding_to_utf8(extracted_encoding, text, text_length);
 		imcb_log(ic, "%s\n%s", _("Away Message"), utf8);
@@ -2340,5 +2489,5 @@
 
 	g_free(utf8);
-   
+
 	return 1;
 }
@@ -2356,18 +2505,16 @@
 	type2 = va_arg(ap, int);
 	va_end(ap);
-    
-	if(type2 == 0x0002) {
+
+	if (type2 == 0x0002) {
 		/* User is typing */
 		imcb_buddy_typing(ic, normalize(sn), OPT_TYPING);
-	} 
-	else if (type2 == 0x0001) {
+	} else if (type2 == 0x0001) {
 		/* User has typed something, but is not actively typing (stale) */
 		imcb_buddy_typing(ic, normalize(sn), OPT_THINKING);
-	}
-	else {
+	} else {
 		/* User has stopped typing */
 		imcb_buddy_typing(ic, normalize(sn), 0);
 	}
-	
+
 	return 1;
 }
@@ -2376,5 +2523,6 @@
 {
 	struct oscar_data *od = ic->proto_data;
-	return( aim_im_sendmtn(od->sess, 1, who, (typing & OPT_TYPING) ? 0x0002 : 0x0000) );
+
+	return(aim_im_sendmtn(od->sess, 1, who, (typing & OPT_TYPING) ? 0x0002 : 0x0000));
 }
 
@@ -2382,5 +2530,5 @@
 {
 	struct im_connection *ic = c->ic;
-	struct oscar_data * od = (struct oscar_data*)ic->proto_data;
+	struct oscar_data * od = (struct oscar_data*) ic->proto_data;
 	struct chat_connection * ccon;
 	int ret;
@@ -2388,14 +2536,17 @@
 	guint16 flags;
 	char *s;
-	
-	if (!(ccon = c->data))
+
+	if (!(ccon = c->data)) {
 		return;
-	  	
-	for (s = message; *s; s++)
-		if (*s & 128)
+	}
+
+	for (s = message; *s; s++) {
+		if (*s & 128) {
 			break;
-	
+		}
+	}
+
 	flags = AIM_CHATFLAGS_NOREFLECT;
-	
+
 	/* Message contains high ASCII chars, time for some translation! */
 	if (*s) {
@@ -2411,5 +2562,5 @@
 		} else {
 			/* OOF, translation failed... Oh well.. */
-			g_free( s );
+			g_free(s);
 			s = message;
 		}
@@ -2417,11 +2568,11 @@
 		s = message;
 	}
-	  	
+
 	ret = aim_chat_send_im(od->sess, ccon->conn, flags, s, len);
-	  	
-	if (s != message) {	
+
+	if (s != message) {
 		g_free(s);
-  }
-  
+	}
+
 /*  return (ret >= 0); */
 }
@@ -2430,17 +2581,18 @@
 {
 	struct im_connection *ic = c->ic;
-	struct oscar_data * od = (struct oscar_data *)ic->proto_data;
+	struct oscar_data * od = (struct oscar_data *) ic->proto_data;
 	struct chat_connection *ccon;
-	
-	if (!(ccon = c->data))
+
+	if (!(ccon = c->data)) {
 		return;
-	
+	}
+
 	aim_chat_invite(od->sess, od->conn, who, message ? message : "",
-					ccon->exchange, ccon->name, 0x0);
+	                ccon->exchange, ccon->name, 0x0);
 }
 
 void oscar_chat_kill(struct im_connection *ic, struct chat_connection *cc)
 {
-	struct oscar_data *od = (struct oscar_data *)ic->proto_data;
+	struct oscar_data *od = (struct oscar_data *) ic->proto_data;
 
 	/* Notify the conversation window that we've left the chat */
@@ -2449,6 +2601,7 @@
 	/* Destroy the chat_connection */
 	od->oscar_chats = g_slist_remove(od->oscar_chats, cc);
-	if (cc->inpa > 0)
+	if (cc->inpa > 0) {
 		b_event_remove(cc->inpa);
+	}
 	aim_conn_kill(od->sess, &cc->conn);
 	g_free(cc->name);
@@ -2459,28 +2612,29 @@
 void oscar_chat_leave(struct groupchat *c)
 {
-	if (!c->data)
+	if (!c->data) {
 		return;
+	}
 	oscar_chat_kill(c->ic, c->data);
 }
 
 struct groupchat *oscar_chat_join_internal(struct im_connection *ic, const char *room,
-	const char *nick, const char *password, int exchange_number)
-{
-	struct oscar_data * od = (struct oscar_data *)ic->proto_data;
+                                           const char *nick, const char *password, int exchange_number)
+{
+	struct oscar_data * od = (struct oscar_data *) ic->proto_data;
 	struct groupchat *ret = imcb_chat_new(ic, room);
 	aim_conn_t * cur;
 
-	if((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) {
+	if ((cur = aim_getconn_type(od->sess, AIM_CONN_TYPE_CHATNAV))) {
 		aim_chatnav_createroom(od->sess, cur, room, exchange_number);
-		
+
 		return ret;
 	} else {
 		struct create_room * cr = g_new0(struct create_room, 1);
-		
+
 		cr->exchange = exchange_number;
 		cr->name = g_strdup(room);
 		od->create_rooms = g_slist_append(od->create_rooms, cr);
 		aim_reqservice(od->sess, od->conn, AIM_CONN_TYPE_CHATNAV);
-		
+
 		return ret;
 	}
@@ -2488,5 +2642,5 @@
 
 struct groupchat *oscar_chat_join(struct im_connection *ic, const char *room,
-	const char *nick, const char *password, set_t **sets)
+                                  const char *nick, const char *password, set_t **sets)
 {
 	return oscar_chat_join_internal(ic, room, nick, password, set_getint(sets, "exchange_number"));
@@ -2495,21 +2649,23 @@
 struct groupchat *oscar_chat_with(struct im_connection * ic, char *who)
 {
-	struct oscar_data * od = (struct oscar_data *)ic->proto_data;
+	struct oscar_data * od = (struct oscar_data *) ic->proto_data;
 	struct groupchat *ret;
 	static int chat_id = 0;
 	char * chatname, *s;
-	
+
 	chatname = g_strdup_printf("%s%s%d", g_ascii_isdigit(*ic->acc->user) ? "icq" : "",
 	                           ic->acc->user, chat_id++);
-	
-	for (s = chatname; *s; s ++)
-		if (!g_ascii_isalnum(*s))
+
+	for (s = chatname; *s; s++) {
+		if (!g_ascii_isalnum(*s)) {
 			*s = '0';
-	
+		}
+	}
+
 	ret = oscar_chat_join_internal(ic, chatname, NULL, NULL, 4);
 	aim_chat_invite(od->sess, od->conn, who, "", 4, chatname, 0x0);
 
 	g_free(chatname);
-	
+
 	return ret;
 }
@@ -2518,5 +2674,5 @@
 {
 	struct aim_chat_invitation * inv = data;
-	
+
 	oscar_chat_join_internal(inv->ic, inv->name, NULL, NULL, 4);
 	g_free(inv->name);
@@ -2527,5 +2683,5 @@
 {
 	struct aim_chat_invitation * inv = data;
-	
+
 	g_free(inv->name);
 	g_free(inv);
@@ -2542,9 +2698,10 @@
 }
 
-void oscar_initmodule() 
+void oscar_initmodule()
 {
 	struct prpl *ret = g_new0(struct prpl, 1);
+
 	ret->name = "oscar";
-    ret->mms = 2343;       /* this guess taken from libotr UPGRADING file */
+	ret->mms = 2343;   /* this guess taken from libotr UPGRADING file */
 	ret->away_states = oscar_away_states;
 	ret->init = oscar_init;
@@ -2570,5 +2727,5 @@
 	ret->rem_deny = oscar_rem_deny;
 	ret->send_typing = oscar_send_typing;
-	
+
 	ret->handle_cmp = aim_sncmp;
 
Index: protocols/oscar/oscar_util.c
===================================================================
--- protocols/oscar/oscar_util.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/oscar_util.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -4,7 +4,7 @@
 /*
 * int snlen(const char *)
-* 
+*
 * This takes a screen name and returns its length without
-* spaces.  If there are no spaces in the SN, then the 
+* spaces.  If there are no spaces in the SN, then the
 * return is equal to that of strlen().
 *
@@ -15,11 +15,13 @@
 	const char *curPtr = NULL;
 
-	if (!sn)
+	if (!sn) {
 		return 0;
+	}
 
 	curPtr = sn;
-	while ( (*curPtr) != (char) '\0') {
-		if ((*curPtr) != ' ')
-		i++;
+	while ((*curPtr) != (char) '\0') {
+		if ((*curPtr) != ' ') {
+			i++;
+		}
 		curPtr++;
 	}
@@ -45,18 +47,22 @@
 	const char *curPtr1 = NULL, *curPtr2 = NULL;
 
-	if (aim_snlen(sn1) != aim_snlen(sn2))
+	if (aim_snlen(sn1) != aim_snlen(sn2)) {
 		return 1;
+	}
 
 	curPtr1 = sn1;
 	curPtr2 = sn2;
-	while ( (*curPtr1 != (char) '\0') && (*curPtr2 != (char) '\0') ) {
-		if ( (*curPtr1 == ' ') || (*curPtr2 == ' ') ) {
-			if (*curPtr1 == ' ')
+	while ((*curPtr1 != (char) '\0') && (*curPtr2 != (char) '\0')) {
+		if ((*curPtr1 == ' ') || (*curPtr2 == ' ')) {
+			if (*curPtr1 == ' ') {
 				curPtr1++;
-			if (*curPtr2 == ' ')
+			}
+			if (*curPtr2 == ' ') {
 				curPtr2++;
+			}
 		} else {
-			if ( g_ascii_toupper(*curPtr1) != g_ascii_toupper(*curPtr2))
+			if (g_ascii_toupper(*curPtr1) != g_ascii_toupper(*curPtr2)) {
 				return 1;
+			}
 			curPtr1++;
 			curPtr2++;
@@ -65,6 +71,7 @@
 
 	/* Should both be NULL */
-	if (*curPtr1 != *curPtr2)
+	if (*curPtr1 != *curPtr2) {
 		return 1;
+	}
 
 	return 0;
Index: protocols/oscar/rxhandlers.c
===================================================================
--- protocols/oscar/rxhandlers.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/rxhandlers.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -22,7 +22,8 @@
 	aim_module_t *cur;
 
-	for (cur = (aim_module_t *)sess->modlistv; cur; cur = cur->next) {
-		if (cur->family == group)
+	for (cur = (aim_module_t *) sess->modlistv; cur; cur = cur->next) {
+		if (cur->family == group) {
 			return cur;
+		}
 	}
 
@@ -34,7 +35,8 @@
 	aim_module_t *cur;
 
-	for (cur = (aim_module_t *)sess->modlistv; cur; cur = cur->next) {
-		if (strcmp(name, cur->name) == 0)
+	for (cur = (aim_module_t *) sess->modlistv; cur; cur = cur->next) {
+		if (strcmp(name, cur->name) == 0) {
 			return cur;
+		}
 	}
 
@@ -46,9 +48,11 @@
 	aim_module_t *mod;
 
-	if (!sess || !modfirst)
-		return -1;
-
-	if (!(mod = g_new0(aim_module_t,1)))
-		return -1;
+	if (!sess || !modfirst) {
+		return -1;
+	}
+
+	if (!(mod = g_new0(aim_module_t, 1))) {
+		return -1;
+	}
 
 	if (modfirst(sess, mod) == -1) {
@@ -58,11 +62,12 @@
 
 	if (aim__findmodule(sess, mod->name)) {
-		if (mod->shutdown)
+		if (mod->shutdown) {
 			mod->shutdown(sess, mod);
+		}
 		g_free(mod);
 		return -1;
 	}
 
-	mod->next = (aim_module_t *)sess->modlistv;
+	mod->next = (aim_module_t *) sess->modlistv;
 	sess->modlistv = mod;
 
@@ -75,11 +80,12 @@
 	aim_module_t *cur;
 
-	for (cur = (aim_module_t *)sess->modlistv; cur; ) {
+	for (cur = (aim_module_t *) sess->modlistv; cur; ) {
 		aim_module_t *tmp;
 
 		tmp = cur->next;
 
-		if (cur->shutdown)
+		if (cur->shutdown) {
 			cur->shutdown(sess, cur);
+		}
 
 		g_free(cur);
@@ -98,6 +104,7 @@
 	aim_modsnac_t snac;
 
-	if (aim_bstream_empty(&rx->data) < 10)
+	if (aim_bstream_empty(&rx->data) < 10) {
 		return 0;
+	}
 
 	snac.family = aimbs_get16(&rx->data);
@@ -107,18 +114,20 @@
 
 	/* Contains TLV(s) in the FNAC header */
-	if(snac.flags & 0x8000) {
+	if (snac.flags & 0x8000) {
 		aim_bstream_advance(&rx->data, aimbs_get16(&rx->data));
-	} else if(snac.flags & 0x0001) {
+	} else if (snac.flags & 0x0001) {
 		/* Following SNAC will be related */
 	}
 
-	for (cur = (aim_module_t *)sess->modlistv; cur; cur = cur->next) {
-
-		if (!(cur->flags & AIM_MODFLAG_MULTIFAMILY) && 
-				(cur->family != snac.family))
-			continue;
-
-		if (cur->snachandler(sess, cur, rx, &snac, &rx->data))
+	for (cur = (aim_module_t *) sess->modlistv; cur; cur = cur->next) {
+
+		if (!(cur->flags & AIM_MODFLAG_MULTIFAMILY) &&
+		    (cur->family != snac.family)) {
+			continue;
+		}
+
+		if (cur->snachandler(sess, cur, rx, &snac, &rx->data)) {
 			return 1;
+		}
 
 	}
@@ -136,12 +145,14 @@
 	snac.flags = snac.id = 0;
 
-	for (cur = (aim_module_t *)sess->modlistv; cur; cur = cur->next) {
-
-		if (!(cur->flags & AIM_MODFLAG_MULTIFAMILY) && 
-				(cur->family != snac.family))
-			continue;
-
-		if (cur->snachandler(sess, cur, rx, &snac, &rx->data))
+	for (cur = (aim_module_t *) sess->modlistv; cur; cur = cur->next) {
+
+		if (!(cur->flags & AIM_MODFLAG_MULTIFAMILY) &&
+		    (cur->family != snac.family)) {
+			continue;
+		}
+
+		if (cur->snachandler(sess, cur, rx, &snac, &rx->data)) {
 			return 1;
+		}
 
 	}
@@ -165,17 +176,21 @@
 	/* Used only by the older login protocol */
 	/* XXX remove this special case? */
-	if (fr->conn->type == AIM_CONN_TYPE_AUTH)
+	if (fr->conn->type == AIM_CONN_TYPE_AUTH) {
 		return consumenonsnac(sess, fr, 0x0017, 0x0003);
+	}
 
 	tlvlist = aim_readtlvchain(&fr->data);
 
-	if (aim_gettlv(tlvlist, 0x0009, 1))
+	if (aim_gettlv(tlvlist, 0x0009, 1)) {
 		code = aim_gettlv16(tlvlist, 0x0009, 1);
-
-	if (aim_gettlv(tlvlist, 0x000b, 1))
+	}
+
+	if (aim_gettlv(tlvlist, 0x000b, 1)) {
 		msg = aim_gettlv_str(tlvlist, 0x000b, 1);
-
-	if ((userfunc = aim_callhandler(sess, fr->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR))) 
+	}
+
+	if ((userfunc = aim_callhandler(sess, fr->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR))) {
 		ret = userfunc(sess, fr, code, msg);
+	}
 
 	aim_freetlvchain(&tlvlist);
@@ -195,29 +210,32 @@
 		guint16 type;
 	} dontuse[] = {
-		{0x0001, 0x0002},
-		{0x0001, 0x0003},
-		{0x0001, 0x0006},
-		{0x0001, 0x0007},
-		{0x0001, 0x0008},
-		{0x0001, 0x0017},
-		{0x0001, 0x0018},
-		{0x0000, 0x0000}
+		{ 0x0001, 0x0002 },
+		{ 0x0001, 0x0003 },
+		{ 0x0001, 0x0006 },
+		{ 0x0001, 0x0007 },
+		{ 0x0001, 0x0008 },
+		{ 0x0001, 0x0017 },
+		{ 0x0001, 0x0018 },
+		{ 0x0000, 0x0000 }
 	};
 	int i;
 
 	for (i = 0; dontuse[i].group != 0x0000; i++) {
-		if ((dontuse[i].group == group) && (dontuse[i].type == type))
+		if ((dontuse[i].group == group) && (dontuse[i].type == type)) {
 			return 1;
-	}
-
-	return 0;
-}
-
-int aim_conn_addhandler(aim_session_t *sess, aim_conn_t *conn, guint16 family, guint16 type, aim_rxcallback_t newhandler, guint16 flags)
+		}
+	}
+
+	return 0;
+}
+
+int aim_conn_addhandler(aim_session_t *sess, aim_conn_t *conn, guint16 family, guint16 type,
+                        aim_rxcallback_t newhandler, guint16 flags)
 {
 	struct aim_rxcblist_s *newcb;
 
-	if (!conn)
-		return -1;
+	if (!conn) {
+		return -1;
+	}
 
 	if (checkdisallowed(family, type)) {
@@ -226,6 +244,7 @@
 	}
 
-	if (!(newcb = (struct aim_rxcblist_s *)g_new0(struct aim_rxcblist_s, 1)))
-		return -1;
+	if (!(newcb = (struct aim_rxcblist_s *) g_new0(struct aim_rxcblist_s, 1))) {
+		return -1;
+	}
 
 	newcb->family = family;
@@ -235,11 +254,12 @@
 	newcb->next = NULL;
 
-	if (!conn->handlerlist)
-		conn->handlerlist = (void *)newcb;
-	else {
+	if (!conn->handlerlist) {
+		conn->handlerlist = (void *) newcb;
+	} else {
 		struct aim_rxcblist_s *cur;
 
-		for (cur = (struct aim_rxcblist_s *)conn->handlerlist; cur->next; cur = cur->next)
+		for (cur = (struct aim_rxcblist_s *) conn->handlerlist; cur->next; cur = cur->next) {
 			;
+		}
 		cur->next = newcb;
 	}
@@ -252,8 +272,9 @@
 	struct aim_rxcblist_s *cur;
 
-	if (!conn)
-		return -1;
-
-	for (cur = (struct aim_rxcblist_s *)conn->handlerlist; cur; ) {
+	if (!conn) {
+		return -1;
+	}
+
+	for (cur = (struct aim_rxcblist_s *) conn->handlerlist; cur; ) {
 		struct aim_rxcblist_s *tmp;
 
@@ -271,10 +292,12 @@
 	struct aim_rxcblist_s *cur;
 
-	if (!conn)
+	if (!conn) {
 		return NULL;
-
-	for (cur = (struct aim_rxcblist_s *)conn->handlerlist; cur; cur = cur->next) {
-		if ((cur->family == family) && (cur->type == type))
+	}
+
+	for (cur = (struct aim_rxcblist_s *) conn->handlerlist; cur; cur = cur->next) {
+		if ((cur->family == family) && (cur->type == type)) {
 			return cur->handler;
+		}
 	}
 
@@ -286,10 +309,12 @@
 }
 
-static int aim_callhandler_noparam(aim_session_t *sess, aim_conn_t *conn,guint16 family, guint16 type, aim_frame_t *ptr)
+static int aim_callhandler_noparam(aim_session_t *sess, aim_conn_t *conn, guint16 family, guint16 type,
+                                   aim_frame_t *ptr)
 {
 	aim_rxcallback_t userfunc;
 
-	if ((userfunc = aim_callhandler(sess, conn, family, type)))
+	if ((userfunc = aim_callhandler(sess, conn, family, type))) {
 		return userfunc(sess, ptr);
+	}
 
 	return 1; /* XXX */
@@ -322,17 +347,20 @@
 		 */
 
-		if (cur->handled)
-			continue;
+		if (cur->handled) {
+			continue;
+		}
 
 		if (cur->hdr.flap.type == 0x01) {
-			
-			cur->handled = aim_callhandler_noparam(sess, cur->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_FLAPVER, cur); /* XXX use consumenonsnac */
-			
-			continue;
-			
+
+			cur->handled = aim_callhandler_noparam(sess, cur->conn, AIM_CB_FAM_SPECIAL,
+			                                       AIM_CB_SPECIAL_FLAPVER, cur);                                      /* XXX use consumenonsnac */
+
+			continue;
+
 		} else if (cur->hdr.flap.type == 0x02) {
 
-			if ((cur->handled = consumesnac(sess, cur)))
+			if ((cur->handled = consumesnac(sess, cur))) {
 				continue;
+			}
 
 		} else if (cur->hdr.flap.type == 0x04) {
@@ -341,7 +369,8 @@
 			continue;
 
-		} else if (cur->hdr.flap.type == 0x05)
+		} else if (cur->hdr.flap.type == 0x05) {
 			;
-		
+		}
+
 		if (!cur->handled) {
 			consumenonsnac(sess, cur, 0xffff, 0xffff); /* last chance! */
@@ -350,5 +379,5 @@
 	}
 
-	/* 
+	/*
 	 * This doesn't have to be called here.  It could easily be done
 	 * by a seperate thread or something. It's an administrative operation,
Index: protocols/oscar/rxqueue.c
===================================================================
--- protocols/oscar/rxqueue.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/rxqueue.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -7,5 +7,5 @@
  */
 
-#include <aim.h> 
+#include <aim.h>
 
 #include <sys/socket.h>
@@ -16,14 +16,15 @@
 int aim_recv(int fd, void *buf, size_t count)
 {
-	int left, cur; 
+	int left, cur;
 
 	for (cur = 0, left = count; left; ) {
 		int ret;
-		
-		ret = recv(fd, ((unsigned char *)buf)+cur, left, 0);
+
+		ret = recv(fd, ((unsigned char *) buf) + cur, left, 0);
 
 		/* Of course EOF is an error, only morons disagree with that. */
-		if (ret <= 0)
+		if (ret <= 0) {
 			return -1;
+		}
 
 		cur += ret;
@@ -42,16 +43,19 @@
 	int red = 0;
 
-	if (!bs || (fd < 0) || (count < 0))
+	if (!bs || (fd < 0) || (count < 0)) {
 		return -1;
-	
-	if (count > (bs->len - bs->offset))
+	}
+
+	if (count > (bs->len - bs->offset)) {
 		count = bs->len - bs->offset; /* truncate to remaining space */
 
+	}
 	if (count) {
 
 		red = aim_recv(fd, bs->data + bs->offset, count);
 
-		if (red <= 0)
+		if (red <= 0) {
 			return -1;
+		}
 	}
 
@@ -63,7 +67,8 @@
 int aim_bstream_init(aim_bstream_t *bs, guint8 *data, int len)
 {
-	
-	if (!bs)
+
+	if (!bs) {
 		return -1;
+	}
 
 	bs->data = data;
@@ -87,6 +92,7 @@
 {
 
-	if (off > bs->len)
+	if (off > bs->len) {
 		return -1;
+	}
 
 	bs->offset = off;
@@ -106,7 +112,8 @@
 {
 
-	if (aim_bstream_empty(bs) < n)
-		return 0; /* XXX throw an exception */
-
+	if (aim_bstream_empty(bs) < n) {
+		return 0; /* XXX throw an exception */
+
+	}
 	bs->offset += n;
 
@@ -116,10 +123,11 @@
 guint8 aimbs_get8(aim_bstream_t *bs)
 {
-	
-	if (aim_bstream_empty(bs) < 1)
-		return 0; /* XXX throw an exception */
-	
+
+	if (aim_bstream_empty(bs) < 1) {
+		return 0; /* XXX throw an exception */
+
+	}
 	bs->offset++;
-	
+
 	return aimutil_get8(bs->data + bs->offset - 1);
 }
@@ -127,10 +135,11 @@
 guint16 aimbs_get16(aim_bstream_t *bs)
 {
-	
-	if (aim_bstream_empty(bs) < 2)
-		return 0; /* XXX throw an exception */
-	
+
+	if (aim_bstream_empty(bs) < 2) {
+		return 0; /* XXX throw an exception */
+
+	}
 	bs->offset += 2;
-	
+
 	return aimutil_get16(bs->data + bs->offset - 2);
 }
@@ -138,10 +147,11 @@
 guint32 aimbs_get32(aim_bstream_t *bs)
 {
-	
-	if (aim_bstream_empty(bs) < 4)
-		return 0; /* XXX throw an exception */
-	
+
+	if (aim_bstream_empty(bs) < 4) {
+		return 0; /* XXX throw an exception */
+
+	}
 	bs->offset += 4;
-	
+
 	return aimutil_get32(bs->data + bs->offset - 4);
 }
@@ -149,10 +159,11 @@
 guint8 aimbs_getle8(aim_bstream_t *bs)
 {
-	
-	if (aim_bstream_empty(bs) < 1)
-		return 0; /* XXX throw an exception */
-	
+
+	if (aim_bstream_empty(bs) < 1) {
+		return 0; /* XXX throw an exception */
+
+	}
 	bs->offset++;
-	
+
 	return aimutil_getle8(bs->data + bs->offset - 1);
 }
@@ -160,10 +171,11 @@
 guint16 aimbs_getle16(aim_bstream_t *bs)
 {
-	
-	if (aim_bstream_empty(bs) < 2)
-		return 0; /* XXX throw an exception */
-	
+
+	if (aim_bstream_empty(bs) < 2) {
+		return 0; /* XXX throw an exception */
+
+	}
 	bs->offset += 2;
-	
+
 	return aimutil_getle16(bs->data + bs->offset - 2);
 }
@@ -171,10 +183,11 @@
 guint32 aimbs_getle32(aim_bstream_t *bs)
 {
-	
-	if (aim_bstream_empty(bs) < 4)
-		return 0; /* XXX throw an exception */
-	
+
+	if (aim_bstream_empty(bs) < 4) {
+		return 0; /* XXX throw an exception */
+
+	}
 	bs->offset += 4;
-	
+
 	return aimutil_getle32(bs->data + bs->offset - 4);
 }
@@ -183,7 +196,8 @@
 {
 
-	if (aim_bstream_empty(bs) < 1)
-		return 0; /* XXX throw an exception */
-
+	if (aim_bstream_empty(bs) < 1) {
+		return 0; /* XXX throw an exception */
+
+	}
 	bs->offset += aimutil_put8(bs->data + bs->offset, v);
 
@@ -194,7 +208,8 @@
 {
 
-	if (aim_bstream_empty(bs) < 2)
-		return 0; /* XXX throw an exception */
-
+	if (aim_bstream_empty(bs) < 2) {
+		return 0; /* XXX throw an exception */
+
+	}
 	bs->offset += aimutil_put16(bs->data + bs->offset, v);
 
@@ -205,7 +220,8 @@
 {
 
-	if (aim_bstream_empty(bs) < 4)
-		return 0; /* XXX throw an exception */
-
+	if (aim_bstream_empty(bs) < 4) {
+		return 0; /* XXX throw an exception */
+
+	}
 	bs->offset += aimutil_put32(bs->data + bs->offset, v);
 
@@ -216,7 +232,8 @@
 {
 
-	if (aim_bstream_empty(bs) < 1)
-		return 0; /* XXX throw an exception */
-
+	if (aim_bstream_empty(bs) < 1) {
+		return 0; /* XXX throw an exception */
+
+	}
 	bs->offset += aimutil_putle8(bs->data + bs->offset, v);
 
@@ -227,7 +244,8 @@
 {
 
-	if (aim_bstream_empty(bs) < 2)
-		return 0; /* XXX throw an exception */
-
+	if (aim_bstream_empty(bs) < 2) {
+		return 0; /* XXX throw an exception */
+
+	}
 	bs->offset += aimutil_putle16(bs->data + bs->offset, v);
 
@@ -238,7 +256,8 @@
 {
 
-	if (aim_bstream_empty(bs) < 4)
-		return 0; /* XXX throw an exception */
-
+	if (aim_bstream_empty(bs) < 4) {
+		return 0; /* XXX throw an exception */
+
+	}
 	bs->offset += aimutil_putle32(bs->data + bs->offset, v);
 
@@ -249,6 +268,7 @@
 {
 
-	if (aim_bstream_empty(bs) < len)
+	if (aim_bstream_empty(bs) < len) {
 		return 0;
+	}
 
 	memcpy(buf, bs->data + bs->offset, len);
@@ -262,6 +282,7 @@
 	guint8 *ob;
 
-	if (!(ob = g_malloc(len)))
+	if (!(ob = g_malloc(len))) {
 		return NULL;
+	}
 
 	if (aimbs_getrawbuf(bs, ob, len) < len) {
@@ -277,6 +298,7 @@
 	guint8 *ob;
 
-	if (!(ob = g_malloc(len+1)))
+	if (!(ob = g_malloc(len + 1))) {
 		return NULL;
+	}
 
 	if (aimbs_getrawbuf(bs, ob, len) < len) {
@@ -284,8 +306,8 @@
 		return NULL;
 	}
-	
+
 	ob[len] = '\0';
 
-	return (char *)ob;
+	return (char *) ob;
 }
 
@@ -293,7 +315,8 @@
 {
 
-	if (aim_bstream_empty(bs) < len)
-		return 0; /* XXX throw an exception */
-
+	if (aim_bstream_empty(bs) < len) {
+		return 0; /* XXX throw an exception */
+
+	}
 	memcpy(bs->data + bs->offset, v, len);
 	bs->offset += len;
@@ -305,10 +328,12 @@
 {
 
-	if (aim_bstream_empty(srcbs) < len)
+	if (aim_bstream_empty(srcbs) < len) {
 		return 0; /* XXX throw exception (underrun) */
 
-	if (aim_bstream_empty(bs) < len)
+	}
+	if (aim_bstream_empty(bs) < len) {
 		return 0; /* XXX throw exception (overflow) */
 
+	}
 	memcpy(bs->data + bs->offset, srcbs->data + srcbs->offset, len);
 	bs->offset += len;
@@ -319,8 +344,8 @@
 
 /**
- * aim_frame_destroy - free aim_frame_t 
- * @frame: the frame to free  
- *
- * returns -1 on error; 0 on success.  
+ * aim_frame_destroy - free aim_frame_t
+ * @frame: the frame to free
+ *
+ * returns -1 on error; 0 on success.
  *
  */
@@ -331,5 +356,5 @@
 
 	g_free(frame);
-} 
+}
 
 
@@ -344,23 +369,26 @@
 	aim_frame_t *newrx;
 	guint16 payloadlen;
-	
-	if (!sess || !conn)
+
+	if (!sess || !conn) {
 		return 0;
-
-	if (conn->fd == -1)
+	}
+
+	if (conn->fd == -1) {
 		return -1; /* its a aim_conn_close()'d connection */
 
+	}
 	/* KIDS, THIS IS WHAT HAPPENS IF YOU USE CODE WRITTEN FOR GUIS IN A DAEMON!
-	   
+
 	   And wouldn't it make sense to return something that prevents this function
 	   from being called again IMMEDIATELY (and making the program suck up all
 	   CPU time)?...
-	   
+
 	if (conn->fd < 3)
-		return 0;
+	        return 0;
 	*/
 
-	if (conn->status & AIM_CONN_STATUS_INPROGRESS)
+	if (conn->status & AIM_CONN_STATUS_INPROGRESS) {
 		return aim_conn_completeconnect(sess, conn);
+	}
 
 	aim_bstream_init(&flaphdr, flaphdr_raw, sizeof(flaphdr_raw));
@@ -368,8 +396,8 @@
 	/*
 	 * Read FLAP header.  Six bytes:
-	 *    
+	 *
 	 *   0 char  -- Always 0x2a
 	 *   1 char  -- Channel ID.  Usually 2 -- 1 and 4 are used during login.
-	 *   2 short -- Sequence number 
+	 *   2 short -- Sequence number
 	 *   4 short -- Number of data bytes that follow.
 	 */
@@ -391,13 +419,14 @@
 		aim_conn_close(conn);
 		return -1;
-	}	
+	}
 
 	/* allocate a new struct */
-	if (!(newrx = (aim_frame_t *)g_new0(aim_frame_t,1)))
+	if (!(newrx = (aim_frame_t *) g_new0(aim_frame_t, 1))) {
 		return -1;
+	}
 
 	/* we're doing FLAP if we're here */
 	newrx->hdrtype = AIM_FRAMETYPE_FLAP;
-	
+
 	newrx->hdr.flap.type = aimbs_get8(&flaphdr);
 	newrx->hdr.flap.seqnum = aimbs_get16(&flaphdr);
@@ -422,6 +451,7 @@
 			return -1;
 		}
-	} else
+	} else {
 		aim_bstream_init(&newrx->data, NULL, 0);
+	}
 
 
@@ -432,11 +462,12 @@
 	newrx->next = NULL;  /* this will always be at the bottom */
 
-	if (!sess->queue_incoming)
+	if (!sess->queue_incoming) {
 		sess->queue_incoming = newrx;
-	else {
+	} else {
 		aim_frame_t *cur;
 
-		for (cur = sess->queue_incoming; cur->next; cur = cur->next)
+		for (cur = sess->queue_incoming; cur->next; cur = cur->next) {
 			;
+		}
 		cur->next = newrx;
 	}
@@ -444,5 +475,5 @@
 	newrx->conn->lastactivity = time(NULL);
 
-	return 0;  
+	return 0;
 }
 
@@ -450,7 +481,7 @@
  * Purge recieve queue of all handled commands (->handled==1).  Also
  * allows for selective freeing using ->nofree so that the client can
- * keep the data for various purposes.  
- *
- * If ->nofree is nonzero, the frame will be delinked from the global list, 
+ * keep the data for various purposes.
+ *
+ * If ->nofree is nonzero, the frame will be delinked from the global list,
  * but will not be free'ed.  The client _must_ keep a pointer to the
  * data -- libfaim will not!  If the client marks ->nofree but
@@ -466,10 +497,12 @@
 
 			*prev = cur->next;
-			
-			if (!cur->nofree)
+
+			if (!cur->nofree) {
 				aim_frame_destroy(cur);
-
-		} else
+			}
+
+		} else {
 			prev = &cur->next;
+		}
 	}
 
@@ -489,7 +522,8 @@
 
 	for (currx = sess->queue_incoming; currx; currx = currx->next) {
-		if ((!currx->handled) && (currx->conn == conn))
+		if ((!currx->handled) && (currx->conn == conn)) {
 			currx->handled = 1;
-	}	
+		}
+	}
 	return;
 }
Index: protocols/oscar/search.c
===================================================================
--- protocols/oscar/search.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/search.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -22,10 +22,12 @@
 	}
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, snac2->data /* address */);
+	}
 
 	/* XXX freesnac()? */
-	if (snac2)
+	if (snac2) {
 		g_free(snac2->data);
+	}
 	g_free(snac2);
 
@@ -42,6 +44,7 @@
 	char *searchaddr = NULL;
 
-	if ((snac2 = aim_remsnac(sess, snac->id)))
-		searchaddr = (char *)snac2->data;
+	if ((snac2 = aim_remsnac(sess, snac->id))) {
+		searchaddr = (char *) snac2->data;
+	}
 
 	tlvlist = aim_readtlvchain(bs);
@@ -49,21 +52,23 @@
 
 	/* XXX uhm. */
-	while ((cur = aim_gettlv_str(tlvlist, 0x0001, j+1)) && j < m) {
-		buf = g_realloc(buf, (j+1) * (MAXSNLEN+1));
+	while ((cur = aim_gettlv_str(tlvlist, 0x0001, j + 1)) && j < m) {
+		buf = g_realloc(buf, (j + 1) * (MAXSNLEN + 1));
 
-		strncpy(&buf[j * (MAXSNLEN+1)], cur, MAXSNLEN);
+		strncpy(&buf[j * (MAXSNLEN + 1)], cur, MAXSNLEN);
 		g_free(cur);
 
-		j++; 
+		j++;
 	}
 
 	aim_freetlvchain(&tlvlist);
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, searchaddr, j, buf);
+	}
 
 	/* XXX freesnac()? */
-	if (snac2)
+	if (snac2) {
 		g_free(snac2->data);
+	}
 	g_free(snac2);
 
@@ -76,8 +81,9 @@
 {
 
-	if (snac->subtype == 0x0001)
+	if (snac->subtype == 0x0001) {
 		return error(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x0003)
+	} else if (snac->subtype == 0x0003) {
 		return reply(sess, mod, rx, snac, bs);
+	}
 
 	return 0;
Index: protocols/oscar/service.c
===================================================================
--- protocols/oscar/service.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/service.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -11,14 +11,16 @@
 int aim_clientready(aim_session_t *sess, aim_conn_t *conn)
 {
-	aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside;
+	aim_conn_inside_t *ins = (aim_conn_inside_t *) conn->inside;
 	struct snacgroup *sg;
 	aim_frame_t *fr;
 	aim_snacid_t snacid;
 
-	if (!ins)
+	if (!ins) {
 		return -EINVAL;
-
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152)))
+	}
+
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152))) {
 		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, 0x0001, 0x0002, 0x0000, NULL, 0);
@@ -27,5 +29,5 @@
 	/*
 	 * Send only the tool versions that the server cares about (that it
-	 * marked as supporting in the server ready SNAC).  
+	 * marked as supporting in the server ready SNAC).
 	 */
 	for (sg = ins->groups; sg; sg = sg->next) {
@@ -37,5 +39,5 @@
 			aimbs_put16(&fr->data, mod->toolid);
 			aimbs_put16(&fr->data, mod->toolversion);
-		} 
+		}
 	}
 
@@ -47,5 +49,5 @@
 /*
  * Host Online (group 1, type 3)
- * 
+ *
  * See comments in conn.c about how the group associations are supposed
  * to work, and how they really work.
@@ -55,7 +57,7 @@
  * We don't actually call the client here.  This starts off the connection
  * initialization routine required by all AIM connections.  The next time
- * the client is called is the CONNINITDONE callback, which should be 
+ * the client is called is the CONNINITDONE callback, which should be
  * shortly after the rate information is acknowledged.
- * 
+ *
  */
 static int hostonline(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
@@ -65,6 +67,7 @@
 
 
-	if (!(families = g_malloc(aim_bstream_empty(bs))))
+	if (!(families = g_malloc(aim_bstream_empty(bs)))) {
 		return 0;
+	}
 
 	for (famcount = 0; aim_bstream_empty(bs); famcount++) {
@@ -86,5 +89,5 @@
 	aim_setversions(sess, rx->conn);
 
-	return 1; 
+	return 1;
 }
 
@@ -109,6 +112,6 @@
 
 	if (!aim_gettlv(tlvlist, 0x000d, 1) ||
-			!aim_gettlv(tlvlist, 0x0005, 1) ||
-			!aim_gettlv(tlvlist, 0x0006, 1)) {
+	    !aim_gettlv(tlvlist, 0x0005, 1) ||
+	    !aim_gettlv(tlvlist, 0x0006, 1)) {
 		aim_freetlvchain(&tlvlist);
 		return 0;
@@ -117,5 +120,5 @@
 	redir.group = aim_gettlv16(tlvlist, 0x000d, 1);
 	redir.ip = aim_gettlv_str(tlvlist, 0x0005, 1);
-	redir.cookie = (guint8 *)aim_gettlv_str(tlvlist, 0x0006, 1);
+	redir.cookie = (guint8 *) aim_gettlv_str(tlvlist, 0x0006, 1);
 
 	/* Fetch original SNAC so we can get csi if needed */
@@ -123,5 +126,5 @@
 
 	if ((redir.group == AIM_CONN_TYPE_CHAT) && origsnac) {
-		struct chatsnacinfo *csi = (struct chatsnacinfo *)origsnac->data;
+		struct chatsnacinfo *csi = (struct chatsnacinfo *) origsnac->data;
 
 		redir.chat.exchange = csi->exchange;
@@ -130,12 +133,14 @@
 	}
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, &redir);
-
-	g_free((void *)redir.ip);
-	g_free((void *)redir.cookie);
-
-	if (origsnac)
+	}
+
+	g_free((void *) redir.ip);
+	g_free((void *) redir.cookie);
+
+	if (origsnac) {
 		g_free(origsnac->data);
+	}
 	g_free(origsnac);
 
@@ -157,5 +162,5 @@
  * it.  The rate classes, their limiting properties, and the definitions
  * of which SNACs are belong to which class, are defined in the
- * Rate Response packet at login to each host.  
+ * Rate Response packet at login to each host.
  *
  * Logically, all rate offenses within one class count against further
@@ -171,8 +176,8 @@
  *
  *  Rate class 0x0001:
- *  	- Everything thats not in any of the other classes
+ *      - Everything thats not in any of the other classes
  *
  *  Rate class 0x0002:
- * 	- Buddy list add/remove
+ *      - Buddy list add/remove
  *	- Permit list add/remove
  *	- Deny list add/remove
@@ -190,5 +195,5 @@
  *
  * The only other thing of note is that class 5 (chat) has slightly looser
- * limiting properties than class 3 (normal messages).  But thats just a 
+ * limiting properties than class 3 (normal messages).  But thats just a
  * small bit of trivia for you.
  *
@@ -196,5 +201,5 @@
  * system is how the actual numbers relate to the passing of time.  This
  * seems to be a big mystery.
- * 
+ *
  */
 
@@ -203,17 +208,20 @@
 	struct rateclass *rc, *rc2;
 
-	if (!(rc = g_malloc(sizeof(struct rateclass))))
+	if (!(rc = g_malloc(sizeof(struct rateclass)))) {
 		return;
+	}
 
 	memcpy(rc, inrc, sizeof(struct rateclass));
 	rc->next = NULL;
 
-	for (rc2 = *head; rc2 && rc2->next; rc2 = rc2->next)
+	for (rc2 = *head; rc2 && rc2->next; rc2 = rc2->next) {
 		;
-
-	if (!rc2)
+	}
+
+	if (!rc2) {
 		*head = rc;
-	else
+	} else {
 		rc2->next = rc;
+	}
 
 	return;
@@ -225,6 +233,7 @@
 
 	for (rc = *head; rc; rc = rc->next) {
-		if (rc->classid == id)
+		if (rc->classid == id) {
 			return rc;
+		}
 	}
 
@@ -236,6 +245,7 @@
 	struct snacpair *sp, *sp2;
 
-	if (!(sp = g_new0(struct snacpair, 1)))
+	if (!(sp = g_new0(struct snacpair, 1))) {
 		return;
+	}
 
 	sp->group = group;
@@ -243,11 +253,13 @@
 	sp->next = NULL;
 
-	for (sp2 = rc->members; sp2 && sp2->next; sp2 = sp2->next)
+	for (sp2 = rc->members; sp2 && sp2->next; sp2 = sp2->next) {
 		;
-
-	if (!sp2)
+	}
+
+	if (!sp2) {
 		rc->members = sp;
-	else
+	} else {
 		sp2->next = sp;
+	}
 
 	return;
@@ -257,5 +269,5 @@
 static int rateresp(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
 {
-	aim_conn_inside_t *ins = (aim_conn_inside_t *)rx->conn->inside;
+	aim_conn_inside_t *ins = (aim_conn_inside_t *) rx->conn->inside;
 	guint16 numclasses, i;
 	aim_rxcallback_t userfunc;
@@ -284,9 +296,10 @@
 		 * depending on the version we advertised in 1/17.  If we
 		 * didn't send 1/17 (evil!), then this will crash and you
-		 * die, as it will default to the old version but we have 
-		 * the new version hardcoded here. 
+		 * die, as it will default to the old version but we have
+		 * the new version hardcoded here.
 		 */
-		if (mod->version >= 3)
+		if (mod->version >= 3) {
 			aimbs_getrawbuf(bs, rc.unknown, sizeof(rc.unknown));
+		}
 
 		rc_addclass(&ins->rates, &rc);
@@ -312,6 +325,7 @@
 			subtype = aimbs_get16(bs);
 
-			if (rc)
+			if (rc) {
 				rc_addpair(rc, group, subtype);
+			}
 		}
 	}
@@ -332,6 +346,7 @@
 	 * Finally, tell the client it's ready to go...
 	 */
-	if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNINITDONE))) {
 		userfunc(sess, rx);
+	}
 
 
@@ -342,17 +357,19 @@
 int aim_rates_addparam(aim_session_t *sess, aim_conn_t *conn)
 {
-	aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside;
-	aim_frame_t *fr;	
+	aim_conn_inside_t *ins = (aim_conn_inside_t *) conn->inside;
+	aim_frame_t *fr;
 	aim_snacid_t snacid;
 	struct rateclass *rc;
 
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 512)))
-		return -ENOMEM; 
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 512))) {
+		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, 0x0001, 0x0008, 0x0000, NULL, 0);
 	aim_putsnac(&fr->data, 0x0001, 0x0008, 0x0000, snacid);
 
-	for (rc = ins->rates; rc; rc = rc->next)
+	for (rc = ins->rates; rc; rc = rc->next) {
 		aimbs_put16(&fr->data, rc->classid);
+	}
 
 	aim_tx_enqueue(sess, fr);
@@ -370,5 +387,5 @@
 	code = aimbs_get16(bs);
 	rateclass = aimbs_get16(bs);
-	
+
 	windowsize = aimbs_get32(bs);
 	clear = aimbs_get32(bs);
@@ -379,6 +396,8 @@
 	maxavg = aimbs_get32(bs);
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
-		return userfunc(sess, rx, code, rateclass, windowsize, clear, alert, limit, disconnect, currentavg, maxavg);
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
+		return userfunc(sess, rx, code, rateclass, windowsize, clear, alert, limit, disconnect, currentavg,
+		                maxavg);
+	}
 
 	return 0;
@@ -386,10 +405,10 @@
 
 /*
- * How Migrations work.  
- *
- * The server sends a Server Pause message, which the client should respond to 
- * with a Server Pause Ack, which contains the families it needs on this 
- * connection. The server will send a Migration Notice with an IP address, and 
- * then disconnect. Next the client should open the connection and send the 
+ * How Migrations work.
+ *
+ * The server sends a Server Pause message, which the client should respond to
+ * with a Server Pause Ack, which contains the families it needs on this
+ * connection. The server will send a Migration Notice with an IP address, and
+ * then disconnect. Next the client should open the connection and send the
  * cookie.  Repeat the normal login process and pretend this never happened.
  *
@@ -403,6 +422,7 @@
 	aim_rxcallback_t userfunc;
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		return userfunc(sess, rx);
+	}
 
 	return 0;
@@ -414,6 +434,7 @@
 	aim_rxcallback_t userfunc;
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		return userfunc(sess, rx);
+	}
 
 	return 0;
@@ -434,6 +455,7 @@
 	aim_extractuserinfo(sess, bs, &userinfo);
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		return userfunc(sess, rx, &userinfo);
+	}
 
 	return 0;
@@ -448,12 +470,14 @@
 
 	memset(&userinfo, 0, sizeof(aim_userinfo_t));
-	
+
 	newevil = aimbs_get16(bs);
 
-	if (aim_bstream_empty(bs))
+	if (aim_bstream_empty(bs)) {
 		aim_extractuserinfo(sess, bs, &userinfo);
-
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	}
+
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		return userfunc(sess, rx, newevil, &userinfo);
+	}
 
 	return 0;
@@ -464,5 +488,5 @@
  *
  * This is the final SNAC sent on the original connection during a migration.
- * It contains the IP and cookie used to connect to the new server, and 
+ * It contains the IP and cookie used to connect to the new server, and
  * optionally a list of the SNAC groups being migrated.
  *
@@ -482,5 +506,5 @@
 	 * moves to the new server.  When not all the groups for a connection
 	 * are migrated, or they are all migrated but some groups are moved
-	 * to a different server than others, it is called a bifurcated 
+	 * to a different server than others, it is called a bifurcated
 	 * migration.
 	 *
@@ -497,11 +521,13 @@
 	tl = aim_readtlvchain(bs);
 
-	if (aim_gettlv(tl, 0x0005, 1))
+	if (aim_gettlv(tl, 0x0005, 1)) {
 		ip = aim_gettlv_str(tl, 0x0005, 1);
+	}
 
 	cktlv = aim_gettlv(tl, 0x0006, 1);
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, ip, cktlv ? cktlv->value : NULL);
+	}
 
 	aim_freetlvchain(&tl);
@@ -528,11 +554,11 @@
 	 *   3 System bulletin
 	 *   4 Nothing's wrong ("top o the world" -- normal)
-	 *   5 Lets-break-something. 
+	 *   5 Lets-break-something.
 	 *
 	 */
 	id = aimbs_get16(bs);
 
-	/* 
-	 * TLVs follow 
+	/*
+	 * TLVs follow
 	 */
 	tlvlist = aim_readtlvchain(bs);
@@ -540,6 +566,7 @@
 	msg = aim_gettlv_str(tlvlist, 0x000b, 1);
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, id, msg);
+	}
 
 	g_free(msg);
@@ -550,5 +577,5 @@
 }
 
-/* 
+/*
  * Set privacy flags (group 1, type 0x14)
  *
@@ -565,12 +592,12 @@
 
 
-/* 
- * Set client versions (group 1, subtype 0x17) 
- *
- * If you've seen the clientonline/clientready SNAC you're probably 
+/*
+ * Set client versions (group 1, subtype 0x17)
+ *
+ * If you've seen the clientonline/clientready SNAC you're probably
  * wondering what the point of this one is.  And that point seems to be
  * that the versions in the client online SNAC are sent too late for the
  * server to be able to use them to change the protocol for the earlier
- * login packets (client versions are sent right after Host Online is 
+ * login packets (client versions are sent right after Host Online is
  * received, but client online versions aren't sent until quite a bit later).
  * We can see them already making use of this by changing the format of
@@ -580,14 +607,16 @@
 int aim_setversions(aim_session_t *sess, aim_conn_t *conn)
 {
-	aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside;
+	aim_conn_inside_t *ins = (aim_conn_inside_t *) conn->inside;
 	struct snacgroup *sg;
 	aim_frame_t *fr;
 	aim_snacid_t snacid;
 
-	if (!ins)
+	if (!ins) {
 		return -EINVAL;
-
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152)))
+	}
+
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152))) {
 		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, 0x0001, 0x0017, 0x0000, NULL, 0);
@@ -596,5 +625,5 @@
 	/*
 	 * Send only the versions that the server cares about (that it
-	 * marked as supporting in the server ready SNAC).  
+	 * marked as supporting in the server ready SNAC).
 	 */
 	for (sg = ins->groups; sg; sg = sg->next) {
@@ -630,10 +659,10 @@
 }
 
-/* 
+/*
  * Subtype 0x001e - Extended Status
  *
  * Sets your ICQ status (available, away, do not disturb, etc.)
  *
- * These are the same TLVs seen in user info.  You can 
+ * These are the same TLVs seen in user info.  You can
  * also set 0x0008 and 0x000c.
  */
@@ -647,19 +676,21 @@
 
 	data = AIM_ICQ_STATE_HIDEIP | status; /* yay for error checking ;^) */
-	
-	if (ic && set_getbool(&ic->acc->set, "web_aware"))
+
+	if (ic && set_getbool(&ic->acc->set, "web_aware")) {
 		data |= AIM_ICQ_STATE_WEBAWARE;
+	}
 
 	aim_addtlvtochain32(&tl, 0x0006, data); /* tlvlen */
 
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 8)))
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10 + 8))) {
 		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, 0x0001, 0x001e, 0x0000, NULL, 0);
 	aim_putsnac(&fr->data, 0x0001, 0x001e, 0x0000, snacid);
-	
+
 	aim_writetlvchain(&fr->data, &tl);
 	aim_freetlvchain(&tl);
-	
+
 	aim_tx_enqueue(sess, fr);
 
@@ -688,12 +719,12 @@
  * the data that the specific client should have, the client will get the
  * following message from "AOL Instant Messenger":
- *    "You have been disconnected from the AOL Instant Message Service (SM) 
+ *    "You have been disconnected from the AOL Instant Message Service (SM)
  *     for accessing the AOL network using unauthorized software.  You can
- *     download a FREE, fully featured, and authorized client, here 
+ *     download a FREE, fully featured, and authorized client, here
  *     http://www.aol.com/aim/download2.html"
  * The connection is then closed, recieving disconnect code 1, URL
- * http://www.aim.aol.com/errors/USER_LOGGED_OFF_NEW_LOGIN.html.  
- *
- * Note, however, that numerous inconsistencies can cause the above error, 
+ * http://www.aim.aol.com/errors/USER_LOGGED_OFF_NEW_LOGIN.html.
+ *
+ * Note, however, that numerous inconsistencies can cause the above error,
  * not just sending back a bad hash.  Do not immediatly suspect this code
  * if you get disconnected.  AOL and the open/free software community have
@@ -718,6 +749,7 @@
 	modname = aim_gettlv_str(list, 0x0001, 1);
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		return userfunc(sess, rx, offset, len, modname);
+	}
 
 	g_free(modname);
@@ -730,28 +762,29 @@
 {
 
-	if (snac->subtype == 0x0003)
+	if (snac->subtype == 0x0003) {
 		return hostonline(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x0005)
+	} else if (snac->subtype == 0x0005) {
 		return redirect(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x0007)
+	} else if (snac->subtype == 0x0007) {
 		return rateresp(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x000a)
+	} else if (snac->subtype == 0x000a) {
 		return ratechange(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x000b)
+	} else if (snac->subtype == 0x000b) {
 		return serverpause(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x000d)
+	} else if (snac->subtype == 0x000d) {
 		return serverresume(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x000f)
+	} else if (snac->subtype == 0x000f) {
 		return selfinfo(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x0010)
+	} else if (snac->subtype == 0x0010) {
 		return evilnotify(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x0012)
+	} else if (snac->subtype == 0x0012) {
 		return migrate(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x0013)
+	} else if (snac->subtype == 0x0013) {
 		return motd(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x0018)
+	} else if (snac->subtype == 0x0018) {
 		return hostversions(sess, mod, rx, snac, bs);
-	else if (snac->subtype == 0x001f)
+	} else if (snac->subtype == 0x001f) {
 		return memrequest(sess, mod, rx, snac, bs);
+	}
 
 	return 0;
Index: protocols/oscar/snac.c
===================================================================
--- protocols/oscar/snac.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/snac.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -1,9 +1,9 @@
 /*
  *
- * Various SNAC-related dodads... 
+ * Various SNAC-related dodads...
  *
  * outstanding_snacs is a list of aim_snac_t structs.  A SNAC should be added
  * whenever a new SNAC is sent and it should remain in the list until the
- * response for it has been receieved.  
+ * response for it has been receieved.
  *
  * cleansnacs() should be called periodically by the client in order
@@ -24,11 +24,13 @@
 	int i;
 
-	for (i = 0; i < AIM_SNAC_HASH_SIZE; i++)
+	for (i = 0; i < AIM_SNAC_HASH_SIZE; i++) {
 		sess->snac_hash[i] = NULL;
+	}
 
 	return;
 }
 
-aim_snacid_t aim_cachesnac(aim_session_t *sess, const guint16 family, const guint16 type, const guint16 flags, const void *data, const int datalen)
+aim_snacid_t aim_cachesnac(aim_session_t *sess, const guint16 family, const guint16 type, const guint16 flags,
+                           const void *data, const int datalen)
 {
 	aim_snac_t snac;
@@ -40,9 +42,11 @@
 
 	if (datalen) {
-		if (!(snac.data = g_malloc(datalen)))
+		if (!(snac.data = g_malloc(datalen))) {
 			return 0; /* er... */
+		}
 		memcpy(snac.data, data, datalen);
-	} else
+	} else {
 		snac.data = NULL;
+	}
 
 	return aim_newsnac(sess, &snac);
@@ -58,9 +62,11 @@
 	int index;
 
-	if (!newsnac)
+	if (!newsnac) {
 		return 0;
+	}
 
-	if (!(snac = g_malloc(sizeof(aim_snac_t))))
+	if (!(snac = g_malloc(sizeof(aim_snac_t)))) {
 		return 0;
+	}
 	memcpy(snac, newsnac, sizeof(aim_snac_t));
 	snac->issuetime = time(NULL);
@@ -68,6 +74,6 @@
 	index = snac->id % AIM_SNAC_HASH_SIZE;
 
-	snac->next = (aim_snac_t *)sess->snac_hash[index];
-	sess->snac_hash[index] = (void *)snac;
+	snac->next = (aim_snac_t *) sess->snac_hash[index];
+	sess->snac_hash[index] = (void *) snac;
 
 	return snac->id;
@@ -75,5 +81,5 @@
 
 /*
- * Finds a snac structure with the passed SNAC ID, 
+ * Finds a snac structure with the passed SNAC ID,
  * removes it from the list/hash, and returns a pointer to it.
  *
@@ -81,5 +87,5 @@
  *
  */
-aim_snac_t *aim_remsnac(aim_session_t *sess, aim_snacid_t id) 
+aim_snac_t *aim_remsnac(aim_session_t *sess, aim_snacid_t id)
 {
 	aim_snac_t *cur, **prev;
@@ -88,10 +94,11 @@
 	index = id % AIM_SNAC_HASH_SIZE;
 
-	for (prev = (aim_snac_t **)&sess->snac_hash[index]; (cur = *prev); ) {
+	for (prev = (aim_snac_t **) &sess->snac_hash[index]; (cur = *prev); ) {
 		if (cur->id == id) {
 			*prev = cur->next;
 			return cur;
-		} else
+		} else {
 			prev = &cur->next;
+		}
 	}
 
@@ -114,10 +121,11 @@
 		time_t curtime;
 
-		if (!sess->snac_hash[i])
+		if (!sess->snac_hash[i]) {
 			continue;
+		}
 
 		curtime = time(NULL); /* done here in case we waited for the lock */
 
-		for (prev = (aim_snac_t **)&sess->snac_hash[i]; (cur = *prev); ) {
+		for (prev = (aim_snac_t **) &sess->snac_hash[i]; (cur = *prev); ) {
 			if ((curtime - cur->issuetime) > maxage) {
 
@@ -128,6 +136,7 @@
 				g_free(cur);
 
-			} else
+			} else {
 				prev = &cur->next;
+			}
 		}
 	}
Index: protocols/oscar/ssi.c
===================================================================
--- protocols/oscar/ssi.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/ssi.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -3,14 +3,14 @@
  *
  * Relatively new facility that allows storing of certain types of information,
- * such as a users buddy list, permit/deny list, and permit/deny preferences, 
+ * such as a users buddy list, permit/deny list, and permit/deny preferences,
  * to be stored on the server, so that they can be accessed from any client.
  *
- * We keep a copy of the ssi data in sess->ssi, because the data needs to be 
- * accessed for various reasons.  So all the "aim_ssi_itemlist_bleh" functions 
+ * We keep a copy of the ssi data in sess->ssi, because the data needs to be
+ * accessed for various reasons.  So all the "aim_ssi_itemlist_bleh" functions
  * near the top just manage the local data.
  *
- * The SNAC sending and receiving functions are lower down in the file, and 
- * they're simpler.  They are in the order of the subtypes they deal with, 
- * starting with the request rights function (subtype 0x0002), then parse 
+ * The SNAC sending and receiving functions are lower down in the file, and
+ * they're simpler.  They are in the order of the subtypes they deal with,
+ * starting with the request rights function (subtype 0x0002), then parse
  * rights (subtype 0x0003), then--well, you get the idea.
  *
@@ -30,28 +30,31 @@
  *
  * @param list A pointer to a pointer to the current list of items.
- * @param parent A pointer to the parent group, or NULL if the item should have no 
+ * @param parent A pointer to the parent group, or NULL if the item should have no
  *        parent group (ie. the group ID# should be 0).
- * @param name A null terminated string of the name of the new item, or NULL if the 
+ * @param name A null terminated string of the name of the new item, or NULL if the
  *        item should have no name.
  * @param type The type of the item, 0x0001 for a contact, 0x0002 for a group, etc.
  * @return The newly created item.
  */
-static struct aim_ssi_item *aim_ssi_itemlist_add(struct aim_ssi_item **list, struct aim_ssi_item *parent, char *name, guint16 type)
+static struct aim_ssi_item *aim_ssi_itemlist_add(struct aim_ssi_item **list, struct aim_ssi_item *parent, char *name,
+                                                 guint16 type)
 {
 	int i;
 	struct aim_ssi_item *cur, *newitem;
 
-	if (!(newitem = g_new0(struct aim_ssi_item, 1)))
+	if (!(newitem = g_new0(struct aim_ssi_item, 1))) {
 		return NULL;
+	}
 
 	/* Set the name */
 	if (name) {
-		if (!(newitem->name = (char *)g_malloc((strlen(name)+1)*sizeof(char)))) {
+		if (!(newitem->name = (char *) g_malloc((strlen(name) + 1) * sizeof(char)))) {
 			g_free(newitem);
 			return NULL;
 		}
 		strcpy(newitem->name, name);
-	} else
+	} else {
 		newitem->name = NULL;
+	}
 
 	/* Set the group ID# and the buddy ID# */
@@ -59,19 +62,25 @@
 	newitem->bid = 0x0000;
 	if (type == AIM_SSI_TYPE_GROUP) {
-		if (name)
+		if (name) {
 			do {
 				newitem->gid += 0x0001;
-				for (cur=*list, i=0; ((cur) && (!i)); cur=cur->next)
-					if ((cur->gid == newitem->gid) && (cur->gid == newitem->gid))
-						i=1;
+				for (cur = *list, i = 0; ((cur) && (!i)); cur = cur->next) {
+					if ((cur->gid == newitem->gid) && (cur->gid == newitem->gid)) {
+						i = 1;
+					}
+				}
 			} while (i);
+		}
 	} else {
-		if (parent)
+		if (parent) {
 			newitem->gid = parent->gid;
+		}
 		do {
 			newitem->bid += 0x0001;
-			for (cur=*list, i=0; ((cur) && (!i)); cur=cur->next)
-				if ((cur->bid == newitem->bid) && (cur->gid == newitem->gid))
-					i=1;
+			for (cur = *list, i = 0; ((cur) && (!i)); cur = cur->next) {
+				if ((cur->bid == newitem->bid) && (cur->gid == newitem->gid)) {
+					i = 1;
+				}
+			}
 		} while (i);
 	}
@@ -100,5 +109,5 @@
 	/* Free the old additional data */
 	if (parentgroup->data) {
-		aim_freetlvchain((aim_tlvlist_t **)&parentgroup->data);
+		aim_freetlvchain((aim_tlvlist_t **) &parentgroup->data);
 		parentgroup->data = NULL;
 	}
@@ -107,30 +116,39 @@
 	newlen = 0;
 	if (parentgroup->gid == 0x0000) {
-		for (cur=*list; cur; cur=cur->next)
-			if ((cur->gid != 0x0000) && (cur->type == AIM_SSI_TYPE_GROUP))
+		for (cur = *list; cur; cur = cur->next) {
+			if ((cur->gid != 0x0000) && (cur->type == AIM_SSI_TYPE_GROUP)) {
 				newlen += 2;
+			}
+		}
 	} else {
-		for (cur=*list; cur; cur=cur->next)
-			if ((cur->gid == parentgroup->gid) && (cur->type == AIM_SSI_TYPE_BUDDY))
+		for (cur = *list; cur; cur = cur->next) {
+			if ((cur->gid == parentgroup->gid) && (cur->type == AIM_SSI_TYPE_BUDDY)) {
 				newlen += 2;
+			}
+		}
 	}
 
 	/* Rebuild the additional data */
-	if (newlen>0) {
+	if (newlen > 0) {
 		guint8 *newdata;
 
-		if (!(newdata = (guint8 *)g_malloc((newlen)*sizeof(guint8))))
+		if (!(newdata = (guint8 *) g_malloc((newlen) * sizeof(guint8)))) {
 			return -ENOMEM;
+		}
 		newlen = 0;
 		if (parentgroup->gid == 0x0000) {
-			for (cur=*list; cur; cur=cur->next)
-				if ((cur->gid != 0x0000) && (cur->type == AIM_SSI_TYPE_GROUP))
-						newlen += aimutil_put16(newdata+newlen, cur->gid);
+			for (cur = *list; cur; cur = cur->next) {
+				if ((cur->gid != 0x0000) && (cur->type == AIM_SSI_TYPE_GROUP)) {
+					newlen += aimutil_put16(newdata + newlen, cur->gid);
+				}
+			}
 		} else {
-			for (cur=*list; cur; cur=cur->next)
-				if ((cur->gid == parentgroup->gid) && (cur->type == AIM_SSI_TYPE_BUDDY))
-						newlen += aimutil_put16(newdata+newlen, cur->bid);
-		}
-		aim_addtlvtochain_raw((aim_tlvlist_t **)&(parentgroup->data), 0x00c8, newlen, newdata);
+			for (cur = *list; cur; cur = cur->next) {
+				if ((cur->gid == parentgroup->gid) && (cur->type == AIM_SSI_TYPE_BUDDY)) {
+					newlen += aimutil_put16(newdata + newlen, cur->bid);
+				}
+			}
+		}
+		aim_addtlvtochain_raw((aim_tlvlist_t **) &(parentgroup->data), 0x00c8, newlen, newdata);
 
 		g_free(newdata);
@@ -152,6 +170,10 @@
 	cur = sess->ssi.items;
 	while (cur) {
-		if (cur->name)  g_free(cur->name);
-		if (cur->data)  aim_freetlvchain((aim_tlvlist_t **)&cur->data);
+		if (cur->name) {
+			g_free(cur->name);
+		}
+		if (cur->data) {
+			aim_freetlvchain((aim_tlvlist_t **) &cur->data);
+		}
 		delitem = cur;
 		cur = cur->next;
@@ -161,5 +183,5 @@
 	sess->ssi.items = NULL;
 	sess->ssi.revision = 0;
-	sess->ssi.timestamp = (time_t)0;
+	sess->ssi.timestamp = (time_t) 0;
 
 	return 0;
@@ -177,12 +199,15 @@
 {
 	struct aim_ssi_item *cur;
-	for (cur=list; cur; cur=cur->next)
-		if ((cur->gid == gid) && (cur->bid == bid))
+
+	for (cur = list; cur; cur = cur->next) {
+		if ((cur->gid == gid) && (cur->bid == bid)) {
 			return cur;
+		}
+	}
 	return NULL;
 }
 
 /**
- * Locally find an item given a group name, screen name, and type.  If group name 
+ * Locally find an item given a group name, screen name, and type.  If group name
  * and screen name are null, then just return the first item of the given type.
  *
@@ -196,25 +221,35 @@
 {
 	struct aim_ssi_item *cur;
-	if (!list)
+
+	if (!list) {
 		return NULL;
+	}
 
 	if (gn && sn) { /* For finding buddies in groups */
-		for (cur=list; cur; cur=cur->next)
+		for (cur = list; cur; cur = cur->next) {
 			if ((cur->type == type) && (cur->name) && !(aim_sncmp(cur->name, sn))) {
 				struct aim_ssi_item *curg;
-				for (curg=list; curg; curg=curg->next)
-					if ((curg->type == AIM_SSI_TYPE_GROUP) && (curg->gid == cur->gid) && (curg->name) && !(aim_sncmp(curg->name, gn)))
+				for (curg = list; curg; curg = curg->next) {
+					if ((curg->type == AIM_SSI_TYPE_GROUP) && (curg->gid == cur->gid) &&
+					    (curg->name) && !(aim_sncmp(curg->name, gn))) {
 						return cur;
-			}
+					}
+				}
+			}
+		}
 
 	} else if (sn) { /* For finding groups, permits, denies, and ignores */
-		for (cur=list; cur; cur=cur->next)
-			if ((cur->type == type) && (cur->name) && !(aim_sncmp(cur->name, sn)))
+		for (cur = list; cur; cur = cur->next) {
+			if ((cur->type == type) && (cur->name) && !(aim_sncmp(cur->name, sn))) {
 				return cur;
-
-	/* For stuff without names--permit deny setting, visibility mask, etc. */
-	} else for (cur=list; cur; cur=cur->next) {
-		if (cur->type == type)
-			return cur;
+			}
+		}
+
+		/* For stuff without names--permit deny setting, visibility mask, etc. */
+	} else { for (cur = list; cur; cur = cur->next) {
+			 if (cur->type == type) {
+				 return cur;
+			 }
+		 }
 	}
 
@@ -232,11 +267,16 @@
 {
 	struct aim_ssi_item *cur, *curg;
-	if (!list || !sn)
+
+	if (!list || !sn) {
 		return NULL;
-	if (!(cur = aim_ssi_itemlist_finditem(list, NULL, sn, AIM_SSI_TYPE_BUDDY)))
+	}
+	if (!(cur = aim_ssi_itemlist_finditem(list, NULL, sn, AIM_SSI_TYPE_BUDDY))) {
 		return NULL;
-	for (curg=list; curg; curg=curg->next)
-		if ((curg->type == AIM_SSI_TYPE_GROUP) && (curg->gid == cur->gid))
+	}
+	for (curg = list; curg; curg = curg->next) {
+		if ((curg->type == AIM_SSI_TYPE_GROUP) && (curg->gid == cur->gid)) {
 			return curg;
+		}
+	}
 	return NULL;
 }
@@ -251,18 +291,20 @@
 {
 	struct aim_ssi_item *cur = aim_ssi_itemlist_finditem(list, NULL, NULL, AIM_SSI_TYPE_PDINFO);
+
 	if (cur) {
 		aim_tlvlist_t *tlvlist = cur->data;
 		if (tlvlist) {
 			aim_tlv_t *tlv = aim_gettlv(tlvlist, 0x00ca, 1);
-			if (tlv && tlv->value)
+			if (tlv && tlv->value) {
 				return aimutil_get8(tlv->value);
-		}
-	}
-	return 0;
-}
-
-/**
- * Add the given packet to the holding queue.  We totally need to send SSI SNACs one at 
- * a time, so we have a local queue where packets get put before they are sent, and 
+			}
+		}
+	}
+	return 0;
+}
+
+/**
+ * Add the given packet to the holding queue.  We totally need to send SSI SNACs one at
+ * a time, so we have a local queue where packets get put before they are sent, and
  * then we send stuff one at a time, nice and orderly-like.
  *
@@ -276,14 +318,18 @@
 	aim_frame_t *cur;
 
-	if (!sess || !conn || !fr)
-		return -EINVAL;
+	if (!sess || !conn || !fr) {
+		return -EINVAL;
+	}
 
 	fr->next = NULL;
 	if (sess->ssi.holding_queue == NULL) {
 		sess->ssi.holding_queue = fr;
-		if (!sess->ssi.waiting_for_ack)
+		if (!sess->ssi.waiting_for_ack) {
 			aim_ssi_modbegin(sess, conn);
+		}
 	} else {
-		for (cur = sess->ssi.holding_queue; cur->next; cur = cur->next) ;
+		for (cur = sess->ssi.holding_queue; cur->next; cur = cur->next) {
+			;
+		}
 		cur->next = fr;
 	}
@@ -293,6 +339,6 @@
 
 /**
- * Send the next SNAC from the holding queue.  This is called 
- * automatically when an ack from an add, mod, or del is received.  
+ * Send the next SNAC from the holding queue.  This is called
+ * automatically when an ack from an add, mod, or del is received.
  * If the queue is empty, it sends the modend SNAC.
  *
@@ -305,6 +351,7 @@
 	aim_frame_t *cur;
 
-	if (!sess || !conn)
-		return -EINVAL;
+	if (!sess || !conn) {
+		return -EINVAL;
+	}
 
 	if (!sess->ssi.waiting_for_ack) {
@@ -315,6 +362,7 @@
 			aim_tx_enqueue(sess, sess->ssi.holding_queue);
 			sess->ssi.holding_queue = cur;
-		} else
+		} else {
 			aim_ssi_modend(sess, conn);
+		}
 	}
 
@@ -338,20 +386,23 @@
 	guint16 i;
 
-	if (!sess || !conn || !gn || !sn || !num)
-		return -EINVAL;
+	if (!sess || !conn || !gn || !sn || !num) {
+		return -EINVAL;
+	}
 
 	/* Look up the parent group */
 	if (!(parentgroup = aim_ssi_itemlist_finditem(sess->ssi.items, NULL, gn, AIM_SSI_TYPE_GROUP))) {
 		aim_ssi_addgroups(sess, conn, &gn, 1);
-		if (!(parentgroup = aim_ssi_itemlist_finditem(sess->ssi.items, NULL, gn, AIM_SSI_TYPE_GROUP)))
+		if (!(parentgroup = aim_ssi_itemlist_finditem(sess->ssi.items, NULL, gn, AIM_SSI_TYPE_GROUP))) {
 			return -ENOMEM;
+		}
 	}
 
 	/* Allocate an array of pointers to each of the new items */
-	if (!(newitems = g_new0(struct aim_ssi_item *, num)))
+	if (!(newitems = g_new0(struct aim_ssi_item *, num))) {
 		return -ENOMEM;
+	}
 
 	/* Add items to the local list, and index them in the array */
-	for (i=0; i<num; i++)
+	for (i = 0; i < num; i++) {
 		if (!(newitems[i] = aim_ssi_itemlist_add(&sess->ssi.items, parentgroup, sn[i], AIM_SSI_TYPE_BUDDY))) {
 			g_free(newitems);
@@ -362,4 +413,5 @@
 			newitems[i]->data = tl;
 		}
+	}
 
 	/* Send the add item SNAC */
@@ -373,20 +425,23 @@
 
 	/* Rebuild the additional data in the parent group */
-	if ((i = aim_ssi_itemlist_rebuildgroup(&sess->ssi.items, parentgroup)))
+	if ((i = aim_ssi_itemlist_rebuildgroup(&sess->ssi.items, parentgroup))) {
 		return i;
+	}
 
 	/* Send the mod item SNAC */
-	if ((i = aim_ssi_addmoddel(sess, conn, &parentgroup, 1, AIM_CB_SSI_MOD )))
+	if ((i = aim_ssi_addmoddel(sess, conn, &parentgroup, 1, AIM_CB_SSI_MOD))) {
 		return i;
+	}
 
 	/* Begin sending SSI SNACs */
-	if (!(i = aim_ssi_dispatch(sess, conn)))
+	if (!(i = aim_ssi_dispatch(sess, conn))) {
 		return i;
-
-	return 0;
-}
-
-/**
- * Add the master group (the group containing all groups).  This is called by 
+	}
+
+	return 0;
+}
+
+/**
+ * Add the master group (the group containing all groups).  This is called by
  * aim_ssi_addgroups, if necessary.
  *
@@ -399,10 +454,12 @@
 	struct aim_ssi_item *newitem;
 
-	if (!sess || !conn)
-		return -EINVAL;
+	if (!sess || !conn) {
+		return -EINVAL;
+	}
 
 	/* Add the item to the local list, and keep a pointer to it */
-	if (!(newitem = aim_ssi_itemlist_add(&sess->ssi.items, NULL, NULL, AIM_SSI_TYPE_GROUP)))
+	if (!(newitem = aim_ssi_itemlist_add(&sess->ssi.items, NULL, NULL, AIM_SSI_TYPE_GROUP))) {
 		return -ENOMEM;
+	}
 
 	/* If there are any existing groups (technically there shouldn't be, but */
@@ -433,24 +490,28 @@
 	guint16 i;
 
-	if (!sess || !conn || !gn || !num)
-		return -EINVAL;
+	if (!sess || !conn || !gn || !num) {
+		return -EINVAL;
+	}
 
 	/* Look up the parent group */
 	if (!(parentgroup = aim_ssi_itemlist_find(sess->ssi.items, 0, 0))) {
 		aim_ssi_addmastergroup(sess, conn);
-		if (!(parentgroup = aim_ssi_itemlist_find(sess->ssi.items, 0, 0)))
+		if (!(parentgroup = aim_ssi_itemlist_find(sess->ssi.items, 0, 0))) {
 			return -ENOMEM;
+		}
 	}
 
 	/* Allocate an array of pointers to each of the new items */
-	if (!(newitems = g_new0(struct aim_ssi_item *, num)))
+	if (!(newitems = g_new0(struct aim_ssi_item *, num))) {
 		return -ENOMEM;
+	}
 
 	/* Add items to the local list, and index them in the array */
-	for (i=0; i<num; i++)
+	for (i = 0; i < num; i++) {
 		if (!(newitems[i] = aim_ssi_itemlist_add(&sess->ssi.items, parentgroup, gn[i], AIM_SSI_TYPE_GROUP))) {
 			g_free(newitems);
 			return -ENOMEM;
 		}
+	}
 
 	/* Send the add item SNAC */
@@ -464,21 +525,24 @@
 
 	/* Rebuild the additional data in the parent group */
-	if ((i = aim_ssi_itemlist_rebuildgroup(&sess->ssi.items, parentgroup)))
+	if ((i = aim_ssi_itemlist_rebuildgroup(&sess->ssi.items, parentgroup))) {
 		return i;
+	}
 
 	/* Send the mod item SNAC */
-	if ((i = aim_ssi_addmoddel(sess, conn, &parentgroup, 1, AIM_CB_SSI_MOD)))
+	if ((i = aim_ssi_addmoddel(sess, conn, &parentgroup, 1, AIM_CB_SSI_MOD))) {
 		return i;
+	}
 
 	/* Begin sending SSI SNACs */
-	if (!(i = aim_ssi_dispatch(sess, conn)))
+	if (!(i = aim_ssi_dispatch(sess, conn))) {
 		return i;
-
-	return 0;
-}
-
-/**
- * Add an array of a certain type of item to the list.  This can be used for 
- * permit buddies, deny buddies, ICQ's ignore buddies, and probably other 
+	}
+
+	return 0;
+}
+
+/**
+ * Add an array of a certain type of item to the list.  This can be used for
+ * permit buddies, deny buddies, ICQ's ignore buddies, and probably other
  * types, also.
  *
@@ -487,5 +551,5 @@
  * @param sn An array of null terminated strings of the names you want to add.
  * @param num The number of groups names you are adding (size of the sn array).
- * @param type The type of item you want to add.  See the AIM_SSI_TYPE_BLEH 
+ * @param type The type of item you want to add.  See the AIM_SSI_TYPE_BLEH
  *        #defines in aim.h.
  * @return Return 0 if no errors, otherwise return the error number.
@@ -496,17 +560,20 @@
 	guint16 i;
 
-	if (!sess || !conn || !sn || !num)
-		return -EINVAL;
+	if (!sess || !conn || !sn || !num) {
+		return -EINVAL;
+	}
 
 	/* Allocate an array of pointers to each of the new items */
-	if (!(newitems = g_new0(struct aim_ssi_item *, num)))
+	if (!(newitems = g_new0(struct aim_ssi_item *, num))) {
 		return -ENOMEM;
+	}
 
 	/* Add items to the local list, and index them in the array */
-	for (i=0; i<num; i++)
+	for (i = 0; i < num; i++) {
 		if (!(newitems[i] = aim_ssi_itemlist_add(&sess->ssi.items, NULL, sn[i], type))) {
 			g_free(newitems);
 			return -ENOMEM;
 		}
+	}
 
 	/* Send the add item SNAC */
@@ -520,12 +587,13 @@
 
 	/* Begin sending SSI SNACs */
-	if (!(i = aim_ssi_dispatch(sess, conn)))
+	if (!(i = aim_ssi_dispatch(sess, conn))) {
 		return i;
-
-	return 0;
-}
-
-/**
- * Move a buddy from one group to another group.  This basically just deletes the 
+	}
+
+	return 0;
+}
+
+/**
+ * Move a buddy from one group to another group.  This basically just deletes the
  * buddy and re-adds it.
  *
@@ -542,14 +610,17 @@
 	guint16 i;
 
-	if (!sess || !conn || !oldgn || !newgn || !sn)
-		return -EINVAL;
+	if (!sess || !conn || !oldgn || !newgn || !sn) {
+		return -EINVAL;
+	}
 
 	/* Look up the buddy */
-	if (!(buddy = aim_ssi_itemlist_finditem(sess->ssi.items, NULL, sn, AIM_SSI_TYPE_BUDDY)))
+	if (!(buddy = aim_ssi_itemlist_finditem(sess->ssi.items, NULL, sn, AIM_SSI_TYPE_BUDDY))) {
 		return -ENOMEM;
+	}
 
 	/* Allocate an array of pointers to the two groups */
-	if (!(groups = g_new0(struct aim_ssi_item *, 2)))
+	if (!(groups = g_new0(struct aim_ssi_item *, 2))) {
 		return -ENOMEM;
+	}
 
 	/* Look up the old parent group */
@@ -575,7 +646,10 @@
 	do {
 		buddy->bid += 0x0001;
-		for (cur=sess->ssi.items, i=0; ((cur) && (!i)); cur=cur->next)
-			if ((cur->bid == buddy->bid) && (cur->gid == buddy->gid) && (cur->type == AIM_SSI_TYPE_BUDDY) && (cur->name) && aim_sncmp(cur->name, buddy->name))
-				i=1;
+		for (cur = sess->ssi.items, i = 0; ((cur) && (!i)); cur = cur->next) {
+			if ((cur->bid == buddy->bid) && (cur->gid == buddy->gid) && (cur->type == AIM_SSI_TYPE_BUDDY) &&
+			    (cur->name) && aim_sncmp(cur->name, buddy->name)) {
+				i = 1;
+			}
+		}
 	} while (i);
 
@@ -614,10 +688,12 @@
 	int i;
 
-	if (!sess || !conn || !gn || !sn || !num)
-		return -EINVAL;
+	if (!sess || !conn || !gn || !sn || !num) {
+		return -EINVAL;
+	}
 
 	/* Look up the parent group */
-	if (!(parentgroup = aim_ssi_itemlist_finditem(sess->ssi.items, NULL, gn, AIM_SSI_TYPE_GROUP)))
-		return -EINVAL;
+	if (!(parentgroup = aim_ssi_itemlist_finditem(sess->ssi.items, NULL, gn, AIM_SSI_TYPE_GROUP))) {
+		return -EINVAL;
+	}
 
 	/* Allocate an array of pointers to each of the items to be deleted */
@@ -625,5 +701,5 @@
 
 	/* Make the delitems array a pointer to the aim_ssi_item structs to be deleted */
-	for (i=0; i<num; i++) {
+	for (i = 0; i < num; i++) {
 		if (!(delitems[i] = aim_ssi_itemlist_finditem(sess->ssi.items, NULL, sn[i], AIM_SSI_TYPE_BUDDY))) {
 			g_free(delitems);
@@ -635,7 +711,10 @@
 			sess->ssi.items = sess->ssi.items->next;
 		} else {
-			for (cur=sess->ssi.items; (cur->next && (cur->next!=delitems[i])); cur=cur->next);
-			if (cur->next)
+			for (cur = sess->ssi.items; (cur->next && (cur->next != delitems[i])); cur = cur->next) {
+				;
+			}
+			if (cur->next) {
 				cur->next = cur->next->next;
+			}
 		}
 	}
@@ -645,9 +724,11 @@
 
 	/* Free the items */
-	for (i=0; i<num; i++) {
-		if (delitems[i]->name)
+	for (i = 0; i < num; i++) {
+		if (delitems[i]->name) {
 			g_free(delitems[i]->name);
-		if (delitems[i]->data)
-			aim_freetlvchain((aim_tlvlist_t **)&delitems[i]->data);
+		}
+		if (delitems[i]->data) {
+			aim_freetlvchain((aim_tlvlist_t **) &delitems[i]->data);
+		}
 		g_free(delitems[i]);
 	}
@@ -661,6 +742,7 @@
 
 	/* Delete the group, but only if it's empty */
-	if (!parentgroup->data)
+	if (!parentgroup->data) {
 		aim_ssi_delgroups(sess, conn, &parentgroup->name, 1);
+	}
 
 	/* Begin sending SSI SNACs */
@@ -682,10 +764,12 @@
 	struct aim_ssi_item *cur, *delitem;
 
-	if (!sess || !conn)
-		return -EINVAL;
+	if (!sess || !conn) {
+		return -EINVAL;
+	}
 
 	/* Make delitem a pointer to the aim_ssi_item to be deleted */
-	if (!(delitem = aim_ssi_itemlist_find(sess->ssi.items, 0, 0)))
-		return -EINVAL;
+	if (!(delitem = aim_ssi_itemlist_find(sess->ssi.items, 0, 0))) {
+		return -EINVAL;
+	}
 
 	/* Remove delitem from the item list */
@@ -693,7 +777,10 @@
 		sess->ssi.items = sess->ssi.items->next;
 	} else {
-		for (cur=sess->ssi.items; (cur->next && (cur->next!=delitem)); cur=cur->next);
-		if (cur->next)
+		for (cur = sess->ssi.items; (cur->next && (cur->next != delitem)); cur = cur->next) {
+			;
+		}
+		if (cur->next) {
 			cur->next = cur->next->next;
+		}
 	}
 
@@ -702,8 +789,10 @@
 
 	/* Free the item */
-	if (delitem->name)
+	if (delitem->name) {
 		g_free(delitem->name);
-	if (delitem->data)
-		aim_freetlvchain((aim_tlvlist_t **)&delitem->data);
+	}
+	if (delitem->data) {
+		aim_freetlvchain((aim_tlvlist_t **) &delitem->data);
+	}
 	g_free(delitem);
 
@@ -723,14 +812,17 @@
  * @return Return 0 if no errors, otherwise return the error number.
  */
-int aim_ssi_delgroups(aim_session_t *sess, aim_conn_t *conn, char **gn, unsigned int num) {
+int aim_ssi_delgroups(aim_session_t *sess, aim_conn_t *conn, char **gn, unsigned int num)
+{
 	struct aim_ssi_item *cur, *parentgroup, **delitems;
 	int i;
 
-	if (!sess || !conn || !gn || !num)
-		return -EINVAL;
+	if (!sess || !conn || !gn || !num) {
+		return -EINVAL;
+	}
 
 	/* Look up the parent group */
-	if (!(parentgroup = aim_ssi_itemlist_find(sess->ssi.items, 0, 0)))
-		return -EINVAL;
+	if (!(parentgroup = aim_ssi_itemlist_find(sess->ssi.items, 0, 0))) {
+		return -EINVAL;
+	}
 
 	/* Allocate an array of pointers to each of the items to be deleted */
@@ -738,5 +830,5 @@
 
 	/* Make the delitems array a pointer to the aim_ssi_item structs to be deleted */
-	for (i=0; i<num; i++) {
+	for (i = 0; i < num; i++) {
 		if (!(delitems[i] = aim_ssi_itemlist_finditem(sess->ssi.items, NULL, gn[i], AIM_SSI_TYPE_GROUP))) {
 			g_free(delitems);
@@ -748,7 +840,10 @@
 			sess->ssi.items = sess->ssi.items->next;
 		} else {
-			for (cur=sess->ssi.items; (cur->next && (cur->next!=delitems[i])); cur=cur->next);
-			if (cur->next)
+			for (cur = sess->ssi.items; (cur->next && (cur->next != delitems[i])); cur = cur->next) {
+				;
+			}
+			if (cur->next) {
 				cur->next = cur->next->next;
+			}
 		}
 	}
@@ -758,9 +853,11 @@
 
 	/* Free the items */
-	for (i=0; i<num; i++) {
-		if (delitems[i]->name)
+	for (i = 0; i < num; i++) {
+		if (delitems[i]->name) {
 			g_free(delitems[i]->name);
-		if (delitems[i]->data)
-			aim_freetlvchain((aim_tlvlist_t **)&delitems[i]->data);
+		}
+		if (delitems[i]->data) {
+			aim_freetlvchain((aim_tlvlist_t **) &delitems[i]->data);
+		}
 		g_free(delitems[i]);
 	}
@@ -774,6 +871,7 @@
 
 	/* Delete the group, but only if it's empty */
-	if (!parentgroup->data)
+	if (!parentgroup->data) {
 		aim_ssi_delmastergroup(sess, conn);
+	}
 
 	/* Begin sending SSI SNACs */
@@ -784,6 +882,6 @@
 
 /**
- * Delete an array of a certain type of item from the list.  This can be 
- * used for permit buddies, deny buddies, ICQ's ignore buddies, and 
+ * Delete an array of a certain type of item from the list.  This can be
+ * used for permit buddies, deny buddies, ICQ's ignore buddies, and
  * probably other types, also.
  *
@@ -794,10 +892,12 @@
  * @return Return 0 if no errors, otherwise return the error number.
  */
-int aim_ssi_delpord(aim_session_t *sess, aim_conn_t *conn, char **sn, unsigned int num, guint16 type) {
+int aim_ssi_delpord(aim_session_t *sess, aim_conn_t *conn, char **sn, unsigned int num, guint16 type)
+{
 	struct aim_ssi_item *cur, **delitems;
 	int i;
 
-	if (!sess || !conn || !sn || !num || (type!=AIM_SSI_TYPE_PERMIT && type!=AIM_SSI_TYPE_DENY))
-		return -EINVAL;
+	if (!sess || !conn || !sn || !num || (type != AIM_SSI_TYPE_PERMIT && type != AIM_SSI_TYPE_DENY)) {
+		return -EINVAL;
+	}
 
 	/* Allocate an array of pointers to each of the items to be deleted */
@@ -805,5 +905,5 @@
 
 	/* Make the delitems array a pointer to the aim_ssi_item structs to be deleted */
-	for (i=0; i<num; i++) {
+	for (i = 0; i < num; i++) {
 		if (!(delitems[i] = aim_ssi_itemlist_finditem(sess->ssi.items, NULL, sn[i], type))) {
 			g_free(delitems);
@@ -815,7 +915,10 @@
 			sess->ssi.items = sess->ssi.items->next;
 		} else {
-			for (cur=sess->ssi.items; (cur->next && (cur->next!=delitems[i])); cur=cur->next);
-			if (cur->next)
+			for (cur = sess->ssi.items; (cur->next && (cur->next != delitems[i])); cur = cur->next) {
+				;
+			}
+			if (cur->next) {
 				cur->next = cur->next->next;
+			}
 		}
 	}
@@ -825,9 +928,11 @@
 
 	/* Free the items */
-	for (i=0; i<num; i++) {
-		if (delitems[i]->name)
+	for (i = 0; i < num; i++) {
+		if (delitems[i]->name) {
 			g_free(delitems[i]->name);
-		if (delitems[i]->data)
-			aim_freetlvchain((aim_tlvlist_t **)&delitems[i]->data);
+		}
+		if (delitems[i]->data) {
+			aim_freetlvchain((aim_tlvlist_t **) &delitems[i]->data);
+		}
 		g_free(delitems[i]);
 	}
@@ -856,6 +961,7 @@
 	aim_rxcallback_t userfunc;
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx);
+	}
 
 	return ret;
@@ -867,9 +973,11 @@
 	aim_snacid_t snacid;
 
-	if (!sess || !conn)
-		return -EINVAL;
-
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10)))
+	if (!sess || !conn) {
+		return -EINVAL;
+	}
+
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10))) {
 		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, AIM_CB_FAM_SSI, AIM_CB_SSI_REQFULLLIST, 0x0000, NULL, 0);
@@ -895,8 +1003,8 @@
 
 	/* When you set the version for the SSI family to 2-4, the beginning of this changes.
-	 * Instead of the version and then the revision, there is "0x0006" and then a type 
-	 * 0x0001 TLV containing the 2 byte SSI family version that you sent earlier.  Also, 
-	 * the SNAC flags go from 0x0000 to 0x8000.  I guess the 0x0006 is the length of the 
-	 * TLV(s) that follow.  The rights SNAC does the same thing, with the differing flag 
+	 * Instead of the version and then the revision, there is "0x0006" and then a type
+	 * 0x0001 TLV containing the 2 byte SSI family version that you sent earlier.  Also,
+	 * the SNAC flags go from 0x0000 to 0x8000.  I guess the 0x0006 is the length of the
+	 * TLV(s) that follow.  The rights SNAC does the same thing, with the differing flag
 	 * and everything.
 	 */
@@ -904,8 +1012,11 @@
 	fmtver = aimbs_get8(bs); /* Version of ssi data.  Should be 0x00 */
 	revision = aimbs_get16(bs); /* # of times ssi data has been modified */
-	if (revision != 0)
+	if (revision != 0) {
 		sess->ssi.revision = revision;
-
-	for (cur = sess->ssi.items; cur && cur->next; cur=cur->next) ;
+	}
+
+	for (cur = sess->ssi.items; cur && cur->next; cur = cur->next) {
+		;
+	}
 
 	while (aim_bstream_empty(bs) > 4) { /* last four bytes are stamp */
@@ -913,15 +1024,18 @@
 
 		if (!sess->ssi.items) {
-			if (!(sess->ssi.items = g_new0(struct aim_ssi_item, 1)))
+			if (!(sess->ssi.items = g_new0(struct aim_ssi_item, 1))) {
 				return -ENOMEM;
+			}
 			cur = sess->ssi.items;
 		} else {
-			if (!(cur->next = g_new0(struct aim_ssi_item, 1)))
+			if (!(cur->next = g_new0(struct aim_ssi_item, 1))) {
 				return -ENOMEM;
+			}
 			cur = cur->next;
 		}
 
-		if ((namelen = aimbs_get16(bs)))
+		if ((namelen = aimbs_get16(bs))) {
 			cur->name = aimbs_getstr(bs, namelen);
+		}
 		cur->gid = aimbs_get16(bs);
 		cur->bid = aimbs_get16(bs);
@@ -932,5 +1046,5 @@
 
 			aim_bstream_init(&tbs, bs->data + bs->offset /* XXX */, tbslen);
-			cur->data = (void *)aim_readtlvchain(&tbs);
+			cur->data = (void *) aim_readtlvchain(&tbs);
 			aim_bstream_advance(bs, tbslen);
 		}
@@ -938,10 +1052,12 @@
 
 	timestamp = aimbs_get32(bs);
-	if (timestamp != 0)
+	if (timestamp != 0) {
 		sess->ssi.timestamp = timestamp;
+	}
 	sess->ssi.received_data = 1;
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, fmtver, sess->ssi.revision, sess->ssi.timestamp, sess->ssi.items);
+	}
 
 	return ret;
@@ -955,5 +1071,5 @@
  * presence information for everyone in your list and put your permit/deny
  * settings into effect.
- * 
+ *
  */
 int aim_ssi_enable(aim_session_t *sess, aim_conn_t *conn)
@@ -977,27 +1093,28 @@
  * @return Return 0 if no errors, otherwise return the error number.
  */
-int aim_ssi_auth_request( aim_session_t *sess, aim_conn_t *conn, char *uin, char *reason )
+int aim_ssi_auth_request(aim_session_t *sess, aim_conn_t *conn, char *uin, char *reason)
 {
 	aim_frame_t *fr;
 	aim_snacid_t snacid;
 	int snaclen;
-	
-	snaclen = 10 + 1 + strlen( uin ) + 2 + strlen( reason ) + 2;
-	
-	if( !( fr = aim_tx_new( sess, conn, AIM_FRAMETYPE_FLAP, 0x02, snaclen ) ) )
+
+	snaclen = 10 + 1 + strlen(uin) + 2 + strlen(reason) + 2;
+
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, snaclen))) {
 		return -ENOMEM;
-
-	snacid = aim_cachesnac( sess, AIM_CB_FAM_SSI, AIM_CB_SSI_SENDAUTHREQ, 0x0000, NULL, 0 );
-	aim_putsnac( &fr->data, AIM_CB_FAM_SSI, AIM_CB_SSI_SENDAUTHREQ, 0x0000, snacid );
-	
-	aimbs_put8( &fr->data, strlen( uin ) );
-	aimbs_putraw( &fr->data, (guint8 *)uin, strlen( uin ) );
-	aimbs_put16( &fr->data, strlen( reason ) );
-	aimbs_putraw( &fr->data, (guint8 *)reason, strlen( reason ) );
-	aimbs_put16( &fr->data, 0 );
-	
-	aim_tx_enqueue( sess, fr );
-	
-	return( 0 );
+	}
+
+	snacid = aim_cachesnac(sess, AIM_CB_FAM_SSI, AIM_CB_SSI_SENDAUTHREQ, 0x0000, NULL, 0);
+	aim_putsnac(&fr->data, AIM_CB_FAM_SSI, AIM_CB_SSI_SENDAUTHREQ, 0x0000, snacid);
+
+	aimbs_put8(&fr->data, strlen(uin));
+	aimbs_putraw(&fr->data, (guint8 *) uin, strlen(uin));
+	aimbs_put16(&fr->data, strlen(reason));
+	aimbs_putraw(&fr->data, (guint8 *) reason, strlen(reason));
+	aimbs_put16(&fr->data, 0);
+
+	aim_tx_enqueue(sess, fr);
+
+	return(0);
 }
 
@@ -1012,27 +1129,28 @@
  * @return Return 0 if no errors, otherwise return the error number.
  */
-int aim_ssi_auth_reply( aim_session_t *sess, aim_conn_t *conn, char *uin, int yesno, char *reason )
+int aim_ssi_auth_reply(aim_session_t *sess, aim_conn_t *conn, char *uin, int yesno, char *reason)
 {
 	aim_frame_t *fr;
 	aim_snacid_t snacid;
 	int snaclen;
-	
-	snaclen = 10 + 1 + strlen( uin ) + 3 + strlen( reason );
-	
-	if( !( fr = aim_tx_new( sess, conn, AIM_FRAMETYPE_FLAP, 0x02, snaclen ) ) )
+
+	snaclen = 10 + 1 + strlen(uin) + 3 + strlen(reason);
+
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, snaclen))) {
 		return -ENOMEM;
-	
-	snacid = aim_cachesnac( sess, AIM_CB_FAM_SSI, AIM_CB_SSI_SENDAUTHREP, 0x0000, NULL, 0 );
-	aim_putsnac( &fr->data, AIM_CB_FAM_SSI, AIM_CB_SSI_SENDAUTHREP, 0x0000, snacid );
-	
-	aimbs_put8( &fr->data, strlen( uin ) );
-	aimbs_putraw( &fr->data, (guint8 *)uin, strlen( uin ) );
-	aimbs_put8( &fr->data, yesno );
-	aimbs_put16( &fr->data, strlen( reason ) );
-	aimbs_putraw( &fr->data, (guint8 *)reason, strlen( reason ) );
-	
-	aim_tx_enqueue( sess, fr );
-	
-	return( 0 );
+	}
+
+	snacid = aim_cachesnac(sess, AIM_CB_FAM_SSI, AIM_CB_SSI_SENDAUTHREP, 0x0000, NULL, 0);
+	aim_putsnac(&fr->data, AIM_CB_FAM_SSI, AIM_CB_SSI_SENDAUTHREP, 0x0000, snacid);
+
+	aimbs_put8(&fr->data, strlen(uin));
+	aimbs_putraw(&fr->data, (guint8 *) uin, strlen(uin));
+	aimbs_put8(&fr->data, yesno);
+	aimbs_put16(&fr->data, strlen(reason));
+	aimbs_putraw(&fr->data, (guint8 *) reason, strlen(reason));
+
+	aim_tx_enqueue(sess, fr);
+
+	return(0);
 }
 
@@ -1044,7 +1162,8 @@
  * information.  These 3 SNACs all have an identical structure.  The only
  * difference is the subtype that is set for the SNAC.
- * 
- */
-int aim_ssi_addmoddel(aim_session_t *sess, aim_conn_t *conn, struct aim_ssi_item **items, unsigned int num, guint16 subtype)
+ *
+ */
+int aim_ssi_addmoddel(aim_session_t *sess, aim_conn_t *conn, struct aim_ssi_item **items, unsigned int num,
+                      guint16 subtype)
 {
 	aim_frame_t *fr;
@@ -1053,14 +1172,15 @@
 	char *list = NULL;
 
-	if (!sess || !conn || !items || !num)
-		return -EINVAL;
+	if (!sess || !conn || !items || !num) {
+		return -EINVAL;
+	}
 
 	snaclen = 10; /* For family, subtype, flags, and SNAC ID */
 	listlen = 0;
-	for (i=0; i<num; i++) {
+	for (i = 0; i < num; i++) {
 		snaclen += 10; /* For length, GID, BID, type, and length */
 		if (items[i]->name) {
 			snaclen += strlen(items[i]->name);
-			
+
 			if (subtype == AIM_CB_SSI_ADD) {
 				list = g_realloc(list, listlen + strlen(items[i]->name) + 1);
@@ -1072,29 +1192,33 @@
 				list = g_realloc(list, listlen + 1);
 				list[listlen] = '\0';
-				listlen ++;
-			}
-		}
-		if (items[i]->data)
-			snaclen += aim_sizetlvchain((aim_tlvlist_t **)&items[i]->data);
-	}
-	
-	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, snaclen)))
+				listlen++;
+			}
+		}
+		if (items[i]->data) {
+			snaclen += aim_sizetlvchain((aim_tlvlist_t **) &items[i]->data);
+		}
+	}
+
+	if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, snaclen))) {
 		return -ENOMEM;
+	}
 
 	snacid = aim_cachesnac(sess, AIM_CB_FAM_SSI, subtype, 0x0000, list, list ? listlen : 0);
 	aim_putsnac(&fr->data, AIM_CB_FAM_SSI, subtype, 0x0000, snacid);
-	
+
 	g_free(list);
 
-	for (i=0; i<num; i++) {
+	for (i = 0; i < num; i++) {
 		aimbs_put16(&fr->data, items[i]->name ? strlen(items[i]->name) : 0);
-		if (items[i]->name)
-			aimbs_putraw(&fr->data, (guint8 *)items[i]->name, strlen(items[i]->name));
+		if (items[i]->name) {
+			aimbs_putraw(&fr->data, (guint8 *) items[i]->name, strlen(items[i]->name));
+		}
 		aimbs_put16(&fr->data, items[i]->gid);
 		aimbs_put16(&fr->data, items[i]->bid);
 		aimbs_put16(&fr->data, items[i]->type);
-		aimbs_put16(&fr->data, items[i]->data ? aim_sizetlvchain((aim_tlvlist_t **)&items[i]->data) : 0);
-		if (items[i]->data)
-			aim_writetlvchain(&fr->data, (aim_tlvlist_t **)&items[i]->data);
+		aimbs_put16(&fr->data, items[i]->data ? aim_sizetlvchain((aim_tlvlist_t **) &items[i]->data) : 0);
+		if (items[i]->data) {
+			aim_writetlvchain(&fr->data, (aim_tlvlist_t **) &items[i]->data);
+		}
 	}
 
@@ -1118,15 +1242,16 @@
 	sess->ssi.waiting_for_ack = 0;
 	aim_ssi_dispatch(sess, rx->conn);
-	
+
 	origsnac = aim_remsnac(sess, snac->id);
-	
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx, origsnac);
-	
+	}
+
 	if (origsnac) {
 		g_free(origsnac->data);
 		g_free(origsnac);
 	}
-	
+
 	return ret;
 }
@@ -1136,5 +1261,5 @@
  *
  * Tells the server you're going to start modifying data.
- * 
+ *
  */
 int aim_ssi_modbegin(aim_session_t *sess, aim_conn_t *conn)
@@ -1161,5 +1286,6 @@
  *
  */
-static int parsedataunchanged(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
+static int parsedataunchanged(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac,
+                              aim_bstream_t *bs)
 {
 	int ret = 0;
@@ -1168,6 +1294,7 @@
 	sess->ssi.received_data = 1;
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		ret = userfunc(sess, rx);
+	}
 
 	return ret;
@@ -1177,12 +1304,13 @@
 {
 
-	if (snac->subtype == AIM_CB_SSI_RIGHTSINFO)
+	if (snac->subtype == AIM_CB_SSI_RIGHTSINFO) {
 		return parserights(sess, mod, rx, snac, bs);
-	else if (snac->subtype == AIM_CB_SSI_LIST)
+	} else if (snac->subtype == AIM_CB_SSI_LIST) {
 		return parsedata(sess, mod, rx, snac, bs);
-	else if (snac->subtype == AIM_CB_SSI_SRVACK)
+	} else if (snac->subtype == AIM_CB_SSI_SRVACK) {
 		return parseack(sess, mod, rx, snac, bs);
-	else if (snac->subtype == AIM_CB_SSI_NOLIST)
+	} else if (snac->subtype == AIM_CB_SSI_NOLIST) {
 		return parsedataunchanged(sess, mod, rx, snac, bs);
+	}
 
 	return 0;
Index: protocols/oscar/ssi.h
===================================================================
--- protocols/oscar/ssi.h	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/ssi.h	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -47,5 +47,6 @@
 int aim_ssi_reqalldata(aim_session_t *sess, aim_conn_t *conn);
 int aim_ssi_enable(aim_session_t *sess, aim_conn_t *conn);
-int aim_ssi_addmoddel(aim_session_t *sess, aim_conn_t *conn, struct aim_ssi_item **items, unsigned int num, guint16 subtype);
+int aim_ssi_addmoddel(aim_session_t *sess, aim_conn_t *conn, struct aim_ssi_item **items, unsigned int num,
+                      guint16 subtype);
 int aim_ssi_modbegin(aim_session_t *sess, aim_conn_t *conn);
 int aim_ssi_modend(aim_session_t *sess, aim_conn_t *conn);
@@ -58,5 +59,6 @@
 
 /* Send packets */
-int aim_ssi_addbuddies(aim_session_t *sess, aim_conn_t *conn, char *gn, char **sn, unsigned int num, unsigned int flags);
+int aim_ssi_addbuddies(aim_session_t *sess, aim_conn_t *conn, char *gn, char **sn, unsigned int num,
+                       unsigned int flags);
 int aim_ssi_addmastergroup(aim_session_t *sess, aim_conn_t *conn);
 int aim_ssi_addgroups(aim_session_t *sess, aim_conn_t *conn, char **gn, unsigned int num);
Index: protocols/oscar/stats.c
===================================================================
--- protocols/oscar/stats.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/stats.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -2,5 +2,6 @@
 #include <aim.h>
 
-static int reportinterval(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs)
+static int reportinterval(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac,
+                          aim_bstream_t *bs)
 {
 	guint16 interval;
@@ -9,6 +10,7 @@
 	interval = aimbs_get16(bs);
 
-	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
+	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {
 		return userfunc(sess, rx, interval);
+	}
 
 	return 0;
@@ -18,6 +20,7 @@
 {
 
-	if (snac->subtype == 0x0002)
+	if (snac->subtype == 0x0002) {
 		return reportinterval(sess, mod, rx, snac, bs);
+	}
 
 	return 0;
Index: protocols/oscar/tlv.c
===================================================================
--- protocols/oscar/tlv.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/tlv.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -3,7 +3,8 @@
 static void freetlv(aim_tlv_t **oldtlv)
 {
-	if (!oldtlv || !*oldtlv)
+	if (!oldtlv || !*oldtlv) {
 		return;
-	
+	}
+
 	g_free((*oldtlv)->value);
 	g_free(*oldtlv);
@@ -22,5 +23,5 @@
  *
  * XXX There should be a flag setable here to have the tlvlist contain
- * bstream references, so that at least the ->value portion of each 
+ * bstream references, so that at least the ->value portion of each
  * element doesn't need to be malloc/memcpy'd.  This could prove to be
  * just as effecient as the in-place TLV parsing used in a couple places
@@ -42,6 +43,7 @@
 		cur->tlv = g_new0(aim_tlv_t, 1);
 		cur->tlv->type = type;
-		if ((cur->tlv->length = length))
-			cur->tlv->value = aimbs_getraw(bs, length);	
+		if ((cur->tlv->length = length)) {
+			cur->tlv->value = aimbs_getraw(bs, length);
+		}
 
 		cur->next = list;
@@ -65,10 +67,11 @@
 	aim_tlvlist_t *cur;
 
-	if (!list || !*list)
+	if (!list || !*list) {
 		return;
+	}
 
 	for (cur = *list; cur; ) {
 		aim_tlvlist_t *tmp;
-		
+
 		freetlv(&cur->tlv);
 
@@ -95,9 +98,11 @@
 	int count;
 
-	if (!list || !*list)
-		return 0;
-
-	for (cur = *list, count = 0; cur; cur = cur->next)
+	if (!list || !*list) {
+		return 0;
+	}
+
+	for (cur = *list, count = 0; cur; cur = cur->next) {
 		count++;
+	}
 
 	return count;
@@ -108,5 +113,5 @@
  * @list: Chain to be sized
  *
- * Returns the number of bytes that would be needed to 
+ * Returns the number of bytes that would be needed to
  * write the passed TLV chain to a data buffer.
  *
@@ -117,9 +122,11 @@
 	int size;
 
-	if (!list || !*list)
-		return 0;
-
-	for (cur = *list, size = 0; cur; cur = cur->next)
+	if (!list || !*list) {
+		return 0;
+	}
+
+	for (cur = *list, size = 0; cur; cur = cur->next) {
 		size += (4 + cur->tlv->length);
+	}
 
 	return size;
@@ -141,9 +148,11 @@
 	aim_tlvlist_t *newtlv, *cur;
 
-	if (!list)
-		return 0;
-
-	if (!(newtlv = g_new0(aim_tlvlist_t, 1)))
-		return 0;
+	if (!list) {
+		return 0;
+	}
+
+	if (!(newtlv = g_new0(aim_tlvlist_t, 1))) {
+		return 0;
+	}
 
 	if (!(newtlv->tlv = g_new0(aim_tlv_t, 1))) {
@@ -153,13 +162,14 @@
 	newtlv->tlv->type = t;
 	if ((newtlv->tlv->length = l)) {
-		newtlv->tlv->value = (guint8 *)g_malloc(newtlv->tlv->length);
+		newtlv->tlv->value = (guint8 *) g_malloc(newtlv->tlv->length);
 		memcpy(newtlv->tlv->value, v, newtlv->tlv->length);
 	}
 
-	if (!*list)
+	if (!*list) {
 		*list = newtlv;
-	else {
-		for(cur = *list; cur->next; cur = cur->next)
+	} else {
+		for (cur = *list; cur->next; cur = cur->next) {
 			;
+		}
 		cur->next = newtlv;
 	}
@@ -234,10 +244,11 @@
 int aim_addtlvtochain_caps(aim_tlvlist_t **list, const guint16 t, const guint32 caps)
 {
-	guint8 buf[16*16]; /* XXX icky fixed length buffer */
+	guint8 buf[16 * 16]; /* XXX icky fixed length buffer */
 	aim_bstream_t bs;
 
-	if (!caps)
+	if (!caps) {
 		return 0; /* nothing there anyway */
 
+	}
 	aim_bstream_init(&bs, buf, sizeof(buf));
 
@@ -266,5 +277,5 @@
  *
  * XXX should probably support sublists for real.
- * 
+ *
  * This is so neat.
  *
@@ -278,9 +289,11 @@
 	buflen = aim_sizetlvchain(tl);
 
-	if (buflen <= 0)
-		return 0;
-
-	if (!(buf = g_malloc(buflen)))
-		return 0;
+	if (buflen <= 0) {
+		return 0;
+	}
+
+	if (!(buf = g_malloc(buflen))) {
+		return 0;
+	}
 
 	aim_bstream_init(&bs, buf, buflen);
@@ -295,5 +308,6 @@
 }
 
-int aim_addtlvtochain_chatroom(aim_tlvlist_t **list, guint16 type, guint16 exchange, const char *roomname, guint16 instance)
+int aim_addtlvtochain_chatroom(aim_tlvlist_t **list, guint16 type, guint16 exchange, const char *roomname,
+                               guint16 instance)
 {
 	guint8 *buf;
@@ -302,7 +316,8 @@
 
 	buflen = 2 + 1 + strlen(roomname) + 2;
-	
-	if (!(buf = g_malloc(buflen)))
-		return 0;
+
+	if (!(buf = g_malloc(buflen))) {
+		return 0;
+	}
 
 	aim_bstream_init(&bs, buf, buflen);
@@ -310,5 +325,5 @@
 	aimbs_put16(&bs, exchange);
 	aimbs_put8(&bs, strlen(roomname));
-	aimbs_putraw(&bs, (guint8 *)roomname, strlen(roomname));
+	aimbs_putraw(&bs, (guint8 *) roomname, strlen(roomname));
 	aimbs_put16(&bs, instance);
 
@@ -327,9 +342,9 @@
  *
  * Copies a TLV chain into a raw data buffer, writing only the number
- * of bytes specified. This operation does not free the chain; 
+ * of bytes specified. This operation does not free the chain;
  * aim_freetlvchain() must still be called to free up the memory used
  * by the chain structures.
  *
- * XXX clean this up, make better use of bstreams 
+ * XXX clean this up, make better use of bstreams
  */
 int aim_writetlvchain(aim_bstream_t *bs, aim_tlvlist_t **list)
@@ -344,13 +359,15 @@
 	}
 
-	if (goodbuflen > aim_bstream_empty(bs))
+	if (goodbuflen > aim_bstream_empty(bs)) {
 		return 0; /* not enough buffer */
 
+	}
 	/* do the real write-out */
 	for (cur = *list; cur; cur = cur->next) {
 		aimbs_put16(bs, cur->tlv->type);
 		aimbs_put16(bs, cur->tlv->length);
-		if (cur->tlv->length)
+		if (cur->tlv->length) {
 			aimbs_putraw(bs, cur->tlv->value, cur->tlv->length);
+		}
 	}
 
@@ -365,5 +382,5 @@
  * @nth: Index of TLV of type to get
  *
- * Returns a pointer to an aim_tlv_t of the specified type; 
+ * Returns a pointer to an aim_tlv_t of the specified type;
  * %NULL on error.  The @nth parameter is specified starting at %1.
  * In most cases, there will be no more than one TLV of any type
@@ -378,8 +395,10 @@
 	for (cur = list, i = 0; cur; cur = cur->next) {
 		if (cur && cur->tlv) {
-			if (cur->tlv->type == t)
+			if (cur->tlv->type == t) {
 				i++;
-			if (i >= n)
+			}
+			if (i >= n) {
 				return cur->tlv;
+			}
 		}
 	}
@@ -395,5 +414,5 @@
  *
  * Same as aim_gettlv(), except that the return value is a %NULL-
- * terminated string instead of an aim_tlv_t.  This is a 
+ * terminated string instead of an aim_tlv_t.  This is a
  * dynamic buffer and must be freed by the caller.
  *
@@ -404,6 +423,7 @@
 	char *newstr;
 
-	if (!(tlv = aim_gettlv(list, t, n)))
+	if (!(tlv = aim_gettlv(list, t, n))) {
 		return NULL;
+	}
 
 	newstr = (char *) g_malloc(tlv->length + 1);
@@ -420,6 +440,6 @@
  * @nth: Index of TLV to return
  *
- * Same as aim_gettlv(), except that the return value is a 
- * 8bit integer instead of an aim_tlv_t. 
+ * Same as aim_gettlv(), except that the return value is a
+ * 8bit integer instead of an aim_tlv_t.
  *
  */
@@ -428,6 +448,7 @@
 	aim_tlv_t *tlv;
 
-	if (!(tlv = aim_gettlv(list, t, n)))
+	if (!(tlv = aim_gettlv(list, t, n))) {
 		return 0; /* erm */
+	}
 	return aimutil_get8(tlv->value);
 }
@@ -439,6 +460,6 @@
  * @nth: Index of TLV to return
  *
- * Same as aim_gettlv(), except that the return value is a 
- * 16bit integer instead of an aim_tlv_t. 
+ * Same as aim_gettlv(), except that the return value is a
+ * 16bit integer instead of an aim_tlv_t.
  *
  */
@@ -447,6 +468,7 @@
 	aim_tlv_t *tlv;
 
-	if (!(tlv = aim_gettlv(list, t, n)))
+	if (!(tlv = aim_gettlv(list, t, n))) {
 		return 0; /* erm */
+	}
 	return aimutil_get16(tlv->value);
 }
@@ -458,6 +480,6 @@
  * @nth: Index of TLV to return
  *
- * Same as aim_gettlv(), except that the return value is a 
- * 32bit integer instead of an aim_tlv_t. 
+ * Same as aim_gettlv(), except that the return value is a
+ * 32bit integer instead of an aim_tlv_t.
  *
  */
@@ -466,6 +488,7 @@
 	aim_tlv_t *tlv;
 
-	if (!(tlv = aim_gettlv(list, t, n)))
+	if (!(tlv = aim_gettlv(list, t, n))) {
 		return 0; /* erm */
+	}
 	return aimutil_get32(tlv->value);
 }
@@ -544,7 +567,8 @@
 
 	i = aimutil_put16(buf, t);
-	i += aimutil_put16(buf+i, l);
-	if (l)
-		memcpy(buf+i, v, l);
+	i += aimutil_put16(buf + i, l);
+	if (l) {
+		memcpy(buf + i, v, l);
+	}
 	i += l;
 
Index: protocols/oscar/txqueue.c
===================================================================
--- protocols/oscar/txqueue.c	(revision 8519f457c31139750b9f7497834ac90a57196d22)
+++ protocols/oscar/txqueue.c	(revision 75ad761cc229568e799659d6c6a623c4bc837ba4)
@@ -32,8 +32,9 @@
 	}
 
-	if (!(fr = (aim_frame_t *)g_new0(aim_frame_t,1)))
+	if (!(fr = (aim_frame_t *) g_new0(aim_frame_t, 1))) {
 		return NULL;
-
-	fr->conn = conn; 
+	}
+
+	fr->conn = conn;
 
 	fr->hdrtype = framing;
@@ -43,11 +44,12 @@
 		fr->hdr.flap.type = chan;
 
-	} else 
+	} else {
 		imcb_error(sess->aux_data, "unknown framing");
+	}
 
 	if (datalen > 0) {
 		guint8 *data;
 
-		if (!(data = (unsigned char *)g_malloc(datalen))) {
+		if (!(data = (unsigned char *) g_malloc(datalen))) {
 			aim_frame_destroy(fr);
 			return NULL;
@@ -90,11 +92,12 @@
 
 	/* see overhead note in aim_rxqueue counterpart */
-	if (!sess->queue_outgoing)
+	if (!sess->queue_outgoing) {
 		sess->queue_outgoing = fr;
-	else {
+	} else {
 		aim_frame_t *cur;
 
-		for (cur = sess->queue_outgoing; cur->next; cur = cur->next)
+		for (cur = sess->queue_outgoing; cur->next; cur = cur->next) {
 			;
+		}
 		cur->next = fr;
 	}
@@ -111,6 +114,6 @@
  * Basically the same as its __queuebased couterpart, however
  * instead of doing a list append, it just calls aim_tx_sendframe()
- * right here. 
- * 
+ * right here.
+ *
  */
 static int aim_tx_enqueue__immediate(aim_session_t *sess, aim_frame_t *fr)
@@ -123,6 +126,7 @@
 	}
 
-	if (fr->hdrtype == AIM_FRAMETYPE_FLAP)
+	if (fr->hdrtype == AIM_FRAMETYPE_FLAP) {
 		fr->hdr.flap.seqnum = aim_get_next_txseqnum(fr->conn);
+	}
 
 	fr->handled = 0; /* not sent yet */
@@ -137,16 +141,18 @@
 int aim_tx_setenqueue(aim_session_t *sess, int what, int (*func)(aim_session_t *, aim_frame_t *))
 {
-	
-	if (what == AIM_TX_QUEUED)
+
+	if (what == AIM_TX_QUEUED) {
 		sess->tx_enqueue = &aim_tx_enqueue__queuebased;
-	else if (what == AIM_TX_IMMEDIATE) 
+	} else if (what == AIM_TX_IMMEDIATE) {
 		sess->tx_enqueue = &aim_tx_enqueue__immediate;
-	else if (what == AIM_TX_USER) {
-		if (!func)
+	} else if (what == AIM_TX_USER) {
+		if (!func) {
 			return -EINVAL;
+		}
 		sess->tx_enqueue = func;
-	} else
+	} else {
 		return -EINVAL; /* unknown action */
 
+	}
 	return 0;
 }
@@ -154,5 +160,5 @@
 int aim_tx_enqueue(aim_session_t *sess, aim_frame_t *fr)
 {
-	
+
 	/*
 	 * If we want to send a connection thats inprogress, we have to force
@@ -160,6 +166,6 @@
 	 * want.
 	 */
-	if (fr && fr->conn && 
-			(fr->conn->status & AIM_CONN_STATUS_INPROGRESS)) {
+	if (fr && fr->conn &&
+	    (fr->conn->status & AIM_CONN_STATUS_INPROGRESS)) {
 		return aim_tx_enqueue__queuebased(sess, fr);
 	}
@@ -168,5 +174,5 @@
 }
 
-/* 
+/*
  *  aim_get_next_txseqnum()
  *
@@ -180,5 +186,5 @@
 {
 	flap_seqnum_t ret;
-	
+
 	ret = ++conn->seqnum;
 
@@ -193,9 +199,10 @@
 		int ret;
 
-		ret = send(fd, ((unsigned char *)buf)+cur, left, 0);
-		if (ret == -1)
+		ret = send(fd, ((unsigned char *) buf) + cur, left, 0);
+		if (ret == -1) {
 			return -1;
-		else if (ret == 0)
+		} else if (ret == 0) {
 			return cur;
+		}
 
 		cur += ret;
@@ -209,20 +216,23 @@
 {
 	int wrote = 0;
-	if (!bs || !conn || (count < 0))
+
+	if (!bs || !conn || (count < 0)) {
 		return -EINVAL;
-
-	if (count > aim_bstream_empty(bs))
+	}
+
+	if (count > aim_bstream_empty(bs)) {
 		count = aim_bstream_empty(bs); /* truncate to remaining space */
 
+	}
 	if (count) {
 		if (count - wrote) {
 			wrote = wrote + aim_send(conn->fd, bs->data + bs->offset + wrote, count - wrote);
 		}
-		
-	}
-	
+
+	}
+
 	bs->offset += wrote;
 
-	return wrote;	
+	return wrote;
 }
 
@@ -235,6 +245,7 @@
 	payloadlen = aim_bstream_curpos(&fr->data);
 
-	if (!(obs_raw = g_malloc(6 + payloadlen)))
+	if (!(obs_raw = g_malloc(6 + payloadlen))) {
 		return -ENOMEM;
+	}
 
 	aim_bstream_init(&obs, obs_raw, 6 + payloadlen);
@@ -252,7 +263,8 @@
 	obslen = aim_bstream_curpos(&obs);
 	aim_bstream_rewind(&obs);
-	if (aim_bstream_send(&obs, fr->conn, obslen) != obslen)
+	if (aim_bstream_send(&obs, fr->conn, obslen) != obslen) {
 		err = -errno;
-	
+	}
+
 	g_free(obs_raw); /* XXX aim_bstream_free */
 
@@ -265,6 +277,7 @@
 int aim_tx_sendframe(aim_session_t *sess, aim_frame_t *fr)
 {
-	if (fr->hdrtype == AIM_FRAMETYPE_FLAP)
+	if (fr->hdrtype == AIM_FRAMETYPE_FLAP) {
 		return sendframe_flap(sess, fr);
+	}
 	return -1;
 }
@@ -276,9 +289,11 @@
 	for (cur = sess->queue_outgoing; cur; cur = cur->next) {
 
-		if (cur->handled)
-	       		continue; /* already been sent */
-
-		if (cur->conn && (cur->conn->status & AIM_CONN_STATUS_INPROGRESS))
+		if (cur->handled) {
+			continue; /* already been sent */
+
+		}
+		if (cur->conn && (cur->conn->status & AIM_CONN_STATUS_INPROGRESS)) {
 			continue;
+		}
 
 		/*
@@ -287,6 +302,6 @@
 		 */
 		if ((cur->conn->lastactivity + cur->conn->forcedlatency) >= time(NULL)) {
-			/* 
-			 * XXX should be a break! we dont want to block the 
+			/*
+			 * XXX should be a break! we dont want to block the
 			 * upper layers
 			 *
@@ -309,8 +324,8 @@
 /*
  *  aim_tx_purgequeue()
- *  
- *  This is responsable for removing sent commands from the transmit 
+ *
+ *  This is responsable for removing sent commands from the transmit
  *  queue. This is not a required operation, but it of course helps
- *  reduce memory footprint at run time!  
+ *  reduce memory footprint at run time!
  *
  */
@@ -326,6 +341,7 @@
 			aim_frame_destroy(cur);
 
-		} else
+		} else {
 			prev = &cur->next;
+		}
 	}
 
@@ -347,6 +363,7 @@
 
 	for (cur = sess->queue_outgoing; cur; cur = cur->next) {
-		if (cur->conn == conn)
+		if (cur->conn == conn) {
 			cur->handled = 1;
+		}
 	}
 
