Index: skype/skype.c
===================================================================
--- skype/skype.c	(revision a5f4040ca3d4d70c593875cfedb3c1f6a249ace4)
+++ skype/skype.c	(revision 5adcc6514dacb4242c1cc89206f95be4f5a200db)
@@ -1,5 +1,5 @@
 /*
  *  skype.c - Skype plugin for BitlBee
- * 
+ *
  *  Copyright (c) 2007, 2008 by Miklos Vajna <vmiklos@frugalware.org>
  *
@@ -7,5 +7,5 @@
  *
  *  Copyright (c) 2006 by Wilmer van der Gaast <wilmer@gaast.net>
- * 
+ *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -20,5 +20,5 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  *  USA.
  */
@@ -38,6 +38,5 @@
  */
 
-typedef enum
-{
+typedef enum {
 	SKYPE_CALL_RINGING = 1,
 	SKYPE_CALL_MISSED,
@@ -47,6 +46,5 @@
 } skype_call_status;
 
-typedef enum
-{
+typedef enum {
 	SKYPE_FILETRANSFER_NEW = 1,
 	SKYPE_FILETRANSFER_FAILED
@@ -57,6 +55,5 @@
  */
 
-struct skype_data
-{
+struct skype_data {
 	struct im_connection *ic;
 	char *username;
@@ -88,7 +85,7 @@
 	/* Using /j #nick we want to have a groupchat with two people. Usually
 	 * not (default). */
-	char* groupchat_with;
+	char *groupchat_with;
 	/* The user who invited us to the chat. */
-	char* adder;
+	char *adder;
 	/* If we are waiting for a confirmation about we changed the topic. */
 	int topic_wait;
@@ -114,12 +111,10 @@
 };
 
-struct skype_away_state
-{
+struct skype_away_state {
 	char *code;
 	char *full_name;
 };
 
-struct skype_buddy_ask_data
-{
+struct skype_buddy_ask_data {
 	struct im_connection *ic;
 	/* This is also used for call IDs for simplicity */
@@ -131,6 +126,5 @@
  */
 
-const struct skype_away_state skype_away_state_list[] =
-{
+const struct skype_away_state skype_away_state_list[] = {
 	{ "ONLINE",  "Online" },
 	{ "SKYPEME",  "Skype Me" },
@@ -147,5 +141,5 @@
  */
 
-int skype_write( struct im_connection *ic, char *buf )
+int skype_write(struct im_connection *ic, char *buf)
 {
 	struct skype_data *sd = ic->proto_data;
@@ -159,19 +153,18 @@
 	 * sd->fd. */
 	poll(pfd, 1, 1000);
-	if(pfd[0].revents & POLLHUP)
-	{
-		imc_logout( ic, TRUE );
+	if (pfd[0].revents & POLLHUP) {
+		imc_logout(ic, TRUE);
 		return FALSE;
 	}
-	ssl_write( sd->ssl, buf, len );
+	ssl_write(sd->ssl, buf, len);
 
 	return TRUE;
 }
 
-static void skype_buddy_ask_yes( void *data )
+static void skype_buddy_ask_yes(void *data)
 {
 	struct skype_buddy_ask_data *bla = data;
 	char *buf = g_strdup_printf("SET USER %s ISAUTHORIZED TRUE", bla->handle);
-	skype_write( bla->ic, buf );
+	skype_write(bla->ic, buf);
 	g_free(buf);
 	g_free(bla->handle);
@@ -179,9 +172,9 @@
 }
 
-static void skype_buddy_ask_no( void *data )
+static void skype_buddy_ask_no(void *data)
 {
 	struct skype_buddy_ask_data *bla = data;
 	char *buf = g_strdup_printf("SET USER %s ISAUTHORIZED FALSE", bla->handle);
-	skype_write( bla->ic, buf );
+	skype_write(bla->ic, buf);
 	g_free(buf);
 	g_free(bla->handle);
@@ -189,7 +182,7 @@
 }
 
-void skype_buddy_ask( struct im_connection *ic, char *handle, char *message)
-{
-	struct skype_buddy_ask_data *bla = g_new0( struct skype_buddy_ask_data, 1 );
+void skype_buddy_ask(struct im_connection *ic, char *handle, char *message)
+{
+	struct skype_buddy_ask_data *bla = g_new0(struct skype_buddy_ask_data, 1);
 	char *buf;
 
@@ -197,14 +190,14 @@
 	bla->handle = g_strdup(handle);
 
-	buf = g_strdup_printf( "The user %s wants to add you to his/her buddy list, saying: '%s'.", handle, message);
-	imcb_ask( ic, buf, bla, skype_buddy_ask_yes, skype_buddy_ask_no );
-	g_free( buf );
-}
-
-static void skype_call_ask_yes( void *data )
+	buf = g_strdup_printf("The user %s wants to add you to his/her buddy list, saying: '%s'.", handle, message);
+	imcb_ask(ic, buf, bla, skype_buddy_ask_yes, skype_buddy_ask_no);
+	g_free(buf);
+}
+
+static void skype_call_ask_yes(void *data)
 {
 	struct skype_buddy_ask_data *bla = data;
 	char *buf = g_strdup_printf("SET CALL %s STATUS INPROGRESS", bla->handle);
-	skype_write( bla->ic, buf );
+	skype_write(bla->ic, buf);
 	g_free(buf);
 	g_free(bla->handle);
@@ -212,9 +205,9 @@
 }
 
-static void skype_call_ask_no( void *data )
+static void skype_call_ask_no(void *data)
 {
 	struct skype_buddy_ask_data *bla = data;
 	char *buf = g_strdup_printf("SET CALL %s STATUS FINISHED", bla->handle);
-	skype_write( bla->ic, buf );
+	skype_write(bla->ic, buf);
 	g_free(buf);
 	g_free(bla->handle);
@@ -222,59 +215,57 @@
 }
 
-void skype_call_ask( struct im_connection *ic, char *call_id, char *message)
-{
-	struct skype_buddy_ask_data *bla = g_new0( struct skype_buddy_ask_data, 1 );
+void skype_call_ask(struct im_connection *ic, char *call_id, char *message)
+{
+	struct skype_buddy_ask_data *bla = g_new0(struct skype_buddy_ask_data, 1);
 
 	bla->ic = ic;
 	bla->handle = g_strdup(call_id);
 
-	imcb_ask( ic, message, bla, skype_call_ask_yes, skype_call_ask_no );
-}
-struct groupchat *skype_chat_by_name( struct im_connection *ic, char *name )
+	imcb_ask(ic, message, bla, skype_call_ask_yes, skype_call_ask_no);
+}
+struct groupchat *skype_chat_by_name(struct im_connection *ic, char *name)
 {
 	struct groupchat *ret;
 
-	for( ret = ic->groupchats; ret; ret = ret->next )
-	{
-		if(strcmp(name, ret->title ) == 0 )
+	for (ret = ic->groupchats; ret; ret = ret->next)
+		if (strcmp(name, ret->title) == 0)
 			break;
+
+	return ret;
+}
+
+static char *skype_call_strerror(int err)
+{
+	switch (err) {
+	case 1:
+		return "Miscellaneous error";
+	case 2:
+		return "User or phone number does not exist.";
+	case 3:
+		return "User is offline";
+	case 4:
+		return "No proxy found";
+	case 5:
+		return "Session terminated.";
+	case 6:
+		return "No common codec found.";
+	case 7:
+		return "Sound I/O error.";
+	case 8:
+		return "Problem with remote sound device.";
+	case 9:
+		return "Call blocked by recipient.";
+	case 10:
+		return "Recipient not a friend.";
+	case 11:
+		return "Current user not authorized by recipient.";
+	case 12:
+		return "Sound recording error.";
+	default:
+		return "Unknown error";
 	}
-
-	return ret;
-}
-
-static char *skype_call_strerror(int err)
-{
-	switch(err) {
-		case 1:
-			return "Miscellaneous error";
-		case 2:
-			return "User or phone number does not exist.";
-		case 3:
-			return "User is offline";
-		case 4:
-			return "No proxy found";
-		case 5:
-			return "Session terminated.";
-		case 6:
-			return "No common codec found.";
-		case 7:
-			return "Sound I/O error.";
-		case 8:
-			return "Problem with remote sound device.";
-		case 9:
-			return "Call blocked by recipient.";
-		case 10:
-			return "Recipient not a friend.";
-		case 11:
-			return "Current user not authorized by recipient.";
-		case 12:
-			return "Sound recording error.";
-		default:
-			return "Unknown error";
-	}
-}
-
-static gboolean skype_read_callback( gpointer data, gint fd, b_input_condition cond )
+}
+
+static gboolean skype_read_callback(gpointer data, gint fd, b_input_condition cond)
 {
 	struct im_connection *ic = data;
@@ -284,20 +275,17 @@
 	char **lines, **lineptr, *line, *ptr;
 
-	if( !sd || sd->fd == -1 )
+	if (!sd || sd->fd == -1)
 		return FALSE;
 	/* Read the whole data. */
-	st = ssl_read( sd->ssl, buf, sizeof( buf ) );
-	if( st > 0 )
-	{
+	st = ssl_read(sd->ssl, buf, sizeof(buf));
+	if (st > 0) {
 		buf[st] = '\0';
 		/* Then split it up to lines. */
 		lines = g_strsplit(buf, "\n", 0);
 		lineptr = lines;
-		while((line = *lineptr))
-		{
-			if(!strlen(line))
+		while ((line = *lineptr)) {
+			if (!strlen(line))
 				break;
-			if(!strncmp(line, "USERS ", 6))
-			{
+			if (!strncmp(line, "USERS ", 6)) {
 				char **i;
 				char **nicks;
@@ -305,14 +293,11 @@
 				nicks = g_strsplit(line + 6, ", ", 0);
 				i = nicks;
-				while(*i)
-				{
+				while (*i) {
 					g_snprintf(buf, 1024, "GET USER %s ONLINESTATUS\n", *i);
-					skype_write( ic, buf );
+					skype_write(ic, buf);
 					i++;
 				}
 				g_strfreev(nicks);
-			}
-			else if(!strncmp(line, "USER ", 5))
-			{
+			} else if (!strncmp(line, "USER ", 5)) {
 				int flags = 0;
 				char *status = strrchr(line, ' ');
@@ -322,102 +307,87 @@
 				*ptr = '\0';
 				ptr++;
-				if(!strncmp(ptr, "ONLINESTATUS ", 13) &&
+				if (!strncmp(ptr, "ONLINESTATUS ", 13) &&
 						strcmp(user, sd->username) != 0
-						&& strcmp(user, "echo123") != 0)
-				{
+						&& strcmp(user, "echo123") != 0) {
 					ptr = g_strdup_printf("%s@skype.com", user);
 					imcb_add_buddy(ic, ptr, NULL);
-					if(strcmp(status, "OFFLINE") && (strcmp(status, "SKYPEOUT") || !set_getbool(&ic->acc->set, "skypeout_offline")))
+					if (strcmp(status, "OFFLINE") && (strcmp(status, "SKYPEOUT") || !set_getbool(&ic->acc->set, "skypeout_offline")))
 						flags |= OPT_LOGGED_IN;
-					if(strcmp(status, "ONLINE") != 0 && strcmp(status, "SKYPEME") != 0)
+					if (strcmp(status, "ONLINE") != 0 && strcmp(status, "SKYPEME") != 0)
 						flags |= OPT_AWAY;
 					imcb_buddy_status(ic, ptr, flags, NULL, NULL);
 					g_free(ptr);
-				}
-				else if(!strncmp(ptr, "RECEIVEDAUTHREQUEST ", 20))
-				{
+				} else if (!strncmp(ptr, "RECEIVEDAUTHREQUEST ", 20)) {
 					char *message = ptr + 20;
-					if(strlen(message))
+					if (strlen(message))
 						skype_buddy_ask(ic, user, message);
-				}
-				else if(!strncmp(ptr, "BUDDYSTATUS ", 12))
-				{
+				} else if (!strncmp(ptr, "BUDDYSTATUS ", 12)) {
 					char *st = ptr + 12;
-					if(!strcmp(st, "3"))
-					{
+					if (!strcmp(st, "3")) {
 						char *buf = g_strdup_printf("%s@skype.com", user);
 						imcb_add_buddy(ic, buf, NULL);
 						g_free(buf);
 					}
-				}
-				else if(!strncmp(ptr, "FULLNAME ", 9))
+				} else if (!strncmp(ptr, "FULLNAME ", 9))
 					sd->info_fullname = g_strdup_printf("%s", ptr + 9);
-				else if(!strncmp(ptr, "PHONE_HOME ", 11))
+				else if (!strncmp(ptr, "PHONE_HOME ", 11))
 					sd->info_phonehome = g_strdup_printf("%s", ptr + 11);
-				else if(!strncmp(ptr, "PHONE_OFFICE ", 13))
+				else if (!strncmp(ptr, "PHONE_OFFICE ", 13))
 					sd->info_phoneoffice = g_strdup_printf("%s", ptr + 13);
-				else if(!strncmp(ptr, "PHONE_MOBILE ", 13))
+				else if (!strncmp(ptr, "PHONE_MOBILE ", 13))
 					sd->info_phonemobile = g_strdup_printf("%s", ptr + 13);
-				else if(!strncmp(ptr, "NROF_AUTHED_BUDDIES ", 20))
+				else if (!strncmp(ptr, "NROF_AUTHED_BUDDIES ", 20))
 					sd->info_nrbuddies = g_strdup_printf("%s", ptr + 20);
-				else if(!strncmp(ptr, "TIMEZONE ", 9))
+				else if (!strncmp(ptr, "TIMEZONE ", 9))
 					sd->info_tz = g_strdup_printf("%s", ptr + 9);
-				else if(!strncmp(ptr, "LASTONLINETIMESTAMP ", 20))
+				else if (!strncmp(ptr, "LASTONLINETIMESTAMP ", 20))
 					sd->info_seen = g_strdup_printf("%s", ptr + 20);
-				else if(!strncmp(ptr, "BIRTHDAY ", 9))
+				else if (!strncmp(ptr, "BIRTHDAY ", 9))
 					sd->info_birthday = g_strdup_printf("%s", ptr + 9);
-				else if(!strncmp(ptr, "SEX ", 4))
+				else if (!strncmp(ptr, "SEX ", 4))
 					sd->info_sex = g_strdup_printf("%s", ptr + 4);
-				else if(!strncmp(ptr, "LANGUAGE ", 9))
+				else if (!strncmp(ptr, "LANGUAGE ", 9))
 					sd->info_language = g_strdup_printf("%s", ptr + 9);
-				else if(!strncmp(ptr, "COUNTRY ", 8))
+				else if (!strncmp(ptr, "COUNTRY ", 8))
 					sd->info_country = g_strdup_printf("%s", ptr + 8);
-				else if(!strncmp(ptr, "PROVINCE ", 9))
+				else if (!strncmp(ptr, "PROVINCE ", 9))
 					sd->info_province = g_strdup_printf("%s", ptr + 9);
-				else if(!strncmp(ptr, "CITY ", 5))
+				else if (!strncmp(ptr, "CITY ", 5))
 					sd->info_city = g_strdup_printf("%s", ptr + 5);
-				else if(!strncmp(ptr, "HOMEPAGE ", 9))
+				else if (!strncmp(ptr, "HOMEPAGE ", 9))
 					sd->info_homepage = g_strdup_printf("%s", ptr + 9);
-				else if(!strncmp(ptr, "ABOUT ", 6))
-				{
+				else if (!strncmp(ptr, "ABOUT ", 6)) {
 					sd->info_about = g_strdup_printf("%s", ptr + 6);
 
 					GString *st = g_string_new("Contact Information\n");
 					g_string_append_printf(st, "Skype Name: %s\n", user);
-					if(sd->info_fullname)
-					{
-						if(strlen(sd->info_fullname))
+					if (sd->info_fullname) {
+						if (strlen(sd->info_fullname))
 							g_string_append_printf(st, "Full Name: %s\n", sd->info_fullname);
 						g_free(sd->info_fullname);
 					}
-					if(sd->info_phonehome)
-					{
-						if(strlen(sd->info_phonehome))
+					if (sd->info_phonehome) {
+						if (strlen(sd->info_phonehome))
 							g_string_append_printf(st, "Home Phone: %s\n", sd->info_phonehome);
 						g_free(sd->info_phonehome);
 					}
-					if(sd->info_phoneoffice)
-					{
-						if(strlen(sd->info_phoneoffice))
+					if (sd->info_phoneoffice) {
+						if (strlen(sd->info_phoneoffice))
 							g_string_append_printf(st, "Office Phone: %s\n", sd->info_phoneoffice);
 						g_free(sd->info_phoneoffice);
 					}
-					if(sd->info_phonemobile)
-					{
-						if(strlen(sd->info_phonemobile))
+					if (sd->info_phonemobile) {
+						if (strlen(sd->info_phonemobile))
 							g_string_append_printf(st, "Mobile Phone: %s\n", sd->info_phonemobile);
 						g_free(sd->info_phonemobile);
 					}
 					g_string_append_printf(st, "Personal Information\n");
-					if(sd->info_nrbuddies)
-					{
-						if(strlen(sd->info_nrbuddies))
+					if (sd->info_nrbuddies) {
+						if (strlen(sd->info_nrbuddies))
 							g_string_append_printf(st, "Contacts: %s\n", sd->info_nrbuddies);
 						g_free(sd->info_nrbuddies);
 					}
-					if(sd->info_tz)
-					{
-						if(strlen(sd->info_tz))
-						{
+					if (sd->info_tz) {
+						if (strlen(sd->info_tz)) {
 							char ib[256];
 							time_t t = time(NULL);
@@ -429,8 +399,6 @@
 						g_free(sd->info_tz);
 					}
-					if(sd->info_seen)
-					{
-						if(strlen(sd->info_seen))
-						{
+					if (sd->info_seen) {
+						if (strlen(sd->info_seen)) {
 							char ib[256];
 							time_t it = atoi(sd->info_seen);
@@ -441,8 +409,6 @@
 						g_free(sd->info_seen);
 					}
-					if(sd->info_birthday)
-					{
-						if(strlen(sd->info_birthday) && strcmp(sd->info_birthday, "0"))
-						{
+					if (sd->info_birthday) {
+						if (strlen(sd->info_birthday) && strcmp(sd->info_birthday, "0")) {
 							char ib[256];
 							struct tm tm;
@@ -459,10 +425,8 @@
 						g_free(sd->info_birthday);
 					}
-					if(sd->info_sex)
-					{
-						if(strlen(sd->info_sex))
-						{
+					if (sd->info_sex) {
+						if (strlen(sd->info_sex)) {
 							char *iptr = sd->info_sex;
-							while(*iptr++)
+							while (*iptr++)
 								*iptr = tolower(*iptr);
 							g_string_append_printf(st, "Gender: %s\n", sd->info_sex);
@@ -470,10 +434,8 @@
 						g_free(sd->info_sex);
 					}
-					if(sd->info_language)
-					{
-						if(strlen(sd->info_language))
-						{
+					if (sd->info_language) {
+						if (strlen(sd->info_language)) {
 							char *iptr = strchr(sd->info_language, ' ');
-							if(iptr)
+							if (iptr)
 								iptr++;
 							else
@@ -483,10 +445,8 @@
 						g_free(sd->info_language);
 					}
-					if(sd->info_country)
-					{
-						if(strlen(sd->info_country))
-						{
+					if (sd->info_country) {
+						if (strlen(sd->info_country)) {
 							char *iptr = strchr(sd->info_country, ' ');
-							if(iptr)
+							if (iptr)
 								iptr++;
 							else
@@ -496,25 +456,21 @@
 						g_free(sd->info_country);
 					}
-					if(sd->info_province)
-					{
-						if(strlen(sd->info_province))
+					if (sd->info_province) {
+						if (strlen(sd->info_province))
 							g_string_append_printf(st, "Region: %s\n", sd->info_province);
 						g_free(sd->info_province);
 					}
-					if(sd->info_city)
-					{
-						if(strlen(sd->info_city))
+					if (sd->info_city) {
+						if (strlen(sd->info_city))
 							g_string_append_printf(st, "City: %s\n", sd->info_city);
 						g_free(sd->info_city);
 					}
-					if(sd->info_homepage)
-					{
-						if(strlen(sd->info_homepage))
+					if (sd->info_homepage) {
+						if (strlen(sd->info_homepage))
 							g_string_append_printf(st, "Homepage: %s\n", sd->info_homepage);
 						g_free(sd->info_homepage);
 					}
-					if(sd->info_about)
-					{
-						if(strlen(sd->info_about))
+					if (sd->info_about) {
+						if (strlen(sd->info_about))
 							g_string_append_printf(st, "%s\n", sd->info_about);
 						g_free(sd->info_about);
@@ -523,15 +479,11 @@
 					g_string_free(st, TRUE);
 				}
-			}
-			else if(!strncmp(line, "CHATMESSAGE ", 12))
-			{
+			} else if (!strncmp(line, "CHATMESSAGE ", 12)) {
 				char *id = strchr(line, ' ');
-				if(++id)
-				{
+				if (++id) {
 					char *info = strchr(id, ' ');
 					*info = '\0';
 					info++;
-					if(!strcmp(info, "STATUS RECEIVED"))
-					{
+					if (!strcmp(info, "STATUS RECEIVED")) {
 						/* New message ID:
 						 * (1) Request its from field
@@ -541,14 +493,12 @@
 						 */
 						g_snprintf(buf, 1024, "GET CHATMESSAGE %s FROM_HANDLE\n", id);
-						skype_write( ic, buf );
+						skype_write(ic, buf);
 						g_snprintf(buf, 1024, "GET CHATMESSAGE %s BODY\n", id);
-						skype_write( ic, buf );
+						skype_write(ic, buf);
 						g_snprintf(buf, 1024, "GET CHATMESSAGE %s TYPE\n", id);
-						skype_write( ic, buf );
+						skype_write(ic, buf);
 						g_snprintf(buf, 1024, "GET CHATMESSAGE %s CHATNAME\n", id);
-						skype_write( ic, buf );
-					}
-					else if(!strncmp(info, "FROM_HANDLE ", 12))
-					{
+						skype_write(ic, buf);
+					} else if (!strncmp(info, "FROM_HANDLE ", 12)) {
 						info += 12;
 						/* New from field value. Store
@@ -558,7 +508,5 @@
 						g_free(sd->handle);
 						sd->handle = g_strdup_printf("%s@skype.com", info);
-					}
-					else if(!strncmp(info, "EDITED_BY ", 10))
-					{
+					} else if (!strncmp(info, "EDITED_BY ", 10)) {
 						info += 10;
 						/* This is the same as
@@ -569,36 +517,25 @@
 						g_free(sd->handle);
 						sd->handle = g_strdup_printf("%s@skype.com", info);
-					}
-					else if(!strncmp(info, "BODY ", 5))
-					{
+					} else if (!strncmp(info, "BODY ", 5)) {
 						info += 5;
 						sd->body = g_list_append(sd->body, g_strdup(info));
-					}
-					else if(!strncmp(info, "TYPE ", 5))
-					{
+					}	else if (!strncmp(info, "TYPE ", 5)) {
 						info += 5;
 						g_free(sd->type);
 						sd->type = g_strdup(info);
-					}
-					else if(!strncmp(info, "CHATNAME ", 9))
-					{
+					} else if (!strncmp(info, "CHATNAME ", 9)) {
 						info += 9;
-						if(sd->handle && sd->body && sd->type)
-						{
+						if (sd->handle && sd->body && sd->type) {
 							struct groupchat *gc = skype_chat_by_name(ic, info);
 							int i;
-							for(i=0;i<g_list_length(sd->body);i++)
-							{
+							for (i = 0; i < g_list_length(sd->body); i++) {
 								char *body = g_list_nth_data(sd->body, i);
-								if(!strcmp(sd->type, "SAID") || !strcmp(sd->type, "EMOTED"))
-								{
+								if (!strcmp(sd->type, "SAID") || !strcmp(sd->type, "EMOTED")) {
 									char *st;
-									if(!strcmp(sd->type, "SAID"))
+									if (!strcmp(sd->type, "SAID"))
 										st = g_strdup(body);
 									else
-									{
 										st = g_strdup_printf("/me %s", body);
-									}
-									if(!gc)
+									if (!gc)
 										/* Private message */
 										imcb_buddy_msg(ic, sd->handle, st, 0, 0);
@@ -607,13 +544,9 @@
 										imcb_chat_msg(gc, sd->handle, st, 0, 0);
 									g_free(st);
-								}
-								else if(!strcmp(sd->type, "SETTOPIC"))
-								{
-									if(gc)
+								} else if (!strcmp(sd->type, "SETTOPIC")) {
+									if (gc)
 										imcb_chat_topic(gc, sd->handle, body, 0);
-								}
-								else if(!strcmp(sd->type, "LEFT"))
-								{
-									if(gc)
+								} else if (!strcmp(sd->type, "LEFT")) {
+									if (gc)
 										imcb_chat_remove_buddy(gc, sd->handle, NULL);
 								}
@@ -624,107 +557,85 @@
 					}
 				}
-			}
-			else if(!strncmp(line, "CALL ", 5))
-			{
+			} else if (!strncmp(line, "CALL ", 5)) {
 				char *id = strchr(line, ' ');
-				if(++id)
-				{
+				if (++id) {
 					char *info = strchr(id, ' ');
 					*info = '\0';
 					info++;
-					if(!strncmp(info, "FAILUREREASON ", 14))
+					if (!strncmp(info, "FAILUREREASON ", 14))
 						sd->failurereason = atoi(strchr(info, ' '));
-					else if(!strcmp(info, "STATUS RINGING"))
-					{
-						if(sd->call_id)
+					else if (!strcmp(info, "STATUS RINGING")) {
+						if (sd->call_id)
 							g_free(sd->call_id);
 						sd->call_id = g_strdup(id);
 						g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);
-						skype_write( ic, buf );
+						skype_write(ic, buf);
 						sd->call_status = SKYPE_CALL_RINGING;
-					}
-					else if(!strcmp(info, "STATUS MISSED"))
-					{
+					} else if (!strcmp(info, "STATUS MISSED")) {
 						g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);
-						skype_write( ic, buf );
+						skype_write(ic, buf);
 						sd->call_status = SKYPE_CALL_MISSED;
-					}
-					else if(!strcmp(info, "STATUS CANCELLED"))
-					{
+					} else if (!strcmp(info, "STATUS CANCELLED")) {
 							g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);
-							skype_write( ic, buf );
+							skype_write(ic, buf);
 							sd->call_status = SKYPE_CALL_CANCELLED;
-					}
-					else if(!strcmp(info, "STATUS FINISHED"))
-					{
+					} else if (!strcmp(info, "STATUS FINISHED")) {
 						g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);
-						skype_write( ic, buf );
+						skype_write(ic, buf);
 						sd->call_status = SKYPE_CALL_FINISHED;
-					}
-					else if(!strcmp(info, "STATUS REFUSED"))
-					{
+					} else if (!strcmp(info, "STATUS REFUSED")) {
 						g_snprintf(buf, 1024, "GET CALL %s PARTNER_HANDLE\n", id);
-						skype_write( ic, buf );
+						skype_write(ic, buf);
 						sd->call_status = SKYPE_CALL_REFUSED;
-					}
-					else if(!strcmp(info, "STATUS UNPLACED"))
-					{
-						if(sd->call_id)
+					} else if (!strcmp(info, "STATUS UNPLACED")) {
+						if (sd->call_id)
 							g_free(sd->call_id);
 						/* Save the ID for later usage (Cancel/Finish). */
 						sd->call_id = g_strdup(id);
 						sd->call_out = TRUE;
-					}
-					else if(!strcmp(info, "STATUS FAILED"))
-					{
+					} else if (!strcmp(info, "STATUS FAILED")) {
 						imcb_error(ic, "Call failed: %s", skype_call_strerror(sd->failurereason));
 						sd->call_id = NULL;
-					}
-					else if(!strncmp(info, "DURATION ", 9))
-					{
-						if(sd->call_duration)
+					} else if (!strncmp(info, "DURATION ", 9)) {
+						if (sd->call_duration)
 							g_free(sd->call_duration);
 						sd->call_duration = g_strdup(info+9);
-					}
-					else if(!strncmp(info, "PARTNER_HANDLE ", 15))
-					{
+					} else if (!strncmp(info, "PARTNER_HANDLE ", 15)) {
 						info += 15;
-						if(sd->call_status) {
-							switch(sd->call_status)
-							{
-								case SKYPE_CALL_RINGING:
-									if(sd->call_out)
-										imcb_log(ic, "You are currently ringing the user %s.", info);
-									else
-									{
-										g_snprintf(buf, 1024, "The user %s is currently ringing you.", info);
-										skype_call_ask(ic, sd->call_id, buf);
-									}
-									break;
-								case SKYPE_CALL_MISSED:
-									imcb_log(ic, "You have missed a call from user %s.", info);
-									break;
-								case SKYPE_CALL_CANCELLED:
-									imcb_log(ic, "You cancelled the call to the user %s.", info);
-									sd->call_status = 0;
-									sd->call_out = FALSE;
-									break;
-								case SKYPE_CALL_REFUSED:
-									if(sd->call_out)
-										imcb_log(ic, "The user %s refused the call.", info);
-									else
-										imcb_log(ic, "You refused the call from user %s.", info);
-									sd->call_out = FALSE;
-									break;
-								case SKYPE_CALL_FINISHED:
-									if(sd->call_duration)
-										imcb_log(ic, "You finished the call to the user %s (duration: %s seconds).", info, sd->call_duration);
-									else
-										imcb_log(ic, "You finished the call to the user %s.", info);
-									sd->call_out = FALSE;
-									break;
-								default:
-									/* Don't be noisy, ignore other statuses for now. */
-									break;
+						if (sd->call_status) {
+							switch (sd->call_status) {
+							case SKYPE_CALL_RINGING:
+								if (sd->call_out)
+									imcb_log(ic, "You are currently ringing the user %s.", info);
+								else {
+									g_snprintf(buf, 1024, "The user %s is currently ringing you.", info);
+									skype_call_ask(ic, sd->call_id, buf);
+								}
+								break;
+							case SKYPE_CALL_MISSED:
+								imcb_log(ic, "You have missed a call from user %s.", info);
+								break;
+							case SKYPE_CALL_CANCELLED:
+								imcb_log(ic, "You cancelled the call to the user %s.", info);
+								sd->call_status = 0;
+								sd->call_out = FALSE;
+								break;
+							case SKYPE_CALL_REFUSED:
+								if (sd->call_out)
+									imcb_log(ic, "The user %s refused the call.", info);
+								else
+									imcb_log(ic, "You refused the call from user %s.", info);
+								sd->call_out = FALSE;
+								break;
+							case SKYPE_CALL_FINISHED:
+								if (sd->call_duration)
+									imcb_log(ic, "You finished the call to the user %s (duration: %s seconds).", info, sd->call_duration);
+								else
+									imcb_log(ic, "You finished the call to the user %s.", info);
+								sd->call_out = FALSE;
+								break;
+							default:
+								/* Don't be noisy, ignore other statuses for now. */
+								break;
 							}
 							sd->call_status = 0;
@@ -732,37 +643,28 @@
 					}
 				}
-			}
-			else if(!strncmp(line, "FILETRANSFER ", 13))
-			{
+			} else if (!strncmp(line, "FILETRANSFER ", 13)) {
 				char *id = strchr(line, ' ');
-				if(++id)
-				{
+				if (++id) {
 					char *info = strchr(id, ' ');
 					*info = '\0';
 					info++;
-					if(!strcmp(info, "STATUS NEW"))
-					{
+					if (!strcmp(info, "STATUS NEW")) {
 						g_snprintf(buf, 1024, "GET FILETRANSFER %s PARTNER_HANDLE\n", id);
-						skype_write( ic, buf );
+						skype_write(ic, buf);
 						sd->filetransfer_status = SKYPE_FILETRANSFER_NEW;
-					}
-					else if(!strcmp(info, "STATUS FAILED"))
-					{
+					} else if (!strcmp(info, "STATUS FAILED")) {
 						g_snprintf(buf, 1024, "GET FILETRANSFER %s PARTNER_HANDLE\n", id);
-						skype_write( ic, buf );
+						skype_write(ic, buf);
 						sd->filetransfer_status = SKYPE_FILETRANSFER_FAILED;
-					}
-					else if(!strncmp(info, "PARTNER_HANDLE ", 15))
-					{
+					} else if (!strncmp(info, "PARTNER_HANDLE ", 15)) {
 						info += 15;
-						if(sd->filetransfer_status) {
-							switch(sd->filetransfer_status)
-							{
-								case SKYPE_FILETRANSFER_NEW:
-									imcb_log(ic, "The user %s offered a new file for you.", info);
-									break;
-								case SKYPE_FILETRANSFER_FAILED:
-									imcb_log(ic, "Failed to transfer file from user %s.", info);
-									break;
+						if (sd->filetransfer_status) {
+							switch (sd->filetransfer_status) {
+							case SKYPE_FILETRANSFER_NEW:
+								imcb_log(ic, "The user %s offered a new file for you.", info);
+								break;
+							case SKYPE_FILETRANSFER_FAILED:
+								imcb_log(ic, "Failed to transfer file from user %s.", info);
+								break;
 							}
 							sd->filetransfer_status = 0;
@@ -770,29 +672,23 @@
 					}
 				}
-			}
-			else if(!strncmp(line, "CHAT ", 5))
-			{
+			} else if (!strncmp(line, "CHAT ", 5)) {
 				char *id = strchr(line, ' ');
-				if(++id)
-				{
+				if (++id) {
 					char *info = strchr(id, ' ');
-					if(info)
+					if (info)
 						*info = '\0';
 					info++;
 					/* Remove fake chat if we created one in skype_chat_with() */
 					struct groupchat *gc = skype_chat_by_name(ic, "");
-					if(gc)
+					if (gc)
 						imcb_chat_free(gc);
-					if(!strcmp(info, "STATUS MULTI_SUBSCRIBED"))
-					{
-						imcb_chat_new( ic, id );
+					if (!strcmp(info, "STATUS MULTI_SUBSCRIBED")) {
+						imcb_chat_new(ic, id);
 						g_snprintf(buf, 1024, "GET CHAT %s ADDER\n", id);
 						skype_write(ic, buf);
 						g_snprintf(buf, 1024, "GET CHAT %s TOPIC\n", id);
 						skype_write(ic, buf);
-					}
-					else if(!strcmp(info, "STATUS DIALOG") && sd->groupchat_with)
-					{
-						gc = imcb_chat_new( ic, id );
+					} else if (!strcmp(info, "STATUS DIALOG") && sd->groupchat_with) {
+						gc = imcb_chat_new(ic, id);
 						/* According to the docs this
 						 * is necessary. However it
@@ -812,25 +708,17 @@
 						g_snprintf(buf, 1024, "GET CHAT %s TOPIC\n", id);
 						skype_write(ic, buf);
-					}
-					else if(!strcmp(info, "STATUS UNSUBSCRIBED"))
-					{
+					} else if (!strcmp(info, "STATUS UNSUBSCRIBED")) {
 						gc = skype_chat_by_name(ic, id);
-						if(gc)
-							gc->data = (void*)FALSE;
-					}
-					else if(!strncmp(info, "ADDER ", 6))
-					{
+						if (gc)
+							gc->data = (void *)FALSE;
+					} else if (!strncmp(info, "ADDER ", 6)) {
 						info += 6;
 						g_free(sd->adder);
 						sd->adder = g_strdup_printf("%s@skype.com", info);
-					}
-					else if(!strncmp(info, "TOPIC ", 6))
-					{
+					} else if (!strncmp(info, "TOPIC ", 6)) {
 						info += 6;
 						gc = skype_chat_by_name(ic, id);
-						if(gc && (sd->adder || sd->topic_wait))
-						{
-							if(sd->topic_wait)
-							{
+						if (gc && (sd->adder || sd->topic_wait)) {
+							if (sd->topic_wait) {
 								sd->adder = g_strdup(sd->username);
 								sd->topic_wait = 0;
@@ -840,7 +728,5 @@
 							sd->adder = NULL;
 						}
-					}
-					else if(!strncmp(info, "ACTIVEMEMBERS ", 14))
-					{
+					} else if (!strncmp(info, "ACTIVEMEMBERS ", 14)) {
 						info += 14;
 						gc = skype_chat_by_name(ic, id);
@@ -849,14 +735,12 @@
 						 * so that we won't rejoin
 						 * after a /part. */
-						if(gc && !gc->data)
-						{
+						if (gc && !gc->data) {
 							char **members = g_strsplit(info, " ", 0);
 							int i;
-							for(i=0;members[i];i++)
-							{
-								if(!strcmp(members[i], sd->username))
+							for (i = 0; members[i]; i++) {
+								if (!strcmp(members[i], sd->username))
 									continue;
 								g_snprintf(buf, 1024, "%s@skype.com", members[i]);
-								if(!g_list_find_custom(gc->in_room, buf, (GCompareFunc)strcmp))
+								if (!g_list_find_custom(gc->in_room, buf, (GCompareFunc)strcmp))
 									imcb_chat_add_buddy(gc, buf);
 							}
@@ -866,36 +750,26 @@
 					}
 				}
-			}
-			else if(!strncmp(line, "PASSWORD ", 9))
-			{
-				if(!strncmp(line+9, "OK", 2))
+			} else if (!strncmp(line, "PASSWORD ", 9)) {
+				if (!strncmp(line+9, "OK", 2))
 					imcb_connected(ic);
-				else
-				{
+				else {
 					imcb_error(ic, "Authentication Failed");
-					imc_logout( ic, TRUE );
+					imc_logout(ic, TRUE);
 				}
-			}
-			else if(!strncmp(line, "PROFILE PSTN_BALANCE ", 21))
-			{
+			} else if (!strncmp(line, "PROFILE PSTN_BALANCE ", 21))
 				imcb_log(ic, "SkypeOut balance value is '%s'.", line+21);
-			}
-			else if(!strncmp(line, "PING", 4))
-			{
+			else if (!strncmp(line, "PING", 4)) {
 				g_snprintf(buf, 1024, "PONG\n");
 				skype_write(ic, buf);
-			}
-			else if(!strncmp(line, "CHATS ", 6))
-			{
+			} else if (!strncmp(line, "CHATS ", 6)) {
 				char **i;
 				char **chats = g_strsplit(line + 6, ", ", 0);
 
 				i = chats;
-				while (*i)
-				{
+				while (*i) {
 					g_snprintf(buf, 1024, "GET CHAT %s STATUS\n", *i);
-					skype_write( ic, buf );
+					skype_write(ic, buf);
 					g_snprintf(buf, 1024, "GET CHAT %s ACTIVEMEMBERS\n", *i);
-					skype_write( ic, buf );
+					skype_write(ic, buf);
 					i++;
 				}
@@ -905,12 +779,10 @@
 		}
 		g_strfreev(lines);
-	}
-	else if( st == 0 || ( st < 0 && !sockerr_again() ) )
-	{
-		closesocket( sd->fd );
+	} else if (st == 0 || (st < 0 && !sockerr_again())) {
+		closesocket(sd->fd);
 		sd->fd = -1;
 
-		imcb_error( ic, "Error while reading from server" );
-		imc_logout( ic, TRUE );
+		imcb_error(ic, "Error while reading from server");
+		imc_logout(ic, TRUE);
 		return FALSE;
 	}
@@ -918,5 +790,5 @@
 }
 
-gboolean skype_start_stream( struct im_connection *ic )
+gboolean skype_start_stream(struct im_connection *ic)
 {
 	struct skype_data *sd = ic->proto_data;
@@ -924,24 +796,24 @@
 	int st;
 
-	if(!sd)
+	if (!sd)
 		return FALSE;
 
-	if( sd->bfd <= 0 )
-		sd->bfd = b_input_add( sd->fd, GAIM_INPUT_READ, skype_read_callback, ic );
+	if (sd->bfd <= 0)
+		sd->bfd = b_input_add(sd->fd, GAIM_INPUT_READ, skype_read_callback, ic);
 
 	/* Log in */
 	buf = g_strdup_printf("USERNAME %s\n", ic->acc->user);
-	st = skype_write( ic, buf );
+	st = skype_write(ic, buf);
 	g_free(buf);
 	buf = g_strdup_printf("PASSWORD %s\n", ic->acc->pass);
-	st = skype_write( ic, buf );
+	st = skype_write(ic, buf);
 	g_free(buf);
 
 	/* This will download all buddies. */
 	buf = g_strdup_printf("SEARCH FRIENDS\n");
-	st = skype_write( ic, buf );
+	st = skype_write(ic, buf);
 	g_free(buf);
 	buf = g_strdup_printf("SET USERSTATUS ONLINE\n");
-	skype_write( ic, buf );
+	skype_write(ic, buf);
 	g_free(buf);
 
@@ -949,5 +821,5 @@
 	if (set_getbool(&ic->acc->set, "auto_join")) {
 		buf = g_strdup_printf("SEARCH BOOKMARKEDCHATS\n");
-		skype_write( ic, buf );
+		skype_write(ic, buf);
 		g_free(buf);
 	}
@@ -955,30 +827,29 @@
 }
 
-gboolean skype_connected( gpointer data, void *source, b_input_condition cond )
+gboolean skype_connected(gpointer data, void *source, b_input_condition cond)
 {
 	struct im_connection *ic = data;
 	struct skype_data *sd = ic->proto_data;
-	if(!source)
-	{
+	if (!source) {
 		sd->ssl = NULL;
-		imcb_error( ic, "Could not connect to server" );
-		imc_logout( ic, TRUE );
+		imcb_error(ic, "Could not connect to server");
+		imc_logout(ic, TRUE);
 		return FALSE;
 	}
-	imcb_log( ic, "Connected to server, logging in" );
+	imcb_log(ic, "Connected to server, logging in");
 	return skype_start_stream(ic);
 }
 
-static void skype_login( account_t *acc )
-{
-	struct im_connection *ic = imcb_new( acc );
-	struct skype_data *sd = g_new0( struct skype_data, 1 );
+static void skype_login(account_t *acc)
+{
+	struct im_connection *ic = imcb_new(acc);
+	struct skype_data *sd = g_new0(struct skype_data, 1);
 
 	ic->proto_data = sd;
 
-	imcb_log( ic, "Connecting" );
-	sd->ssl = ssl_connect(set_getstr( &acc->set, "server" ), set_getint( &acc->set, "port" ), skype_connected, ic );
-	sd->fd = sd->ssl ? ssl_getfd( sd->ssl ) : -1;
-	sd->username = g_strdup( acc->user );
+	imcb_log(ic, "Connecting");
+	sd->ssl = ssl_connect(set_getstr(&acc->set, "server"), set_getint(&acc->set, "port"), skype_connected, ic);
+	sd->fd = sd->ssl ? ssl_getfd(sd->ssl) : -1;
+	sd->username = g_strdup(acc->user);
 
 	sd->ic = ic;
@@ -988,5 +859,5 @@
 }
 
-static void skype_logout( struct im_connection *ic )
+static void skype_logout(struct im_connection *ic)
 {
 	struct skype_data *sd = ic->proto_data;
@@ -994,5 +865,5 @@
 
 	buf = g_strdup_printf("SET USERSTATUS OFFLINE\n");
-	skype_write( ic, buf );
+	skype_write(ic, buf);
 	g_free(buf);
 
@@ -1003,5 +874,5 @@
 }
 
-static int skype_buddy_msg( struct im_connection *ic, char *who, char *message, int flags )
+static int skype_buddy_msg(struct im_connection *ic, char *who, char *message, int flags)
 {
 	char *buf, *ptr, *nick;
@@ -1010,5 +881,5 @@
 	nick = g_strdup(who);
 	ptr = strchr(nick, '@');
-	if(ptr)
+	if (ptr)
 		*ptr = '\0';
 
@@ -1018,5 +889,5 @@
 		buf = g_strdup_printf("MESSAGE %s %s\n", nick, message);
 	g_free(nick);
-	st = skype_write( ic, buf );
+	st = skype_write(ic, buf);
 	g_free(buf);
 
@@ -1024,42 +895,42 @@
 }
 
-const struct skype_away_state *skype_away_state_by_name( char *name )
+const struct skype_away_state *skype_away_state_by_name(char *name)
 {
 	int i;
 
-	for( i = 0; skype_away_state_list[i].full_name; i ++ )
-		if( g_strcasecmp( skype_away_state_list[i].full_name, name ) == 0 )
-			return( skype_away_state_list + i );
+	for (i = 0; skype_away_state_list[i].full_name; i++)
+		if (g_strcasecmp(skype_away_state_list[i].full_name, name) == 0)
+			return skype_away_state_list + i;
 
 	return NULL;
 }
 
-static void skype_set_away( struct im_connection *ic, char *state_txt, char *message )
+static void skype_set_away(struct im_connection *ic, char *state_txt, char *message)
 {
 	const struct skype_away_state *state;
 	char *buf;
 
-	if( strcmp( state_txt, GAIM_AWAY_CUSTOM ) == 0 )
-		state = skype_away_state_by_name( "Away" );
+	if (strcmp(state_txt, GAIM_AWAY_CUSTOM) == 0)
+		state = skype_away_state_by_name("Away");
 	else
-		state = skype_away_state_by_name( state_txt );
+		state = skype_away_state_by_name(state_txt);
 	buf = g_strdup_printf("SET USERSTATUS %s\n", state->code);
-	skype_write( ic, buf );
-	g_free(buf);
-}
-
-static GList *skype_away_states( struct im_connection *ic )
-{
-	static GList *l = NULL;
+	skype_write(ic, buf);
+	g_free(buf);
+}
+
+static GList *skype_away_states(struct im_connection *ic)
+{
+	static GList *l;
 	int i;
-	
-	if( l == NULL )
-		for( i = 0; skype_away_state_list[i].full_name; i ++ )
-			l = g_list_append( l, (void*) skype_away_state_list[i].full_name );
-	
+
+	if (l == NULL)
+		for (i = 0; skype_away_state_list[i].full_name; i++)
+			l = g_list_append(l, (void *)skype_away_state_list[i].full_name);
+
 	return l;
 }
 
-static char *skype_set_display_name( set_t *set, char *value )
+static char *skype_set_display_name(set_t *set, char *value)
 {
 	account_t *acc = set->data;
@@ -1068,10 +939,10 @@
 
 	buf = g_strdup_printf("SET PROFILE FULLNAME %s", value);
-	skype_write( ic, buf );
-	g_free(buf);
-	return(value);
-}
-
-static char *skype_set_balance( set_t *set, char *value )
+	skype_write(ic, buf);
+	g_free(buf);
+	return value;
+}
+
+static char *skype_set_balance(set_t *set, char *value)
 {
 	account_t *acc = set->data;
@@ -1080,10 +951,10 @@
 
 	buf = g_strdup_printf("GET PROFILE PSTN_BALANCE");
-	skype_write( ic, buf );
-	g_free(buf);
-	return(value);
-}
-
-static char *skype_set_call( set_t *set, char *value )
+	skype_write(ic, buf);
+	g_free(buf);
+	return value;
+}
+
+static char *skype_set_call(set_t *set, char *value)
 {
 	account_t *acc = set->data;
@@ -1092,41 +963,34 @@
 	char *nick, *ptr, *buf;
 
-	if(value)
-	{
+	if (value) {
 		user_t *u = user_find(acc->irc, value);
 		/* We are starting a call */
-		if(!u)
+		if (!u)
 			nick = g_strdup(value);
 		else
 			nick = g_strdup(u->handle);
 		ptr = strchr(nick, '@');
-		if(ptr)
+		if (ptr)
 			*ptr = '\0';
 
 		buf = g_strdup_printf("CALL %s", nick);
-		skype_write( ic, buf );
+		skype_write(ic, buf);
 		g_free(buf);
 		g_free(nick);
-	}
-	else
-	{
+	} else {
 		/* We are ending a call */
-		if(sd->call_id)
-		{
+		if (sd->call_id) {
 			buf = g_strdup_printf("SET CALL %s STATUS FINISHED", sd->call_id);
-			skype_write( ic, buf );
+			skype_write(ic, buf);
 			g_free(buf);
 			g_free(sd->call_id);
 			sd->call_id = NULL;
-		}
-		else
-		{
+		} else
 			imcb_error(ic, "There are no active calls currently.");
-		}
 	}
-	return(value);
-}
-
-static void skype_add_buddy( struct im_connection *ic, char *who, char *group )
+	return value;
+}
+
+static void skype_add_buddy(struct im_connection *ic, char *who, char *group)
 {
 	char *buf, *nick, *ptr;
@@ -1134,12 +998,12 @@
 	nick = g_strdup(who);
 	ptr = strchr(nick, '@');
-	if(ptr)
+	if (ptr)
 		*ptr = '\0';
 	buf = g_strdup_printf("SET USER %s BUDDYSTATUS 2 Please authorize me\n", nick);
-	skype_write( ic, buf );
+	skype_write(ic, buf);
 	g_free(nick);
 }
 
-static void skype_remove_buddy( struct im_connection *ic, char *who, char *group )
+static void skype_remove_buddy(struct im_connection *ic, char *who, char *group)
 {
 	char *buf, *nick, *ptr;
@@ -1147,28 +1011,28 @@
 	nick = g_strdup(who);
 	ptr = strchr(nick, '@');
-	if(ptr)
+	if (ptr)
 		*ptr = '\0';
 	buf = g_strdup_printf("SET USER %s BUDDYSTATUS 1\n", nick);
-	skype_write( ic, buf );
+	skype_write(ic, buf);
 	g_free(nick);
 }
 
-void skype_chat_msg( struct groupchat *gc, char *message, int flags )
+void skype_chat_msg(struct groupchat *gc, char *message, int flags)
 {
 	struct im_connection *ic = gc->ic;
 	char *buf;
 	buf = g_strdup_printf("CHATMESSAGE %s %s\n", gc->title, message);
-	skype_write( ic, buf );
-	g_free(buf);
-}
-
-void skype_chat_leave( struct groupchat *gc )
+	skype_write(ic, buf);
+	g_free(buf);
+}
+
+void skype_chat_leave(struct groupchat *gc)
 {
 	struct im_connection *ic = gc->ic;
 	char *buf;
 	buf = g_strdup_printf("ALTER CHAT %s LEAVE\n", gc->title);
-	skype_write( ic, buf );
-	g_free(buf);
-	gc->data = (void*)TRUE;
+	skype_write(ic, buf);
+	g_free(buf);
+	gc->data = (void *)TRUE;
 }
 
@@ -1179,8 +1043,8 @@
 	nick = g_strdup(message);
 	ptr = strchr(nick, '@');
-	if(ptr)
+	if (ptr)
 		*ptr = '\0';
 	buf = g_strdup_printf("ALTER CHAT %s ADDMEMBERS %s\n", gc->title, nick);
-	skype_write( ic, buf );
+	skype_write(ic, buf);
 	g_free(buf);
 	g_free(nick);
@@ -1193,5 +1057,5 @@
 	char *buf;
 	buf = g_strdup_printf("ALTER CHAT %s SETTOPIC %s\n", gc->title, message);
-	skype_write( ic, buf );
+	skype_write(ic, buf);
 	g_free(buf);
 	sd->topic_wait = 1;
@@ -1204,5 +1068,5 @@
 	nick = g_strdup(who);
 	ptr = strchr(nick, '@');
-	if(ptr)
+	if (ptr)
 		*ptr = '\0';
 	buf = g_strdup_printf("CHAT CREATE %s\n", nick);
@@ -1213,5 +1077,5 @@
 	/* We create a fake chat for now. We will replace it with a real one in
 	 * the real callback. */
-	return(imcb_chat_new( ic, "" ));
+	return imcb_chat_new(ic, "");
 }
 
@@ -1221,5 +1085,5 @@
 	nick = g_strdup(who);
 	ptr = strchr(nick, '@');
-	if(ptr)
+	if (ptr)
 		*ptr = '\0';
 	buf = g_strdup_printf("GET USER %s FULLNAME\n", nick);
@@ -1270,34 +1134,34 @@
 }
 
-static void skype_set_my_name( struct im_connection *ic, char *info )
-{
-	skype_set_display_name( set_find( &ic->acc->set, "display_name" ), info );
-}
-
-static void skype_init( account_t *acc )
+static void skype_set_my_name(struct im_connection *ic, char *info)
+{
+	skype_set_display_name(set_find(&ic->acc->set, "display_name"), info);
+}
+
+static void skype_init(account_t *acc)
 {
 	set_t *s;
 
-	s = set_add( &acc->set, "server", SKYPE_DEFAULT_SERVER, set_eval_account, acc );
+	s = set_add(&acc->set, "server", SKYPE_DEFAULT_SERVER, set_eval_account, acc);
 	s->flags |= ACC_SET_OFFLINE_ONLY;
 
-	s = set_add( &acc->set, "port", SKYPE_DEFAULT_PORT, set_eval_int, acc );
+	s = set_add(&acc->set, "port", SKYPE_DEFAULT_PORT, set_eval_int, acc);
 	s->flags |= ACC_SET_OFFLINE_ONLY;
 
-	s = set_add( &acc->set, "display_name", NULL, skype_set_display_name, acc );
+	s = set_add(&acc->set, "display_name", NULL, skype_set_display_name, acc);
 	s->flags |= ACC_SET_NOSAVE | ACC_SET_ONLINE_ONLY;
 
-	s = set_add( &acc->set, "call", NULL, skype_set_call, acc );
+	s = set_add(&acc->set, "call", NULL, skype_set_call, acc);
 	s->flags |= ACC_SET_NOSAVE | ACC_SET_ONLINE_ONLY;
 
-	s = set_add( &acc->set, "balance", NULL, skype_set_balance, acc );
+	s = set_add(&acc->set, "balance", NULL, skype_set_balance, acc);
 	s->flags |= ACC_SET_NOSAVE | ACC_SET_ONLINE_ONLY;
 
-	s = set_add( &acc->set, "skypeout_offline", "true", set_eval_bool, acc );
-
-	s = set_add( &acc->set, "skypeconsole", "false", set_eval_bool, acc );
+	s = set_add(&acc->set, "skypeout_offline", "true", set_eval_bool, acc);
+
+	s = set_add(&acc->set, "skypeconsole", "false", set_eval_bool, acc);
 	s->flags |= ACC_SET_OFFLINE_ONLY;
 
-	s = set_add( &acc->set, "auto_join", "false", set_eval_bool, acc );
+	s = set_add(&acc->set, "auto_join", "false", set_eval_bool, acc);
 	s->flags |= ACC_SET_OFFLINE_ONLY;
 }
@@ -1305,5 +1169,5 @@
 void init_plugin(void)
 {
-	struct prpl *ret = g_new0( struct prpl, 1 );
+	struct prpl *ret = g_new0(struct prpl, 1);
 
 	ret->name = "skype";
@@ -1324,5 +1188,5 @@
 	ret->handle_cmp = g_strcasecmp;
 	ret->chat_topic = skype_chat_topic;
-	register_protocol( ret );
+	register_protocol(ret);
 }
 
