changeset 1252:46c09828e929

[gaim-migrate @ 1262] still need to do buddy.c, conversation.c, dialogs.c, prefs.c. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 13 Dec 2000 22:12:02 +0000
parents 2d12541cedb1
children 8342d3aab1f1
files src/gaim.h src/plugins.c src/proxy.c src/prpl.c src/server.c src/sound.c src/toc.c src/util.c
diffstat 8 files changed, 1490 insertions(+), 1398 deletions(-) [+]
line wrap: on
line diff
--- a/src/gaim.h	Wed Dec 13 20:23:06 2000 +0000
+++ b/src/gaim.h	Wed Dec 13 22:12:02 2000 +0000
@@ -710,6 +710,7 @@
 
 /* Functions in prefs.c */
 extern void debug_printf( char * fmt, ... );
+#define debug_print(x) debug_printf(x);
 extern void set_general_option(GtkWidget *, int *);
 extern void set_option(GtkWidget *, int *);
 extern void show_prefs();
--- a/src/plugins.c	Wed Dec 13 20:23:06 2000 +0000
+++ b/src/plugins.c	Wed Dec 13 22:12:02 2000 +0000
@@ -50,7 +50,7 @@
 
 /* ------------------ Global Variables ----------------------- */
 
-GList *plugins   = NULL;
+GList *plugins = NULL;
 GList *callbacks = NULL;
 
 /* ------------------ Local Variables ------------------------ */
@@ -67,25 +67,26 @@
 
 /* --------------- Function Declarations --------------------- */
 
-       void show_plugins (GtkWidget *, gpointer);
-       void load_plugin  (char *);
+void show_plugins(GtkWidget *, gpointer);
+void load_plugin(char *);
 
-       void gaim_signal_connect   (GModule *, enum gaim_event, void *, void *);
-       void gaim_signal_disconnect(GModule *, enum gaim_event, void *);
-       void gaim_plugin_unload    (GModule *);
+void gaim_signal_connect(GModule *, enum gaim_event, void *, void *);
+void gaim_signal_disconnect(GModule *, enum gaim_event, void *);
+void gaim_plugin_unload(GModule *);
 
-static void destroy_plugins  (GtkWidget *, gpointer);
-static void load_file        (GtkWidget *, gpointer);
+static void destroy_plugins(GtkWidget *, gpointer);
+static void load_file(GtkWidget *, gpointer);
 static void load_which_plugin(GtkWidget *, gpointer);
-static void unload           (GtkWidget *, gpointer);
-static void unload_immediate (GModule *);
-static void list_clicked     (GtkWidget *, struct gaim_plugin *);
+static void unload(GtkWidget *, gpointer);
+static void unload_immediate(GModule *);
+static void list_clicked(GtkWidget *, struct gaim_plugin *);
 static void update_show_plugins();
-static void hide_plugins     (GtkWidget *, gpointer);
+static void hide_plugins(GtkWidget *, gpointer);
 
 /* ------------------ Code Below ---------------------------- */
 
-static void destroy_plugins(GtkWidget *w, gpointer data) {
+static void destroy_plugins(GtkWidget *w, gpointer data)
+{
 	if (plugin_dialog)
 		gtk_widget_destroy(plugin_dialog);
 	plugin_dialog = NULL;
@@ -94,7 +95,7 @@
 static void load_file(GtkWidget *w, gpointer data)
 {
 	gchar *buf;
- 
+
 	if (plugin_dialog) {
 		gtk_widget_show(plugin_dialog);
 		gdk_window_raise(plugin_dialog->window);
@@ -103,8 +104,7 @@
 
 	plugin_dialog = gtk_file_selection_new(_("Gaim - Plugin List"));
 
-	gtk_file_selection_hide_fileop_buttons(
-					GTK_FILE_SELECTION(plugin_dialog));
+	gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(plugin_dialog));
 
 	if (!last_dir)
 		buf = g_strdup(LIBDIR);
@@ -114,24 +114,24 @@
 	gtk_file_selection_set_filename(GTK_FILE_SELECTION(plugin_dialog), buf);
 	gtk_file_selection_complete(GTK_FILE_SELECTION(plugin_dialog), "*.so");
 	gtk_signal_connect(GTK_OBJECT(plugin_dialog), "destroy",
-			GTK_SIGNAL_FUNC(destroy_plugins), plugin_dialog);
+			   GTK_SIGNAL_FUNC(destroy_plugins), plugin_dialog);
 
 	gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plugin_dialog)->ok_button),
-			"clicked", GTK_SIGNAL_FUNC(load_which_plugin), NULL);
-    
+			   "clicked", GTK_SIGNAL_FUNC(load_which_plugin), NULL);
+
 	gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plugin_dialog)->cancel_button),
-			"clicked", GTK_SIGNAL_FUNC(destroy_plugins), NULL);
+			   "clicked", GTK_SIGNAL_FUNC(destroy_plugins), NULL);
 
 	g_free(buf);
 	gtk_widget_show(plugin_dialog);
-	gdk_window_raise(plugin_dialog->window);   
+	gdk_window_raise(plugin_dialog->window);
 }
 
-static void load_which_plugin(GtkWidget *w, gpointer data) {
+static void load_which_plugin(GtkWidget *w, gpointer data)
+{
 	char *file;
 
-	file = gtk_file_selection_get_filename(
-		                   GTK_FILE_SELECTION(plugin_dialog));
+	file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(plugin_dialog));
 	if (file_is_dir(file, plugin_dialog)) {
 		return;
 	}
@@ -143,7 +143,8 @@
 	plugin_dialog = NULL;
 }
 
-void load_plugin(char *filename) {
+void load_plugin(char *filename)
+{
 	struct gaim_plugin *plug;
 	GList *c = plugins;
 	char *(*gaim_plugin_init)(GModule *);
@@ -151,15 +152,19 @@
 	char *error;
 	char *retval;
 
-	if (!g_module_supported()) return;
-	if (filename == NULL) return;
-	if (strlen(filename) == 0) return;
+	if (!g_module_supported())
+		return;
+	if (filename == NULL)
+		return;
+	if (strlen(filename) == 0)
+		return;
 
 	while (c) {
 		plug = (struct gaim_plugin *)c->data;
 		if (!strcmp(filename, g_module_name(plug->handle))) {
 			void (*gaim_plugin_remove)();
-			if (g_module_symbol(plug->handle, "gaim_plugin_remove", (gpointer *)&gaim_plugin_remove))
+			if (g_module_symbol(plug->handle, "gaim_plugin_remove",
+					    (gpointer *)&gaim_plugin_remove))
 				(*gaim_plugin_remove)();
 
 			unload_immediate(plug->handle);
@@ -229,7 +234,8 @@
 	save_prefs();
 }
 
-void show_plugins(GtkWidget *w, gpointer data) {
+void show_plugins(GtkWidget *w, gpointer data)
+{
 	/* most of this code was shamelessly stolen from prefs.c */
 	GtkWidget *page;
 	GtkWidget *topbox;
@@ -241,10 +247,11 @@
 	GtkWidget *add;
 	GtkWidget *remove;
 	GtkWidget *close;
-	GList     *plugs = plugins;
+	GList *plugs = plugins;
 	struct gaim_plugin *p;
 
-	if (plugwindow) return;
+	if (plugwindow)
+		return;
 
 	plugwindow = gtk_window_new(GTK_WINDOW_DIALOG);
 	gtk_window_set_wmclass(GTK_WINDOW(plugwindow), "plugins", "Gaim");
@@ -253,8 +260,7 @@
 	gtk_container_border_width(GTK_CONTAINER(plugwindow), 5);
 	gtk_window_set_title(GTK_WINDOW(plugwindow), _("Gaim - Plugins"));
 	gtk_widget_set_usize(plugwindow, 400, 250);
-	gtk_signal_connect(GTK_OBJECT(plugwindow), "destroy",
-			   GTK_SIGNAL_FUNC(hide_plugins), NULL);
+	gtk_signal_connect(GTK_OBJECT(plugwindow), "destroy", GTK_SIGNAL_FUNC(hide_plugins), NULL);
 
 	page = gtk_vbox_new(FALSE, 5);
 	topbox = gtk_hbox_new(FALSE, 5);
@@ -263,8 +269,7 @@
 	/* Left side: list of plugin file names */
 	sw2 = gtk_scrolled_window_new(NULL, NULL);
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2),
-				       GTK_POLICY_AUTOMATIC,
-				       GTK_POLICY_AUTOMATIC);
+				       GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 
 	pluglist = gtk_list_new();
 	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2), pluglist);
@@ -273,8 +278,7 @@
 	/* Right side: the text description of the plugin */
 	sw = gtk_scrolled_window_new(NULL, NULL);
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
-				       GTK_POLICY_AUTOMATIC,
-				       GTK_POLICY_AUTOMATIC);
+				       GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 
 	plugtext = gtk_text_new(NULL, NULL);
 	gtk_container_add(GTK_CONTAINER(sw), plugtext);
@@ -284,8 +288,7 @@
 
 	/* Build the bottom button bar */
 	add = gtk_button_new_with_label(_("Load Plugin"));
-	gtk_signal_connect(GTK_OBJECT(add), "clicked",
-			   GTK_SIGNAL_FUNC(load_file), NULL);
+	gtk_signal_connect(GTK_OBJECT(add), "clicked", GTK_SIGNAL_FUNC(load_file), NULL);
 	gtk_box_pack_start(GTK_BOX(botbox), add, TRUE, TRUE, 0);
 	if (display_options & OPT_DISP_COOL_LOOK)
 		gtk_button_set_relief(GTK_BUTTON(add), GTK_RELIEF_NONE);
@@ -297,15 +300,13 @@
 		gtk_button_set_relief(GTK_BUTTON(config), GTK_RELIEF_NONE);
 
 	remove = gtk_button_new_with_label(_("Unload Plugin"));
-	gtk_signal_connect(GTK_OBJECT(remove), "clicked",
-			   GTK_SIGNAL_FUNC(unload), pluglist);
+	gtk_signal_connect(GTK_OBJECT(remove), "clicked", GTK_SIGNAL_FUNC(unload), pluglist);
 	gtk_box_pack_start(GTK_BOX(botbox), remove, TRUE, TRUE, 0);
 	if (display_options & OPT_DISP_COOL_LOOK)
 		gtk_button_set_relief(GTK_BUTTON(remove), GTK_RELIEF_NONE);
 
 	close = gtk_button_new_with_label(_("Close"));
-	gtk_signal_connect(GTK_OBJECT(close), "clicked",
-			   GTK_SIGNAL_FUNC(hide_plugins), NULL);
+	gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(hide_plugins), NULL);
 	gtk_box_pack_start(GTK_BOX(botbox), close, TRUE, TRUE, 0);
 	if (display_options & OPT_DISP_COOL_LOOK)
 		gtk_button_set_relief(GTK_BUTTON(close), GTK_RELIEF_NONE);
@@ -318,8 +319,7 @@
 		label = gtk_label_new(g_module_name(p->handle));
 		list_item = gtk_list_item_new();
 		gtk_container_add(GTK_CONTAINER(list_item), label);
-		gtk_signal_connect(GTK_OBJECT(list_item), "select",
-				   GTK_SIGNAL_FUNC(list_clicked), p);
+		gtk_signal_connect(GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(list_clicked), p);
 		gtk_object_set_user_data(GTK_OBJECT(list_item), p);
 
 		gtk_widget_show(label);
@@ -328,7 +328,7 @@
 
 		plugs = g_list_next(plugs);
 	}
-	
+
 	/* Make the first item selected */
 	if (plugins != NULL)
 		gtk_list_select_item(GTK_LIST(pluglist), 0);
@@ -349,13 +349,15 @@
 	gtk_widget_show(plugwindow);
 }
 
-void update_show_plugins() {
+void update_show_plugins()
+{
 	GList *plugs = plugins;
 	struct gaim_plugin *p;
 	GtkWidget *label;
 	GtkWidget *list_item;
 
-	if (plugwindow == NULL) return;
+	if (plugwindow == NULL)
+		return;
 
 	gtk_list_clear_items(GTK_LIST(pluglist), 0, -1);
 	while (plugs) {
@@ -363,8 +365,7 @@
 		label = gtk_label_new(g_module_name(p->handle));
 		list_item = gtk_list_item_new();
 		gtk_container_add(GTK_CONTAINER(list_item), label);
-		gtk_signal_connect(GTK_OBJECT(list_item), "select",
-				   GTK_SIGNAL_FUNC(list_clicked), p);
+		gtk_signal_connect(GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(list_clicked), p);
 		gtk_object_set_user_data(GTK_OBJECT(list_item), p);
 
 		gtk_widget_show(label);
@@ -376,19 +377,20 @@
 		gtk_list_select_item(GTK_LIST(pluglist), 0);
 	else {
 		gtk_text_set_point(GTK_TEXT(plugtext), 0);
-		gtk_text_forward_delete(GTK_TEXT(plugtext),
-			gtk_text_get_length(GTK_TEXT(plugtext)));
+		gtk_text_forward_delete(GTK_TEXT(plugtext), gtk_text_get_length(GTK_TEXT(plugtext)));
 	}
 }
 
-void unload(GtkWidget *w, gpointer data) {
+void unload(GtkWidget *w, gpointer data)
+{
 	GList *i;
 	struct gaim_plugin *p;
 	void (*gaim_plugin_remove)();
 
 	i = GTK_LIST(pluglist)->selection;
 
-	if (i == NULL) return;
+	if (i == NULL)
+		return;
 
 	p = gtk_object_get_user_data(GTK_OBJECT(i->data));
 
@@ -399,7 +401,8 @@
 	unload_immediate(p->handle);
 }
 
-static void unload_for_real(void *handle) {
+static void unload_for_real(void *handle)
+{
 	GList *i;
 	struct gaim_plugin *p = NULL;
 	GList *c = callbacks;
@@ -438,27 +441,32 @@
 
 	plugins = g_list_remove(plugins, p);
 	g_free(p);
-	if (config) gtk_widget_set_sensitive(config, 0);
+	if (config)
+		gtk_widget_set_sensitive(config, 0);
 	update_show_plugins();
 	save_prefs();
 }
 
-void unload_immediate(GModule *handle) {
+void unload_immediate(GModule *handle)
+{
 	unload_for_real(handle);
 	g_module_close(handle);
 }
 
-static gint unload_timeout(GModule *handle) {
+static gint unload_timeout(GModule *handle)
+{
 	g_module_close(handle);
 	return FALSE;
 }
 
-void gaim_plugin_unload(GModule *handle) {
+void gaim_plugin_unload(GModule *handle)
+{
 	unload_for_real(handle);
 	gtk_timeout_add(5000, (GtkFunction)unload_timeout, handle);
 }
 
-void list_clicked(GtkWidget *w, struct gaim_plugin *p) {
+void list_clicked(GtkWidget *w, struct gaim_plugin *p)
+{
 	gchar *temp;
 	guint text_len;
 	void (*gaim_plugin_config)();
@@ -476,7 +484,7 @@
 	/* Find out if this plug-in has a configuration function */
 	if (g_module_symbol(p->handle, "gaim_plugin_config", (gpointer *)&gaim_plugin_config)) {
 		confighandle = gtk_signal_connect(GTK_OBJECT(config), "clicked",
-				   GTK_SIGNAL_FUNC(gaim_plugin_config), NULL);
+						  GTK_SIGNAL_FUNC(gaim_plugin_config), NULL);
 		gtk_widget_set_sensitive(config, 1);
 	} else {
 		confighandle = 0;
@@ -484,7 +492,8 @@
 	}
 }
 
-void hide_plugins(GtkWidget *w, gpointer data) {
+void hide_plugins(GtkWidget *w, gpointer data)
+{
 	if (plugwindow)
 		gtk_widget_destroy(plugwindow);
 	plugwindow = NULL;
@@ -492,8 +501,8 @@
 	confighandle = 0;
 }
 
-void gaim_signal_connect(GModule *handle, enum gaim_event which,
-			 void *func, void *data) {
+void gaim_signal_connect(GModule *handle, enum gaim_event which, void *func, void *data)
+{
 	struct gaim_callback *call = g_new0(struct gaim_callback, 1);
 	call->handle = handle;
 	call->event = which;
@@ -504,7 +513,8 @@
 	debug_printf("Adding callback %d\n", g_list_length(callbacks));
 }
 
-void gaim_signal_disconnect(GModule *handle, enum gaim_event which, void *func) {
+void gaim_signal_disconnect(GModule *handle, enum gaim_event which, void *func)
+{
 	GList *c = callbacks;
 	struct gaim_callback *g = NULL;
 
@@ -514,7 +524,8 @@
 			callbacks = g_list_remove(callbacks, c->data);
 			g_free(g);
 			c = callbacks;
-			if (c == NULL) break;
+			if (c == NULL)
+				break;
 		}
 		c = g_list_next(c);
 	}
@@ -525,87 +536,88 @@
 char *event_name(enum gaim_event event)
 {
 	static char buf[128];
-	switch(event) {
-		case event_signon:
-			sprintf(buf, "event_signon");
-			break;
-		case event_signoff:
-			sprintf(buf, "event_signoff");
-			break;
-		case event_away:
-			sprintf(buf, "event_away");
-			break;
-		case event_back:
-			sprintf(buf, "event_back");
-			break;
-		case event_im_recv:
-			sprintf(buf, "event_im_recv");
-			break;
-		case event_im_send:
-			sprintf(buf, "event_im_send");
-			break;
-		case event_buddy_signon:
-			sprintf(buf, "event_buddy_signon");
-			break;
-		case event_buddy_signoff:
-			sprintf(buf, "event_buddy_signoff");
-			break;
-		case event_buddy_away:
-			sprintf(buf, "event_buddy_away");
-			break;
-		case event_buddy_back:
-			sprintf(buf, "event_buddy_back");
-			break;
-		case event_buddy_idle:
-			sprintf(buf, "event_buddy_idle");
-			break;
-		case event_buddy_unidle:
-			sprintf(buf, "event_buddy_unidle");
-			break;
-		case event_blist_update:
-			sprintf(buf, "event_blist_update");
-			break;
-		case event_chat_invited:
-			sprintf(buf, "event_chat_invited");
-			break;
-		case event_chat_join:
-			sprintf(buf, "event_chat_join");
-			break;
-		case event_chat_leave:
-			sprintf(buf, "event_chat_leave");
-			break;
-		case event_chat_buddy_join:
-			sprintf(buf, "event_chat_buddy_join");
-			break;
-		case event_chat_buddy_leave:
-			sprintf(buf, "event_chat_buddy_leave");
-			break;
-		case event_chat_recv:
-			sprintf(buf, "event_chat_recv");
-			break;
-		case event_chat_send:
-			sprintf(buf, "event_chat_send");
-			break;
-		case event_warned:
-			sprintf(buf, "event_warned");
-			break;
-		case event_error:
-			sprintf(buf, "event_error");
-			break;
-		case event_quit:
-			sprintf(buf, "event_quit");
-			break;
-		case event_new_conversation:
-			sprintf(buf, "event_new_conversaion");
-			break;
-		default:
-			sprintf(buf, "event_unknown");
-			break;
+	switch (event) {
+	case event_signon:
+		sprintf(buf, "event_signon");
+		break;
+	case event_signoff:
+		sprintf(buf, "event_signoff");
+		break;
+	case event_away:
+		sprintf(buf, "event_away");
+		break;
+	case event_back:
+		sprintf(buf, "event_back");
+		break;
+	case event_im_recv:
+		sprintf(buf, "event_im_recv");
+		break;
+	case event_im_send:
+		sprintf(buf, "event_im_send");
+		break;
+	case event_buddy_signon:
+		sprintf(buf, "event_buddy_signon");
+		break;
+	case event_buddy_signoff:
+		sprintf(buf, "event_buddy_signoff");
+		break;
+	case event_buddy_away:
+		sprintf(buf, "event_buddy_away");
+		break;
+	case event_buddy_back:
+		sprintf(buf, "event_buddy_back");
+		break;
+	case event_buddy_idle:
+		sprintf(buf, "event_buddy_idle");
+		break;
+	case event_buddy_unidle:
+		sprintf(buf, "event_buddy_unidle");
+		break;
+	case event_blist_update:
+		sprintf(buf, "event_blist_update");
+		break;
+	case event_chat_invited:
+		sprintf(buf, "event_chat_invited");
+		break;
+	case event_chat_join:
+		sprintf(buf, "event_chat_join");
+		break;
+	case event_chat_leave:
+		sprintf(buf, "event_chat_leave");
+		break;
+	case event_chat_buddy_join:
+		sprintf(buf, "event_chat_buddy_join");
+		break;
+	case event_chat_buddy_leave:
+		sprintf(buf, "event_chat_buddy_leave");
+		break;
+	case event_chat_recv:
+		sprintf(buf, "event_chat_recv");
+		break;
+	case event_chat_send:
+		sprintf(buf, "event_chat_send");
+		break;
+	case event_warned:
+		sprintf(buf, "event_warned");
+		break;
+	case event_error:
+		sprintf(buf, "event_error");
+		break;
+	case event_quit:
+		sprintf(buf, "event_quit");
+		break;
+	case event_new_conversation:
+		sprintf(buf, "event_new_conversaion");
+		break;
+	default:
+		sprintf(buf, "event_unknown");
+		break;
 	}
 	return buf;
 }
 
-int plugin_event(enum gaim_event event, void *arg1, void *arg2, void *arg3, void *arg4) {
+int plugin_event(enum gaim_event event, void *arg1, void *arg2, void *arg3, void *arg4)
+{
 #ifdef USE_PERL
 	char buf[BUF_LONG];
 	char *tmp;
@@ -616,19 +628,20 @@
 
 	while (c) {
 		g = (struct gaim_callback *)c->data;
-		if (g->event == event && g->function != NULL) {
-			switch(event) {
+		if (g->event == event && g->function !=NULL) {
+			switch (event) {
 
-			/* struct gaim_connection * */
+				/* struct gaim_connection * */
 			case event_signon:
 			case event_signoff:
 				{
-					void (*function)(struct gaim_connection *, void *) = g->function;
+					void (*function) (struct gaim_connection *, void *) =
+					    g->function;
 					(*function)(arg1, g->data);
 				}
 				break;
 
-			/* no args */
+				/* no args */
 			case event_away:
 			case event_back:
 			case event_blist_update:
@@ -639,26 +652,26 @@
 				}
 				break;
 
-			/* struct gaim_connection *, char **, char ** */
+				/* struct gaim_connection *, char **, char ** */
 			case event_im_recv:
 				{
 					void (*function)(struct gaim_connection *, char **, char **,
-							void *) = g->function;
+							  void *) = g->function;
 					(*function)(arg1, arg2, arg3, g->data);
 				}
 				break;
 
-			/* struct gaim_connection *, char *, char ** */
+				/* struct gaim_connection *, char *, char ** */
 			case event_im_send:
 			case event_chat_send:
 				{
 					void (*function)(struct gaim_connection *, char *, char **,
-							void *) = g->function;
+							  void *) = g->function;
 					(*function)(arg1, arg2, arg3, g->data);
 				}
 				break;
 
-			/* struct gaim_connection *, char * */
+				/* struct gaim_connection *, char * */
 			case event_chat_join:
 			case event_chat_leave:
 			case event_buddy_signon:
@@ -669,12 +682,12 @@
 			case event_buddy_unidle:
 				{
 					void (*function)(struct gaim_connection *, char *, void *) =
-										g->function;
+					    g->function;
 					(*function)(arg1, arg2, g->data);
 				}
 				break;
 
-			/* char * */
+				/* char * */
 			case event_new_conversation:
 				{
 					void (*function)(char *, void *) = g->function;
@@ -682,27 +695,27 @@
 				}
 				break;
 
-			/* struct gaim_connection *, char *, char *, char * */
+				/* struct gaim_connection *, char *, char *, char * */
 			case event_chat_invited:
 			case event_chat_recv:
 				{
 					void (*function)(struct gaim_connection *, char *, char *,
-							char *, void *) = g->function;
+							  char *, void *) = g->function;
 					(*function)(arg1, arg2, arg3, arg4, g->data);
 				}
 				break;
 
-			/* struct gaim_connection *, char *, char * */
+				/* struct gaim_connection *, char *, char * */
 			case event_chat_buddy_join:
 			case event_chat_buddy_leave:
 				{
 					void (*function)(struct gaim_connection *, char *, char *,
-							void *) = g->function;
+							  void *) = g->function;
 					(*function)(arg1, arg2, arg3, g->data);
 				}
 				break;
 
-			/* char *, int */
+				/* char *, int */
 			case event_warned:
 				{
 					void (*function)(char *, int, void *) = g->function;
@@ -710,7 +723,7 @@
 				}
 				break;
 
-			/* int */
+				/* int */
 			case event_error:
 				{
 					void (*function)(int, void *) = g->function;
@@ -728,80 +741,84 @@
 #endif /* GAIM_PLUGINS */
 #ifdef USE_PERL
 	switch (event) {
-		case event_signon:
-			g_snprintf(buf, sizeof buf, "\"%s\"", ((struct gaim_connection *)arg1)->username);
-			break;
-		case event_signoff:
-			g_snprintf(buf, sizeof buf, "\"%s\"", ((struct gaim_connection *)arg1)->username);
-			break;
-		case event_away:
-			buf[0] = 0;
-			break;
-		case event_back:
-			buf[0] = 0;
-			break;
-		case event_im_recv:
-			g_snprintf(buf, sizeof buf, "\"%s\" \"%s\" %s", ((struct gaim_connection *)arg1)->username, *(char **)arg2, *(char **)arg3);
-			break;
-		case event_im_send:
-			g_snprintf(buf, sizeof buf, "\"%s\" \"%s\" %s", ((struct gaim_connection *)arg1)->username, (char *)arg2, *(char **)arg3);
-			break;
-		case event_buddy_signon:
-			g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2);
-			break;
-		case event_buddy_signoff:
-			g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2);
-			break;
-		case event_buddy_away:
-			g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2);
-			break;
-		case event_buddy_back:
-			g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2);
-			break;
-		case event_buddy_idle:
-			g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2);
-			break;
-		case event_buddy_unidle:
-			g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2);
-			break;
-		case event_blist_update:
-			buf[0] = 0;
-			break;
-		case event_chat_invited:
-			g_snprintf(buf, sizeof buf, "\"%s\" \"%s\" %s", (char *)arg2, (char *)arg3, (char *)arg4);
-			break;
-		case event_chat_join:
-			g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2);
-			break;
-		case event_chat_leave:
-			g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2);
-			break;
-		case event_chat_buddy_join:
-			g_snprintf(buf, sizeof buf, "\"%s\" \"%s\"", (char *)arg2, (char *)arg3);
-			break;
-		case event_chat_buddy_leave:
-			g_snprintf(buf, sizeof buf, "\"%s\" \"%s\"", (char *)arg2, (char *)arg3);
-			break;
-		case event_chat_recv:
-			g_snprintf(buf, sizeof buf, "\"%s\" \"%s\" %s", (char *)arg2, (char *)arg3, (char *)arg4);
-			break;
-		case event_chat_send:
-			g_snprintf(buf, sizeof buf, "\"%s\" %s", (char *)arg2, *(char **)arg3);
-			break;
-		case event_warned:
-			g_snprintf(buf, sizeof buf, "\"%s\" %d", (char *)arg1, (int)arg2);
-			break;
-		case event_error:
-			g_snprintf(buf, sizeof buf, "%d", (int)arg1);
-			break;
-		case event_quit:
-			buf[0] = 0;
-			break;
-		case event_new_conversation:
-			g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg1);
-			break;
-		default:
-			break;
+	case event_signon:
+		g_snprintf(buf, sizeof buf, "\"%s\"", ((struct gaim_connection *)arg1)->username);
+		break;
+	case event_signoff:
+		g_snprintf(buf, sizeof buf, "\"%s\"", ((struct gaim_connection *)arg1)->username);
+		break;
+	case event_away:
+		buf[0] = 0;
+		break;
+	case event_back:
+		buf[0] = 0;
+		break;
+	case event_im_recv:
+		g_snprintf(buf, sizeof buf, "\"%s\" \"%s\" %s",
+			   ((struct gaim_connection *)arg1)->username, *(char **)arg2, *(char **)arg3);
+		break;
+	case event_im_send:
+		g_snprintf(buf, sizeof buf, "\"%s\" \"%s\" %s",
+			   ((struct gaim_connection *)arg1)->username, (char *)arg2, *(char **)arg3);
+		break;
+	case event_buddy_signon:
+		g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2);
+		break;
+	case event_buddy_signoff:
+		g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2);
+		break;
+	case event_buddy_away:
+		g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2);
+		break;
+	case event_buddy_back:
+		g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2);
+		break;
+	case event_buddy_idle:
+		g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2);
+		break;
+	case event_buddy_unidle:
+		g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2);
+		break;
+	case event_blist_update:
+		buf[0] = 0;
+		break;
+	case event_chat_invited:
+		g_snprintf(buf, sizeof buf, "\"%s\" \"%s\" %s", (char *)arg2, (char *)arg3,
+			   (char *)arg4);
+		break;
+	case event_chat_join:
+		g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2);
+		break;
+	case event_chat_leave:
+		g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg2);
+		break;
+	case event_chat_buddy_join:
+		g_snprintf(buf, sizeof buf, "\"%s\" \"%s\"", (char *)arg2, (char *)arg3);
+		break;
+	case event_chat_buddy_leave:
+		g_snprintf(buf, sizeof buf, "\"%s\" \"%s\"", (char *)arg2, (char *)arg3);
+		break;
+	case event_chat_recv:
+		g_snprintf(buf, sizeof buf, "\"%s\" \"%s\" %s", (char *)arg2, (char *)arg3,
+			   (char *)arg4);
+		break;
+	case event_chat_send:
+		g_snprintf(buf, sizeof buf, "\"%s\" %s", (char *)arg2, *(char **)arg3);
+		break;
+	case event_warned:
+		g_snprintf(buf, sizeof buf, "\"%s\" %d", (char *)arg1, (int)arg2);
+		break;
+	case event_error:
+		g_snprintf(buf, sizeof buf, "%d", (int)arg1);
+		break;
+	case event_quit:
+		buf[0] = 0;
+		break;
+	case event_new_conversation:
+		g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg1);
+		break;
+	default:
+		break;
 	}
 	tmp = event_name(event);
 	debug_printf("%s: %s\n", tmp, buf);
