changeset 11539:5a2c38d33eb4

[gaim-migrate @ 13794] Formatting and whitespace committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 14 Sep 2005 02:58:30 +0000
parents 5c6c2e893803
children 9ddda2a86f50
files src/protocols/bonjour/bonjour.c src/protocols/bonjour/bonjour.h src/protocols/bonjour/buddy.c src/protocols/bonjour/buddy.h src/protocols/bonjour/dns_sd.c src/protocols/bonjour/dns_sd.h src/protocols/bonjour/jabber.c src/protocols/bonjour/jabber.h
diffstat 8 files changed, 454 insertions(+), 359 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/bonjour/bonjour.c	Wed Sep 14 01:18:07 2005 +0000
+++ b/src/protocols/bonjour/bonjour.c	Wed Sep 14 02:58:30 2005 +0000
@@ -32,32 +32,33 @@
 #include "jabber.h"
 #include "buddy.h"
 
-void bonjour_login(GaimAccount *account, GaimStatus *status)
+void
+bonjour_login(GaimAccount *account, GaimStatus *status)
 {
 	GaimConnection *gc = gaim_account_get_connection(account);
-	GaimGroup* bonjour_group = NULL;
-	BonjourData* bd = NULL;
-	
+	GaimGroup *bonjour_group = NULL;
+	BonjourData *bd = NULL;
+
 	gc->flags |= GAIM_CONNECTION_HTML;
 	gc->proto_data = g_new(BonjourData, 1);
 	bd = gc->proto_data;
-	
+
 	// Start waiting for jabber connections (iChat style)
 	bd->jabber_data = g_new(BonjourJabber, 1);
 	bd->jabber_data->name = gc->account->username;
 	bd->jabber_data->port = gaim_account_get_int(account, "port", BONJOUR_DEFAULT_PORT_INT);
 	bd->jabber_data->account = account;
-	
+
 	if (bonjour_jabber_start(bd->jabber_data) == -1) {
 		// Send a message about the connection error
 		gaim_debug_error("bonjour", "Unable to listen to ichat connections");
-		
+
 		// Free the data
 		g_free(bd->jabber_data);
 		g_free(bd);
 		return;
 	}
-	
+
 	// Connect to the mDNS daemon looking for buddies in the LAN
 	bd->dns_sd_data = bonjour_dns_sd_new();
 	bd->dns_sd_data->name = (sw_string)gaim_account_get_username(account);
@@ -73,25 +74,26 @@
 	bd->dns_sd_data->jid = g_strdup("");
 	bd->dns_sd_data->AIM = g_strdup("");
 	bd->dns_sd_data->msg = NULL; /* TODO */
-	
+
 	bd->dns_sd_data->account = account;
 	bonjour_dns_sd_start(bd->dns_sd_data);
-	
+
 	// Create a group for bonjour buddies
 	bonjour_group = gaim_group_new(BONJOUR_GROUP_NAME);
 	gaim_blist_add_group(bonjour_group, NULL);
-	
+
 	// Show the buddy list by telling Gaim we have already connected
 	gaim_connection_set_state(gc, GAIM_CONNECTED);
 }
 
-void bonjour_close(GaimConnection* connection)
+void
+bonjour_close(GaimConnection *connection)
 {
-	GaimGroup* bonjour_group = gaim_find_group(BONJOUR_GROUP_NAME);
-	GSList* buddies;
-	GSList* l;
-	BonjourData* bd = (BonjourData*)connection->proto_data;
-	
+	GaimGroup *bonjour_group = gaim_find_group(BONJOUR_GROUP_NAME);
+	GSList *buddies;
+	GSList *l;
+	BonjourData *bd = (BonjourData*)connection->proto_data;
+
 	// Stop looking for buddies in the LAN
 	if (connection != NULL) {
 		bonjour_dns_sd_stop(bd->dns_sd_data);
@@ -99,11 +101,11 @@
 			bonjour_dns_sd_free(bd->dns_sd_data);
 		}
 	}
-	
+
 	// Stop waiting for conversations
 	bonjour_jabber_stop(bd->jabber_data);
 	g_free(bd->jabber_data);
-	
+
 	// Remove all the bonjour buddies
 	if(connection != NULL){
 		buddies = gaim_find_buddies(connection->account, connection->account->username);
@@ -113,28 +115,31 @@
 		}
 		g_slist_free(buddies);
 	}
-	
+
 	// Delete the bonjour group
 	gaim_blist_remove_group(bonjour_group);
-	
+
 }
 
-const char* bonjour_list_icon(GaimAccount* account, GaimBuddy* buddy)
+const char *
+bonjour_list_icon(GaimAccount *account, GaimBuddy *buddy)
 {
 	return BONJOUR_ICON_NAME;
 }
 
-int bonjour_send_im(GaimConnection* connection, const char* to, const char* msg, GaimConvImFlags flags)
+int
+bonjour_send_im(GaimConnection *connection, const char *to, const char *msg, GaimConvImFlags flags)
 {
 	if(!to || !msg)
 		return 0;
-		
+
 	bonjour_jabber_send_message(((BonjourData*)(connection->proto_data))->jabber_data, to, msg);
-		
+
 	return 1;
 }
 
-void bonjour_set_status(GaimAccount *account, GaimStatus *status)
+void
+bonjour_set_status(GaimAccount *account, GaimStatus *status)
 {
 	GaimConnection *gc;
 	BonjourData *bd;
@@ -218,14 +223,16 @@
 	return status_types;
 }
 
-static void bonjour_convo_closed(GaimConnection *connection, const char *who)
+static void
+bonjour_convo_closed(GaimConnection *connection, const char *who)
 {
-	GaimBuddy* buddy = gaim_find_buddy(connection->account, who);
-	
+	GaimBuddy *buddy = gaim_find_buddy(connection->account, who);
+
 	bonjour_jabber_close_conversation(((BonjourData*)(connection->proto_data))->jabber_data, buddy);
 }
 
