Index: protocols/oscar/oscar.c
===================================================================
--- protocols/oscar/oscar.c	(revision 6b13103dad92d505e038c268af66aeb04b7b4d87)
+++ protocols/oscar/oscar.c	(revision 5ebff60479fc7a9f7f50ac03b124c91d4e6ebe11)
@@ -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;
 