--- a/src/proxy.c	Wed Dec 13 20:23:06 2000 +0000
+++ b/src/proxy.c	Wed Dec 13 22:12:02 2000 +0000
@@ -39,50 +39,47 @@
 #include "proxy.h"
 
 /* this code is borrowed from cvs 1.10 */
-static int proxy_recv_line (int sock, char **resultp)
+static int proxy_recv_line(int sock, char **resultp)
 {
-    int c;
-    char *result;
-    size_t input_index = 0;
-    size_t result_size = 80;
+	int c;
+	char *result;
+	size_t input_index = 0;
+	size_t result_size = 80;
 
-    result = g_malloc (result_size);
+	result = g_malloc(result_size);
+
+	while (1) {
+		char ch;
+		if (recv(sock, &ch, 1, 0) < 0)
+			debug_printf("recv() error from proxy server\n");
+		c = ch;
 
-    while (1)
-    {
-	char ch;
-	if (recv (sock, &ch, 1, 0) < 0)
-	    fprintf (stderr, "recv() error from  proxy server\n");
-	c = ch;
+		if (c == EOF) {
+			g_free(result);
+
+			/* It's end of file.  */
+			debug_printf("end of file from  server\n");
+		}
 
-	if (c == EOF)
-	{
-	    g_free (result);
+		if (c == '\012')
+			break;
 
-	    /* It's end of file.  */
-	    fprintf(stderr, "end of file from  server\n");
+		result[input_index++] = c;
+		while (input_index + 1 >= result_size) {
+			result_size *= 2;
+			result = (char *)g_realloc(result, result_size);
+		}
 	}
 
-	if (c == '\012')
-	    break;
+	if (resultp)
+		*resultp = result;
 
-	result[input_index++] = c;
-	while (input_index + 1 >= result_size)
-	{
-	    result_size *= 2;
-	    result = (char *) g_realloc (result, result_size);
-	}
-    }
+	/* Terminate it just for kicks, but we *can* deal with embedded NULs.  */
+	result[input_index] = '\0';
 
-    if (resultp)
-	*resultp = result;
-
-    /* Terminate it just for kicks, but we *can* deal with embedded NULs.  */
-    result[input_index] = '\0';
-
-    if (resultp == NULL)
-	g_free (result);
-    return input_index;
+	if (resultp == NULL)
+		g_free(result);
+	return input_index;
 }
 
 static int proxy_connect_none(char *host, unsigned short port)
@@ -93,7 +90,7 @@
 
 	debug_printf("connecting to %s:%d with no proxy\n", host, port);
 
-	if (!(hp = gethostbyname(host))) 
+	if (!(hp = gethostbyname(host)))
 		return -1;
 
 	memset(&sin, 0, sizeof(struct sockaddr_in));
@@ -115,8 +112,7 @@
 #define HTTP_GOODSTRING "HTTP/1.0 200 Connection established"
 #define HTTP_GOODSTRING2 "HTTP/1.1 200 Connection established"
 
-static int proxy_connect_http(char *host, unsigned short port,
-                              char *proxyhost, unsigned short proxyport)
+static int proxy_connect_http(char *host, unsigned short port, char *proxyhost, unsigned short proxyport)
 {
 	struct hostent *hp;
 	struct sockaddr_in sin;
@@ -126,7 +122,7 @@
 
 	debug_printf("connecting to %s:%d via %s:%d using HTTP\n", host, port, proxyhost, proxyport);
 
-	if (!(hp = gethostbyname(proxyhost))) 
+	if (!(hp = gethostbyname(proxyhost)))
 		return -1;
 
 	memset(&sin, 0, sizeof(struct sockaddr_in));
@@ -144,13 +140,13 @@
 
 	snprintf(cmd, sizeof(cmd), "CONNECT %s:%d HTTP/1.1\n\r\n\r", host, port);
 
-	if (send(fd, cmd, strlen(cmd),0) < 0)
+	if (send(fd, cmd, strlen(cmd), 0) < 0)
 		return -1;
 	if (proxy_recv_line(fd, &inputline) < 0)
 		return -1;
 
 	if ((memcmp(HTTP_GOODSTRING, inputline, strlen(HTTP_GOODSTRING) == 0) ||
-			(memcmp(HTTP_GOODSTRING2, inputline, strlen(HTTP_GOODSTRING2) == 0)))) {
+	     (memcmp(HTTP_GOODSTRING2, inputline, strlen(HTTP_GOODSTRING2) == 0)))) {
 		while (strlen(inputline) > 1) {
 			free(inputline);
 			if (proxy_recv_line(fd, &inputline) < 0)
@@ -168,7 +164,7 @@
 }
 
 static int proxy_connect_socks4(char *host, unsigned short port,
-                                char *proxyhost, unsigned short proxyport)
+				char *proxyhost, unsigned short proxyport)
 {
 	struct sockaddr_in sin;
 	unsigned char packet[12];
@@ -177,7 +173,7 @@
 
 	debug_printf("connecting to %s:%d via %s:%d using SOCKS4\n", host, port, proxyhost, proxyport);
 
-	if (!(hp = gethostbyname(proxyhost))) 
+	if (!(hp = gethostbyname(proxyhost)))
 		return -1;
 
 	memset(&sin, 0, sizeof(struct sockaddr_in));
@@ -199,12 +195,12 @@
 
 	packet[0] = 4;
 	packet[1] = 1;
-	packet[2] = (((unsigned short) htons(port)) >> 8);
-	packet[3] = (((unsigned short) htons(port)) & 0xff);
-	packet[4] = (unsigned char) (hp->h_addr_list[0])[0];
-	packet[5] = (unsigned char) (hp->h_addr_list[0])[1];
-	packet[6] = (unsigned char) (hp->h_addr_list[0])[2];
-	packet[7] = (unsigned char) (hp->h_addr_list[0])[3];
+	packet[2] = (((unsigned short)htons(port)) >> 8);
+	packet[3] = (((unsigned short)htons(port)) & 0xff);
+	packet[4] = (unsigned char)(hp->h_addr_list[0])[0];
+	packet[5] = (unsigned char)(hp->h_addr_list[0])[1];
+	packet[6] = (unsigned char)(hp->h_addr_list[0])[2];
+	packet[7] = (unsigned char)(hp->h_addr_list[0])[3];
 	packet[8] = 0;
 	if (write(fd, packet, 9) == 9) {
 		memset(packet, 0, sizeof(packet));
@@ -217,7 +213,7 @@
 }
 
 static int proxy_connect_socks5(char *host, unsigned short port,
-                                char *proxyhost, unsigned short proxyport)
+				char *proxyhost, unsigned short proxyport)
 {
 	int i, fd = -1;
 	unsigned char buf[512];
@@ -226,7 +222,7 @@
 
 	debug_printf("connecting to %s:%d via %s:%d using SOCKS5\n", host, port, proxyhost, proxyport);
 
-	if (!(hp = gethostbyname(proxyhost))) 
+	if (!(hp = gethostbyname(proxyhost)))
 		return -1;
 
 	memset(&sin, 0, sizeof(struct sockaddr_in));
@@ -243,7 +239,7 @@
 	}
 
 	i = 0;
-	buf[0] = 0x05; /* SOCKS version 5 */
+	buf[0] = 0x05;		/* SOCKS version 5 */
 	buf[1] = 0x01;
 	buf[2] = 0x00;
 	i = 3;
@@ -264,15 +260,15 @@
 	}
 
 	buf[0] = 0x05;
-	buf[1] = 0x01; /* CONNECT */
-	buf[2] = 0x00; /* reserved */
-	buf[3] = 0x03; /* address type -- host name */
+	buf[1] = 0x01;		/* CONNECT */
+	buf[2] = 0x00;		/* reserved */
+	buf[3] = 0x03;		/* address type -- host name */
 	buf[4] = strlen(host);
-	memcpy(buf+5, host, strlen(host));
-	buf[5+strlen(host)] = htons(port) >> 8;
-	buf[5+strlen(host)+1] = htons(port) & 0xff;
+	memcpy(buf + 5, host, strlen(host));
+	buf[5 + strlen(host)] = htons(port) >> 8;
+	buf[5 + strlen(host) + 1] = htons(port) & 0xff;
 