-static void bonjour_list_emblems(GaimBuddy *buddy,
+static void
+bonjour_list_emblems(GaimBuddy *buddy,
 								 const char **se, const char **sw,
 								 const char **nw,const char **ne)
 {
@@ -237,7 +244,8 @@
 		*se = "away";
 }
 
-static char *bonjour_status_text(GaimBuddy *buddy)
+static char *
+bonjour_status_text(GaimBuddy *buddy)
 {
 	GaimPresence *presence;
 
@@ -249,7 +257,8 @@
 		return g_strdup("Away");
 }
 
-static char *bonjour_tooltip_text(GaimBuddy *buddy)
+static char *
+bonjour_tooltip_text(GaimBuddy *buddy)
 {
 	GString *ret;
 	GaimPresence *presence;
@@ -385,7 +394,7 @@
 	// Creating the user splits
 	split = gaim_account_user_split_new(_("Host name"), hostname, '@');
 	prpl_info.user_splits = g_list_append(prpl_info.user_splits, split);
-	
+
 	// Creating the options for the protocol
 	option = gaim_account_option_int_new(_("Port"), "port", 5298);
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
@@ -398,7 +407,7 @@
 
 	option = gaim_account_option_string_new(_("Email"), "email", "");
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
-	
+
 	my_protocol = plugin;
 }
 
--- a/src/protocols/bonjour/bonjour.h	Wed Sep 14 01:18:07 2005 +0000
+++ b/src/protocols/bonjour/bonjour.h	Wed Sep 14 02:58:30 2005 +0000
@@ -39,9 +39,10 @@
 #define BONJOUR_STATUS_ID_AVAILABLE "available"
 #define BONJOUR_STATUS_ID_AWAY      "away"
 
-typedef struct _bonjour_data{
-	BonjourDnsSd* dns_sd_data;
-	BonjourJabber* jabber_data;
-}BonjourData;
+typedef struct _BonjourData
+{
+	BonjourDnsSd *dns_sd_data;
+	BonjourJabber *jabber_data;
+} BonjourData;
 
 #endif /* _BONJOUR_H_ */
--- a/src/protocols/bonjour/buddy.c	Wed Sep 14 01:18:07 2005 +0000
+++ b/src/protocols/bonjour/buddy.c	Wed Sep 14 02:58:30 2005 +0000
@@ -13,7 +13,6 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
- 
 
 #include <glib.h>
 #include <stdlib.h>
@@ -27,11 +26,12 @@
 /**
  * Creates a new buddy.
  */
-BonjourBuddy* bonjour_buddy_new(gchar* name, gchar* first, gint port_p2pj,
-	gchar* phsh, gchar* status, gchar* email, gchar* last, gchar* jid, gchar* AIM,
-	gchar* vc, gchar* ip, gchar* msg)
+BonjourBuddy *
+bonjour_buddy_new(gchar *name, gchar *first, gint port_p2pj,
+	gchar *phsh, gchar *status, gchar *email, gchar *last, gchar *jid, gchar *AIM,
+	gchar *vc, gchar *ip, gchar *msg)
 {
-	BonjourBuddy* buddy = malloc(sizeof(BonjourBuddy));
+	BonjourBuddy *buddy = malloc(sizeof(BonjourBuddy));
 
 	buddy->name = g_strdup(name);
 	buddy->first = g_strdup(first);
@@ -46,35 +46,36 @@
 	buddy->ip = g_strdup(ip);
 	buddy->msg = g_strdup(msg);
 	buddy->conversation = NULL;
-	
+
 	return buddy;
 }
 
 /**
  * Check if all the compulsory buddy data is present.
  */
-gboolean bonjour_buddy_check(BonjourBuddy* buddy)
+gboolean
+bonjour_buddy_check(BonjourBuddy *buddy)
 {
-	if(buddy->name == NULL){
+	if (buddy->name == NULL) {
 		return FALSE;
 	}
-	
-	if(buddy->first == NULL){
+
+	if (buddy->first == NULL) {
 		return FALSE;
 	}
-	
-	if(buddy->last == NULL){
+
+	if (buddy->last == NULL) {
 		return FALSE;
 	}
-	
-	if(buddy->port_p2pj == -1){
+
+	if (buddy->port_p2pj == -1) {
 		return FALSE;
 	}
-	
-	if(buddy->status == NULL){
+
+	if (buddy->status == NULL) {
 		return FALSE;
 	}
-	
+
 	return TRUE;
 }
 
@@ -144,7 +145,8 @@
 /**
  * Deletes a buddy from memory.
  */
-void bonjour_buddy_delete(BonjourBuddy* buddy)
+void
+bonjour_buddy_delete(BonjourBuddy *buddy)
 {
 	g_free(buddy->name);
 	g_free(buddy->first);
@@ -157,11 +159,12 @@
 	g_free(buddy->vc);
 	g_free(buddy->ip);
 	g_free(buddy->msg);
-	
-	if (buddy->conversation != NULL) {
+
+	if (buddy->conversation != NULL)
+	{
 		g_free(buddy->conversation->buddy_name);
 		g_free(buddy->conversation);
 	}
-	
+
 	free(buddy);
 }
--- a/src/protocols/bonjour/buddy.h	Wed Sep 14 01:18:07 2005 +0000
+++ b/src/protocols/bonjour/buddy.h	Wed Sep 14 02:58:30 2005 +0000
@@ -23,33 +23,34 @@
 #include "account.h"
 #include "jabber.h"
 
-typedef struct _bonjour_buddy{
-	gchar* name;
-	gchar* first;
+typedef struct _BonjourBuddy
+{
+	gchar *name;
+	gchar *first;
 	gint port_p2pj;
-	gchar* phsh;
-	gchar* status;
-	gchar* email;
-	gchar* last;
-	gchar* jid;
-	gchar* AIM;
-	gchar* vc;
-	gchar* ip;
-	gchar* msg;
-	BonjourJabberConversation* conversation;
-}BonjourBuddy;
+	gchar *phsh;
+	gchar *status;
+	gchar *email;
+	gchar *last;
+	gchar *jid;
+	gchar *AIM;
+	gchar *vc;
+	gchar *ip;
+	gchar *msg;
+	BonjourJabberConversation *conversation;
+} BonjourBuddy;
 
 /**
  * Creates a new buddy.
  */
-BonjourBuddy* bonjour_buddy_new(gchar* name, gchar* first, gint port_p2pj,
-	gchar* phsh, gchar* status, gchar* email, gchar* last, gchar* jid, gchar* AIM,
-	gchar* vc, gchar* ip, gchar* msg);
+BonjourBuddy *bonjour_buddy_new(gchar *name, gchar *first, gint port_p2pj,
+	gchar *phsh, gchar *status, gchar *email, gchar *last, gchar *jid, gchar *AIM,
+	gchar *vc, gchar *ip, gchar *msg);
 
 /**
  * Check if all the compulsory buddy data is present.
  */
-gboolean bonjour_buddy_check(BonjourBuddy* buddy);
+gboolean bonjour_buddy_check(BonjourBuddy *buddy);
 
 /**
  * If the buddy doesn't previoulsy exists, it is created. Else, its data is changed (???)
@@ -59,6 +60,6 @@
 /**
  * Deletes a buddy from memory.
  */
-void bonjour_buddy_delete(BonjourBuddy* buddy);
+void bonjour_buddy_delete(BonjourBuddy *buddy);
 
 #endif
--- a/src/protocols/bonjour/dns_sd.c	Wed Sep 14 01:18:07 2005 +0000
+++ b/src/protocols/bonjour/dns_sd.c	Wed Sep 14 02:58:30 2005 +0000
@@ -23,32 +23,36 @@
 
 // Private data
 
-typedef struct _dns_sd_packet{
-	gchar* name;
-	gchar* txtvers;
-	gchar* version;
-	gchar* first;
-	gchar* last;
+typedef struct _dns_sd_packet
+{
+	gchar *name;
+	gchar *txtvers;
+	gchar *version;
+	gchar *first;
+	gchar *last;
 	gint port_p2pj;
-	gchar* phsh;
-	gchar* status;
-	gchar* message;
-	gchar* email;
-	gchar* vc;
-	gchar* jid;
-	gchar* AIM;
-}dns_sd_packet;
+	gchar *phsh;
+	gchar *status;
+	gchar *message;
+	gchar *email;
+	gchar *vc;
+	gchar *jid;
+	gchar *AIM;
+} dns_sd_packet;
 
 // End private data
 
 // Private functions
 
-static sw_result HOWL_API _publish_reply(sw_discovery discovery, 
-	sw_discovery_oid oid, sw_discovery_publish_status status, sw_opaque extra)
+static sw_result HOWL_API
+_publish_reply(sw_discovery discovery, sw_discovery_oid oid,
+			   sw_discovery_publish_status status, sw_opaque extra)
 {
-gaim_debug_warning("bonjour", "_publish_reply --> Start\n");
+	gaim_debug_warning("bonjour", "_publish_reply --> Start\n");
+
 	// Check the answer from the mDNS daemon
-	switch(status){
+	switch (status)
+	{
 		case SW_DISCOVERY_PUBLISH_STARTED :
 			gaim_debug_info("bonjour", "_publish_reply --> Service started\n");
 			break;
@@ -62,48 +66,52 @@
 			gaim_debug_info("bonjour", "_publish_reply --> Service invalid\n");
 			break;
 	}
-	
+
 	return SW_OKAY;
 }
 
-static sw_result HOWL_API _resolve_reply(sw_discovery discovery, 
-	sw_discovery_oid oid, sw_uint32 interface_index, sw_const_string name, 
-	sw_const_string type, sw_const_string domain, sw_ipv4_address address, 
-	sw_port port, sw_octets text_record, sw_ulong text_record_len, 
-	sw_opaque extra)
+static sw_result HOWL_API
+_resolve_reply(sw_discovery discovery, sw_discovery_oid oid,
+			   sw_uint32 interface_index, sw_const_string name,
+			   sw_const_string type, sw_const_string domain,
+			   sw_ipv4_address address, sw_port port,
+			   sw_octets text_record, sw_ulong text_record_len,
+			   sw_opaque extra)
 {
-	BonjourBuddy* buddy;
-	GaimAccount* account = (GaimAccount*)extra;
-	gchar* txtvers = NULL;
-	gchar* version = NULL;
-	gchar* first = NULL;
+	BonjourBuddy *buddy;
+	GaimAccount *account = (GaimAccount*)extra;
+	gchar *txtvers = NULL;
+	gchar *version = NULL;
+	gchar *first = NULL;
 	gint port_p2pj = -1;
-	gchar* phsh = NULL;
-	gchar* status = NULL;
-	gchar* email = NULL;
-	gchar* last = NULL;
-	gchar* jid = NULL;
-	gchar* AIM = NULL;
-	gchar* vc = NULL;
-	gchar* msg = NULL;
+	gchar *phsh = NULL;
+	gchar *status = NULL;
+	gchar *email = NULL;
+	gchar *last = NULL;
+	gchar *jid = NULL;
+	gchar *AIM = NULL;
+	gchar *vc = NULL;
+	gchar *msg = NULL;
 	gint address_length = 16;
-	gchar* ip = NULL;
+	gchar *ip = NULL;
 	sw_text_record_iterator iterator;
 	char key[SW_TEXT_RECORD_MAX_LEN];
 	char value[SW_TEXT_RECORD_MAX_LEN];
 	sw_uint32 value_length;
 
 	sw_discovery_cancel(discovery, oid);
-	
+
 	// Get the ip as a string
 	ip = malloc(address_length);
 	sw_ipv4_address_name(address, ip, address_length);
 
 	// Obtain the parameters from the text_record
-	if ((text_record_len > 0) && (text_record) && (*text_record != '\0')) {
+	if ((text_record_len > 0) && (text_record) && (*text_record != '\0'))
+	{
 		sw_text_record_iterator_init(&iterator, text_record, text_record_len);
-		while (sw_text_record_iterator_next(iterator, key, (sw_octet *)value, &value_length) == SW_OKAY) {
-			// Compare the keys with the possible ones and save them on 
+		while (sw_text_record_iterator_next(iterator, key, (sw_octet *)value, &value_length) == SW_OKAY)
+		{
+			// Compare the keys with the possible ones and save them on
 			// the appropiate place of the buddy_list
 			if (strcmp(key, "txtvers") == 0) {
 				txtvers = g_strdup(value);
@@ -133,18 +141,19 @@
 		}
 	}
 
-	// Put the parameters of the text_record in a buddy and add the buddy to 
+	// Put the parameters of the text_record in a buddy and add the buddy to
 	// the buddy list
-	buddy = bonjour_buddy_new((gchar*)name, first, port_p2pj, phsh, status, email,
-		last, jid, AIM, vc, ip, msg);
-		
-	if (bonjour_buddy_check(buddy) == FALSE) {
+	buddy = bonjour_buddy_new((gchar *)name, first, port_p2pj, phsh,
+							  status, email, last, jid, AIM, vc, ip, msg);
+
+	if (bonjour_buddy_check(buddy) == FALSE)
+	{
 		return SW_DISCOVERY_E_UNKNOWN;
 	}
-	
+
 	/* Add or update the buddy in our buddy list */
 	bonjour_buddy_add_to_gaim(account, buddy);
-	
+
 	// Free all the temporal strings
 	g_free(txtvers);
 	g_free(version);
@@ -157,19 +166,23 @@
 	g_free(vc);
 	g_free(phsh);
 	g_free(msg);
-	
+
 	return SW_OKAY;
 }
 
-static sw_result HOWL_API _browser_reply(sw_discovery discovery, sw_discovery_oid oid, 
-			sw_discovery_browse_status status, sw_uint32 interface_index, sw_const_string name, 
-			sw_const_string type, sw_const_string domain, sw_opaque_t extra)
+static sw_result HOWL_API
+_browser_reply(sw_discovery discovery, sw_discovery_oid oid,
+			   sw_discovery_browse_status status,
+			   sw_uint32 interface_index, sw_const_string name,
+			   sw_const_string type, sw_const_string domain,
+			   sw_opaque_t extra)
 {
 	sw_discovery_resolve_id rid;
-	GaimAccount* account = (GaimAccount*)extra;
-	GaimBuddy* gb = NULL;
-	
-	switch(status){
+	GaimAccount *account = (GaimAccount*)extra;
+	GaimBuddy *gb = NULL;
+
+	switch (status)
+	{
 		case SW_DISCOVERY_BROWSE_INVALID:
 			gaim_debug_warning("bonjour", "_browser_reply --> Invalid\n");
 			break;
@@ -188,9 +201,11 @@
 		case SW_DISCOVERY_BROWSE_ADD_SERVICE:
 			// A new peer has join the network and uses iChat bonjour
 			gaim_debug_info("bonjour", "_browser_reply --> Add service\n");
-			if (g_ascii_strcasecmp(name, account->username) != 0){
-				if (sw_discovery_resolve(discovery, interface_index, name, type, 
-						domain, _resolve_reply, extra, &rid) != SW_OKAY) {
+			if (g_ascii_strcasecmp(name, account->username) != 0)
+			{
+				if (sw_discovery_resolve(discovery, interface_index, name, type,
+						domain, _resolve_reply, extra, &rid) != SW_OKAY)
+				{
 					gaim_debug_warning("bonjour", "_browser_reply --> Cannot send resolve\n");
 				}
 			}
@@ -198,7 +213,8 @@
 		case SW_DISCOVERY_BROWSE_REMOVE_SERVICE:
 			gaim_debug_info("bonjour", "_browser_reply --> Remove service\n");
 			gb = gaim_find_buddy((GaimAccount*)extra, name);
-			if (gb != NULL) {
+			if (gb != NULL)
+			{
 				bonjour_buddy_delete(gb->proto_data);
 				gaim_blist_remove_buddy(gb);
 			}
@@ -209,17 +225,19 @@
 		default:
 			break;
 	}
-	
+
 	return SW_OKAY;
 }
 
-int _dns_sd_publish(BonjourDnsSd* data, PublishType type)
+int
+_dns_sd_publish(BonjourDnsSd *data, PublishType type)
 {
 	sw_text_record dns_data;
 	sw_result publish_result;
 
-	// Fill the data for the service	
-	if(sw_text_record_init(&dns_data) != SW_OKAY){
+	// Fill the data for the service
+	if (sw_text_record_init(&dns_data) != SW_OKAY)
+	{
 		gaim_debug_error("bonjour", "Unable to initialize the data for the mDNS.");
 		return -1;
 	}
@@ -239,10 +257,11 @@
 	sw_text_record_add_key_and_string_value(dns_data, "AIM", data->AIM);
 
 	// Publish the service
-	switch (type) {
+	switch (type)
+	{
 		case PUBLISH_START:
-			publish_result = sw_discovery_publish(*(data->session), 0, data->name, ICHAT_SERVICE, NULL, 
-								NULL, data->port_p2pj, sw_text_record_bytes(dns_data), sw_text_record_len(dns_data), 
+			publish_result = sw_discovery_publish(*(data->session), 0, data->name, ICHAT_SERVICE, NULL,
+								NULL, data->port_p2pj, sw_text_record_bytes(dns_data), sw_text_record_len(dns_data),
 								_publish_reply, NULL, &(data->session_id));
 			break;
 		case PUBLISH_UPDATE:
@@ -250,7 +269,8 @@
 								sw_text_record_bytes(dns_data), sw_text_record_len(dns_data));
 			break;
 	}
-	if(publish_result != SW_OKAY){
+	if (publish_result != SW_OKAY)
+	{
 		gaim_debug_error("bonjour", "Unable to publish or change the status of the _presence._tcp service.");
 		return -1;
 	}
@@ -261,27 +281,30 @@
 	return 0;
 }
 
-gboolean _dns_sd_handle_packets(GIOChannel* source, GIOCondition condition, gpointer data)
+gboolean
+_dns_sd_handle_packets(GIOChannel *source, GIOCondition condition, gpointer data)
 {
 	sw_discovery_read_socket(*((sw_discovery*)data));
 	return TRUE;
 }
 
-gpointer _dns_sd_wait_for_connections(gpointer data)
+gpointer
+_dns_sd_wait_for_connections(gpointer data)
 {
 	sw_discovery_oid session_id;
-	BonjourDnsSd* dns_sd_data = (BonjourDnsSd*)data;
+	BonjourDnsSd *dns_sd_data = (BonjourDnsSd*)data;
 
 	// Advise the daemon that we are waiting for connections
-	if(sw_discovery_browse(*(dns_sd_data->session), 0, ICHAT_SERVICE, NULL, _browser_reply,
-			dns_sd_data->account, &session_id) != SW_OKAY){
+	if (sw_discovery_browse(*(dns_sd_data->session), 0, ICHAT_SERVICE, NULL, _browser_reply,
+			dns_sd_data->account, &session_id) != SW_OKAY)
+	{
 		gaim_debug_error("bonjour", "Unable to get service.");
 		return NULL;
 	}
 
 	// Yields control of the cpu to the daemon
 	sw_discovery_run(*(dns_sd_data->session));
-	
+
 	return NULL;
 }
 
@@ -290,18 +313,20 @@
 /**
  * Allocate space for the dns-sd data.
  */
-BonjourDnsSd* bonjour_dns_sd_new()
+BonjourDnsSd *
+bonjour_dns_sd_new()
 {
-	BonjourDnsSd* data = g_new(BonjourDnsSd, 1);
+	BonjourDnsSd *data = g_new(BonjourDnsSd, 1);
 	data->session = g_malloc(sizeof(sw_discovery));
-	
+
 	return data;
 }
 
 /**
  * Deallocate the space of the dns-sd data.
  */
-void bonjour_dns_sd_free(BonjourDnsSd* data)
+void
+bonjour_dns_sd_free(BonjourDnsSd *data)
 {
 	g_free(data->session);
 	g_free(data->first);
@@ -313,7 +338,8 @@
 /**
  * Send a new dns-sd packet updating our status.
  */
-void bonjour_dns_sd_send_status(BonjourDnsSd *data, const char *status, const char* status_message)
+void
+bonjour_dns_sd_send_status(BonjourDnsSd *data, const char *status, const char *status_message)
 {
 	g_free(data->status);
 	g_free(data->msg);
@@ -329,43 +355,47 @@
  * Advertise our presence within the dns-sd daemon and start browsing
  * for other bonjour peers.
  */
-void bonjour_dns_sd_start(BonjourDnsSd* data)
-{	
-	GIOChannel* io_channel;
+void
+bonjour_dns_sd_start(BonjourDnsSd *data)
+{
+	GIOChannel *io_channel;
 	gint dns_sd_socket;
 	sw_discovery_oid session_id;
-	
+
 	// Initilizations of the dns-sd data and session
 	data->session = malloc(sizeof(sw_discovery));
-	if(sw_discovery_init(data->session) != SW_OKAY){
+	if (sw_discovery_init(data->session) != SW_OKAY)
+	{
 		gaim_debug_error("bonjour", "Unable to initialize a mDNS session.");
 		return;
 	}
-	
+
 	// Publish our bonjour IM client at the mDNS daemon
 	_dns_sd_publish(data, PUBLISH_START); // <--We must control the errors
-	
-	
+
 	// Advise the daemon that we are waiting for connections
-	if(sw_discovery_browse(*(data->session), 0, ICHAT_SERVICE, NULL, _browser_reply,
-			data->account, &session_id) != SW_OKAY){
+	if (sw_discovery_browse(*(data->session), 0, ICHAT_SERVICE, NULL, _browser_reply,
+			data->account, &session_id) != SW_OKAY)
+	{
 		gaim_debug_error("bonjour", "Unable to get service.");
 		return;
 	}
-	
-	// Get the socket that communicates with the mDNS daemon and bind it to a 
+
+	// Get the socket that communicates with the mDNS daemon and bind it to a
 	// callback that will handle the dns_sd packets
 	dns_sd_socket = sw_discovery_socket(*(data->session));
 	io_channel = g_io_channel_unix_new(dns_sd_socket);
-	g_io_add_watch(io_channel, G_IO_IN, _dns_sd_handle_packets, data->session); // Add more for other conditions like when the conn. has been broken
+	// Add more for other conditions like when the conn. has been broken
+	g_io_add_watch(io_channel, G_IO_IN, _dns_sd_handle_packets, data->session);
 }
 
 /**
  * Unregister the "_presence._tcp" service at the mDNS daemon.
  */
-int bonjour_dns_sd_stop(BonjourDnsSd* data)
+int
+bonjour_dns_sd_stop(BonjourDnsSd *data)
 {
 	sw_discovery_cancel(*(data->session), data->session_id);
-	
+
 	return 0;
 }
--- a/src/protocols/bonjour/dns_sd.h	Wed Sep 14 01:18:07 2005 +0000
+++ b/src/protocols/bonjour/dns_sd.h	Wed Sep 14 02:58:30 2005 +0000
@@ -13,14 +13,14 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
- 
+
 #ifndef _BONJOUR_DNS_SD
 #define _BONJOUR_DNS_SD
 
 #include <howl.h>
 #include <glib.h>
 #include "account.h"
-	
+
 #define BONJOUR_DEFAULT_PORT "5298"
 #define BONJOUR_DEFAULT_PORT_INT 5298
 #define ICHAT_SERVICE "_presence._tcp."
@@ -28,40 +28,41 @@
 /**
  * Data to be used by the dns-sd connection.
  */
-typedef struct _bonjour_dns_sd{
-	sw_discovery* session;
+typedef struct _BonjourDnsSd
+{
+	sw_discovery *session;
 	sw_discovery_oid session_id;
-	GaimAccount* account;
-	gchar* name;
-	gchar* txtvers;
-	gchar* version;
-	gchar* first;
-	gchar* last;
+	GaimAccount *account;
+	gchar *name;
+	gchar *txtvers;
+	gchar *version;
+	gchar *first;
+	gchar *last;
 	gint port_p2pj;
-	gchar* phsh;
-	gchar* status;
-	gchar* email;
-	gchar* vc;
-	gchar* jid;
-	gchar* AIM;
-	gchar* msg;
-	GHashTable* buddies;
-}BonjourDnsSd;
+	gchar *phsh;
+	gchar *status;
+	gchar *email;
+	gchar *vc;
+	gchar *jid;
+	gchar *AIM;
+	gchar *msg;
+	GHashTable *buddies;
+} BonjourDnsSd;
 
-typedef enum _PublishType{
+typedef enum _PublishType {
 	PUBLISH_START,
 	PUBLISH_UPDATE
-}PublishType;
+} PublishType;
 
 /**
  * Allocate space for the dns-sd data.
  */
-BonjourDnsSd* bonjour_dns_sd_new();
+BonjourDnsSd *bonjour_dns_sd_new();
 
 /**
  * Deallocate the space of the dns-sd data.
  */
-void bonjour_dns_sd_free(BonjourDnsSd* data);
+void bonjour_dns_sd_free(BonjourDnsSd *data);
 
 /**
  * Send a new dns-sd packet updating our status.
@@ -69,14 +70,14 @@
 void bonjour_dns_sd_send_status(BonjourDnsSd *data, const char *status, const char *status_message);
 
 /**
- * Advertise our presence within the dns-sd daemon and start browsing for other 
- * bonjour peers.
+ * Advertise our presence within the dns-sd daemon and start
+ * browsing for other bonjour peers.
  */
-void bonjour_dns_sd_start(BonjourDnsSd* data);
- 
+void bonjour_dns_sd_start(BonjourDnsSd *data);
+
 /**
  * Unregister the "_presence._tcp" service at the mDNS daemon.
  */
-int bonjour_dns_sd_stop(BonjourDnsSd* data);
+int bonjour_dns_sd_stop(BonjourDnsSd *data);
 
 #endif
--- a/src/protocols/bonjour/jabber.c	Wed Sep 14 01:18:07 2005 +0000
+++ b/src/protocols/bonjour/jabber.c	Wed Sep 14 02:58:30 2005 +0000
@@ -42,34 +42,36 @@
 #include "bonjour.h"
 #include "buddy.h"
 
-gint _connect_to_buddy(GaimBuddy* gb)
+gint
+_connect_to_buddy(GaimBuddy *gb)
 {
 	gint socket_fd;
 	gint retorno = 0;
 	struct sockaddr_in buddy_address;
-	
+
 	// Create a socket and make it non-blocking
 	socket_fd = socket(PF_INET, SOCK_STREAM, 0);
-	
+
 	buddy_address.sin_family = PF_INET;
 	buddy_address.sin_port = htons(((BonjourBuddy*)(gb->proto_data))->port_p2pj);
 	inet_aton(((BonjourBuddy*)(gb->proto_data))->ip, &(buddy_address.sin_addr));
 	memset(&(buddy_address.sin_zero), '\0', 8);
-	
+
 	retorno = connect(socket_fd, (struct sockaddr*)&buddy_address, sizeof(struct sockaddr));
 	if (retorno == -1) {
-		perror("connect");	
+		perror("connect");
 	}
 	fcntl(socket_fd, F_SETFL, O_NONBLOCK);
 
 	return socket_fd;
 }
 
-char* _font_size_gaim_to_ichat(int size)
+char *
+_font_size_gaim_to_ichat(int size)
 {
-	GString* result = NULL;
-	
-	switch(size){
+	GString *result = NULL;
+
+	switch(size) {
 		case 1 :
 			result = g_string_new("8");
 			break;
@@ -94,25 +96,26 @@
 		default:
 			result = g_string_new("12");
 	}
-	
+
 	return g_string_free(result, FALSE);
 }
 
-char* _font_size_ichat_to_gaim(int size)
+char *
+_font_size_ichat_to_gaim(int size)
 {
-	GString* result = NULL;
-	
+	GString *result = NULL;
+
 	if (size > 24) {
 		result = g_string_new("7");
-	} else if(size >= 21) {
+	} else if (size >= 21) {
 		result = g_string_new("6");
-	} else if(size >= 17) {
+	} else if (size >= 17) {
 		result = g_string_new("5");
-	} else if(size >= 14) {
+	} else if (size >= 14) {
 		result = g_string_new("4");
-	} else if(size >= 12) {
+	} else if (size >= 12) {
 		result = g_string_new("3");
-	} else if(size >= 10) {
+	} else if (size >= 10) {
 		result = g_string_new("2");
 	} else {
 		result = g_string_new("1");
@@ -120,56 +123,63 @@
 
 	return g_string_free(result, FALSE);
 }
-void _jabber_parse_and_write_message_to_ui(char* message, GaimConnection* connection, GaimBuddy* gb)
+void
+_jabber_parse_and_write_message_to_ui(char *message, GaimConnection *connection, GaimBuddy *gb)
 {
-	xmlnode* body_node = NULL;
-	char* body = NULL;
-	xmlnode* html_node = NULL;
+	xmlnode *body_node = NULL;
+	char *body = NULL;
+	xmlnode *html_node = NULL;
 	gboolean isHTML = FALSE;
-	xmlnode* html_body_node = NULL;
-	const char* ichat_balloon_color = NULL;
-	const char* ichat_text_color = NULL;
-	xmlnode* html_body_font_node = NULL;
-	const char* font_face = NULL;
-	const char* font_size = NULL;
-	const char* font_color = NULL;
-	char* html_body = NULL;
-	xmlnode* events_node = NULL;
+	xmlnode *html_body_node = NULL;
+	const char *ichat_balloon_color = NULL;
+	const char *ichat_text_color = NULL;
+	xmlnode *html_body_font_node = NULL;
+	const char *font_face = NULL;
+	const char *font_size = NULL;
+	const char *font_color = NULL;
+	char *html_body = NULL;
+	xmlnode *events_node = NULL;
 	gboolean composing_event = FALSE;
 	gint garbage = -1;
-	xmlnode* message_node = NULL;
+	xmlnode *message_node = NULL;
 
 	// Parsing of the message
 	message_node = xmlnode_from_str(message, strlen(message));
 	if (message_node == NULL) {
 		return;
 	}
-	
+
 	body_node = xmlnode_get_child(message_node, "body");
 	if (body_node != NULL) {
 		body = xmlnode_get_data(body_node);
 	} else {
 		return;
 	}
-	
+
 	html_node = xmlnode_get_child(message_node, "html");
-	if (html_node != NULL) {
+	if (html_node != NULL)
+	{
 		isHTML = TRUE;
 		html_body_node = xmlnode_get_child(html_node, "body");
-		if (html_body_node != NULL) {
+		if (html_body_node != NULL)
+		{
 			ichat_balloon_color = xmlnode_get_attrib(html_body_node, "ichatballooncolor");
 			ichat_text_color = xmlnode_get_attrib(html_body_node, "ichattextcolor");
 			html_body_font_node = xmlnode_get_child(html_body_node, "font");
-			if (html_body_font_node != NULL) { // Types of messages sent by iChat
+			if (html_body_font_node != NULL)
+			{ // Types of messages sent by iChat
 				font_face = xmlnode_get_attrib(html_body_font_node, "face");
 				// The absolute iChat font sizes should be converted to 1..7 range
 				font_size = xmlnode_get_attrib(html_body_font_node, "ABSZ");
-				if (font_size != NULL) {
+				if (font_size != NULL)
+				{
 					font_size = _font_size_ichat_to_gaim(atoi(font_size)); //<-- This call will probably leak memory
 				}
 				font_color = xmlnode_get_attrib(html_body_font_node, "color");
 				html_body = xmlnode_get_data(html_body_font_node);
-				if (html_body == NULL) { // This is the kind of formated messages that Gaim creates
+				if (html_body == NULL)
+				{
+					// This is the kind of formated messages that Gaim creates
 					html_body = xmlnode_to_str(html_body_font_node, &garbage);
 				}
 			} else {
@@ -178,71 +188,81 @@
 		} else {
 			isHTML = FALSE;
 		}
-			
+
 	}
-	
+
 	events_node = xmlnode_get_child_with_namespace(message_node, "x", "jabber:x:event");
-	if (events_node != NULL) {
-		if (xmlnode_get_child(events_node, "composing") != NULL) {
+	if (events_node != NULL)
+	{
+		if (xmlnode_get_child(events_node, "composing") != NULL)
+		{
 			composing_event = TRUE;
 		}
-		if (xmlnode_get_child(events_node, "id") != NULL) { // The user is just typing
+		if (xmlnode_get_child(events_node, "id") != NULL)
+		{
+			// The user is just typing
 			xmlnode_free(message_node);
 			g_free(body);
 			g_free(html_body);
 			return;
 		}
 	}
-	
+
 	// Compose the message
-	if (isHTML) {
+	if (isHTML)
+	{
 		if (font_face == NULL) font_face = "Helvetica";
 		if (font_size == NULL) font_size = "3";
 		if (ichat_text_color == NULL) ichat_text_color = "#000000";
 		if (ichat_balloon_color == NULL) ichat_balloon_color = "#FFFFFF";
-		body = g_strconcat("<font face='", font_face, "' size='", font_size, "' color='", ichat_text_color, 
+		body = g_strconcat("<font face='", font_face, "' size='", font_size, "' color='", ichat_text_color,
 							"' back='", ichat_balloon_color, "'>", html_body, "</font>", NULL);
 	}
-	
+
 	// Send the message to the UI
 	serv_got_im(connection, gb->name, body, 0, time(NULL));
-	
+
 	// Free all the strings and nodes (the attributes are freed with their nodes)
 	xmlnode_free(message_node);
 	g_free(body);
 	g_free(html_body);
 }
 
-gboolean _check_buddy_by_address(gpointer key, gpointer value, gpointer address)
+gboolean
+_check_buddy_by_address(gpointer key, gpointer value, gpointer address)
 {
-	GaimBuddy* gb = (GaimBuddy*)value;
-	BonjourBuddy* bb = (BonjourBuddy*)gb->proto_data;
-	
-	if (bb != NULL) {
+	GaimBuddy *gb = (GaimBuddy*)value;
+	BonjourBuddy *bb = (BonjourBuddy*)gb->proto_data;
+
+	if (bb != NULL)
+	{
 		if (g_strcasecmp(bb->ip, (char*)address) == 0) {
 			return TRUE;
 		} else {
 			return FALSE;
 		}
 	} else {
-		return FALSE;	
+		return FALSE;
 	}
 }
 
-gint _read_data(gint socket, char** message)
+gint
+_read_data(gint socket, char **message)
 {
-	GString* data = g_string_new("");
+	GString *data = g_string_new("");
 	char parcial_data[512];
 	gint total_message_length = 0;
 	gint parcial_message_length = 0;
 
 	// Read chunks of 512 bytes till the end of the data
-	while ((parcial_message_length = recv(socket, parcial_data, 512, 0)) > 0) {
+	while ((parcial_message_length = recv(socket, parcial_data, 512, 0)) > 0)
+	{
 			g_string_append_len(data, parcial_data, parcial_message_length);
 			total_message_length += parcial_message_length;
 	}
-	
-	if (parcial_message_length == -1) {
+
+	if (parcial_message_length == -1)
+	{
 		perror("recv");
 		if (total_message_length == 0) {
 			return -1;
@@ -251,17 +271,21 @@
 
 	*message = data->str;
 	g_string_free(data, FALSE);
-if (total_message_length != 0) gaim_debug_info("bonjour", "Receive: -%s- %d bytes\n", *message, total_message_length);
+	if (total_message_length != 0)
+		gaim_debug_info("bonjour", "Receive: -%s- %d bytes\n", *message, total_message_length);
+
 	return total_message_length;
 }
 
-gint _send_data(gint socket, char* message)
+gint
+_send_data(gint socket, char *message)
 {
 	gint message_len = strlen(message);
 	gint parcial_sent = 0;
-	gchar* parcial_message = message;
-	
-	while ((parcial_sent = send(socket, parcial_message, message_len, 0)) < message_len) {
+	gchar *parcial_message = message;
+
+	while ((parcial_sent = send(socket, parcial_message, message_len, 0)) < message_len)
+	{
 		if (parcial_sent != -1) {
 			parcial_message += parcial_sent;
 			message_len -= parcial_sent;
@@ -269,19 +293,20 @@
 			return -1;
 		}
 	}
-	
+
 	return strlen(message);
 }
 
-void _client_socket_handler(gpointer data, gint socket, GaimInputCondition condition)
+void
+_client_socket_handler(gpointer data, gint socket, GaimInputCondition condition)
 {
-	char* message = NULL;
+	char *message = NULL;
 	gint message_length;
-	GaimBuddy* gb = (GaimBuddy*)data;
-	GaimAccount* account = gb->account;
-	GaimConversation* conversation;
-	char* closed_conv_message;
-	BonjourBuddy* bb = (BonjourBuddy*)gb->proto_data;
+	GaimBuddy *gb = (GaimBuddy*)data;
+	GaimAccount *account = gb->account;
+	GaimConversation *conversation;
+	char *closed_conv_message;
+	BonjourBuddy *bb = (BonjourBuddy*)gb->proto_data;
 	gboolean closed_conversation = FALSE;
 
 	// Read the data from the socket
@@ -292,27 +317,30 @@
 		closed_conversation = TRUE;
 	} else {
 		message[message_length] = '\0';
-		
+
 		while (g_ascii_iscntrl(message[message_length - 1])) {
 			message[message_length - 1] = '\0';
 			message_length--;
 		}
 	}
-	
+
 	// Check if the start of the doctype has been received, if not check that the current
 	// data is the doctype
-	if (!(bb->conversation->start_step_one)) {
-		if (g_str_has_prefix(message, DOCTYPE_DECLARATION)){
+	if (!(bb->conversation->start_step_one))
+	{
+		if (g_str_has_prefix(message, DOCTYPE_DECLARATION))
+		{
 			bb->conversation->start_step_one = TRUE;
 		}
 	}
-	
-	// Check if the start of the stream has been received, if not check that the current 
+
+	// Check if the start of the stream has been received, if not check that the current
 	// data is the start of the stream
-	if (!(bb->conversation->start_step_two)) {
+	if (!(bb->conversation->start_step_two))
+	{
 		if (g_str_has_suffix(message, STREAM_START)) {
 			bb->conversation->start_step_two = TRUE;
-			
+
 			// If we haven't done it yet, we have to sent the start of the stream to the other buddy
 			if (!(bb->conversation->stream_started)) {
 				if (send(bb->conversation->socket, DOCTYPE, strlen(DOCTYPE), 0) == -1) {
@@ -322,7 +350,7 @@
 		}
 		return;
 	}
-	
+
 	// Check that this is not the end of the conversation
 	if (g_str_has_prefix(message, STREAM_END) || (closed_conversation == TRUE)) {
 		// Close the socket, clear the watcher and free memory
@@ -333,7 +361,7 @@
 			g_free(bb->conversation);
 			bb->conversation = NULL;
 		}
-		
+
 		// Inform the user that the conversation has been closed
 		conversation = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, gb->name, account);
 		closed_conv_message = g_strconcat(gb->name, " has closed the conversation.", NULL);
@@ -344,22 +372,24 @@
 	}
 }
 
-void _server_socket_handler(gpointer data, int server_socket, GaimInputCondition condition)
+void
+_server_socket_handler(gpointer data, int server_socket, GaimInputCondition condition)
 {
-	GaimBuddy* gb = NULL;
+	GaimBuddy *gb = NULL;
 	struct sockaddr_in their_addr; // connector's address information
 	socklen_t sin_size = sizeof(struct sockaddr);
 	int client_socket;
-	BonjourBuddy* bb = NULL;
-	char* address_text = NULL;
-	GaimBuddyList* bl = gaim_get_blist();
+	BonjourBuddy *bb = NULL;
+	char *address_text = NULL;
+	GaimBuddyList *bl = gaim_get_blist();
 
 	//Check that it is a read condition
 	if (condition != GAIM_INPUT_READ) {
 		return;
 	}
 
-	if ((client_socket = accept(server_socket, (struct sockaddr *)&their_addr, &sin_size)) == -1) {
+	if ((client_socket = accept(server_socket, (struct sockaddr *)&their_addr, &sin_size)) == -1)
+	{
 		return;
 	}
 	fcntl(client_socket, F_SETFL, O_NONBLOCK);
@@ -367,7 +397,8 @@
 	// Look for the buddy that has open the conversation and fill information
 	address_text = inet_ntoa(their_addr.sin_addr);
 	gb = (GaimBuddy*)g_hash_table_find(bl->buddies, _check_buddy_by_address, address_text);
-	if (gb == NULL) {
+	if (gb == NULL)
+	{
 		gaim_debug_info("bonjour", "We don't like invisible buddies, this is not a superheros comic\n");
 		close(client_socket);
 		return;
@@ -375,7 +406,8 @@
 	bb = (BonjourBuddy*)gb->proto_data;
 
 	// Check if the conversation has been previously started
-	if (bb->conversation == NULL) {
+	if (bb->conversation == NULL)
+	{
 		bb->conversation = g_new(BonjourJabberConversation, 1);
 		bb->conversation->socket = client_socket;
 		bb->conversation->start_step_one = FALSE;
@@ -383,7 +415,7 @@
 		bb->conversation->stream_started = FALSE;
 		bb->conversation->buddy_name = g_strdup(gb->name);
 		bb->conversation->message_id = 1;
-		
+
 		if (bb->conversation->stream_started == FALSE) {
 			// Start the stream
 			send(bb->conversation->socket, DOCTYPE, strlen(DOCTYPE), 0);
@@ -391,31 +423,33 @@
 		}
 
 		// Open a watcher for the client socket
-		bb->conversation->watcher_id = gaim_input_add(client_socket, GAIM_INPUT_READ, 
+		bb->conversation->watcher_id = gaim_input_add(client_socket, GAIM_INPUT_READ,
 													_client_socket_handler, gb);
 	} else {
 		close(client_socket);
 	}
 }
 
-gint bonjour_jabber_start(BonjourJabber* data)
+gint
+bonjour_jabber_start(BonjourJabber *data)
 {
 	struct sockaddr_in my_addr;
 	int yes = 1;
-	char* error_message = NULL;
-	
+	char *error_message = NULL;
 
 	// Open a listening socket for incoming conversations
-	if ((data->socket = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
+	if ((data->socket = socket(PF_INET, SOCK_STREAM, 0)) < 0)
+	{
 		gaim_debug_error("bonjour", "Cannot get socket\n");
 		error_message = strerror(errno);
 		gaim_debug_error("bonjour", "%s\n", error_message);
 		gaim_connection_error(data->account->gc, "Cannot open socket");
 		return -1;
 	}
-	
+
 	// Make the socket reusable
-	if (setsockopt(data->socket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) != 0) {
+	if (setsockopt(data->socket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) != 0)
+	{
 		gaim_debug_error("bonjour", "Cannot make socket reusable\n");
 		error_message = strerror(errno);
 		gaim_debug_error("bonjour", "%s\n", error_message);
@@ -426,16 +460,18 @@
 	memset(&my_addr, 0, sizeof(struct sockaddr_in));
 	my_addr.sin_family = PF_INET;
 	my_addr.sin_port = htons(data->port);
-	
-	if (bind(data->socket, (struct sockaddr*)&my_addr, sizeof(struct sockaddr)) != 0) {
+
+	if (bind(data->socket, (struct sockaddr*)&my_addr, sizeof(struct sockaddr)) != 0)
+	{
 		gaim_debug_error("bonjour", "Cannot bind socket\n");
 		error_message = strerror(errno);
 		gaim_debug_error("bonjour", "%s\n", error_message);
 		gaim_connection_error(data->account->gc, "Cannot bind socket to port");
 		return -1;
 	}
-	
-	if (listen(data->socket, 10) != 0) {
+
+	if (listen(data->socket, 10) != 0)
+	{
 		gaim_debug_error("bonjour", "Cannot listen to socket\n");
 		error_message = strerror(errno);
 		gaim_debug_error("bonjour", "%s\n", error_message);
@@ -445,44 +481,46 @@
 
 	//data->socket = gaim_network_listen(data->port);
 
-	//if (data->socket == -1) {
+	//if (data->socket == -1)
+	//{
 	//	gaim_debug_error("bonjour", "No se ha podido crear el socket\n");
 	//}
 
 	// Open a watcher in the socket we have just opened
 	data->watcher_id = gaim_input_add(data->socket, GAIM_INPUT_READ, _server_socket_handler, data);
-	
+
 	return 0;
 }
 
-void bonjour_jabber_send_message(BonjourJabber* data, const gchar* to, const gchar* body)
+void
+bonjour_jabber_send_message(BonjourJabber *data, const gchar *to, const gchar *body)
 {
-	xmlnode* message_node = NULL;
-	gchar* message = NULL;
+	xmlnode *message_node = NULL;
+	gchar *message = NULL;
 	gint message_length = -1;
-	xmlnode* message_body_node = NULL;
-	xmlnode* message_html_node = NULL;
-	xmlnode* message_html_body_node = NULL;
-	xmlnode* message_html_body_font_node = NULL;
-	xmlnode* message_x_node = NULL;
-	GaimBuddy* gb = gaim_find_buddy(data->account, to);
-	BonjourBuddy* bb = (BonjourBuddy*)gb->proto_data;
-	char* conv_message = NULL;
-	GaimConversation* conversation = NULL;
-	char* message_from_ui = NULL;
-	char* stripped_message = NULL;
-	
+	xmlnode *message_body_node = NULL;
+	xmlnode *message_html_node = NULL;
+	xmlnode *message_html_body_node = NULL;
+	xmlnode *message_html_body_font_node = NULL;
+	xmlnode *message_x_node = NULL;
+	GaimBuddy *gb = gaim_find_buddy(data->account, to);
+	BonjourBuddy *bb = (BonjourBuddy*)gb->proto_data;
+	char *conv_message = NULL;
+	GaimConversation *conversation = NULL;
+	char *message_from_ui = NULL;
+	char *stripped_message = NULL;
+
 	// Enclose the message from the UI within a "font" node
 	message_body_node = xmlnode_new("body");
 	stripped_message = gaim_markup_strip_html(body);
 	xmlnode_insert_data(message_body_node, stripped_message, strlen(stripped_message));
-	
+
 	message_from_ui = g_strconcat("<font>", body, "</font>", NULL);
 	message_html_body_font_node = xmlnode_from_str(message_from_ui, strlen(message_from_ui));
-	
+
 	message_html_body_node = xmlnode_new("body");
 	xmlnode_insert_child(message_html_body_node, message_html_body_font_node);
-	
+
 	message_html_node = xmlnode_new("html");
 	xmlnode_set_attrib(message_html_node, "xmlns", "http://www.w3.org/1999/xhtml");
 	xmlnode_insert_child(message_html_node, message_html_body_node);
@@ -490,32 +528,35 @@
 	message_x_node = xmlnode_new("x");
 	xmlnode_set_attrib(message_x_node, "xmlns", "jabber:x:event");
 	xmlnode_insert_child(message_x_node, xmlnode_new("composing"));
-	
+
 	message_node = xmlnode_new("message");
 	xmlnode_set_attrib(message_node, "to", ((BonjourBuddy*)(gb->proto_data))->name);
 	xmlnode_set_attrib(message_node, "type", "chat");
 	xmlnode_insert_child(message_node, message_body_node);
 	xmlnode_insert_child(message_node, message_html_node);
 	xmlnode_insert_child(message_node, message_x_node);
-	
+
 	message = xmlnode_to_str(message_node, &message_length);
 
 	// Check if there is a previously open conversation
-	if (bb->conversation == NULL) {
+	if (bb->conversation == NULL)
+	{
 		bb->conversation = g_new(BonjourJabberConversation, 1);
 		bb->conversation->socket = _connect_to_buddy(gb);;
 		bb->conversation->start_step_one = FALSE;
 		bb->conversation->start_step_two = FALSE;
 		bb->conversation->stream_started = FALSE;
 		bb->conversation->buddy_name = g_strdup(gb->name);
-		bb->conversation->watcher_id = gaim_input_add(bb->conversation->socket, 
+		bb->conversation->watcher_id = gaim_input_add(bb->conversation->socket,
 														GAIM_INPUT_READ, _client_socket_handler, gb);
 	}
 
 	// Check if the stream for the conversation has been started
-	if (bb->conversation->stream_started == FALSE) {
+	if (bb->conversation->stream_started == FALSE)
+	{
 		// Start the stream
-		if (send(bb->conversation->socket, DOCTYPE, strlen(DOCTYPE), 0) == -1) {
+		if (send(bb->conversation->socket, DOCTYPE, strlen(DOCTYPE), 0) == -1)
+		{
 				gaim_debug_error("bonjour", "Unable to start a conversation\n");
 				perror("send");
 				conv_message = g_strdup("Unable to send the message, the conversation couldn't be started.");
@@ -523,19 +564,20 @@
 				gaim_conversation_write(conversation, NULL, conv_message, GAIM_MESSAGE_SYSTEM, time(NULL));
 				close(bb->conversation->socket);
 				gaim_input_remove(bb->conversation->watcher_id);
-				
+
 				// Free all the data related to the conversation
 				g_free(bb->conversation->buddy_name);
 				g_free(bb->conversation);
 				bb->conversation = NULL;
 				return;
 		}
-		
+
 		bb->conversation->stream_started = TRUE;
 	}
-	
+
 	// Send the message
-	if (_send_data(bb->conversation->socket, message) == -1) {
+	if (_send_data(bb->conversation->socket, message) == -1)
+	{
 		gaim_debug_error("bonjour", "Unable to send the message\n");
 		conv_message = g_strdup("Unable to send the message.");
 		conversation = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, bb->name, data->account);
@@ -543,18 +585,20 @@
 	}
 }
 
-void bonjour_jabber_close_conversation(BonjourJabber* data, GaimBuddy* gb)
+void
+bonjour_jabber_close_conversation(BonjourJabber *data, GaimBuddy *gb)
 {
-	BonjourBuddy* bb = (BonjourBuddy*)gb->proto_data;
-	
-	if (bb->conversation != NULL) {
+	BonjourBuddy *bb = (BonjourBuddy*)gb->proto_data;
+
+	if (bb->conversation != NULL)
+	{
 		// Send the end of the stream to the other end of the conversation
 		send(bb->conversation->socket, STREAM_END, strlen(STREAM_END), 0);
-		
+
 		// Close the socket and remove the watcher
 		close(bb->conversation->socket);
 		gaim_input_remove(bb->conversation->watcher_id);
-		
+
 		// Free all the data related to the conversation
 		g_free(bb->conversation->buddy_name);
 		g_free(bb->conversation);
@@ -562,24 +606,28 @@
 	}
 }
 
-void bonjour_jabber_stop(BonjourJabber* data)
+void
+bonjour_jabber_stop(BonjourJabber *data)
 {
-	GaimBuddy* gb = NULL;
-	BonjourBuddy* bb = NULL;
-	GSList* buddies;
-	GSList* l;
-	
+	GaimBuddy *gb = NULL;
+	BonjourBuddy *bb = NULL;
+	GSList *buddies;
+	GSList *l;
+
 	// Close the server socket and remove all the watcher
 	close(data->socket);
 	gaim_input_remove(data->watcher_id);
-	
+
 	// Close all the sockets and remove all the watchers after sending end streams
-	if(data->account->gc != NULL){
+	if (data->account->gc != NULL)
+	{
 		buddies = gaim_find_buddies(data->account, data->account->username);
-		for(l = buddies; l; l = l->next){
+		for (l = buddies; l; l = l->next)
+		{
 			gb = (GaimBuddy*)l->data;
 			bb = (BonjourBuddy*)gb->proto_data;
-			if (bb->conversation != NULL) {
+			if (bb->conversation != NULL)
+			{
 				send(bb->conversation->socket, STREAM_END, strlen(STREAM_END), 0);
 				close(bb->conversation->socket);
 				gaim_input_remove(bb->conversation->watcher_id);
--- a/src/protocols/bonjour/jabber.h	Wed Sep 14 01:18:07 2005 +0000
+++ b/src/protocols/bonjour/jabber.h	Wed Sep 14 02:58:30 2005 +0000
@@ -33,15 +33,18 @@
 #define CONVERSATION_START "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><stream:stream xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\">"
 #define STREAM_END "</stream:stream>"
 #define DOCTYPE "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<stream:stream xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" >"
-typedef struct _bonjour_jabber{
+
+typedef struct _BonjourJabber
+{
 	gint port;
 	gint socket;
 	gint watcher_id;
 	char* name;
 	GaimAccount* account;
-}BonjourJabber;
+} BonjourJabber;
 
-typedef struct _bonjour_jabber_conversation{
+typedef struct _BonjourJabberConversation
+{
 	gint socket;
 	gint watcher_id;
 	gchar* buddy_name;
@@ -49,19 +52,18 @@
 	gboolean start_step_two;
 	gboolean stream_started;
 	gint message_id;
-}BonjourJabberConversation;
+} BonjourJabberConversation;
 
 /**
  * Start listening for jabber connections. Returns 0 if the connection could be
  * stablished, -1 if a problem appears.
  */
-gint bonjour_jabber_start(BonjourJabber* data);
+gint bonjour_jabber_start(BonjourJabber *data);
 
-void bonjour_jabber_send_message(BonjourJabber* data, const gchar* to, const gchar* body);
+void bonjour_jabber_send_message(BonjourJabber *data, const gchar *to, const gchar *body);
 
-void bonjour_jabber_close_conversation(BonjourJabber* data, GaimBuddy* gb);
+void bonjour_jabber_close_conversation(BonjourJabber *data, GaimBuddy *gb);
 
-void bonjour_jabber_stop(BonjourJabber* data);
-
+void bonjour_jabber_stop(BonjourJabber *data);
 
 #endif /* _BONJOUR_JABBER_H_ */