-	if (write(fd, buf, (5+strlen(host)+2)) < (5+strlen(host)+2)) {
+	if (write(fd, buf, (5 + strlen(host) + 2)) < (5 + strlen(host) + 2)) {
 		close(fd);
 		return -1;
 	}
@@ -292,10 +288,9 @@
 {
 	if (!host || !port || (port == -1))
 		return -1;
-	else if ((proxytype == PROXY_NONE) || 
-			!proxyhost || !proxyhost[0] ||
-			!proxyport || (proxyport == -1))
-		return proxy_connect_none(host, port);
+	else if ((proxytype == PROXY_NONE) ||
+		 !proxyhost || !proxyhost[0] ||
+		 !proxyport || (proxyport == -1)) return proxy_connect_none(host, port);
 	else if (proxytype == PROXY_HTTP)
 		return proxy_connect_http(host, port, proxyhost, proxyport);
 	else if (proxytype == PROXY_SOCKS4)
--- a/src/prpl.c	Wed Dec 13 20:23:06 2000 +0000
+++ b/src/prpl.c	Wed Dec 13 22:12:02 2000 +0000
@@ -44,7 +44,8 @@
 	return NULL;
 }
 
-static gint proto_compare(struct prpl *a, struct prpl *b) {
+static gint proto_compare(struct prpl *a, struct prpl *b)
+{
 	/* neg if a before b, 0 if equal, pos if a after b */
 	return a->protocol - b->protocol;
 }
@@ -59,7 +60,8 @@
 	protocols = g_slist_insert_sorted(protocols, p, (GCompareFunc)proto_compare);
 }
 
-void unload_protocol(struct prpl *p) {
+void unload_protocol(struct prpl *p)
+{
 	GSList *c = connections;
 	struct gaim_connection *g;
 	while (c) {
@@ -67,8 +69,8 @@
 		if (g->prpl == p) {
 			char buf[256];
 			g_snprintf(buf, sizeof buf, _("%s was using %s, which got removed."
-							" %s is now offline."), g->username,
-							(*p->name)(), g->username);
+						      " %s is now offline."), g->username,
+				   (*p->name)(), g->username);
 			do_error_dialog(buf, _("Disconnect"));
 			signoff(g);
 			c = connections;
@@ -87,11 +89,13 @@
 #endif
 }
 
-static void des_win(GtkWidget *a, GtkWidget *b) {
+static void des_win(GtkWidget *a, GtkWidget *b)
+{
 	gtk_widget_destroy(b);
 }
 
-static int rem_win(GtkObject *a, GtkWidget *b) {
+static int rem_win(GtkObject * a, GtkWidget *b)
+{
 	gpointer d = gtk_object_get_user_data(a);
 	gtk_signal_disconnect_by_data(GTK_OBJECT(b), d);
 	gtk_widget_destroy(b);
@@ -109,14 +113,14 @@
 	window = gtk_window_new(GTK_WINDOW_DIALOG);
 	gtk_window_set_wmclass(GTK_WINDOW(window), "accept", "Gaim");
 	gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, TRUE);
-        gtk_window_set_title(GTK_WINDOW(window), _("Accept?"));
+	gtk_window_set_title(GTK_WINDOW(window), _("Accept?"));
 	gtk_widget_realize(window);
 	aol_icon(window->window);
 	if (dont)
 		gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(dont), data);
 
 	vbox = gtk_vbox_new(FALSE, 5);
-        gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
+	gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
 	gtk_container_add(GTK_CONTAINER(window), vbox);
 
 	label = gtk_label_new(text);
--- a/src/server.c	Wed Dec 13 20:23:06 2000 +0000
+++ b/src/server.c	Wed Dec 13 22:12:02 2000 +0000
@@ -47,7 +47,8 @@
 void serv_login(struct aim_user *user)
 {
 	struct prpl *p = find_prpl(user->protocol);
-	if (user->gc != NULL) return;
+	if (user->gc != NULL)
+		return;
 	if (p && p->login) {
 		debug_printf("Logging in using %s\n", (*p->name)());
 		(*p->login)(user);
@@ -67,7 +68,7 @@
 
 	if (gc->idle_timer > 0)
 		gtk_timeout_remove(gc->idle_timer);
-        gc->idle_timer = 0;
+	gc->idle_timer = 0;
 
 	if (gc->keepalive > 0)
 		gtk_timeout_remove(gc->keepalive);
@@ -86,14 +87,14 @@
 	/* Are we idle?  If so, not anymore */
 	if (gc->is_idle > 0) {
 		gc->is_idle = 0;
-                serv_set_idle(gc, 0);
-        }
-        time(&gc->lastsent);
+		serv_set_idle(gc, 0);
+	}
+	time(&gc->lastsent);
 }
 
 void serv_finish_login(struct gaim_connection *gc)
 {
-        char *buf;
+	char *buf;
 
 	if (strlen(gc->user->user_info)) {
 		buf = g_malloc(strlen(gc->user->user_info) * 4);
@@ -102,15 +103,15 @@
 		g_free(buf);
 	}
 
-        if (gc->idle_timer > 0)
-                gtk_timeout_remove(gc->idle_timer);
-        
-        gc->idle_timer = gtk_timeout_add(20000, (GtkFunction)check_idle, gc);
-        serv_touch_idle(gc);
+	if (gc->idle_timer > 0)
+		gtk_timeout_remove(gc->idle_timer);
 
-        time(&gc->login_time);
+	gc->idle_timer = gtk_timeout_add(20000, (GtkFunction)check_idle, gc);
+	serv_touch_idle(gc);
 
-        serv_add_buddy(gc, gc->username);
+	time(&gc->login_time);
+
+	serv_add_buddy(gc, gc->username);
 
 	update_keepalive(gc, gc->options & OPT_USR_KEEPALV);
 }
@@ -122,8 +123,8 @@
 	if (gc->prpl && gc->prpl->send_im)
 		(*gc->prpl->send_im)(gc, name, message, away);
 
-        if (!away)
-                serv_touch_idle(gc);
+	if (!away)
+		serv_touch_idle(gc);
 }
 
 void serv_get_info(struct gaim_connection *g, char *name)
@@ -178,7 +179,8 @@
 		(*g->prpl->set_info)(g, info);
 }
 
-void serv_change_passwd(struct gaim_connection *g, char *orig, char *new) {
+void serv_change_passwd(struct gaim_connection *g, char *orig, char *new)
+{
 	if (g->prpl && g->prpl->change_passwd)
 		(*g->prpl->change_passwd)(g, orig, new);
 }
@@ -189,7 +191,7 @@
 		(*g->prpl->add_buddy)(g, name);
 }
 
-void serv_add_buddies(struct gaim_connection *g, GList *buddies)
+void serv_add_buddies(struct gaim_connection *g, GList * buddies)
 {
 	if (g->prpl && g->prpl->add_buddies)
 		(*g->prpl->add_buddies)(g, buddies);
@@ -270,7 +272,8 @@
 {
 	/* i think this is the only one this should be necessary for since this is the
 	 * only thing that could possibly get called after the connection is closed */
-	if (!g_slist_find(connections, g)) return;
+	if (!g_slist_find(connections, g))
+		return;
 
 	if (g->prpl && g->prpl->chat_leave)
 		(*g->prpl->chat_leave)(g, id);
@@ -301,30 +304,31 @@
 	char *angel = g_strdup(name);
 	int plugin_return = plugin_event(event_im_recv, gc, &angel, &buffy, 0);
 	if (!buffy || !angel || plugin_return) {
-		if (buffy) g_free(buffy);
-		if (angel) g_free(angel);
+		if (buffy)
+			g_free(buffy);
+		if (angel)
+			g_free(angel);
 		return;
 	}
 	g_snprintf(message, strlen(message) + 1, "%s", buffy);
 	g_free(buffy);
 	g_snprintf(name, strlen(name) + 1, "%s", angel);
 	g_free(angel);
-	
+
 	if ((general_options & OPT_GEN_TIK_HACK) && awaymessage &&
-	    !strcmp(message, ">>>Automated Message: Getting Away Message<<<"))
-	{
+	    !strcmp(message, ">>>Automated Message: Getting Away Message<<<")) {
 		char *tmpmsg = stylize(awaymessage->message, MSG_LEN);
-	    	serv_send_im(gc, name, tmpmsg, 1);
+		serv_send_im(gc, name, tmpmsg, 1);
 		g_free(tmpmsg);
-	    	return;
+		return;
 	}
-	
-        cnv = find_conversation(name);
+
+	cnv = find_conversation(name);
 
 	if (general_options & OPT_GEN_SEND_LINKS) {
 		linkify_text(message);
 	}
-	
+
 	if (away)
 		away = WFLAG_AUTO;
 
@@ -378,7 +382,7 @@
 
 		/* apply default fonts and colors */
 		tmpmsg = stylize(awaymessage->message, MSG_LEN);
-		
+
 		/* PRPL */
 		if (gc->protocol == PROTO_TOC) {
 			escape_text(tmpmsg);
@@ -390,7 +394,7 @@
 
 		if (is_idle == -1)
 			is_idle = 1;
-		
+
 		if (cnv != NULL)
 			write_to_conv(cnv, away_subs(tmpmsg, alias), WFLAG_SEND | WFLAG_AUTO, NULL);
 		g_free(tmpmsg);
@@ -399,131 +403,132 @@
 
 
 
-void serv_got_update(struct gaim_connection *gc, char *name, int loggedin, int evil, time_t signon, time_t idle, int type, gushort caps)
+void serv_got_update(struct gaim_connection *gc, char *name, int loggedin, int evil, time_t signon,
+		     time_t idle, int type, gushort caps)
 {
-        struct buddy *b = find_buddy(gc, name);
+	struct buddy *b = find_buddy(gc, name);
 	struct gaim_connection *g = find_gaim_conn_by_name(name);
-                     
-        if (g) {
-                gc->correction_time = (int)(signon - g->login_time);
-                if (!b) {
-                        return;
+
+	if (g) {
+		gc->correction_time = (int)(signon - g->login_time);
+		if (!b) {
+			return;
 		}
-        }
-        
-        if (!b) {
-                debug_printf("Error, no such person\n");
-                return;
-        }
+	}
+
+	if (!b) {
+		debug_printf("Error, no such person\n");
+		return;
+	}
 
-        /* This code will 'align' the name from the TOC */
-        /* server with what's in our record.  We want to */
-        /* store things how THEY want it... */
-        if (strcmp(name, b->name)) {
-                GList  *cnv = conversations;
-                struct conversation *cv;
+	/* This code will 'align' the name from the TOC */
+	/* server with what's in our record.  We want to */
+	/* store things how THEY want it... */
+	if (strcmp(name, b->name)) {
+		GList *cnv = conversations;
+		struct conversation *cv;
 
-                char *who = g_malloc(80);
+		char *who = g_malloc(80);
 
-                strcpy(who, normalize(name));
+		strcpy(who, normalize(name));
 
-                while(cnv) {
-                        cv = (struct conversation *)cnv->data;
-                        if (!strcasecmp(who, normalize(cv->name))) {
-                                g_snprintf(cv->name, sizeof(cv->name), "%s", name);
-                                if (find_log_info(name) || (general_options & OPT_GEN_LOG_ALL))
-                                        g_snprintf(who, 63, LOG_CONVERSATION_TITLE, name);
-                                else
-                                        g_snprintf(who, 63, CONVERSATION_TITLE, name);
-                                gtk_window_set_title(GTK_WINDOW(cv->window), who);
+		while (cnv) {
+			cv = (struct conversation *)cnv->data;
+			if (!strcasecmp(who, normalize(cv->name))) {
+				g_snprintf(cv->name, sizeof(cv->name), "%s", name);
+				if (find_log_info(name) || (general_options & OPT_GEN_LOG_ALL))
+					 g_snprintf(who, 63, LOG_CONVERSATION_TITLE, name);
+				else
+					g_snprintf(who, 63, CONVERSATION_TITLE, name);
+				gtk_window_set_title(GTK_WINDOW(cv->window), who);
 				/* was g_free(buf), but break gives us that
 				 * and freeing twice is not good --Sumner */
-                                break;
-                        }
-                        cnv = cnv->next;
-                }
-		g_free(who); 
-                g_snprintf(b->name, sizeof(b->name), "%s", name);
-                /*gtk_label_set_text(GTK_LABEL(b->label), b->name);*/
+				break;
+			}
+			cnv = cnv->next;
+		}
+		g_free(who);
+		g_snprintf(b->name, sizeof(b->name), "%s", name);
+		/*gtk_label_set_text(GTK_LABEL(b->label), b->name); */
 
-                /* okay lets save the new config... */
+		/* okay lets save the new config... */
 
-        }
+	}
 
-	if (!b->idle && idle) plugin_event(event_buddy_idle, gc, b->name, 0, 0);
+	if (!b->idle && idle)
+		plugin_event(event_buddy_idle, gc, b->name, 0, 0);
 	if (b->idle && !idle) {
-                do_pounce(b->name, OPT_POUNCE_UNIDLE);
+		do_pounce(b->name, OPT_POUNCE_UNIDLE);
 		plugin_event(event_buddy_unidle, gc, b->name, 0, 0);
 	}
 
-        b->idle = idle;
-        b->evil = evil;
+	b->idle = idle;
+	b->evil = evil;
 
 	if ((b->uc & UC_UNAVAILABLE) && !(type & UC_UNAVAILABLE)) {
-                do_pounce(b->name, OPT_POUNCE_UNAWAY);
+		do_pounce(b->name, OPT_POUNCE_UNAWAY);
 		plugin_event(event_buddy_back, gc, b->name, 0, 0);
 	} else if (!(b->uc & UC_UNAVAILABLE) && (type & UC_UNAVAILABLE)) {
 		plugin_event(event_buddy_away, gc, b->name, 0, 0);
 	}
 
-        b->uc = type;
-	if (caps) b->caps = caps;
-        
-        b->signon = signon;
+	b->uc = type;
+	if (caps)
+		b->caps = caps;
+
+	b->signon = signon;
 
-        if (loggedin) {
-                if (!b->present) {
-                        b->present = 1;
-                        do_pounce(b->name, OPT_POUNCE_SIGNON);
+	if (loggedin) {
+		if (!b->present) {
+			b->present = 1;
+			do_pounce(b->name, OPT_POUNCE_SIGNON);
 			plugin_event(event_buddy_signon, gc, b->name, 0, 0);
-                }
-        } else {
+		}
+	} else {
 		if (b->present)
 			plugin_event(event_buddy_signoff, gc, b->name, 0, 0);
-                b->present = 0;
+		b->present = 0;
 	}
 
-        set_buddy(gc, b);
+	set_buddy(gc, b);
 }
 
 static
 void close_warned(GtkWidget *w, GtkWidget *w2)
 {
-        gtk_widget_destroy(w2);
+	gtk_widget_destroy(w2);
 }
 
 
 
 void serv_got_eviled(struct gaim_connection *gc, char *name, int lev)
 {
-        char *buf2 = g_malloc(1024);
-        GtkWidget *d, *label, *close;
+	char *buf2 = g_malloc(1024);
+	GtkWidget *d, *label, *close;
 
 
 	plugin_event(event_warned, gc, name, (void *)lev, 0);
 
-        g_snprintf(buf2, 1023, "%s have just been warned by %s.\nYour new warning level is %d%%",
-                   gc->username, ((name == NULL) ? "an anonymous person" : name) , lev);
+	g_snprintf(buf2, 1023, "%s have just been warned by %s.\nYour new warning level is %d%%",
+		   gc->username, ((name == NULL)? "an anonymous person" : name), lev);
 
 
-        d = gtk_dialog_new();
-        gtk_widget_realize(d);
-        aol_icon(d->window);
+	d = gtk_dialog_new();
+	gtk_widget_realize(d);
+	aol_icon(d->window);
 
-        label = gtk_label_new(buf2);
-        gtk_widget_show(label);
-        close = gtk_button_new_with_label("Close");
+	label = gtk_label_new(buf2);
+	gtk_widget_show(label);
+	close = gtk_button_new_with_label("Close");
 	if (display_options & OPT_DISP_COOL_LOOK)
 		gtk_button_set_relief(GTK_BUTTON(close), GTK_RELIEF_NONE);
-        gtk_widget_show(close);
-        gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox),
-                           label, FALSE, FALSE, 5);
-        gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area),
-                           close, FALSE, FALSE, 5);
+	gtk_widget_show(close);
+	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox), label, FALSE, FALSE, 5);
+	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area), close, FALSE, FALSE, 5);
 
-        gtk_window_set_title(GTK_WINDOW(d), "Warned");
-        gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_warned), d);
-        gtk_widget_show(d);
+	gtk_window_set_title(GTK_WINDOW(d), "Warned");
+	gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(close_warned), d);
+	gtk_widget_show(d);
 }
 
 
@@ -536,10 +541,10 @@
 static void chat_invite_callback(GtkWidget *w, GtkWidget *w2)
 {
 	struct gaim_connection *g = (struct gaim_connection *)
-					gtk_object_get_user_data(GTK_OBJECT(GTK_DIALOG(w2)->vbox));
+	    gtk_object_get_user_data(GTK_OBJECT(GTK_DIALOG(w2)->vbox));
 	if (g->protocol == PROTO_TOC) {
-	        int i = (int)gtk_object_get_user_data(GTK_OBJECT(w2));
-	        serv_accept_chat(g, i);
+		int i = (int)gtk_object_get_user_data(GTK_OBJECT(w2));
+		serv_accept_chat(g, i);
 		gtk_widget_destroy(w2);
 	} else if (g->protocol == PROTO_OSCAR) {
 		char *i = (char *)gtk_object_get_user_data(GTK_OBJECT(w2));
@@ -554,41 +559,40 @@
 
 void serv_got_chat_invite(struct gaim_connection *g, char *name, int id, char *who, char *message)
 {
-        GtkWidget *d;
-        GtkWidget *label;
-        GtkWidget *yesbtn;
-        GtkWidget *nobtn;
+	GtkWidget *d;
+	GtkWidget *label;
+	GtkWidget *yesbtn;
+	GtkWidget *nobtn;
 
-        char buf2[BUF_LONG];
+	char buf2[BUF_LONG];
 
 
 	plugin_event(event_chat_invited, g, who, name, message);
 
 	if (message)
-		g_snprintf(buf2, sizeof(buf2), "User '%s' invites %s to buddy chat room: '%s'\n%s", who, g->username, name, message);
+		g_snprintf(buf2, sizeof(buf2), "User '%s' invites %s to buddy chat room: '%s'\n%s", who,
+			   g->username, name, message);
 	else
-		g_snprintf(buf2, sizeof(buf2), "User '%s' invites %s to buddy chat room: '%s'\n", who, g->username, name);
+		g_snprintf(buf2, sizeof(buf2), "User '%s' invites %s to buddy chat room: '%s'\n", who,
+			   g->username, name);
 
-        d = gtk_dialog_new();
-        gtk_widget_realize(d);
-        aol_icon(d->window);
+	d = gtk_dialog_new();
+	gtk_widget_realize(d);
+	aol_icon(d->window);
 
 
-        label = gtk_label_new(buf2);
-        gtk_widget_show(label);
-        yesbtn = picture_button(d, _("Yes"), ok_xpm);
-        nobtn = picture_button(d, _("No"), cancel_xpm);
-        gtk_widget_show(nobtn);
-        gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox),
-                           label, FALSE, FALSE, 5);
-        gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area),
-                           yesbtn, FALSE, FALSE, 5);
-        gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area),
-                           nobtn, FALSE, FALSE, 5);
+	label = gtk_label_new(buf2);
+	gtk_widget_show(label);
+	yesbtn = picture_button(d, _("Yes"), ok_xpm);
+	nobtn = picture_button(d, _("No"), cancel_xpm);
+	gtk_widget_show(nobtn);
+	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox), label, FALSE, FALSE, 5);
+	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area), yesbtn, FALSE, FALSE, 5);
+	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area), nobtn, FALSE, FALSE, 5);
 
 	gtk_object_set_user_data(GTK_OBJECT(GTK_DIALOG(d)->vbox), g);
 	if (g->protocol == PROTO_TOC) {
-	        gtk_object_set_user_data(GTK_OBJECT(d), (void *)id);
+		gtk_object_set_user_data(GTK_OBJECT(d), (void *)id);
 		gtk_object_set_user_data(GTK_OBJECT(GTK_DIALOG(d)->vbox), g);
 	} else if (g->protocol == PROTO_OSCAR) {
 		gtk_object_set_user_data(GTK_OBJECT(d), (void *)g_strdup(name));
@@ -596,29 +600,29 @@
 	}
 
 
-        gtk_window_set_title(GTK_WINDOW(d), "Buddy chat invite");
-        gtk_signal_connect(GTK_OBJECT(nobtn), "clicked", GTK_SIGNAL_FUNC(close_invite), d);
-        gtk_signal_connect(GTK_OBJECT(yesbtn), "clicked", GTK_SIGNAL_FUNC(chat_invite_callback), d);
+	gtk_window_set_title(GTK_WINDOW(d), "Buddy chat invite");
+	gtk_signal_connect(GTK_OBJECT(nobtn), "clicked", GTK_SIGNAL_FUNC(close_invite), d);
+	gtk_signal_connect(GTK_OBJECT(yesbtn), "clicked", GTK_SIGNAL_FUNC(chat_invite_callback), d);
 
 
-        gtk_widget_show(d);
+	gtk_widget_show(d);
 }
 
 void serv_got_joined_chat(struct gaim_connection *gc, int id, char *name)
 {
-        struct conversation *b;
+	struct conversation *b;
 
 	plugin_event(event_chat_join, gc, name, 0, 0);
 
-        b = (struct conversation *)g_new0(struct conversation, 1);
-        gc->buddy_chats = g_slist_append(gc->buddy_chats, b);
+	b = (struct conversation *)g_new0(struct conversation, 1);
+	gc->buddy_chats = g_slist_append(gc->buddy_chats, b);
 
 	b->is_chat = TRUE;
-        b->ignored = NULL;
-        b->in_room = NULL;
-        b->id = id;
+	b->ignored = NULL;
+	b->in_room = NULL;
+	b->id = id;
 	b->gc = gc;
-        g_snprintf(b->name, 80, "%s", name);
+	g_snprintf(b->name, 80, "%s", name);
 
 	if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(b->name)) {
 		FILE *fd;
@@ -626,43 +630,45 @@
 
 		filename = (char *)malloc(100);
 		g_snprintf(filename, 100, "%s.chat", b->name);
-		
+
 		fd = open_log_file(filename);
 		if (!(general_options & OPT_GEN_STRIP_HTML))
-			fprintf(fd, "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n", full_date());
+			fprintf(fd,
+				"<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n",
+				full_date());
 		else
 			fprintf(fd, "---- New Conversation @ %s ----\n", full_date());
-		
+
 		fclose(fd);
 		free(filename);
 	}
-	
-        show_new_buddy_chat(b);
+
+	show_new_buddy_chat(b);
 }
 
 void serv_got_chat_left(struct gaim_connection *g, int id)
 {
-        GSList *bcs = g->buddy_chats;
-        struct conversation *b = NULL;
+	GSList *bcs = g->buddy_chats;
+	struct conversation *b = NULL;
 
 
-        while(bcs) {
-                b = (struct conversation *)bcs->data;
-                if (id == b->id) {
-                        break;
-                        }
-                b = NULL;
-                bcs = bcs->next;
-        }
+	while (bcs) {
+		b = (struct conversation *)bcs->data;
+		if (id == b->id) {
+			break;
+		}
+		b = NULL;
+		bcs = bcs->next;
+	}
 
-        if (!b)
-                return;
+	if (!b)
+		return;
 
 	plugin_event(event_chat_leave, g, b->name, 0, 0);
 
 	debug_printf("Leaving room %s.\n", b->name);
 
-        g->buddy_chats = g_slist_remove(g->buddy_chats, b);
+	g->buddy_chats = g_slist_remove(g->buddy_chats, b);
 
 	while (b->in_room) {
 		char *tmp = b->in_room->data;
@@ -670,44 +676,46 @@
 		g_free(tmp);
 	}
 
-        g_free(b);
+	g_free(b);
 }
 
 void serv_got_chat_in(struct gaim_connection *g, int id, char *who, int whisper, char *message)
 {
-        int w;
-        GSList *bcs = g->buddy_chats;
-        struct conversation *b = NULL;
+	int w;
+	GSList *bcs = g->buddy_chats;
+	struct conversation *b = NULL;
 
-        while(bcs) {
-                b = (struct conversation *)bcs->data;
-                if (id == b->id)
-                        break;
-                bcs = bcs->next;
-                b = NULL;
+	while (bcs) {
+		b = (struct conversation *)bcs->data;
+		if (id == b->id)
+			break;
+		bcs = bcs->next;
+		b = NULL;
 
-        }
-        if (!b)
-                return;
-        
-	if (plugin_event(event_chat_recv, g, b->name, who, message))
+	}
+	if (!b)
 		return;
 
-        if (whisper)
-                w = WFLAG_WHISPER;
-        else
-                w = 0;
+	if (plugin_event(event_chat_recv, g, b->name, who, message))
+		 return;
 
-        chat_write(b, who, w, message);
+	if (whisper)
+		w = WFLAG_WHISPER;
+	else
+		w = 0;
+
+	chat_write(b, who, w, message);
 }
 
-void send_keepalive(gpointer d) {
+void send_keepalive(gpointer d)
+{
 	struct gaim_connection *gc = (struct gaim_connection *)d;
 	if (gc->prpl && gc->prpl->keepalive)
 		(*gc->prpl->keepalive)(gc);
 }
 
-void update_keepalive(struct gaim_connection *gc, gboolean on) {
+void update_keepalive(struct gaim_connection *gc, gboolean on)
+{
 	if (on && !gc->keepalive && blist) {
 		debug_printf("allowing NOP\n");
 		gc->keepalive = gtk_timeout_add(60000, (GtkFunction)send_keepalive, gc);
--- a/src/sound.c	Wed Dec 13 20:23:06 2000 +0000
+++ b/src/sound.c	Wed Dec 13 22:12:02 2000 +0000
@@ -53,12 +53,11 @@
 {
 	struct stat stat_buf;
 	uid_t user = getuid();
-	gid_t group = getgid(), 
-	      other_groups[32];
+	gid_t group = getgid(), other_groups[32];
 	int i, numgroups;
 
-	if ((numgroups = getgroups (32, other_groups)) == -1)
-	  return 0;
+	if ((numgroups = getgroups(32, other_groups)) == -1)
+		return 0;
 	if (stat(dev, &stat_buf))
 		return 0;
 	if (user == stat_buf.st_uid && stat_buf.st_mode & S_IWUSR)
@@ -78,13 +77,13 @@
 
 static void play_audio(char *data, int size)
 {
-        int fd;
-        
-        fd = open("/dev/audio", O_WRONLY | O_EXCL);
-        if (fd < 0)
-                return;
-        write(fd, data, size);
-        close(fd);
+	int fd;
+
+	fd = open("/dev/audio", O_WRONLY | O_EXCL);
+	if (fd < 0)
+		return;
+	write(fd, data, size);
+	close(fd);
 }
 
 static void play_audio_file(char *file)
@@ -138,19 +137,20 @@
 ** Z-note -- this is from libaudiofile.  Thanks guys!
 */
 
-int _af_ulaw2linear (unsigned char ulawbyte)
+int _af_ulaw2linear(unsigned char ulawbyte)
 {
-  static int exp_lut[8] = {0,132,396,924,1980,4092,8316,16764};
-  int sign, exponent, mantissa, sample;
+	static int exp_lut[8] = { 0, 132, 396, 924, 1980, 4092, 8316, 16764 };
+	int sign, exponent, mantissa, sample;
 
-  ulawbyte = ~ulawbyte;
-  sign = (ulawbyte & 0x80);
-  exponent = (ulawbyte >> 4) & 0x07;
-  mantissa = ulawbyte & 0x0F;
-  sample = exp_lut[exponent] + (mantissa << (exponent + 3));
-  if (sign != 0) sample = -sample;
+	ulawbyte = ~ulawbyte;
+	sign = (ulawbyte & 0x80);
+	exponent = (ulawbyte >> 4) & 0x07;
+	mantissa = ulawbyte & 0x0F;
+	sample = exp_lut[exponent] + (mantissa << (exponent + 3));
+	if (sign != 0)
+		sample = -sample;
 
-  return(sample);
+	return (sample);
 }
 
 
@@ -158,20 +158,20 @@
 
 static int play_esd(unsigned char *data, int size)
 {
-        int i;
-        guint16 *lineardata;
-	
-        lineardata = g_malloc(size * 2);
+	int i;
+	guint16 *lineardata;
 
-	for (i=0; i<size; i++)
+	lineardata = g_malloc(size * 2);
+
+	for (i = 0; i < size; i++)
 		lineardata[i] = _af_ulaw2linear(data[i]);
-	
+
 	write(esd_fd, lineardata, size * 2);
 
 	close(esd_fd);
 	g_free(lineardata);
 
-        return 1;
+	return 1;
 
 }
 
@@ -189,10 +189,10 @@
 {
 	esd_format_t format = ESD_BITS16 | ESD_STREAM | ESD_PLAY | ESD_MONO;
 
-        esd_fd = esd_play_stream(format, 8012, NULL, "gaim");
+	esd_fd = esd_play_stream(format, 8012, NULL, "gaim");
 
-        if (esd_fd < 0) {
-                return 0;
+	if (esd_fd < 0) {
+		return 0;
 	}
 
 	return 1;
@@ -205,74 +205,70 @@
 char nas_server[] = "localhost";
 AuServer *nas_serv = NULL;
 
-static AuBool
-NasEventHandler(AuServer *aud, AuEvent *ev, AuEventHandlerRec *handler)
+static AuBool NasEventHandler(AuServer * aud, AuEvent * ev, AuEventHandlerRec * handler)
 {
-        AuElementNotifyEvent *event = (AuElementNotifyEvent *) ev;
+	AuElementNotifyEvent *event = (AuElementNotifyEvent *) ev;
 
-        if (ev->type == AuEventTypeElementNotify) {
-                switch (event->kind) {
-                case AuElementNotifyKindState:
-                        switch (event->cur_state) {
-                        case AuStateStop:
-                                _exit(0);
-                        }
-                        break;
-                }
-        }
-        return AuTrue;
+	if (ev->type == AuEventTypeElementNotify) {
+		switch (event->kind) {
+		case AuElementNotifyKindState:
+			switch (event->cur_state) {
+			case AuStateStop:
+				_exit(0);
+			}
+			break;
+		}
+	}
+	return AuTrue;
 }
 
 
 static int play_nas(unsigned char *data, int size)
 {
-        AuDeviceID device = AuNone;
-        AuFlowID flow;
-        AuElement elements[3];
-        int i, n, w;
+	AuDeviceID device = AuNone;
+	AuFlowID flow;
+	AuElement elements[3];
+	int i, n, w;
 
-        /* look for an output device */
-        for (i = 0; i < AuServerNumDevices(nas_serv); i++) {
-                if ((AuDeviceKind(AuServerDevice(nas_serv, i)) ==
-                     AuComponentKindPhysicalOutput) &&
-                    AuDeviceNumTracks(AuServerDevice(nas_serv, i)) == 1) {
-                        device = AuDeviceIdentifier(AuServerDevice(nas_serv, i));
-                        break;
-                }
-        }
+	/* look for an output device */
+	for (i = 0; i < AuServerNumDevices(nas_serv); i++) {
+		if ((AuDeviceKind(AuServerDevice(nas_serv, i)) ==
+		     AuComponentKindPhysicalOutput) &&
+		    AuDeviceNumTracks(AuServerDevice(nas_serv, i)) == 1) {
+			device = AuDeviceIdentifier(AuServerDevice(nas_serv, i));
+			break;
+		}
+	}
 
-        if (device == AuNone)
-                return 0;
+	if (device == AuNone)
+		return 0;
 
-        if (!(flow = AuCreateFlow(nas_serv, NULL)))
-                return 0;
+	if (!(flow = AuCreateFlow(nas_serv, NULL)))
+		return 0;
 
 
-        AuMakeElementImportClient(&elements[0], 8012, AuFormatULAW8,
-                                  1, AuTrue, size, size/2, 0, NULL);
-        AuMakeElementExportDevice(&elements[1], 0, device, 8012,
-                                  AuUnlimitedSamples, 0, NULL);
-        AuSetElements(nas_serv, flow, AuTrue, 2, elements, NULL);
+	AuMakeElementImportClient(&elements[0], 8012, AuFormatULAW8, 1, AuTrue, size, size / 2, 0, NULL);
+	AuMakeElementExportDevice(&elements[1], 0, device, 8012, AuUnlimitedSamples, 0, NULL);
+	AuSetElements(nas_serv, flow, AuTrue, 2, elements, NULL);
 
-        AuStartFlow(nas_serv, flow, NULL);
+	AuStartFlow(nas_serv, flow, NULL);
+
+	AuWriteElement(nas_serv, flow, 0, size, data, AuTrue, NULL);
 
-        AuWriteElement(nas_serv, flow, 0, size, data, AuTrue, NULL);
+	AuRegisterEventHandler(nas_serv, AuEventHandlerIDMask, 0, flow, NasEventHandler, NULL);
 
-        AuRegisterEventHandler(nas_serv, AuEventHandlerIDMask, 0, flow,
-                               NasEventHandler, NULL);
-        
-        while(1) {
-                AuHandleEvents(nas_serv);
-        }
+	while (1) {
+		AuHandleEvents(nas_serv);
+	}
 
-        return 1;
+	return 1;
 }
 
 static int can_play_nas()
 {
-        if ((nas_serv = AuOpenServer(NULL, 0, NULL, 0, NULL, NULL)))
-                return 1;
-        return 0;
+	if ((nas_serv = AuOpenServer(NULL, 0, NULL, 0, NULL, NULL)))
+		return 1;
+	return 0;
 }
 
 static int play_nas_file(char *file)
@@ -302,7 +298,8 @@
 
 #endif
 
-void play_file(char *filename) {
+void play_file(char *filename)
+{
 	int pid;
 
 #ifdef _WIN32
@@ -331,7 +328,6 @@
 			execvp(args[0], args);
 			_exit(0);
 		}
-
 #ifdef ESD_SOUND
 		if (play_esd_file(filename))
 			_exit(0);
@@ -355,50 +351,49 @@
 
 void play(unsigned char *data, int size)
 {
-        int pid;
+	int pid;
 
 #ifdef _WIN32
-        return;
+	return;
 #endif
-        
+
 	pid = fork();
-	
+
 	if (pid < 0)
 		return;
-        else if (pid == 0) {
+	else if (pid == 0) {
 		if (sound_options & OPT_SOUND_BEEP) {
 			printf("\a");
 			fflush(stdout);
 			_exit(0);
 		}
-
 #ifdef ESD_SOUND
-                /* ESD is our player of choice.  Are we OK to
-                 * go there? */
-                if (can_play_esd()) {
-                        if (play_esd(data, size))
-                                _exit(0);
-                }
+		/* ESD is our player of choice.  Are we OK to
+		 * go there? */
+		if (can_play_esd()) {
+			if (play_esd(data, size))
+				_exit(0);
+		}
 #endif
 
 #ifdef NAS_SOUND
-                /* NAS is our second choice setup. */
-                if (can_play_nas()) {
-                        if (play_nas(data, size))
-                                _exit(0);
-                }
+		/* NAS is our second choice setup. */
+		if (can_play_nas()) {
+			if (play_nas(data, size))
+				_exit(0);
+		}
 #endif
 
-                /* Lastly, we can try just plain old /dev/audio */
-                if (can_play_audio()) {
-                        play_audio(data, size);
-                        _exit(0);
-                }
+		/* Lastly, we can try just plain old /dev/audio */
+		if (can_play_audio()) {
+			play_audio(data, size);
+			_exit(0);
+		}
 
 		_exit(0);
-        } else {
-                gtk_timeout_add(100, (GtkFunction)clean_pid, NULL);
-        }
+	} else {
+		gtk_timeout_add(100, (GtkFunction)clean_pid, NULL);
+	}
 }
 
 extern int logins_not_muted;
@@ -409,7 +404,7 @@
 	if (awaymessage && !(sound_options & OPT_SOUND_WHEN_AWAY))
 		return;
 
-	switch(sound) {
+	switch (sound) {
 	case BUDDY_ARRIVE:
 		if ((sound_options & OPT_SOUND_LOGIN) && logins_not_muted) {
 			if (sound_file[BUDDY_ARRIVE]) {
@@ -428,7 +423,7 @@
 			}
 		}
 		break;
-        case FIRST_RECEIVE:
+	case FIRST_RECEIVE:
 		if (sound_options & OPT_SOUND_FIRST_RCV) {
 			if (sound_file[FIRST_RECEIVE]) {
 				play_file(sound_file[FIRST_RECEIVE]);
@@ -437,7 +432,7 @@
 			}
 		}
 		break;
-        case RECEIVE:
+	case RECEIVE:
 		if (sound_options & OPT_SOUND_RECV) {
 			if (sound_file[RECEIVE]) {
 				play_file(sound_file[RECEIVE]);
@@ -455,7 +450,7 @@
 			}
 		}
 		break;
-        case CHAT_JOIN:
+	case CHAT_JOIN:
 		if (sound_options & OPT_SOUND_CHAT_JOIN) {
 			if (sound_file[CHAT_JOIN]) {
 				play_file(sound_file[CHAT_JOIN]);
@@ -464,7 +459,7 @@
 			}
 		}
 		break;
-        case CHAT_LEAVE:
+	case CHAT_LEAVE:
 		if (sound_options & OPT_SOUND_CHAT_PART) {
 			if (sound_file[CHAT_LEAVE]) {
 				play_file(sound_file[CHAT_LEAVE]);
@@ -473,7 +468,7 @@
 			}
 		}
 		break;
-        case CHAT_YOU_SAY:
+	case CHAT_YOU_SAY:
 		if (sound_options & OPT_SOUND_CHAT_YOU_SAY) {
 			if (sound_file[CHAT_YOU_SAY]) {
 				play_file(sound_file[CHAT_YOU_SAY]);
@@ -482,7 +477,7 @@
 			}
 		}
 		break;
-        case CHAT_SAY:
+	case CHAT_SAY:
 		if (sound_options & OPT_SOUND_CHAT_SAY) {
 			if (sound_file[CHAT_SAY]) {
 				play_file(sound_file[CHAT_SAY]);
@@ -491,6 +486,5 @@
 			}
 		}
 		break;
-       }
+	}
 }
-
--- a/src/toc.c	Wed Dec 13 20:23:06 2000 +0000
+++ b/src/toc.c	Wed Dec 13 22:12:02 2000 +0000
@@ -47,7 +47,7 @@
 #include "pixmaps/dt_icon.xpm"
 #include "pixmaps/free_icon.xpm"
 
-#define REVISION "gaim:$Revision: 1260 $"
+#define REVISION "gaim:$Revision: 1262 $"
 
 #define TYPE_SIGNON    1
 #define TYPE_DATA      2
@@ -71,9 +71,9 @@
 #define STATE_PAUSE 4
 
 struct toc_data {
-        int toc_fd;
-        int seqno;
-        int state;
+	int toc_fd;
+	int seqno;
+	int state;
 };
 
 struct sflap_hdr {
@@ -103,7 +103,8 @@
 /* ok. this function used to take username/password, and return 0 on success.
  * now, it takes username/password, and returns NULL on error or a new gaim_connection
  * on success. */
-static void toc_login(struct aim_user *user) {
+static void toc_login(struct aim_user *user)
+{
 	struct gaim_connection *gc;
 	struct toc_data *tdt;
 	char buf[80];
@@ -112,7 +113,7 @@
 	gc->proto_data = tdt = g_new0(struct toc_data, 1);
 
 	g_snprintf(buf, sizeof buf, "Lookin up %s",
-			user->proto_opt[USEROPT_AUTH][0] ? user->proto_opt[USEROPT_AUTH] : TOC_HOST);
+		   user->proto_opt[USEROPT_AUTH][0] ? user->proto_opt[USEROPT_AUTH] : TOC_HOST);
 	/* this is such a hack */
 	set_login_progress(gc, 1, buf);
 	while (gtk_events_pending())
@@ -120,16 +121,17 @@
 	if (!g_slist_find(connections, gc))
 		return;
 
-	tdt->toc_fd = proxy_connect(
-		user->proto_opt[USEROPT_AUTH][0] ? user->proto_opt[USEROPT_AUTH] : TOC_HOST,
-		user->proto_opt[USEROPT_AUTHPORT][0] ? atoi(user->proto_opt[USEROPT_AUTHPORT]):TOC_PORT,
-		user->proto_opt[USEROPT_SOCKSHOST], atoi(user->proto_opt[USEROPT_SOCKSPORT]),
-		atoi(user->proto_opt[USEROPT_PROXYTYPE]));
+	tdt->toc_fd =
+	    proxy_connect(user->proto_opt[USEROPT_AUTH][0] ? user->proto_opt[USEROPT_AUTH] : TOC_HOST,
+			  user->proto_opt[USEROPT_AUTHPORT][0] ? atoi(user->
+								      proto_opt[USEROPT_AUTHPORT]) :
+			  TOC_PORT, user->proto_opt[USEROPT_SOCKSHOST],
+			  atoi(user->proto_opt[USEROPT_SOCKSPORT]),
+			  atoi(user->proto_opt[USEROPT_PROXYTYPE]));
 
 	debug_printf("* Client connects to TOC\n");
 	if (tdt->toc_fd < 0) {
-		g_snprintf(buf, sizeof(buf), "Connect to %s failed",
-				user->proto_opt[USEROPT_AUTH]);
+		g_snprintf(buf, sizeof(buf), "Connect to %s failed", user->proto_opt[USEROPT_AUTH]);
 		hide_login_progress(gc, buf);
 		signoff(gc);
 		return;
@@ -152,16 +154,18 @@
 	set_login_progress(gc, 2, buf);
 }
 
-static void toc_close(struct gaim_connection *gc) {
+static void toc_close(struct gaim_connection *gc)
+{
 	if (gc->inpa > 0)
 		gdk_input_remove(gc->inpa);
 	gc->inpa = -1;
 	close(((struct toc_data *)gc->proto_data)->toc_fd);
 }
 
-int sflap_send(struct gaim_connection *gc, char *buf, int olen, int type) {
+int sflap_send(struct gaim_connection *gc, char *buf, int olen, int type)
+{
 	int len;
-	int slen=0;
+	int slen = 0;
 	struct sflap_hdr hdr;
 	char obuf[MSG_LEN];
 	struct toc_data *tdt = (struct toc_data *)gc->proto_data;
@@ -172,9 +176,9 @@
 		return 0;
 
 	/* One _last_ 2048 check here!  This shouldn't ever
-	* get hit though, hopefully.  If it gets hit on an IM
-	* It'll lose the last " and the message won't go through,
-	* but this'll stop a segfault. */
+	   * get hit though, hopefully.  If it gets hit on an IM
+	   * It'll lose the last " and the message won't go through,
+	   * but this'll stop a segfault. */
 	if (strlen(buf) > (MSG_LEN - sizeof(hdr))) {
 		debug_printf("message too long, truncating\n");
 		buf[MSG_LEN - sizeof(hdr) - 3] = '"';
@@ -195,14 +199,15 @@
 	memcpy(&obuf[slen], buf, len);
 	slen += len;
 	if (type != TYPE_SIGNON) {
-		obuf[slen]='\0';
+		obuf[slen] = '\0';
 		slen += 1;
 	}
 
 	return write(tdt->toc_fd, obuf, slen);
 }
 
-static int wait_reply(struct gaim_connection *gc, char *buffer, size_t buflen) {
+static int wait_reply(struct gaim_connection *gc, char *buffer, size_t buflen)
+{
 	struct toc_data *tdt = (struct toc_data *)gc->proto_data;
 	struct sflap_hdr *hdr;
 	int ret;
@@ -226,28 +231,30 @@
 		do {
 			count += ret;
 			ret = read(tdt->toc_fd,
-				   buffer + sizeof(struct sflap_hdr) + count,
-				   ntohs(hdr->len));
+				   buffer + sizeof(struct sflap_hdr) + count, ntohs(hdr->len));
 		} while (count + ret < ntohs(hdr->len) && ret > 0);
 		buffer[sizeof(struct sflap_hdr) + count + ret] = '\0';
 		return ret;
-	} else return 0;
+	} else
+		return 0;
 }
 
-static unsigned char *roast_password(char *pass) {
+static unsigned char *roast_password(char *pass)
+{
 	/* Trivial "encryption" */
 	static char rp[256];
 	static char *roast = ROAST;
-	int pos=2;
+	int pos = 2;
 	int x;
 	strcpy(rp, "0x");
-	for (x=0;(x<150) && pass[x]; x++)
-		pos+=sprintf(&rp[pos],"%02x", pass[x] ^ roast[x % strlen(roast)]);
-	rp[pos]='\0';
+	for (x = 0; (x < 150) && pass[x]; x++)
+		pos += sprintf(&rp[pos], "%02x", pass[x] ^ roast[x % strlen(roast)]);
+	rp[pos] = '\0';
 	return rp;
 }
 
-static void toc_callback(gpointer data, gint source, GdkInputCondition condition) {
+static void toc_callback(gpointer data, gint source, GdkInputCondition condition)
+{
 	struct gaim_connection *gc = (struct gaim_connection *)data;
 	struct toc_data *tdt = (struct toc_data *)gc->proto_data;
 	struct sflap_hdr *hdr;
@@ -291,8 +298,8 @@
 
 		debug_printf("* Client sends TOC \"toc_signon\" message\n");
 		g_snprintf(snd, sizeof snd, "toc_signon %s %d %s %s %s \"%s\"",
-				AUTH_HOST, AUTH_PORT, normalize(gc->username),
-				roast_password(gc->password), LANGUAGE, REVISION);
+			   AUTH_HOST, AUTH_PORT, normalize(gc->username),
+			   roast_password(gc->password), LANGUAGE, REVISION);
 		if (sflap_send(gc, snd, -1, TYPE_DATA) < 0) {
 			hide_login_progress(gc, _("Disconnected."));
 			signoff(gc);
@@ -306,7 +313,8 @@
 	if (tdt->state == STATE_SIGNON_REQUEST) {
 		debug_printf("* TOC sends client SIGN_ON reply\n");
 		if (strncasecmp(buf + sizeof(struct sflap_hdr), "SIGN_ON", strlen("SIGN_ON"))) {
-			debug_printf("Didn't get SIGN_ON! buf was: %s\n", buf+sizeof(struct sflap_hdr));
+			debug_printf("Didn't get SIGN_ON! buf was: %s\n",
+				     buf + sizeof(struct sflap_hdr));
 			hide_login_progress(gc, _("Authentication Failed"));
 			signoff(gc);
 			return;
@@ -331,7 +339,7 @@
 		sflap_send(gc, snd, -1, TYPE_DATA);
 
 		g_snprintf(snd, sizeof snd, "toc_set_caps %s %s %s %s %s",
-			FILE_SEND_UID, FILE_GET_UID, B_ICON_UID, IMAGE_UID, VOICE_UID);
+			   FILE_SEND_UID, FILE_GET_UID, B_ICON_UID, IMAGE_UID, VOICE_UID);
 		sflap_send(gc, snd, -1, TYPE_DATA);
 
 		return;
@@ -339,7 +347,7 @@
 
 	debug_printf("From TOC server: %s\n", buf + sizeof(struct sflap_hdr));
 
-	c = strtok(buf + sizeof(struct sflap_hdr), ":"); /* Ditch the first part */
+	c = strtok(buf + sizeof(struct sflap_hdr), ":");	/* Ditch the first part */
 
 	if (!strcasecmp(c, "SIGN_ON")) {
 		/* we should only get here after a PAUSE */
@@ -348,8 +356,8 @@
 		else {
 			tdt->state = STATE_ONLINE;
 			g_snprintf(snd, sizeof snd, "toc_signon %s %d %s %s %s \"%s\"",
-					AUTH_HOST, AUTH_PORT, normalize(gc->username),
-					roast_password(gc->password), LANGUAGE, REVISION);
+				   AUTH_HOST, AUTH_PORT, normalize(gc->username),
+				   roast_password(gc->password), LANGUAGE, REVISION);
 			if (sflap_send(gc, snd, -1, TYPE_DATA) < 0) {
 				hide_login_progress(gc, _("Disconnected."));
 				signoff(gc);
@@ -359,7 +367,7 @@
 			g_snprintf(snd, sizeof snd, "toc_init_done");
 			sflap_send(gc, snd, -1, TYPE_DATA);
 			do_error_dialog(_("TOC has come back from its pause. You may now send"
-					" messages again."), _("TOC Resume"));
+					  " messages again."), _("TOC Resume"));
 		}
 	} else if (!strcasecmp(c, "CONFIG")) {
 		c = strtok(NULL, ":");
@@ -375,7 +383,8 @@
 		away = strtok(NULL, ":");
 
 		message = away;
-		while (*message && (*message != ':')) message++;
+		while (*message && (*message != ':'))
+			message++;
 		message++;
 
 		a = (away && (*away == 'T')) ? 1 : 0;
@@ -386,8 +395,8 @@
 		int logged, evil, idle, type = 0;
 		time_t signon, time_idle;
 
-		c = strtok(NULL, ":"); /* name */
-		l = strtok(NULL, ":"); /* online */
+		c = strtok(NULL, ":");	/* name */
+		l = strtok(NULL, ":");	/* online */
 		sscanf(strtok(NULL, ":"), "%d", &evil);
 		sscanf(strtok(NULL, ":"), "%ld", &signon);
 		sscanf(strtok(NULL, ":"), "%d", &idle);
@@ -395,7 +404,8 @@
 
 		logged = (l && (*l == 'T')) ? 1 : 0;
 
-		if (uc[0] == 'A') type |= UC_AOL;
+		if (uc[0] == 'A')
+			type |= UC_AOL;
 		switch (uc[1]) {
 		case 'A':
 			type |= UC_ADMIN;
@@ -409,10 +419,14 @@
 		default:
 			break;
 		}
-		if (uc[2] == 'U') type |= UC_UNAVAILABLE;
+		if (uc[2] == 'U')
+			type |= UC_UNAVAILABLE;
 
-		if (idle) { time(&time_idle); time_idle -= idle * 60; }
-		else time_idle = 0;
+		if (idle) {
+			time(&time_idle);
+			time_idle -= idle * 60;
+		} else
+			time_idle = 0;
 
 		serv_got_update(gc, c, logged, evil, signon, time_idle, type, 0);
 	} else if (!strcasecmp(c, "ERROR")) {
@@ -442,7 +456,8 @@
 		who = strtok(NULL, ":");
 		whisper = strtok(NULL, ":");
 		m = whisper;
-		while (*m && (*m != ':')) m++;
+		while (*m && (*m != ':'))
+			m++;
 		m++;
 
 		w = (whisper && (*whisper == 'T')) ? 1 : 0;
@@ -457,7 +472,7 @@
 		sscanf(strtok(NULL, ":"), "%d", &id);
 		in = strtok(NULL, ":");
 
-		while(bcs) {
+		while (bcs) {
 			b = (struct conversation *)bcs->data;
 			if (id == b->id)
 				break;
@@ -465,7 +480,8 @@
 			b = NULL;
 		}
 
-		if (!b) return;
+		if (!b)
+			return;
 
 		if (in && (*in == 'T'))
 			while ((buddy = strtok(NULL, ":")) != NULL)
@@ -505,7 +521,7 @@
 			char error_buf[BUF_LONG];
 			b->gc = NULL;
 			g_snprintf(error_buf, sizeof error_buf, _("You have been disconnected"
-						" from chat room %s."), b->name);
+								  " from chat room %s."), b->name);
 		} else
 			serv_got_chat_left(gc, id);
 	} else if (!strcasecmp(c, "GOTO_URL")) {
@@ -523,9 +539,9 @@
 	} else if (!strcasecmp(c, "PAUSE")) {
 		tdt->state = STATE_PAUSE;
 		do_error_dialog(_("TOC has sent a PAUSE command. When this happens, TOC ignores"
-				" any messages sent to it, and may kick you off if you send a"
-				" message. Gaim will prevent anything from going through. This"
-				" is only temporary, please be patient."), _("TOC Pause"));
+				  " any messages sent to it, and may kick you off if you send a"
+				  " message. Gaim will prevent anything from going through. This"
+				  " is only temporary, please be patient."), _("TOC Pause"));
 	} else if (!strcasecmp(c, "RVOUS_PROPOSE")) {
 		char *user, *uuid, *cookie;
 		int seq;
@@ -550,22 +566,24 @@
 
 			for (i = 0; i < 4; i++) {
 				sscanf(strtok(NULL, ":"), "%d", &unk[i]);
-				if (unk[i] == 10001) break;
+				if (unk[i] == 10001)
+					break;
 				messages[i] = frombase64(strtok(NULL, ":"));
 			}
 			tmp = frombase64(strtok(NULL, ":"));
 
 			subtype = tmp[1];
 			files = tmp[3];
-			
+
 			totalsize |= (tmp[4] << 24) & 0xff000000;
 			totalsize |= (tmp[5] << 16) & 0x00ff0000;
-			totalsize |= (tmp[6] <<  8) & 0x0000ff00;
-			totalsize |= (tmp[7] <<  0) & 0x000000ff;
+			totalsize |= (tmp[6] << 8) & 0x0000ff00;
+			totalsize |= (tmp[7] << 0) & 0x000000ff;
 
 			if (!totalsize) {
 				g_free(tmp);
-				for (i--; i >= 0; i--) g_free(messages[i]);
+				for (i--; i >= 0; i--)
+					g_free(messages[i]);
 				return;
 			}
 
@@ -575,8 +593,10 @@
 			ft->cookie = g_strdup(cookie);
 			ft->ip = g_strdup(pip);
 			ft->port = port;
-			if (i) ft->message = g_strdup(messages[0]);
-			else ft->message = NULL;
+			if (i)
+				ft->message = g_strdup(messages[0]);
+			else
+				ft->message = NULL;
 			ft->filename = g_strdup(name);
 			ft->user = g_strdup(user);
 			ft->size = totalsize;
@@ -584,7 +604,8 @@
 			ft->gc = gc;
 
 			g_free(tmp);
-			for (i--; i >= 0; i--) g_free(messages[i]);
+			for (i--; i >= 0; i--)
+				g_free(messages[i]);
 
 			accept_file_dialog(ft);
 		} else if (!strcmp(uuid, FILE_GET_UID)) {
@@ -595,7 +616,8 @@
 
 			for (i = 0; i < 4; i++) {
 				sscanf(strtok(NULL, ":"), "%d", unk + i);
-				if (unk[i] == 10001) break;
+				if (unk[i] == 10001)
+					break;
 				messages[i] = frombase64(strtok(NULL, ":"));
 			}
 			tmp = frombase64(strtok(NULL, ":"));
@@ -604,14 +626,17 @@
 			ft->cookie = g_strdup(cookie);
 			ft->ip = g_strdup(pip);
 			ft->port = port;
-			if (i) ft->message = g_strdup(messages[0]);
-			else ft->message = NULL;
+			if (i)
+				ft->message = g_strdup(messages[0]);
+			else
+				ft->message = NULL;
 			ft->user = g_strdup(user);
 			g_snprintf(ft->UID, sizeof(ft->UID), "%s", FILE_GET_UID);
 			ft->gc = gc;
 
 			g_free(tmp);
-			for (i--; i >= 0; i--) g_free(messages[i]);
+			for (i--; i >= 0; i--)
+				g_free(messages[i]);
 
 			accept_file_dialog(ft);
 		} else if (!strcmp(uuid, VOICE_UID)) {
@@ -638,33 +663,33 @@
 	GSList *plist = gc->permit;
 	GSList *dlist = gc->deny;
 
-	int pos=0;
+	int pos = 0;
 
 	if (!gc->permdeny)
 		gc->permdeny = 1;
 
 	pos += g_snprintf(&s[pos], len - pos, "m %d\n", gc->permdeny);
-	while(grp) {
+	while (grp) {
 		g = (struct group *)grp->data;
 		pos += g_snprintf(&s[pos], len - pos, "g %s\n", g->name);
 		mem = g->members;
-		while(mem) {
+		while (mem) {
 			b = (struct buddy *)mem->data;
 			pos += g_snprintf(&s[pos], len - pos, "b %s%s%s\n", b->name,
-					show ? ":" : "", show ? b->show : "");
+					  show ? ":" : "", show ? b->show : "");
 			mem = mem->next;
 		}
 		grp = g_slist_next(grp);
 	}
 
-	while(plist) {
+	while (plist) {
 		pos += g_snprintf(&s[pos], len - pos, "p %s\n", (char *)plist->data);
-		plist=plist->next;
+		plist = plist->next;
 	}
 
-	while(dlist) {
+	while (dlist) {
 		pos += g_snprintf(&s[pos], len - pos, "d %s\n", (char *)dlist->data);
-		dlist=dlist->next;
+		dlist = dlist->next;
 	}
 }
 
@@ -677,40 +702,42 @@
 	int how_many = 0;
 
 	bud = NULL;
-        
+
 	if (config != NULL) {
 
-		/* skip "CONFIG:" (if it exists)*/
-		c = strncmp(config + sizeof(struct sflap_hdr),"CONFIG:",strlen("CONFIG:"))?
-			strtok(config, "\n"):
-			strtok(config + sizeof(struct sflap_hdr)+strlen("CONFIG:"), "\n");
+		/* skip "CONFIG:" (if it exists) */
+		c = strncmp(config + sizeof(struct sflap_hdr), "CONFIG:", strlen("CONFIG:")) ?
+		    strtok(config, "\n") :
+		    strtok(config + sizeof(struct sflap_hdr) + strlen("CONFIG:"), "\n");
 		do {
-			if (c == NULL) 
+			if (c == NULL)
 				break;
 			if (*c == 'g') {
-				strncpy(current,c+2, sizeof(current));
+				strncpy(current, c + 2, sizeof(current));
 				add_group(gc, current);
 				how_many++;
-			} else if (*c == 'b' && !find_buddy(gc, c+2)) {
-				char nm[80], sw[80], *tmp = c+2;
+			} else if (*c == 'b' && !find_buddy(gc, c + 2)) {
+				char nm[80], sw[80], *tmp = c + 2;
 				int i = 0;
 				while (*tmp != ':' && *tmp)
 					nm[i++] = *tmp++;
-				if (*tmp == ':') *tmp++ = '\0';
+				if (*tmp == ':')
+					*tmp++ = '\0';
 				nm[i] = '\0';
 				i = 0;
-				while (*tmp) sw[i++] = *tmp++;
+				while (*tmp)
+					sw[i++] = *tmp++;
 				sw[i] = '\0';
 				if (!find_buddy(gc, nm))
 					add_buddy(gc, current, nm, sw);
 				how_many++;
-				
-				bud = g_list_append(bud, c+2);
+
+				bud = g_list_append(bud, c + 2);
 			} else if (*c == 'p') {
 				GSList *d = gc->permit;
 				char *n;
-				name = g_malloc(strlen(c+2) + 2);
-				g_snprintf(name, strlen(c+2) + 1, "%s", c+2);
+				name = g_malloc(strlen(c + 2) + 2);
+				g_snprintf(name, strlen(c + 2) + 1, "%s", c + 2);
 				n = g_strdup(normalize(name));
 				while (d) {
 					if (!strcasecmp(n, normalize(d->data)))
@@ -723,8 +750,8 @@
 			} else if (*c == 'd') {
 				GSList *d = gc->deny;
 				char *n;
-				name = g_malloc(strlen(c+2) + 2);
-				g_snprintf(name, strlen(c+2) + 1, "%s", c+2);
+				name = g_malloc(strlen(c + 2) + 2);
+				g_snprintf(name, strlen(c + 2) + 1, "%s", c + 2);
 				n = g_strdup(normalize(name));
 				while (d) {
 					if (!strcasecmp(n, normalize(d->data)))
@@ -745,12 +772,13 @@
 				if (gc->permdeny == 0)
 					gc->permdeny = 1;
 			}
-		} while((c=strtok(NULL,"\n"))); 
+		} while ((c = strtok(NULL, "\n")));
 #if 0
-		fprintf(stdout, "Sending message '%s'\n",buf);
+		fprintf(stdout, "Sending message '%s'\n", buf);
 #endif
-				      
-		if (bud != NULL) serv_add_buddies(gc, bud);
+
+		if (bud != NULL)
+			serv_add_buddies(gc, bud);
 		serv_set_permit_deny(gc);
 		if (blist) {
 			build_edit_tree();
@@ -758,69 +786,76 @@
 	}
 
 	/* perhaps the server dropped the buddy list, try importing from
-           cache */
+	   cache */
 
-	if ( how_many == 0 && !from_do_import ) {
-		do_import( (GtkWidget *) NULL, gc );
-	} else if ( gc && (bud_list_cache_exists(gc) == FALSE) ) {
-		do_export( (GtkWidget *) NULL, 0 );	
+	if (how_many == 0 && !from_do_import) {
+		do_import((GtkWidget *)NULL, gc);
+	} else if (gc && (bud_list_cache_exists(gc) == FALSE)) {
+		do_export((GtkWidget *)NULL, 0);
 	}
- }
+}
 
-static char *toc_name() {
+static char *toc_name()
+{
 	return "TOC";
 }
 
-static void toc_send_im(struct gaim_connection *gc, char *name, char *message, int away) {
+static void toc_send_im(struct gaim_connection *gc, char *name, char *message, int away)
+{
 	char buf[MSG_LEN - 7];
 
 	escape_text(message);
 	g_snprintf(buf, MSG_LEN - 8, "toc_send_im %s \"%s\"%s", normalize(name),
-			message, ((away) ? " auto" : ""));
+		   message, ((away) ? " auto" : ""));
 	sflap_send(gc, buf, -1, TYPE_DATA);
 }
 
-static void toc_set_config(struct gaim_connection *gc) {
+static void toc_set_config(struct gaim_connection *gc)
+{
 	char buf[MSG_LEN], snd[MSG_LEN];
 	toc_build_config(gc, buf, MSG_LEN, FALSE);
 	g_snprintf(snd, MSG_LEN, "toc_set_config \"%s\"", buf);
 	sflap_send(gc, snd, -1, TYPE_DATA);
 }
 
-static void toc_get_info(struct gaim_connection *g, char *name) {
+static void toc_get_info(struct gaim_connection *g, char *name)
+{
 	char buf[MSG_LEN];
 	g_snprintf(buf, MSG_LEN, "toc_get_info %s", normalize(name));
 	sflap_send(g, buf, -1, TYPE_DATA);
 }
 
-static void toc_get_dir(struct gaim_connection *g, char *name) {
+static void toc_get_dir(struct gaim_connection *g, char *name)
+{
 	char buf[MSG_LEN];
 	g_snprintf(buf, MSG_LEN, "toc_get_dir %s", normalize(name));
 	sflap_send(g, buf, -1, TYPE_DATA);
 }
 
 static void toc_set_dir(struct gaim_connection *g, char *first, char *middle, char *last,
-			char *maiden, char *city, char *state, char *country, int web) {
-	char buf2[BUF_LEN*4], buf[BUF_LEN];
+			char *maiden, char *city, char *state, char *country, int web)
+{
+	char buf2[BUF_LEN * 4], buf[BUF_LEN];
 	g_snprintf(buf2, sizeof(buf2), "%s:%s:%s:%s:%s:%s:%s:%s", first,
-			middle, last, maiden, city, state, country,
-			(web == 1) ? "Y" : "");
+		   middle, last, maiden, city, state, country, (web == 1) ? "Y" : "");
 	escape_text(buf2);
 	g_snprintf(buf, sizeof(buf), "toc_set_dir %s", buf2);
 	sflap_send(g, buf, -1, TYPE_DATA);
 }
 
 static void toc_dir_search(struct gaim_connection *g, char *first, char *middle, char *last,
-			char *maiden, char *city, char *state, char *country, char *email) {
+			   char *maiden, char *city, char *state, char *country, char *email)
+{
 	char buf[BUF_LONG];
-	g_snprintf(buf, sizeof(buf)/2, "toc_dir_search %s:%s:%s:%s:%s:%s:%s:%s", first, middle,
-			last, maiden, city, state, country, email);
+	g_snprintf(buf, sizeof(buf) / 2, "toc_dir_search %s:%s:%s:%s:%s:%s:%s:%s", first, middle,
+		   last, maiden, city, state, country, email);
 	debug_printf("Searching for: %s,%s,%s,%s,%s,%s,%s\n", first, middle, last, maiden,
-			city, state, country);
+		     city, state, country);
 	sflap_send(g, buf, -1, TYPE_DATA);
 }
 
-static void toc_set_away(struct gaim_connection *g, char *message) {
+static void toc_set_away(struct gaim_connection *g, char *message)
+{
 	char buf[MSG_LEN];
 	if (message) {
 		escape_text(message);
@@ -830,27 +865,31 @@
 	sflap_send(g, buf, -1, TYPE_DATA);
 }
 
-static void toc_set_info(struct gaim_connection *g, char *info) {
+static void toc_set_info(struct gaim_connection *g, char *info)
+{
 	char buf[MSG_LEN];
 	escape_text(info);
 	g_snprintf(buf, sizeof(buf), "toc_set_info \"%s\n\"", info);
 	sflap_send(g, buf, -1, TYPE_DATA);
 }
 
-static void toc_change_passwd(struct gaim_connection *g, char *orig, char *new) {
+static void toc_change_passwd(struct gaim_connection *g, char *orig, char *new)
+{
 	char buf[MSG_LEN];
 	g_snprintf(buf, BUF_LONG, "toc_change_passwd %s %s", orig, new);
 	sflap_send(g, buf, strlen(buf), TYPE_DATA);
 }
 
-static void toc_add_buddy(struct gaim_connection *g, char *name) {
-	char buf[1024]; 
+static void toc_add_buddy(struct gaim_connection *g, char *name)
+{
+	char buf[1024];
 	g_snprintf(buf, sizeof(buf), "toc_add_buddy %s", normalize(name));
 	sflap_send(g, buf, -1, TYPE_DATA);
 	toc_set_config(g);
 }
 
-static void toc_add_buddies(struct gaim_connection *g, GList *buddies) {
+static void toc_add_buddies(struct gaim_connection *g, GList * buddies)
+{
 	char buf[MSG_LEN];
 	int n;
 
@@ -860,50 +899,57 @@
 			sflap_send(g, buf, -1, TYPE_DATA);
 			n = g_snprintf(buf, sizeof(buf), "toc_add_buddy");
 		}
-		n += g_snprintf(buf + n, sizeof(buf)-n, " %s", normalize(buddies->data));
+		n += g_snprintf(buf + n, sizeof(buf) - n, " %s", normalize(buddies->data));
 		buddies = buddies->next;
 	}
 	sflap_send(g, buf, -1, TYPE_DATA);
 }
 
-static void toc_remove_buddy(struct gaim_connection *g, char *name) {
-	char buf[1024]; 
+static void toc_remove_buddy(struct gaim_connection *g, char *name)
+{
+	char buf[1024];
 	g_snprintf(buf, sizeof(buf), "toc_remove_buddy %s", normalize(name));
 	sflap_send(g, buf, -1, TYPE_DATA);
 	toc_set_config(g);
 }
 
-static void toc_set_idle(struct gaim_connection *g, int time) {
+static void toc_set_idle(struct gaim_connection *g, int time)
+{
 	char buf[256];
 	g_snprintf(buf, sizeof(buf), "toc_set_idle %d", time);
 	sflap_send(g, buf, -1, TYPE_DATA);
 }
 
-static void toc_warn(struct gaim_connection *g, char *name, int anon) {
+static void toc_warn(struct gaim_connection *g, char *name, int anon)
+{
 	char send[256];
 	g_snprintf(send, 255, "toc_evil %s %s", name, ((anon) ? "anon" : "norm"));
 	sflap_send(g, send, -1, TYPE_DATA);
 }
 
-static void toc_accept_chat(struct gaim_connection *g, int i) {
+static void toc_accept_chat(struct gaim_connection *g, int i)
+{
 	char buf[256];
-	g_snprintf(buf, 255, "toc_chat_accept %d",  i);
+	g_snprintf(buf, 255, "toc_chat_accept %d", i);
 	sflap_send(g, buf, -1, TYPE_DATA);
 }
 
-static void toc_join_chat(struct gaim_connection *g, int exchange, char *name) {
+static void toc_join_chat(struct gaim_connection *g, int exchange, char *name)
+{
 	char buf[BUF_LONG];
-	g_snprintf(buf, sizeof(buf)/2, "toc_chat_join %d \"%s\"", exchange, name);
+	g_snprintf(buf, sizeof(buf) / 2, "toc_chat_join %d \"%s\"", exchange, name);
 	sflap_send(g, buf, -1, TYPE_DATA);
 }
 
-static void toc_chat_invite(struct gaim_connection *g, int id, char *message, char *name) {
+static void toc_chat_invite(struct gaim_connection *g, int id, char *message, char *name)
+{
 	char buf[BUF_LONG];
-	g_snprintf(buf, sizeof(buf)/2, "toc_chat_invite %d \"%s\" %s", id, message, normalize(name));
+	g_snprintf(buf, sizeof(buf) / 2, "toc_chat_invite %d \"%s\" %s", id, message, normalize(name));
 	sflap_send(g, buf, -1, TYPE_DATA);
 }
 
-static void toc_chat_leave(struct gaim_connection *g, int id) {
+static void toc_chat_leave(struct gaim_connection *g, int id)
+{
 	GSList *bcs = g->buddy_chats;
 	struct conversation *b = NULL;
 	char buf[256];
@@ -917,34 +963,38 @@
 	}
 
 	if (!b)
-		return; /* can this happen? */
+		return;		/* can this happen? */
 
-	if (!b->gc) /* TOC already kicked us out of this room */
+	if (!b->gc)		/* TOC already kicked us out of this room */
 		serv_got_chat_left(g, id);
 	else {
-		g_snprintf(buf, 255, "toc_chat_leave %d",  id);
+		g_snprintf(buf, 255, "toc_chat_leave %d", id);
 		sflap_send(g, buf, -1, TYPE_DATA);
 	}
 }
 
-static void toc_chat_whisper(struct gaim_connection *g, int id, char *who, char *message) {
+static void toc_chat_whisper(struct gaim_connection *g, int id, char *who, char *message)
+{
 	char buf2[MSG_LEN];
 	g_snprintf(buf2, sizeof(buf2), "toc_chat_whisper %d %s \"%s\"", id, who, message);
 	sflap_send(g, buf2, -1, TYPE_DATA);
 }
 
-static void toc_chat_send(struct gaim_connection *g, int id, char *message) {
+static void toc_chat_send(struct gaim_connection *g, int id, char *message)
+{
 	char buf[MSG_LEN];
 	escape_text(message);
-	g_snprintf(buf, sizeof(buf), "toc_chat_send %d \"%s\"",id, message);
+	g_snprintf(buf, sizeof(buf), "toc_chat_send %d \"%s\"", id, message);
 	sflap_send(g, buf, -1, TYPE_DATA);
 }
 
-static void toc_keepalive(struct gaim_connection *gc) {
+static void toc_keepalive(struct gaim_connection *gc)
+{
 	sflap_send(gc, "", 0, TYPE_KEEPALIVE);
 }
 
-static char **toc_list_icon(int uc) {
+static char **toc_list_icon(int uc)
+{
 	if (uc & UC_UNAVAILABLE)
 		return (char **)away_icon_xpm;
 	if (uc & UC_AOL)
@@ -958,69 +1008,68 @@
 	return NULL;
 }
 
-static void toc_info(GtkObject *obj, char *who) {
+static void toc_info(GtkObject * obj, char *who)
+{
 	struct gaim_connection *gc = (struct gaim_connection *)gtk_object_get_user_data(obj);
 	serv_get_info(gc, who);
 }
 
-static void toc_dir_info(GtkObject *obj, char *who) {
+static void toc_dir_info(GtkObject * obj, char *who)
+{
 	struct gaim_connection *gc = (struct gaim_connection *)gtk_object_get_user_data(obj);
 	serv_get_dir(gc, who);
 }
 
-static void toc_action_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) {
+static void toc_action_menu(GtkWidget *menu, struct gaim_connection *gc, char *who)
+{
 	GtkWidget *button;
 
 	button = gtk_menu_item_new_with_label(_("Get Info"));
-	gtk_signal_connect(GTK_OBJECT(button), "activate",
-			   GTK_SIGNAL_FUNC(toc_info), who);
+	gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(toc_info), who);
 	gtk_object_set_user_data(GTK_OBJECT(button), gc);
 	gtk_menu_append(GTK_MENU(menu), button);
 	gtk_widget_show(button);
 
 	button = gtk_menu_item_new_with_label(_("Get Dir Info"));
-	gtk_signal_connect(GTK_OBJECT(button), "activate",
-			   GTK_SIGNAL_FUNC(toc_dir_info), who);
+	gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(toc_dir_info), who);
 	gtk_object_set_user_data(GTK_OBJECT(button), gc);
 	gtk_menu_append(GTK_MENU(menu), button);
 	gtk_widget_show(button);
 }
 
-static void toc_print_option(GtkEntry *entry, struct aim_user *user) {
+static void toc_print_option(GtkEntry * entry, struct aim_user *user)
+{
 	int entrynum;
 
-	entrynum = (int) gtk_object_get_user_data(GTK_OBJECT(entry));
+	entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry));
 
 	if (entrynum == USEROPT_AUTH) {
 		g_snprintf(user->proto_opt[USEROPT_AUTH],
-				sizeof(user->proto_opt[USEROPT_AUTH]), 
-				"%s", gtk_entry_get_text(entry));
+			   sizeof(user->proto_opt[USEROPT_AUTH]), "%s", gtk_entry_get_text(entry));
 	} else if (entrynum == USEROPT_AUTHPORT) {
-		g_snprintf(user->proto_opt[USEROPT_AUTHPORT], 
-				sizeof(user->proto_opt[USEROPT_AUTHPORT]), 
-				"%s", gtk_entry_get_text(entry));
+		g_snprintf(user->proto_opt[USEROPT_AUTHPORT],
+			   sizeof(user->proto_opt[USEROPT_AUTHPORT]), "%s", gtk_entry_get_text(entry));
 	} else if (entrynum == USEROPT_SOCKSHOST) {
-		g_snprintf(user->proto_opt[USEROPT_SOCKSHOST], 
-				sizeof(user->proto_opt[USEROPT_SOCKSHOST]), 
-				"%s", gtk_entry_get_text(entry));
+		g_snprintf(user->proto_opt[USEROPT_SOCKSHOST],
+			   sizeof(user->proto_opt[USEROPT_SOCKSHOST]), "%s", gtk_entry_get_text(entry));
 	} else if (entrynum == USEROPT_SOCKSPORT) {
-		g_snprintf(user->proto_opt[USEROPT_SOCKSPORT], 
-				sizeof(user->proto_opt[USEROPT_SOCKSPORT]), 
-				"%s", gtk_entry_get_text(entry));
-	} 
+		g_snprintf(user->proto_opt[USEROPT_SOCKSPORT],
+			   sizeof(user->proto_opt[USEROPT_SOCKSPORT]), "%s", gtk_entry_get_text(entry));
+	}
 }
 
-static void toc_print_optionrad(GtkRadioButton *entry, struct aim_user *user) {
+static void toc_print_optionrad(GtkRadioButton * entry, struct aim_user *user)
+{
 	int entrynum;
 
-	entrynum = (int) gtk_object_get_user_data(GTK_OBJECT(entry));
+	entrynum = (int)gtk_object_get_user_data(GTK_OBJECT(entry));
 
 	g_snprintf(user->proto_opt[USEROPT_PROXYTYPE],
-			sizeof(user->proto_opt[USEROPT_PROXYTYPE]),
-			"%d", entrynum);
+		   sizeof(user->proto_opt[USEROPT_PROXYTYPE]), "%d", entrynum);
 }
 
-static void toc_user_opts(GtkWidget *book, struct aim_user *user) {
+static void toc_user_opts(GtkWidget *book, struct aim_user *user)
+{
 	/* so here, we create the new notebook page */
 	GtkWidget *vbox;
 	GtkWidget *hbox;
@@ -1030,8 +1079,7 @@
 
 	vbox = gtk_vbox_new(FALSE, 5);
 	gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
-	gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox,
-			gtk_label_new("TOC Options"));
+	gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new("TOC Options"));
 	gtk_widget_show(vbox);
 
 
@@ -1046,8 +1094,7 @@
 	entry = gtk_entry_new();
 	gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
 	gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_AUTH);
-	gtk_signal_connect(GTK_OBJECT(entry), "changed",
-			   GTK_SIGNAL_FUNC(toc_print_option), user);
+	gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user);
 	if (user->proto_opt[USEROPT_AUTH][0]) {
 		debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTH]);
 		gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_AUTH]);
@@ -1067,8 +1114,7 @@
 	entry = gtk_entry_new();
 	gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
 	gtk_object_set_user_data(GTK_OBJECT(entry), (void *)1);
-	gtk_signal_connect(GTK_OBJECT(entry), "changed",
-			   GTK_SIGNAL_FUNC(toc_print_option), user);
+	gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user);
 	if (user->proto_opt[USEROPT_AUTHPORT][0]) {
 		debug_printf("setting text %s\n", user->proto_opt[USEROPT_AUTHPORT]);
 		gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_AUTHPORT]);
@@ -1089,8 +1135,7 @@
 	entry = gtk_entry_new();
 	gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
 	gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_SOCKSHOST);
-	gtk_signal_connect(GTK_OBJECT(entry), "changed",
-			   GTK_SIGNAL_FUNC(toc_print_option), user);
+	gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user);
 	if (user->proto_opt[USEROPT_SOCKSHOST][0]) {
 		debug_printf("setting text %s\n", user->proto_opt[USEROPT_SOCKSHOST]);
 		gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_SOCKSHOST]);
@@ -1109,15 +1154,14 @@
 	entry = gtk_entry_new();
 	gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 0);
 	gtk_object_set_user_data(GTK_OBJECT(entry), (void *)USEROPT_SOCKSPORT);
-	gtk_signal_connect(GTK_OBJECT(entry), "changed",
-			   GTK_SIGNAL_FUNC(toc_print_option), user);
+	gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(toc_print_option), user);
 	if (user->proto_opt[USEROPT_SOCKSPORT][0]) {
 		debug_printf("setting text %s\n", user->proto_opt[USEROPT_SOCKSPORT]);
 		gtk_entry_set_text(GTK_ENTRY(entry), user->proto_opt[USEROPT_SOCKSPORT]);
 	}
 	gtk_widget_show(entry);
 
-	
+
 	first = gtk_radio_button_new_with_label(NULL, "No proxy");
 	gtk_box_pack_start(GTK_BOX(vbox), first, FALSE, FALSE, 0);
 	gtk_object_set_user_data(GTK_OBJECT(first), (void *)PROXY_NONE);
@@ -1126,7 +1170,8 @@
 	if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_NONE)
 		gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(first), TRUE);
 
-	opt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 4");
+	opt =
+	    gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 4");
 	gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0);
 	gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS4);
 	gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(toc_print_optionrad), user);
@@ -1134,7 +1179,8 @@
 	if (atoi(user->proto_opt[USEROPT_PROXYTYPE]) == PROXY_SOCKS4)
 		gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE);
 
-	opt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 5");
+	opt =
+	    gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), "SOCKS 5");
 	gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0);
 	gtk_object_set_user_data(GTK_OBJECT(opt), (void *)PROXY_SOCKS5);
 	gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(toc_print_optionrad), user);
@@ -1151,21 +1197,26 @@
 		gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE);
 }
 
-static void toc_add_permit(struct gaim_connection *gc, char *who) {
+static void toc_add_permit(struct gaim_connection *gc, char *who)
+{
 	char buf2[MSG_LEN];
-	if (gc->permdeny != 3) return;
+	if (gc->permdeny != 3)
+		return;
 	g_snprintf(buf2, sizeof(buf2), "toc_add_permit %s", normalize(who));
 	sflap_send(gc, buf2, -1, TYPE_DATA);
 }
 
-static void toc_add_deny(struct gaim_connection *gc, char *who) {
+static void toc_add_deny(struct gaim_connection *gc, char *who)
+{
 	char buf2[MSG_LEN];
-	if (gc->permdeny != 4) return;
+	if (gc->permdeny != 4)
+		return;
 	g_snprintf(buf2, sizeof(buf2), "toc_add_deny %s", normalize(who));
 	sflap_send(gc, buf2, -1, TYPE_DATA);
 }
 
-static void toc_set_permit_deny(struct gaim_connection *gc) {
+static void toc_set_permit_deny(struct gaim_connection *gc)
+{
 	char buf2[MSG_LEN];
 	GSList *list;
 	int at;
@@ -1197,7 +1248,7 @@
 		list = gc->permit;
 		while (list) {
 			at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", normalize(list->data));
-			if (at > MSG_LEN + 32) /* from out my ass comes greatness */ {
+			if (at > MSG_LEN + 32) {	/* from out my ass comes greatness */
 				sflap_send(gc, buf2, -1, TYPE_DATA);
 				at = g_snprintf(buf2, sizeof(buf2), "toc_add_permit ");
 			}
@@ -1215,7 +1266,7 @@
 		list = gc->deny;
 		while (list) {
 			at += g_snprintf(buf2 + at, sizeof(buf2) - at, "%s ", normalize(list->data));
-			if (at > MSG_LEN + 32) /* from out my ass comes greatness */ {
+			if (at > MSG_LEN + 32) {	/* from out my ass comes greatness */
 				sflap_send(gc, buf2, -1, TYPE_DATA);
 				at = g_snprintf(buf2, sizeof(buf2), "toc_add_deny ");
 			}
@@ -1228,48 +1279,53 @@
 	}
 }
 
-static void toc_rem_permit(struct gaim_connection *gc, char *who) {
-	if (gc->permdeny != 3) return;
+static void toc_rem_permit(struct gaim_connection *gc, char *who)
+{
+	if (gc->permdeny != 3)
+		return;
 	toc_set_permit_deny(gc);
 }
 
-static void toc_rem_deny(struct gaim_connection *gc, char *who) {
-	if (gc->permdeny != 4) return;
+static void toc_rem_deny(struct gaim_connection *gc, char *who)
+{
+	if (gc->permdeny != 4)
+		return;
 	toc_set_permit_deny(gc);
 }
 
-void toc_init(struct prpl *ret) {
-        ret->protocol = PROTO_TOC;
-        ret->name = toc_name;
+void toc_init(struct prpl *ret)
+{
+	ret->protocol = PROTO_TOC;
+	ret->name = toc_name;
 	ret->list_icon = toc_list_icon;
 	ret->action_menu = toc_action_menu;
 	ret->user_opts = toc_user_opts;
-        ret->login = toc_login;
-        ret->close = toc_close;
-        ret->send_im = toc_send_im;
-        ret->set_info = toc_set_info;
-        ret->get_info = toc_get_info;
-        ret->set_away = toc_set_away;
-        ret->get_away_msg = NULL;
-        ret->set_dir = toc_set_dir;
-        ret->get_dir = toc_get_dir;
-        ret->dir_search = toc_dir_search;
-        ret->set_idle = toc_set_idle;
-        ret->change_passwd = toc_change_passwd;
-        ret->add_buddy = toc_add_buddy;
-        ret->add_buddies = toc_add_buddies;
-        ret->remove_buddy = toc_remove_buddy;
-        ret->add_permit = toc_add_permit;
-        ret->add_deny = toc_add_deny;
+	ret->login = toc_login;
+	ret->close = toc_close;
+	ret->send_im = toc_send_im;
+	ret->set_info = toc_set_info;
+	ret->get_info = toc_get_info;
+	ret->set_away = toc_set_away;
+	ret->get_away_msg = NULL;
+	ret->set_dir = toc_set_dir;
+	ret->get_dir = toc_get_dir;
+	ret->dir_search = toc_dir_search;
+	ret->set_idle = toc_set_idle;
+	ret->change_passwd = toc_change_passwd;
+	ret->add_buddy = toc_add_buddy;
+	ret->add_buddies = toc_add_buddies;
+	ret->remove_buddy = toc_remove_buddy;
+	ret->add_permit = toc_add_permit;
+	ret->add_deny = toc_add_deny;
 	ret->rem_permit = toc_rem_permit;
 	ret->rem_deny = toc_rem_deny;
 	ret->set_permit_deny = toc_set_permit_deny;
-        ret->warn = toc_warn;
-        ret->accept_chat = toc_accept_chat;
-        ret->join_chat = toc_join_chat;
-        ret->chat_invite = toc_chat_invite;
-        ret->chat_leave = toc_chat_leave;
-        ret->chat_whisper = toc_chat_whisper;
-        ret->chat_send = toc_chat_send;
+	ret->warn = toc_warn;
+	ret->accept_chat = toc_accept_chat;
+	ret->join_chat = toc_join_chat;
+	ret->chat_invite = toc_chat_invite;
+	ret->chat_leave = toc_chat_leave;
+	ret->chat_whisper = toc_chat_whisper;
+	ret->chat_send = toc_chat_send;
 	ret->keepalive = toc_keepalive;
 }
--- a/src/util.c	Wed Dec 13 20:23:06 2000 +0000
+++ b/src/util.c	Wed Dec 13 22:12:02 2000 +0000
@@ -39,19 +39,20 @@
 static GdkPixmap *icon_pm = NULL;
 static GdkBitmap *icon_bm = NULL;
 
-char *full_date() {
-	char * date;
+char *full_date()
+{
+	char *date;
 	time_t tme;
 
 	time(&tme);
 	date = ctime(&tme);
-	date[strlen(date)-1] = '\0';
+	date[strlen(date) - 1] = '\0';
 	return date;
 }
 
 gint badchar(char c)
 {
-	switch(c) {
+	switch (c) {
 	case ' ':
 	case ',':
 	case '(':
@@ -69,354 +70,369 @@
 
 gchar *sec_to_text(gint sec)
 {
-        int hrs, min;
-        char minutes[64];
-        char hours[64];
-        char *sep;
-        char *ret = g_malloc(256);
-        
-        hrs = sec / 3600;
-        min = sec % 3600;
+	int hrs, min;
+	char minutes[64];
+	char hours[64];
+	char *sep;
+	char *ret = g_malloc(256);
 
-        min = min / 60;
-        sec = min % 60;
+	hrs = sec / 3600;
+	min = sec % 3600;
+
+	min = min / 60;
+	sec = min % 60;
 
-        if (min) {
-                if (min == 1)
-                        g_snprintf(minutes, sizeof(minutes), "%d minute.", min);
-                else
-                        g_snprintf(minutes, sizeof(minutes), "%d minutes.", min);
-                sep = ", ";
-        } else {
-                if (!hrs)
-                        g_snprintf(minutes, sizeof(minutes), "%d minutes.", min);
-                else {
-                        minutes[0] = '.';
-                        minutes[1] = '\0';
-                }
-                sep = "";
-        }
+	if (min) {
+		if (min == 1)
+			g_snprintf(minutes, sizeof(minutes), "%d minute.", min);
+		else
+			g_snprintf(minutes, sizeof(minutes), "%d minutes.", min);
+		sep = ", ";
+	} else {
+		if (!hrs)
+			g_snprintf(minutes, sizeof(minutes), "%d minutes.", min);
+		else {
+			minutes[0] = '.';
+			minutes[1] = '\0';
+		}
+		sep = "";
+	}
 
-        if (hrs) {
-                if (hrs == 1)
-                        g_snprintf(hours, sizeof(hours), "%d hour%s", hrs, sep);
-                else
-                        g_snprintf(hours, sizeof(hours), "%d hours%s", hrs, sep);
-        } else
-                hours[0] = '\0';
+	if (hrs) {
+		if (hrs == 1)
+			g_snprintf(hours, sizeof(hours), "%d hour%s", hrs, sep);
+		else
+			g_snprintf(hours, sizeof(hours), "%d hours%s", hrs, sep);
+	} else
+		hours[0] = '\0';
 
-        
-        g_snprintf(ret, 256, "%s%s", hours, minutes);
 
-        return ret;
+	g_snprintf(ret, 256, "%s%s", hours, minutes);
+
+	return ret;
 }
 
 gint linkify_text(char *text)
 {
-        char *c, *t;
-        char *cpy = g_malloc(strlen(text) * 2 + 1);
-        char url_buf[512];
-        int cnt=0;
-        /* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
+	char *c, *t;
+	char *cpy = g_malloc(strlen(text) * 2 + 1);
+	char url_buf[512];
+	int cnt = 0;
+	/* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
 
-        strncpy(cpy, text, strlen(text));
-        cpy[strlen(text)] = 0;
-        c = cpy;
-        while(*c) {
-                if (!strncasecmp(c, "<A", 2)) {
-                        while(1) {
-                                if (!strncasecmp(c, "/A>", 3)) {
-                                        break;
-                                }
-                                text[cnt++] = *c;
-                                c++;
-                                if (!(*c))
-                                        break;
-                        }
-                } else if ( (!strncasecmp(c, "http://", 7) || (!strncasecmp(c, "https://", 8)))) {
-                        t = c;
-                        while(1) {
-                                if (badchar(*t)) {
+	strncpy(cpy, text, strlen(text));
+	cpy[strlen(text)] = 0;
+	c = cpy;
+	while (*c) {
+		if (!strncasecmp(c, "<A", 2)) {
+			while (1) {
+				if (!strncasecmp(c, "/A>", 3)) {
+					break;
+				}
+				text[cnt++] = *c;
+				c++;
+				if (!(*c))
+					break;
+			}
+		} else if ((!strncasecmp(c, "http://", 7) || (!strncasecmp(c, "https://", 8)))) {
+			t = c;
+			while (1) {
+				if (badchar(*t)) {
 
-					if (*(t) == ',' && (*(t+1) != ' '))
-					{
+					if (*(t) == ',' && (*(t + 1) != ' ')) {
 						t++;
 						continue;
 					}
 
-                                        if (*(t-1) == '.')
-                                                t--;
-                                        strncpy(url_buf, c, t-c);
-                                        url_buf[t-c] = 0;
-                                        cnt += g_snprintf(&text[cnt++], 1024, "<A HREF=\"%s\">%s</A>", url_buf, url_buf);
-                                        cnt--;
-                                        c = t;
-                                        break;
-                                }
-                                if (!t)
-                                        break;
-                                t++;
+					if (*(t - 1) == '.')
+						t--;
+					strncpy(url_buf, c, t - c);
+					url_buf[t - c] = 0;
+					cnt +=
+					    g_snprintf(&text[cnt++], 1024, "<A HREF=\"%s\">%s</A>",
+						       url_buf, url_buf);
+					cnt--;
+					c = t;
+					break;
+				}
+				if (!t)
+					break;
+				t++;
 
-                        }
-                } else if (!strncasecmp(c, "www.", 4)) {
-                        if (strncasecmp(c, "www..", 5)) {
-                        t = c;
-                        while(1) {
-                                if (badchar(*t)) {
-                                        if (t-c == 4) {
-                                                break;
-                                        }
+			}
+		} else if (!strncasecmp(c, "www.", 4)) {
+			if (strncasecmp(c, "www..", 5)) {
+				t = c;
+				while (1) {
+					if (badchar(*t)) {
+						if (t - c == 4) {
+							break;
+						}
 
-					if (*(t) == ',' && (*(t+1) != ' '))
-					{
-						t++;
-						continue;
+						if (*(t) == ',' && (*(t + 1) != ' ')) {
+							t++;
+							continue;
+						}
+
+						if (*(t - 1) == '.')
+							t--;
+						strncpy(url_buf, c, t - c);
+						url_buf[t - c] = 0;
+						cnt +=
+						    g_snprintf(&text[cnt++], 1024,
+							       "<A HREF=\"http://%s\">%s</A>", url_buf,
+							       url_buf);
+						cnt--;
+						c = t;
+						break;
 					}
-					
-                                        if (*(t-1) == '.')
-                                                t--;
-                                        strncpy(url_buf, c, t-c);
-                                        url_buf[t-c] = 0;
-                                        cnt += g_snprintf(&text[cnt++], 1024, "<A HREF=\"http://%s\">%s</A>", url_buf, url_buf);
-                                        cnt--;
-                                        c = t;
-                                        break;
-                                }
-                                if (!t)
-                                        break;
-                                t++;
-                        }
-                 }
-                } else if (!strncasecmp(c, "ftp://", 6)) {
-                        t = c;
-                        while(1) {
-                                if (badchar(*t)) {
-                                        if (*(t-1) == '.')
-                                                t--;
-                                        strncpy(url_buf, c, t-c);
-                                        url_buf[t-c] = 0;
-                                        cnt += g_snprintf(&text[cnt++], 1024, "<A HREF=\"%s\">%s</A>", url_buf, url_buf);
-                                        cnt--;
-                                        c = t;
-                                        break;
-                                }
-                                if (!t)
-                                        break;
-                                t++;
+					if (!t)
+						break;
+					t++;
+				}
+			}
+		} else if (!strncasecmp(c, "ftp://", 6)) {
+			t = c;
+			while (1) {
+				if (badchar(*t)) {
+					if (*(t - 1) == '.')
+						t--;
+					strncpy(url_buf, c, t - c);
+					url_buf[t - c] = 0;
+					cnt +=
+					    g_snprintf(&text[cnt++], 1024, "<A HREF=\"%s\">%s</A>",
+						       url_buf, url_buf);
+					cnt--;
+					c = t;
+					break;
+				}
+				if (!t)
+					break;
+				t++;
 
-                        }
-                } else if (!strncasecmp(c, "ftp.", 4) ) {
+			}
+		} else if (!strncasecmp(c, "ftp.", 4)) {
 			if (strncasecmp(c, "ftp..", 5)) {
-                        t = c;
-                        while(1) {
-                                if (badchar(*t)) {
-                                        if (t-c == 4) {
-                                                break;
-                                        }
-                                        if (*(t-1) == '.')
-                                                t--;
-                                        strncpy(url_buf, c, t-c);
-                                        url_buf[t-c] = 0;
-                                        cnt += g_snprintf(&text[cnt++], 1024, "<A HREF=\"ftp://%s\">%s</A>", url_buf, url_buf);
-                                        cnt--; 
-                                        c = t;
-                                        break;
-                                }
-                                if (!t)
-                                        break;
-                                t++;
-                        }
+				t = c;
+				while (1) {
+					if (badchar(*t)) {
+						if (t - c == 4) {
+							break;
+						}
+						if (*(t - 1) == '.')
+							t--;
+						strncpy(url_buf, c, t - c);
+						url_buf[t - c] = 0;
+						cnt +=
+						    g_snprintf(&text[cnt++], 1024,
+							       "<A HREF=\"ftp://%s\">%s</A>", url_buf,
+							       url_buf);
+						cnt--;
+						c = t;
+						break;
+					}
+					if (!t)
+						break;
+					t++;
+				}
 			}
-                } else if (!strncasecmp(c, "mailto:", 7)) {
-                        t = c;
-                        while(1) {
-                                if (badchar(*t)) {
-                                        if (*(t-1) == '.')
-                                                t--;
-                                        strncpy(url_buf, c, t-c);
-                                        url_buf[t-c] = 0;
-                                        cnt += g_snprintf(&text[cnt++], 1024, "<A HREF=\"%s\">%s</A>", url_buf, url_buf);
-                                        cnt--;
-                                        c = t;
-                                        break;
-                                }
-                                if (!t)
-                                        break;
-                                t++;
+		} else if (!strncasecmp(c, "mailto:", 7)) {
+			t = c;
+			while (1) {
+				if (badchar(*t)) {
+					if (*(t - 1) == '.')
+						t--;
+					strncpy(url_buf, c, t - c);
+					url_buf[t - c] = 0;
+					cnt +=
+					    g_snprintf(&text[cnt++], 1024, "<A HREF=\"%s\">%s</A>",
+						       url_buf, url_buf);
+					cnt--;
+					c = t;
+					break;
+				}
+				if (!t)
+					break;
+				t++;
 
-                        }
-                } else if (!strncasecmp(c, "@", 1)) {
-                        char *tmp;
-                        int flag;
-                        int len=0;
+			}
+		} else if (!strncasecmp(c, "@", 1)) {
+			char *tmp;
+			int flag;
+			int len = 0;
 			char illegal_chars[] = "!@#$%^&*()[]{}/\\<>\":;\0";
-                        url_buf[0] = 0;
+			url_buf[0] = 0;
 
-                        if (*(c-1) == ' ' || *(c+1) == ' ' || rindex(illegal_chars, *(c+1)) || *(c+1) == 13 || *(c+1) == 10)
-                                flag = 0;
-                        else
-                                flag = 1;
+			if (*(c - 1) == ' ' || *(c + 1) == ' ' || rindex(illegal_chars, *(c + 1))
+			    || *(c + 1) == 13 || *(c + 1) == 10)
+				flag = 0;
+			else
+				flag = 1;
 
-                        t = c;
-                        while(flag) {
-                                if (badchar(*t)) {
-                                        cnt -= (len - 1);
-                                        break;
-                                } else {
-                                        len++;
-                                        tmp = g_malloc(len + 1);
-                                        tmp[len] = 0;
-                                        tmp[0] = *t;
-                                        strncpy(tmp + 1, url_buf, len - 1);
-                                        strcpy(url_buf, tmp);
-                                        url_buf[len] = 0;
-                                        g_free(tmp);
-                                        t--;
-                                        if (t < cpy) {
-                                                cnt = 0;
-                                                break;
-                                        }
-                                }
-                        }
+			t = c;
+			while (flag) {
+				if (badchar(*t)) {
+					cnt -= (len - 1);
+					break;
+				} else {
+					len++;
+					tmp = g_malloc(len + 1);
+					tmp[len] = 0;
+					tmp[0] = *t;
+					strncpy(tmp + 1, url_buf, len - 1);
+					strcpy(url_buf, tmp);
+					url_buf[len] = 0;
+					g_free(tmp);
+					t--;
+					if (t < cpy) {
+						cnt = 0;
+						break;
+					}
+				}
+			}
 
 
-                        t = c + 1;
+			t = c + 1;
 
-                        while(flag) {
-                                if (badchar(*t)) {
-                                        if (*(t-1) == '.')
-                                                t--;
-                                        cnt += g_snprintf(&text[cnt++], 1024, "<A HREF=\"mailto:%s\">%s</A>", url_buf, url_buf);
-                                        text[cnt]=0;
+			while (flag) {
+				if (badchar(*t)) {
+					if (*(t - 1) == '.')
+						t--;
+					cnt +=
+					    g_snprintf(&text[cnt++], 1024,
+						       "<A HREF=\"mailto:%s\">%s</A>", url_buf, url_buf);
+					text[cnt] = 0;
 
 
-                                        cnt--;
-                                        c = t;
+					cnt--;
+					c = t;
 
-                                        break;
-                                } else {
-                                        strncat(url_buf, t, 1);
-                                        len++;
-                                        url_buf[len] = 0;
-                                }
+					break;
+				} else {
+					strncat(url_buf, t, 1);
+					len++;
+					url_buf[len] = 0;
+				}
 
-                                t++;
+				t++;
 
-                        }
+			}
 
 
-                }
+		}
 
-                if (*c == 0)
-                        break;
+		if (*c == 0)
+			break;
 
-                text[cnt++] = *c;
-                c++;
+		text[cnt++] = *c;
+		c++;
 
-        }
-        text[cnt]=0;
+	}
+	text[cnt] = 0;
 	g_free(cpy);
-        return cnt; 
+	return cnt;
 }
 
 
-FILE *open_log_file (char *name)
+FILE *open_log_file(char *name)
 {
-        char *buf;
-        char *buf2;
-        char log_all_file[256];
-        struct log_conversation *l;
-        struct stat st;
-        int flag = 0;
-        FILE *fd;
-        int res;
-	gchar* gaim_dir;
+	char *buf;
+	char *buf2;
+	char log_all_file[256];
+	struct log_conversation *l;
+	struct stat st;
+	int flag = 0;
+	FILE *fd;
+	int res;
+	gchar *gaim_dir;
 
-        if (!(general_options & OPT_GEN_LOG_ALL)) {
+	if (!(general_options & OPT_GEN_LOG_ALL)) {
 
-                l = find_log_info(name);
-                if (!l)
-                        return NULL;
+		l = find_log_info(name);
+		if (!l)
+			return NULL;
 
-                if (stat(l->filename, &st) < 0)
-                        flag = 1;
+		if (stat(l->filename, &st) < 0)
+			flag = 1;
 
-                fd = fopen(l->filename, "a");
+		fd = fopen(l->filename, "a");
 
-                if (flag) { /* is a new file */
-                        fprintf(fd, "<HTML><HEAD><TITLE>" );
-                        fprintf(fd, "IM Sessions with %s", name );
-                        fprintf(fd, "</TITLE></HEAD><BODY BGCOLOR=\"ffffff\">\n" );
-                }
+		if (flag) {	/* is a new file */
+			fprintf(fd, "<HTML><HEAD><TITLE>");
+			fprintf(fd, "IM Sessions with %s", name);
+			fprintf(fd, "</TITLE></HEAD><BODY BGCOLOR=\"ffffff\">\n");
+		}
 
-                return fd;
-        }
+		return fd;
+	}
 
 	buf = g_malloc(BUF_LONG);
 	buf2 = g_malloc(BUF_LONG);
 	gaim_dir = gaim_user_dir();
-	
-        /*  Dont log yourself */
+
+	/*  Dont log yourself */
 	strncpy(log_all_file, gaim_dir, 256);
 
-        stat(log_all_file, &st);
-        if (!S_ISDIR(st.st_mode))
-                unlink(log_all_file);
+	stat(log_all_file, &st);
+	if (!S_ISDIR(st.st_mode))
+		unlink(log_all_file);
 
-        fd = fopen(log_all_file, "r");
+	fd = fopen(log_all_file, "r");
 
-        if (!fd) {
-                res = mkdir(log_all_file, S_IRUSR | S_IWUSR | S_IXUSR);
-                if (res < 0) {
-                        g_snprintf(buf, BUF_LONG, "Unable to make directory %s for logging", log_all_file);
-                        do_error_dialog(buf, "Error!");
-                        g_free(buf);
-                        g_free(buf2);
-                        return NULL;
-                }
-        } else
-                fclose(fd);
+	if (!fd) {
+		res = mkdir(log_all_file, S_IRUSR | S_IWUSR | S_IXUSR);
+		if (res < 0) {
+			g_snprintf(buf, BUF_LONG, "Unable to make directory %s for logging",
+				   log_all_file);
+			do_error_dialog(buf, "Error!");
+			g_free(buf);
+			g_free(buf2);
+			return NULL;
+		}
+	} else
+		fclose(fd);
 
-		g_snprintf(log_all_file, 256, "%s/logs", gaim_dir);
+	g_snprintf(log_all_file, 256, "%s/logs", gaim_dir);
 
-        if (stat(log_all_file, &st) < 0)
-                flag = 1;
-        if (!S_ISDIR(st.st_mode))
-                unlink(log_all_file);
+	if (stat(log_all_file, &st) < 0)
+		flag = 1;
+	if (!S_ISDIR(st.st_mode))
+		unlink(log_all_file);
 
-        fd = fopen(log_all_file, "r");
-        if (!fd) {
-                res = mkdir(log_all_file, S_IRUSR | S_IWUSR | S_IXUSR);
-                if (res < 0) {
-                        g_snprintf(buf, BUF_LONG, "Unable to make directory %s for logging", log_all_file);
-                        do_error_dialog(buf, "Error!");
-                        g_free(buf);
-                        g_free(buf2);
-                        return NULL;
-                }
-        } else
-                fclose(fd);
+	fd = fopen(log_all_file, "r");
+	if (!fd) {
+		res = mkdir(log_all_file, S_IRUSR | S_IWUSR | S_IXUSR);
+		if (res < 0) {
+			g_snprintf(buf, BUF_LONG, "Unable to make directory %s for logging",
+				   log_all_file);
+			do_error_dialog(buf, "Error!");
+			g_free(buf);
+			g_free(buf2);
+			return NULL;
+		}
+	} else
+		fclose(fd);
+
 
-        
 
-        g_snprintf(log_all_file, 256, "%s/logs/%s.log", gaim_dir, normalize(name));
-        if (stat(log_all_file, &st) < 0)
-                flag = 1;
+	g_snprintf(log_all_file, 256, "%s/logs/%s.log", gaim_dir, normalize(name));
+	if (stat(log_all_file, &st) < 0)
+		flag = 1;
 
-        debug_printf("Logging to: \"%s\"\n", log_all_file);
+	debug_printf("Logging to: \"%s\"\n", log_all_file);
 
-        fd = fopen(log_all_file, "a");
+	fd = fopen(log_all_file, "a");
 
-        if (fd && flag) { /* is a new file */
-		fprintf(fd, "<HTML><HEAD><TITLE>" );
-		fprintf(fd, "IM Sessions with %s", name );
-		fprintf(fd, "</TITLE></HEAD><BODY BGCOLOR=\"ffffff\">\n" );
-        }
+	if (fd && flag) {	/* is a new file */
+		fprintf(fd, "<HTML><HEAD><TITLE>");
+		fprintf(fd, "IM Sessions with %s", name);
+		fprintf(fd, "</TITLE></HEAD><BODY BGCOLOR=\"ffffff\">\n");
+	}
 
 	g_free(buf);
 	g_free(buf2);
 	g_free(gaim_dir);
-        return fd;
+	return fd;
 }
 
 
@@ -424,31 +440,31 @@
 int escape_message(char *msg)
 {
 	char *c, *cpy;
-	int cnt=0;
+	int cnt = 0;
 	/* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
 	if (strlen(msg) > BUF_LEN) {
 		debug_printf("Warning:  truncating message to 2048 bytes\n");
-		msg[2047]='\0';
+		msg[2047] = '\0';
 	}
 
 	cpy = g_strdup(msg);
 	c = cpy;
-	while(*c) {
-		switch(*c) {
+	while (*c) {
+		switch (*c) {
 		case '$':
 		case '[':
 		case ']':
 		case '(':
 		case ')':
 		case '#':
-			msg[cnt++]='\\';
+			msg[cnt++] = '\\';
 			/* Fall through */
 		default:
-			msg[cnt++]=*c;
+			msg[cnt++] = *c;
 		}
 		c++;
 	}
-	msg[cnt]='\0';
+	msg[cnt] = '\0';
 	g_free(cpy);
 	return cnt;
 }
@@ -457,17 +473,17 @@
 int escape_text(char *msg)
 {
 	char *c, *cpy;
-	int cnt=0;
+	int cnt = 0;
 	/* Assumes you have a buffer able to cary at least BUF_LEN * 4 bytes */
 	if (strlen(msg) > BUF_LEN) {
 		fprintf(stderr, "Warning:  truncating message to 2048 bytes\n");
-		msg[2047]='\0';
+		msg[2047] = '\0';
 	}
 
 	cpy = g_strdup(msg);
 	c = cpy;
-	while(*c) {
-		switch(*c) {
+	while (*c) {
+		switch (*c) {
 		case '\n':
 			msg[cnt++] = '<';
 			msg[cnt++] = 'B';
@@ -478,61 +494,60 @@
 		case '}':
 		case '\\':
 		case '"':
-			msg[cnt++]='\\';
+			msg[cnt++] = '\\';
 			/* Fall through */
 		default:
-			msg[cnt++]=*c;
+			msg[cnt++] = *c;
 		}
 		c++;
 	}
-	msg[cnt]='\0';
+	msg[cnt] = '\0';
 	g_free(cpy);
 	return cnt;
 }
 
-char * escape_text2(char *msg)
+char *escape_text2(char *msg)
 {
 	char *c, *cpy;
 	char *woo;
-        int cnt=0;
-        /* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
-        if (strlen(msg) > BUF_LEN) {
-                fprintf(stderr, "Warning:  truncating message to 2048 bytes\n");
-                msg[2047]='\0';
-        }
+	int cnt = 0;
+	/* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
+	if (strlen(msg) > BUF_LEN) {
+		fprintf(stderr, "Warning:  truncating message to 2048 bytes\n");
+		msg[2047] = '\0';
+	}
 
-	woo = malloc(strlen(msg) * 2); 
-        cpy = g_strdup(msg);
-        c = cpy;
-        while(*c) {
-                switch(*c) {
-                case '\n':
-                        woo[cnt++] = '<';
-                        woo[cnt++] = 'B';
-                        woo[cnt++] = 'R';
-                        woo[cnt++] = '>';
-                        break;
-                case '{':
-                case '}':
-                case '\\':
-                case '"':
-                        woo[cnt++]='\\';
-                        /* Fall through */
-                default:
-                        woo[cnt++]=*c;
-                }
-                c++;
-        }
-        woo[cnt]='\0';
+	woo = malloc(strlen(msg) * 2);
+	cpy = g_strdup(msg);
+	c = cpy;
+	while (*c) {
+		switch (*c) {
+		case '\n':
+			woo[cnt++] = '<';
+			woo[cnt++] = 'B';
+			woo[cnt++] = 'R';
+			woo[cnt++] = '>';
+			break;
+		case '{':
+		case '}':
+		case '\\':
+		case '"':
+			woo[cnt++] = '\\';
+			/* Fall through */
+		default:
+			woo[cnt++] = *c;
+		}
+		c++;
+	}
+	woo[cnt] = '\0';
 
-	g_free (cpy);
-        return woo;
+	g_free(cpy);
+	return woo;
 }
 
 
-char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
-                  "0123456789+/";
-                  
+char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" "0123456789+/";
+
 
 char *tobase64(char *text)
 {
@@ -540,47 +555,47 @@
 	char *c;
 	unsigned int tmp = 0;
 	int len = 0, n = 0;
-    
+
 	c = text;
-    
-	while(c) {
+
+	while (c) {
 		tmp = tmp << 8;
 		tmp += *c;
 		n++;
 
 		if (n == 3) {
-			out = g_realloc(out, len+4);
+			out = g_realloc(out, len + 4);
 			out[len] = alphabet[(tmp >> 18) & 0x3f];
-			out[len+1] = alphabet[(tmp >> 12) & 0x3f];
-			out[len+2] = alphabet[(tmp >> 6) & 0x3f];
-			out[len+3] = alphabet[tmp & 0x3f];
+			out[len + 1] = alphabet[(tmp >> 12) & 0x3f];
+			out[len + 2] = alphabet[(tmp >> 6) & 0x3f];
+			out[len + 3] = alphabet[tmp & 0x3f];
 			len += 4;
 			tmp = 0;
 			n = 0;
 		}
 		c++;
 	}
-	switch(n) {
+	switch (n) {
 
 	case 2:
-		out = g_realloc(out, len+5);
+		out = g_realloc(out, len + 5);
 		out[len] = alphabet[(tmp >> 12) & 0x3f];
-		out[len+1] = alphabet[(tmp >> 6) & 0x3f];
-		out[len+2] = alphabet[tmp & 0x3f];
-		out[len+3] = '=';
-		out[len+4] = 0;
+		out[len + 1] = alphabet[(tmp >> 6) & 0x3f];
+		out[len + 2] = alphabet[tmp & 0x3f];
+		out[len + 3] = '=';
+		out[len + 4] = 0;
 		break;
 	case 1:
-		out = g_realloc(out, len+4);
+		out = g_realloc(out, len + 4);
 		out[len] = alphabet[(tmp >> 6) & 0x3f];
-		out[len+1] = alphabet[tmp & 0x3f];
-		out[len+2] = '=';
-		out[len+3] = 0;
+		out[len + 1] = alphabet[tmp & 0x3f];
+		out[len + 2] = '=';
+		out[len + 3] = 0;
 		break;
 	case 0:
-		out = g_realloc(out, len+2);
+		out = g_realloc(out, len + 2);
 		out[len] = '=';
-		out[len+1] = 0;
+		out[len + 1] = 0;
 		break;
 	}
 	return out;
@@ -589,84 +604,84 @@
 
 char *frombase64(char *text)
 {
-        char *out = NULL;
-        char tmp = 0;
-        char *c;
-        gint32 tmp2 = 0;
-        int len = 0, n = 0;
-        
-        c = text;
-        
-        while(*c) {
-                if (*c >= 'A' && *c <= 'Z') {
-                        tmp = *c - 'A';
-                } else if (*c >= 'a' && *c <= 'z') {
-                        tmp = 26 + (*c - 'a');
-                } else if (*c >= '0' && *c <= 57) {
-                        tmp = 52 + (*c - '0');
-                } else if (*c == '+') {
-                        tmp = 62;
-                } else if (*c == '/') {
-                        tmp = 63;
-                } else if (*c == '=') {
-                        if (n == 3) {
-                                out = g_realloc(out, len + 2);
-                                out[len] = (char)(tmp2 >> 10) & 0xff;
-                                len++;
-                                out[len] = (char)(tmp2 >> 2) & 0xff;
-                                len++;
-                        } else if (n == 2) {
-                                out = g_realloc(out, len + 1);
-                                out[len] = (char)(tmp2 >> 4) & 0xff;
-                                len++;
-                        }
-                        break;
-                }
-                tmp2 = ((tmp2 << 6) | (tmp & 0xff));
-                n++;
-                if (n == 4) {
-                        out = g_realloc(out, len + 3);
-                        out[len] = (char)((tmp2 >> 16) & 0xff);
-                        len++;
-                        out[len] = (char)((tmp2 >> 8) & 0xff);
-                        len++;
-                        out[len] = (char)(tmp2 & 0xff);
-                        len++;
-                        tmp2 = 0;
-                        n = 0;
-                }
-                c++;
-        }
+	char *out = NULL;
+	char tmp = 0;
+	char *c;
+	gint32 tmp2 = 0;
+	int len = 0, n = 0;
+
+	c = text;
 
-        out = g_realloc(out, len+1);
-        out[len] = 0;
-        
-        return out;
+	while (*c) {
+		if (*c >= 'A' && *c <= 'Z') {
+			tmp = *c - 'A';
+		} else if (*c >= 'a' && *c <= 'z') {
+			tmp = 26 + (*c - 'a');
+		} else if (*c >= '0' && *c <= 57) {
+			tmp = 52 + (*c - '0');
+		} else if (*c == '+') {
+			tmp = 62;
+		} else if (*c == '/') {
+			tmp = 63;
+		} else if (*c == '=') {
+			if (n == 3) {
+				out = g_realloc(out, len + 2);
+				out[len] = (char)(tmp2 >> 10) & 0xff;
+				len++;
+				out[len] = (char)(tmp2 >> 2) & 0xff;
+				len++;
+			} else if (n == 2) {
+				out = g_realloc(out, len + 1);
+				out[len] = (char)(tmp2 >> 4) & 0xff;
+				len++;
+			}
+			break;
+		}
+		tmp2 = ((tmp2 << 6) | (tmp & 0xff));
+		n++;
+		if (n == 4) {
+			out = g_realloc(out, len + 3);
+			out[len] = (char)((tmp2 >> 16) & 0xff);
+			len++;
+			out[len] = (char)((tmp2 >> 8) & 0xff);
+			len++;
+			out[len] = (char)(tmp2 & 0xff);
+			len++;
+			tmp2 = 0;
+			n = 0;
+		}
+		c++;
+	}
+
+	out = g_realloc(out, len + 1);
+	out[len] = 0;
+
+	return out;
 }
 
 
 char *normalize(const char *s)
 {
 	static char buf[BUF_LEN];
-        char *t, *u;
-        int x=0;
+	char *t, *u;
+	int x = 0;
 
-        g_return_val_if_fail ((s != NULL), NULL);
+	g_return_val_if_fail((s != NULL), NULL);
 
-        u = t = g_strdup(s);
+	u = t = g_strdup(s);
 
-        strcpy(t, s);
-        g_strdown(t);
-        
-	while(*t && (x < BUF_LEN - 1)) {
+	strcpy(t, s);
+	g_strdown(t);
+
+	while (*t && (x < BUF_LEN - 1)) {
 		if (*t != ' ') {
 			buf[x] = *t;
 			x++;
 		}
 		t++;
 	}
-        buf[x]='\0';
-        g_free(u);
+	buf[x] = '\0';
+	g_free(u);
 	return buf;
 }
 
@@ -697,23 +712,23 @@
 {
 #ifndef _WIN32
 	if (icon_pm == NULL) {
-		icon_pm = gdk_pixmap_create_from_xpm_d(w, &icon_bm,
-							   NULL, (gchar **)aimicon_xpm);
+		icon_pm = gdk_pixmap_create_from_xpm_d(w, &icon_bm, NULL, (gchar **)aimicon_xpm);
 	}
 	gdk_window_set_icon(w, NULL, icon_pm, icon_bm);
-	if (mainwindow) gdk_window_set_group(w, mainwindow->window);
+	if (mainwindow)
+		gdk_window_set_group(w, mainwindow->window);
 #endif
 }
 
 struct aim_user *find_user(const char *name, int protocol)
 {
-        char *who = g_strdup(normalize(name));
-        GList *usr = aim_users;
-        struct aim_user *u;
+	char *who = g_strdup(normalize(name));
+	GList *usr = aim_users;
+	struct aim_user *u;
 
-        while(usr) {
-                u = (struct aim_user *)usr->data;
-                if (!strcmp(normalize(u->username), who)) {
+	while (usr) {
+		u = (struct aim_user *)usr->data;
+		if (!strcmp(normalize(u->username), who)) {
 			if (protocol != -1) {
 				if (u->protocol == protocol) {
 					g_free(who);
@@ -723,12 +738,12 @@
 				g_free(who);
 				return u;
 			}
-				
-                }
-                usr = usr->next;
-        }
-        g_free(who);
-        return NULL;
+
+		}
+		usr = usr->next;
+	}
+	g_free(who);
+	return NULL;
 }
 
 
@@ -738,50 +753,50 @@
 {
 	char *c;
 	static char cpy[BUF_LONG];
-	int cnt=0;
+	int cnt = 0;
 	time_t t = time(0);
 	struct tm *tme = localtime(&t);
 	char tmp[20];
 
 	cpy[0] = '\0';
 	c = msg;
-	while(*c) {
-		switch(*c) {
+	while (*c) {
+		switch (*c) {
 		case '%':
-			if (*(c+1)) {
-				switch (*(c+1)) {
+			if (*(c + 1)) {
+				switch (*(c + 1)) {
 				case 'n':
 					// append name
-					strcpy (cpy+cnt, name);
+					strcpy(cpy + cnt, name);
 					cnt += strlen(name);
 					c++;
 					break;
 				case 'd':
 					// append date
-					strftime (tmp, 20, "%D", tme);
-					strcpy (cpy+cnt, tmp);
+					strftime(tmp, 20, "%D", tme);
+					strcpy(cpy + cnt, tmp);
 					cnt += strlen(tmp);
 					c++;
 					break;
 				case 't':
 					// append time
-					strftime (tmp, 20, "%r", tme);
-					strcpy (cpy+cnt, tmp);
+					strftime(tmp, 20, "%r", tme);
+					strcpy(cpy + cnt, tmp);
 					cnt += strlen(tmp);
 					c++;
 					break;
 				default:
-					cpy[cnt++]=*c;
+					cpy[cnt++] = *c;
 				}
 			}
 			break;
 		default:
-			cpy[cnt++]=*c;
+			cpy[cnt++] = *c;
 		}
 		c++;
 	}
-	cpy[cnt]='\0';
-	return(cpy);
+	cpy[cnt] = '\0';
+	return (cpy);
 }
 
 GtkWidget *picture_button(GtkWidget *window, char *text, char **xpm)
@@ -808,8 +823,7 @@
 	pixmap = gtk_pixmap_new(pm, mask);
 	gtk_box_pack_end(GTK_BOX(button_box_2), pixmap, FALSE, FALSE, 0);
 
-	if (text)
-	{
+	if (text) {
 		label = gtk_label_new(text);
 		gtk_box_pack_start(GTK_BOX(button_box_3), label, FALSE, FALSE, 2);
 		gtk_widget_show(label);
@@ -825,7 +839,7 @@
 	gtk_widget_show(button);
 	gdk_pixmap_unref(pm);
 	gdk_bitmap_unref(mask);
-		
+
 	return button;
 }
 
@@ -839,7 +853,8 @@
 	GtkWidget *pixmap;
 	GtkWidget *label;
 
-	if (!button_tips) button_tips = gtk_tooltips_new();
+	if (!button_tips)
+		button_tips = gtk_tooltips_new();
 	button = gtk_button_new();
 	if (display_options & OPT_DISP_COOL_LOOK)
 		gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
@@ -863,21 +878,20 @@
 		gdk_bitmap_unref(mask);
 	}
 
-	if (dispstyle == 2 || dispstyle == 1)
-	{
+	if (dispstyle == 2 || dispstyle == 1) {
 		label = gtk_label_new(text);
 		gtk_widget_show(label);
 		gtk_box_pack_end(GTK_BOX(button_box_2), label, FALSE, FALSE, 0);
 	}
 
-	gtk_tooltips_set_tip(button_tips, button, text, "Gaim");	
+	gtk_tooltips_set_tip(button_tips, button, text, "Gaim");
 	gtk_widget_show(button);
 	return button;
 }
 
 
 /* remove leading whitespace from a string */
-char *remove_spaces (char *str)
+char *remove_spaces(char *str)
 {
 	int i;
 	char *new;
@@ -885,7 +899,7 @@
 	if (str == NULL)
 		return NULL;
 
-	i = strspn (str, " \t\n\r\f");
+	i = strspn(str, " \t\n\r\f");
 	new = &str[i];
 
 	return new;
@@ -893,31 +907,31 @@
 
 
 /* translate an AIM 3 buddylist (*.lst) to a GAIM buddylist */
-void translate_lst (FILE *src_fp, char *dest) 
+void translate_lst(FILE *src_fp, char *dest)
 {
 	char line[BUF_LEN], *line2;
 	char *name;
 	int i;
 
-	sprintf (dest, "m 1\n");
-  
-	while (fgets (line, BUF_LEN, src_fp)) {
-		line2 = remove_spaces (line);
-		if (strstr (line2, "group") == line2) {
-			name = strpbrk (line2, " \t\n\r\f") + 1;
-			strcat (dest, "g ");
-			for (i = 0; i < strcspn (name, "\n\r"); i++)
+	sprintf(dest, "m 1\n");
+
+	while (fgets(line, BUF_LEN, src_fp)) {
+		line2 = remove_spaces(line);
+		if (strstr(line2, "group") == line2) {
+			name = strpbrk(line2, " \t\n\r\f") + 1;
+			strcat(dest, "g ");
+			for (i = 0; i < strcspn(name, "\n\r"); i++)
 				if (name[i] != '\"')
-					strncat (dest, &name[i], 1);
-			strcat (dest, "\n");
+					strncat(dest, &name[i], 1);
+			strcat(dest, "\n");
 		}
-		if (strstr (line2, "buddy") == line2) {
-			name = strpbrk (line2, " \t\n\r\f") + 1;
-			strcat (dest, "b ");
-			for (i = 0; i < strcspn (name, "\n\r"); i++)
+		if (strstr(line2, "buddy") == line2) {
+			name = strpbrk(line2, " \t\n\r\f") + 1;
+			strcat(dest, "b ");
+			for (i = 0; i < strcspn(name, "\n\r"); i++)
 				if (name[i] != '\"')
-					strncat (dest, &name[i], 1);
-			strcat (dest, "\n");
+					strncat(dest, &name[i], 1);
+			strcat(dest, "\n");
 		}
 	}
 
@@ -926,75 +940,75 @@
 
 
 /* translate an AIM 4 buddylist (*.blt) to GAIM format */
-void translate_blt (FILE *src_fp, char *dest)
+void translate_blt(FILE *src_fp, char *dest)
 {
 	int i;
 	char line[BUF_LEN];
 	char *buddy;
 
-	sprintf (dest, "m 1\n");
-  
-	while (strstr (fgets (line, BUF_LEN, src_fp), "Buddy") == NULL) ;
-	while (strstr (fgets (line, BUF_LEN, src_fp), "list") == NULL)  ;
+	sprintf(dest, "m 1\n");
+
+	while (strstr(fgets(line, BUF_LEN, src_fp), "Buddy") == NULL);
+	while (strstr(fgets(line, BUF_LEN, src_fp), "list") == NULL);
 
 	while (1) {
-		fgets (line, BUF_LEN, src_fp);
-		if (strchr (line, '}') != NULL)
+		fgets(line, BUF_LEN, src_fp);
+		if (strchr(line, '}') != NULL)
 			break;
-	
+
 		/* Syntax starting with "<group> {" */
-		if (strchr (line, '{') != NULL) {
-			strcat (dest, "g ");
-			buddy = remove_spaces (strtok (line, "{"));
+		if (strchr(line, '{') != NULL) {
+			strcat(dest, "g ");
+			buddy = remove_spaces(strtok(line, "{"));
 			for (i = 0; i < strlen(buddy); i++) {
 				if (buddy[i] != '\"')
-					strncat (dest, &buddy[i], 1);
+					strncat(dest, &buddy[i], 1);
 			}
-			strcat (dest, "\n");
-			while (strchr (fgets (line, BUF_LEN, src_fp), '}') == NULL) {
-				buddy = remove_spaces (line);
-				strcat (dest, "b ");
-				if (strchr (buddy, '\"') != NULL) {
-					strncat (dest, &buddy[1], strlen(buddy)-3);
-					strcat (dest, "\n");
+			strcat(dest, "\n");
+			while (strchr(fgets(line, BUF_LEN, src_fp), '}') == NULL) {
+				buddy = remove_spaces(line);
+				strcat(dest, "b ");
+				if (strchr(buddy, '\"') != NULL) {
+					strncat(dest, &buddy[1], strlen(buddy) - 3);
+					strcat(dest, "\n");
 				} else
-					strcat (dest, buddy);
+					strcat(dest, buddy);
 			}
 		}
 		/* Syntax "group buddy buddy ..." */
 		else {
-			buddy = remove_spaces (strtok (line, " \n"));
-			strcat (dest, "g ");
-			if (strchr (buddy, '\"') != NULL) {
-				strcat (dest, &buddy[1]);
-				strcat (dest, " ");
-				buddy = remove_spaces (strtok (NULL, " \n"));
-				while (strchr (buddy, '\"') == NULL) {
-					strcat (dest, buddy);
-					strcat (dest, " ");
-					buddy = remove_spaces (strtok (NULL, " \n"));
+			buddy = remove_spaces(strtok(line, " \n"));
+			strcat(dest, "g ");
+			if (strchr(buddy, '\"') != NULL) {
+				strcat(dest, &buddy[1]);
+				strcat(dest, " ");
+				buddy = remove_spaces(strtok(NULL, " \n"));
+				while (strchr(buddy, '\"') == NULL) {
+					strcat(dest, buddy);
+					strcat(dest, " ");
+					buddy = remove_spaces(strtok(NULL, " \n"));
 				}
-				strncat (dest, buddy, strlen(buddy)-1);
+				strncat(dest, buddy, strlen(buddy) - 1);
 			} else {
-				strcat (dest, buddy);
+				strcat(dest, buddy);
 			}
-			strcat (dest, "\n");
-			while ((buddy = remove_spaces (strtok (NULL, " \n"))) != NULL) {
-				strcat (dest, "b ");
-				if (strchr (buddy, '\"') != NULL) {
-					strcat (dest, &buddy[1]);
-					strcat (dest, " ");
-					buddy = remove_spaces (strtok (NULL, " \n"));
-					while (strchr (buddy, '\"') == NULL) {
-						strcat (dest, buddy);
-						strcat (dest, " ");
-						buddy = remove_spaces (strtok (NULL, " \n"));
+			strcat(dest, "\n");
+			while ((buddy = remove_spaces(strtok(NULL, " \n"))) != NULL) {
+				strcat(dest, "b ");
+				if (strchr(buddy, '\"') != NULL) {
+					strcat(dest, &buddy[1]);
+					strcat(dest, " ");
+					buddy = remove_spaces(strtok(NULL, " \n"));
+					while (strchr(buddy, '\"') == NULL) {
+						strcat(dest, buddy);
+						strcat(dest, " ");
+						buddy = remove_spaces(strtok(NULL, " \n"));
 					}
-					strncat (dest, buddy, strlen(buddy)-1);
+					strncat(dest, buddy, strlen(buddy) - 1);
 				} else {
-					strcat (dest, buddy);
+					strcat(dest, buddy);
 				}
-				strcat (dest, "\n");
+				strcat(dest, "\n");
 			}
 		}
 	}
@@ -1004,7 +1018,7 @@
 
 char *stylize(gchar *text, int length)
 {
-	gchar *buf;	
+	gchar *buf;
 	char tmp[length];
 
 	buf = g_malloc(length);
@@ -1036,86 +1050,86 @@
 	}
 
 	if (font_options & OPT_FONT_FGCOL) {
-		g_snprintf(tmp, length, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", fgcolor.red, fgcolor.green, fgcolor.blue, buf);
+		g_snprintf(tmp, length, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", fgcolor.red,
+			   fgcolor.green, fgcolor.blue, buf);
 		strcpy(buf, tmp);
 	}
 
 	if (font_options & OPT_FONT_BGCOL) {
-		g_snprintf(tmp, length, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", bgcolor.red, bgcolor.green, bgcolor.blue, buf);
+		g_snprintf(tmp, length, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", bgcolor.red,
+			   bgcolor.green, bgcolor.blue, buf);
 		strcpy(buf, tmp);
 	}
-	
+
 	return buf;
 }
 
-int set_dispstyle (int chat)
+int set_dispstyle(int chat)
 {
 	int dispstyle;
 
 	if (chat) {
-		switch (display_options & (OPT_DISP_CHAT_BUTTON_TEXT | 
-					   OPT_DISP_CHAT_BUTTON_XPM)) {
+		switch (display_options & (OPT_DISP_CHAT_BUTTON_TEXT | OPT_DISP_CHAT_BUTTON_XPM)) {
 		case OPT_DISP_CHAT_BUTTON_TEXT:
-			  dispstyle = 1;
-			  break;
+			dispstyle = 1;
+			break;
 		case OPT_DISP_CHAT_BUTTON_XPM:
-			  dispstyle = 0;
-			  break;
-		default: /* both or neither */
-			  dispstyle = 2;
-			  break;
+			dispstyle = 0;
+			break;
+		default:	/* both or neither */
+			dispstyle = 2;
+			break;
 		}
 	} else {
-		switch (display_options & (OPT_DISP_CONV_BUTTON_TEXT | 
-					   OPT_DISP_CONV_BUTTON_XPM)) {
+		switch (display_options & (OPT_DISP_CONV_BUTTON_TEXT | OPT_DISP_CONV_BUTTON_XPM)) {
 		case OPT_DISP_CONV_BUTTON_TEXT:
-			  dispstyle = 1;
-			  break;
+			dispstyle = 1;
+			break;
 		case OPT_DISP_CONV_BUTTON_XPM:
-			  dispstyle = 0;
-			  break;
-		default: /* both or neither */
-			  dispstyle = 2;
-			  break;
+			dispstyle = 0;
+			break;
+		default:	/* both or neither */
+			dispstyle = 2;
+			break;
 		}
 	}
 	return dispstyle;
 }
 
 
-void show_usage (int mode, char *name)
+void show_usage(int mode, char *name)
 {
 	switch (mode) {
-	case 0: /* full help text */
-	  printf ("Usage: %s [OPTION]...\n\n"
-		  "  -a, --acct          display account editor window\n"
-		  "  -l, --login[=NAME]  automatically login (optional argument NAME specifies\n"
-		  "                      account(s) to use)\n"
-		  "  -u, --user=NAME     use account NAME\n"
-		  "  -v, --version       display version information window\n"
-		  "  -h, --help          display this help and exit\n", name);
-	  break;
-	case 1: /* short message */
-	  printf ("Try `%s -h' for more information.\n", name);
-	  break;
+	case 0:		/* full help text */
+		printf("Usage: %s [OPTION]...\n\n"
+		       "  -a, --acct          display account editor window\n"
+		       "  -l, --login[=NAME]  automatically login (optional argument NAME specifies\n"
+		       "                      account(s) to use)\n"
+		       "  -u, --user=NAME     use account NAME\n"
+		       "  -v, --version       display version information window\n"
+		       "  -h, --help          display this help and exit\n", name);
+		break;
+	case 1:		/* short message */
+		printf("Try `%s -h' for more information.\n", name);
+		break;
 	}
 }
 
 
-void set_first_user (char *name)
+void set_first_user(char *name)
 {
 	struct aim_user *u;
 
-	u = find_user (name, -1);
+	u = find_user(name, -1);
 
-	if (!u) { /* new user */
+	if (!u) {		/* new user */
 		u = g_new0(struct aim_user, 1);
 		g_snprintf(u->username, sizeof(u->username), "%s", name);
-		u->protocol = 0 /* PROTO_TOC */;
-		aim_users = g_list_prepend (aim_users, u);
-	} else { /* user already exists */
-		aim_users = g_list_remove (aim_users, u);
-		aim_users = g_list_prepend (aim_users, u);
+		u->protocol = 0 /* PROTO_TOC */ ;
+		aim_users = g_list_prepend(aim_users, u);
+	} else {		/* user already exists */
+		aim_users = g_list_remove(aim_users, u);
+		aim_users = g_list_prepend(aim_users, u);
 	}
 	save_prefs();
 }
@@ -1128,22 +1142,22 @@
    returns:  0 if successful
             -1 if no user was found that had a saved password
 */
-int do_auto_login (char *name)
+int do_auto_login(char *name)
 {
 	struct aim_user *u;
 	char **names, **n, *first = NULL;
 	int retval = -1;
 
-	if (name != NULL) { /* list of names given */
-		names = g_strsplit (name, ",", 32);
+	if (name !=NULL) {	/* list of names given */
+		names = g_strsplit(name, ",", 32);
 		for (n = names; *n != NULL; n++) {
-			printf ("user %s...\n", *n);
+			printf("user %s...\n", *n);
 			u = find_user(*n, -1);
-			if (u) { /* found a user */
+			if (u) {	/* found a user */
 				if (first == NULL)
-					first = g_strdup (*n);
+					first = g_strdup(*n);
 				if (u->options & OPT_USR_REM_PASS) {
-					printf ("got user %s\n", *n);
+					printf("got user %s\n", *n);
 					retval = 0;
 					serv_login(u);
 				}
@@ -1151,10 +1165,10 @@
 		}
 		/* make the first user listed the default */
 		if (first != NULL)
-			set_first_user (first);
-		g_strfreev (names);
-		g_free (first);
-	} else { /* no name given, use default */
+			set_first_user(first);
+		g_strfreev(names);
+		g_free(first);
+	} else {		/* no name given, use default */
 		u = (struct aim_user *)aim_users->data;
 		if (u->options & OPT_USR_REM_PASS) {
 			retval = 0;
@@ -1164,17 +1178,17 @@
 
 	return retval;
 }
-		
+
 
-int file_is_dir (char *path, GtkWidget *w)
+int file_is_dir(char *path, GtkWidget *w)
 {
 	struct stat st;
 	char *name;
 
 	if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) {
 		/* append a / if needed */
-		if (path[strlen(path)-1] != '/')
-			name = g_strconcat(path,"/",NULL);
+		if (path[strlen(path) - 1] != '/')
+			name = g_strconcat(path, "/", NULL);
 		else
 			name = g_strdup(path);
 		gtk_file_selection_set_filename(GTK_FILE_SELECTION(w), name);
@@ -1185,7 +1199,8 @@
 	return 0;
 }
 
-GSList *message_split(char *message, int limit) {
+GSList *message_split(char *message, int limit)
+{
 	static GSList *ret = NULL;
 	int lastgood = 0, curgood = 0, curpos = 0, len = strlen(message);
 	gboolean intag = FALSE;
@@ -1207,7 +1222,7 @@
 			ret = g_slist_append(ret, g_strdup(&message[lastgood]));
 			return ret;
 		}
-		
+
 		curgood = curpos = 0;
 		intag = FALSE;
 		while (curpos <= limit) {
@@ -1237,7 +1252,8 @@
 /* returns a string of the form ~/.gaim, where ~ is replaced by the user's home
  * dir. this string should be freed after it's used. Note that there is no
  * trailing slash after .gaim. */
-gchar* gaim_user_dir() {
+gchar *gaim_user_dir()
+{
 	return g_strjoin(G_DIR_SEPARATOR_S, g_get_home_dir(), ".gaim", NULL);
 }
 
@@ -1248,8 +1264,9 @@
 	while (dest < end) {
 		if (*src == '\n' && dest < end - 4) {
 			strcpy(dest, "<BR>");
-			src++; dest+=4;
-                }
-		else *dest++ = *src++;
+			src++;
+			dest += 4;
+		} else
+			*dest++ = *src++;
 	}
 }