gnome-mud r723 - in trunk: . po src ui



Author: lharris
Date: Sun Feb 15 19:29:27 2009
New Revision: 723
URL: http://svn.gnome.org/viewvc/gnome-mud?rev=723&view=rev

Log:
Added MCCP Support


Added:
   trunk/src/mud-telnet-mccp.c
   trunk/src/mud-telnet-mccp.h
Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/po/ChangeLog
   trunk/po/POTFILES.in
   trunk/src/Makefile.am
   trunk/src/mud-connection-view.c
   trunk/src/mud-telnet-handlers.c
   trunk/src/mud-telnet-handlers.h
   trunk/src/mud-telnet-zmp.c
   trunk/src/mud-telnet.c
   trunk/src/mud-telnet.h
   trunk/src/mud-window.c
   trunk/ui/main.glade

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Sun Feb 15 19:29:27 2009
@@ -92,26 +92,24 @@
 #	AC_DEFINE(ENABLE_MAPPER, 1, [Define if mapper support should be enabled])
 #fi
 
-dnl Temporarily disabling MCCP check.
-
 dnl Check whether to include MCCP code or not
-dnl AC_ARG_ENABLE(mccp,
-dnl 	AC_HELP_STRING([--enable-mccp],
-dnl 		       [Enable MCCP (MUD Client Compression Protocol)]),,
-dnl 		enable_mccp=auto)
-dnl if test "x$enable_mccp" != "xno"; then
-dnl 	AC_CHECK_HEADER(zlib.h, have_zlib=yes, have_zlib=no)
-dnl 	if test "x$have_zlib" = "xno" -a "x$enable_mccp" = "xyes"; then
-dnl 	  AC_MSG_ERROR([MCCP support explicitly requested but zlib was not found])
-dnl 	fi
-dnl 	if test "x$have_zlib" = "xyes"; then
-dnl 	  AC_DEFINE(ENABLE_MCCP, 1, [Define if MCCP should be enabled])
-dnl 	  enable_mccp=yes
-dnl 	  Z_LIBS="-lz"
-dnl 	fi
-dnl fi
-dnl AM_CONDITIONAL(USE_MCCP, test "x$enable_mccp" = xyes)
-dnl AC_SUBST(Z_LIBS)
+AC_ARG_ENABLE(mccp,
+              AC_HELP_STRING([--enable-mccp],
+                             [Enable MCCP (MUD Client Compression Protocol)]),,
+                             enable_mccp=auto)
+if test "x$enable_mccp" != "xno"; then
+    AC_CHECK_HEADER(zlib.h, have_zlib=yes, have_zlib=no)
+    if test "x$have_zlib" = "xno" -a "x$enable_mccp" = "xyes"; then
+        AC_MSG_ERROR([MCCP support explicitly requested but zlib was not found])
+    fi
+    if test "x$have_zlib" = "xyes"; then
+        AC_DEFINE(ENABLE_MCCP, 1, [Define if MCCP should be enabled])
+        enable_mccp=yes
+        Z_LIBS="-lz"
+    fi
+fi
+AM_CONDITIONAL(USE_MCCP, test "x$enable_mccp" = xyes)
+AC_SUBST(Z_LIBS)
 
 dnl Check whether to include GStreamer code or not
 AC_ARG_ENABLE(gstreamer,
@@ -160,11 +158,11 @@
 
 AC_MSG_NOTICE([GNOME-Mud has been configured with the following options:])
 
-dnl if test "x$enable_mccp" = xyes; then
-dnl 	AC_MSG_NOTICE([    * MCCP support is enabled])
-dnl else
-dnl 	AC_MSG_NOTICE([    * MCCP support is disabled])
-dnl fi
+if test "x$enable_mccp" = xyes; then
+	AC_MSG_NOTICE([    * MCCP support is enabled])
+else
+ 	AC_MSG_NOTICE([    * MCCP support is disabled])
+fi
 
 #if test "x$enable_mapper" = xyes; then
 #	AC_MSG_NOTICE([    * Mapper support is enabled])

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Sun Feb 15 19:29:27 2009
@@ -9,6 +9,7 @@
 src/modules_api.c
 src/mud-connection-view.c
 src/mud-log.c
+src/mud-telnet-mccp.c
 src/mud-tray.c
 src/mud-preferences-window.c
 src/mud-window.c

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Sun Feb 15 19:29:27 2009
@@ -49,6 +49,8 @@
 	mud-telnet.h                \
 	mud-telnet-handlers.c		\
 	mud-telnet-handlers.h		\
+	mud-telnet-mccp.c \
+	mud-telnet-mccp.h \
 	mud-telnet-msp.c			\
 	mud-telnet-msp.h			\
 	mud-telnet-zmp.c			\

Modified: trunk/src/mud-connection-view.c
==============================================================================
--- trunk/src/mud-connection-view.c	(original)
+++ trunk/src/mud-connection-view.c	Sun Feb 15 19:29:27 2009
@@ -41,8 +41,12 @@
 #include "mud-telnet-zmp.h"
 #include "mud-telnet-msp.h"
 
+#ifdef ENABLE_MCCP
+#include "mud-telnet-mccp.h"
+#endif
+
 #ifdef ENABLE_GST
-    #include "mud-telnet-msp.h"
+#include "mud-telnet-msp.h"
 #endif
 
 /* Hack, will refactor with plugin rewrite -lh */
@@ -50,50 +54,50 @@
 
 struct _MudConnectionViewPrivate
 {
-	gint id;
+    gint id;
 
-	MudWindow *window;
-	MudTray *tray;
+    MudWindow *window;
+    MudTray *tray;
 
-	GtkWidget *terminal;
-	GtkWidget *scrollbar;
-	GtkWidget *box;
-	GtkWidget *popup_menu;
-	GtkWidget *progressbar;
-	GtkWidget *dl_label;
-	GtkWidget *dl_button;
+    GtkWidget *terminal;
+    GtkWidget *scrollbar;
+    GtkWidget *box;
+    GtkWidget *popup_menu;
+    GtkWidget *progressbar;
+    GtkWidget *dl_label;
+    GtkWidget *dl_button;
 
-	MudProfile *profile;
-	MudLog *log;
+    MudProfile *profile;
+    MudLog *log;
 
-	gulong signal;
-	gulong signal_profile_changed;
+    gulong signal;
+    gulong signal_profile_changed;
 
-	gboolean connect_hook;
-	gboolean connected;
-	gchar *connect_string;
+    gboolean connect_hook;
+    gboolean connected;
+    gchar *connect_string;
 
-	MudParseBase *parse;
+    MudParseBase *parse;
 
-	GQueue *history;
-	guint current_history_index;
+    GQueue *history;
+    guint current_history_index;
 
-	MudTelnet *telnet;
-	gchar *hostname;
-	guint port;
+    MudTelnet *telnet;
+    gchar *hostname;
+    guint port;
 
-	gchar *mud_name;
+    gchar *mud_name;
 
 #ifdef ENABLE_GST
-	GQueue *download_queue;
-	GConnHttp *dl_conn;
-	gboolean downloading;
+    GQueue *download_queue;
+    GConnHttp *dl_conn;
+    gboolean downloading;
 #endif
 
-	GString *processed;
+    GString *processed;
 
-	guint width;
-	guint height;
+    guint width;
+    guint height;
 };
 
 static void mud_connection_view_init                     (MudConnectionView *connection_view);
@@ -118,110 +122,110 @@
 GType
 mud_connection_view_get_type (void)
 {
-	static GType object_type = 0;
+    static GType object_type = 0;
 
-	g_type_init();
+    g_type_init();
 
-	if (!object_type)
-	{
-		static const GTypeInfo object_info =
-		{
-			sizeof (MudConnectionViewClass),
-			NULL,
-			NULL,
-			(GClassInitFunc) mud_connection_view_class_init,
-			NULL,
-			NULL,
-			sizeof (MudConnectionView),
-			0,
-			(GInstanceInitFunc) mud_connection_view_init,
-		};
+    if (!object_type)
+    {
+        static const GTypeInfo object_info =
+            {
+                sizeof (MudConnectionViewClass),
+                NULL,
+                NULL,
+                (GClassInitFunc) mud_connection_view_class_init,
+                NULL,
+                NULL,
+                sizeof (MudConnectionView),
+                0,
+                (GInstanceInitFunc) mud_connection_view_init,
+            };
 
-		object_type = g_type_register_static(G_TYPE_OBJECT, "MudConnectionView", &object_info, 0);
-	}
+        object_type = g_type_register_static(G_TYPE_OBJECT, "MudConnectionView", &object_info, 0);
+    }
 
-	return object_type;
+    return object_type;
 }
 
 static GtkWidget*
 append_stock_menuitem(GtkWidget *menu, const gchar *text, GCallback callback, gpointer data)
 {
-	GtkWidget *menu_item;
-	GtkWidget *image;
-	GConfClient *client;
-	GError *error;
-	gboolean use_image;
-
-	menu_item = gtk_image_menu_item_new_from_stock(text, NULL);
-	image = gtk_image_menu_item_get_image(GTK_IMAGE_MENU_ITEM(menu_item));
-
-	client = gconf_client_get_default();
-	error = NULL;
-
-	use_image = gconf_client_get_bool(client,
-									  "/desktop/gnome/interface/menus_have_icons",
-									  &error);
-	if (error)
-	{
-		g_printerr(_("There was an error loading config value for whether to use image in menus. (%s)\n"),
-				   error->message);
-		g_error_free(error);
-	}
-	else
-	{
-		if (use_image)
-			gtk_widget_show(image);
-		else
-			gtk_widget_hide(image);
-	}
-
-	gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
-
-	if (callback)
-		g_signal_connect(G_OBJECT(menu_item),
-						 "activate",
-						 callback, data);
+    GtkWidget *menu_item;
+    GtkWidget *image;
+    GConfClient *client;
+    GError *error;
+    gboolean use_image;
+
+    menu_item = gtk_image_menu_item_new_from_stock(text, NULL);
+    image = gtk_image_menu_item_get_image(GTK_IMAGE_MENU_ITEM(menu_item));
+
+    client = gconf_client_get_default();
+    error = NULL;
+
+    use_image = gconf_client_get_bool(client,
+                                      "/desktop/gnome/interface/menus_have_icons",
+                                      &error);
+    if (error)
+    {
+        g_printerr(_("There was an error loading config value for whether to use image in menus. (%s)\n"),
+                   error->message);
+        g_error_free(error);
+    }
+    else
+    {
+        if (use_image)
+            gtk_widget_show(image);
+        else
+            gtk_widget_hide(image);
+    }
+
+    gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
 
-	return menu_item;
+    if (callback)
+        g_signal_connect(G_OBJECT(menu_item),
+                         "activate",
+                         callback, data);
+
+    return menu_item;
 }
 
 static GtkWidget*
 append_menuitem(GtkWidget *menu, const gchar *text, GCallback callback, gpointer data)
 {
-	GtkWidget *menu_item;
+    GtkWidget *menu_item;
 
-	menu_item = gtk_menu_item_new_with_mnemonic(text);
-	gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
+    menu_item = gtk_menu_item_new_with_mnemonic(text);
+    gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
 
-	if (callback)
-		g_signal_connect(G_OBJECT(menu_item), "activate", callback, data);
+    if (callback)
+        g_signal_connect(G_OBJECT(menu_item), "activate", callback, data);
 
-	return menu_item;
+    return menu_item;
 }
 
 static void
 popup_menu_detach(GtkWidget *widget, GtkMenu *menu)
 {
-	MudConnectionView *view;
+    MudConnectionView *view;
 
-	view = g_object_get_data(G_OBJECT(widget), "connection-view");
-	view->priv->popup_menu = NULL;
+    view = g_object_get_data(G_OBJECT(widget), "connection-view");
+    view->priv->popup_menu = NULL;
 }
 
 static void
 choose_profile_callback(GtkWidget *menu_item, MudConnectionView *view)
 {
-	MudProfile *profile;
+    MudProfile *profile;
 
-	if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menu_item)))
-		return;
+    if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menu_item)))
+        return;
 
-	profile = g_object_get_data(G_OBJECT(menu_item), "profile");
+    profile = g_object_get_data(G_OBJECT(menu_item), "profile");
 
-	g_assert(profile);
+    g_assert(profile);
 
-	mud_connection_view_set_profile(view, profile);
-	mud_connection_view_reread_profile(view);
+    mud_connection_view_set_profile(view, profile);
+    mud_connection_view_reread_profile(view);
 }
 
 static void
@@ -234,39 +238,39 @@
 static void
 mud_connection_view_str_replace (gchar *buf, const gchar *s, const gchar *repl)
 {
-	gchar out_buf[4608];
-	gchar *pc, *out;
-	gint  len = strlen (s);
-	gboolean found = FALSE;
-
-	for ( pc = buf, out = out_buf; *pc && (out-out_buf) < (4608-len-4);)
-		if ( !strncasecmp(pc, s, len))
-		{
-			out += sprintf (out, "%s", repl);
-			pc += len;
-			found = TRUE;
-		}
-		else
-			*out++ = *pc++;
-
-	if ( found)
-	{
-		*out = '\0';
-		strcpy (buf, out_buf);
-	}
+    gchar out_buf[4608];
+    gchar *pc, *out;
+    gint  len = strlen (s);
+    gboolean found = FALSE;
+
+    for ( pc = buf, out = out_buf; *pc && (out-out_buf) < (4608-len-4);)
+        if ( !strncasecmp(pc, s, len))
+        {
+            out += sprintf (out, "%s", repl);
+            pc += len;
+            found = TRUE;
+        }
+        else
+            *out++ = *pc++;
+
+    if ( found)
+    {
+        *out = '\0';
+        strcpy (buf, out_buf);
+    }
 }
 
 static void
 mud_connection_view_feed_text(MudConnectionView *view, gchar *message)
 {
-	gint rlen = strlen(message);
-	gchar buf[rlen*2];
+    gint rlen = strlen(message);
+    gchar buf[rlen*2];
 
-	g_stpcpy(buf, message);
-	mud_connection_view_str_replace(buf, "\r", "");
-	mud_connection_view_str_replace(buf, "\n", "\n\r");
+    g_stpcpy(buf, message);
+    mud_connection_view_str_replace(buf, "\r", "");
+    mud_connection_view_str_replace(buf, "\n", "\n\r");
 
-	vte_terminal_feed(VTE_TERMINAL(view->priv->terminal), buf, strlen(buf));
+    vte_terminal_feed(VTE_TERMINAL(view->priv->terminal), buf, strlen(buf));
 }
 
 void
@@ -274,11 +278,11 @@
 {
     gchar *encoding;
     gchar *profile_name;
-	GConfClient *client;
-	gboolean remote;
+    GConfClient *client;
+    gboolean remote;
 
     gchar key[2048];
-	gchar extra_path[512] = "";
+    gchar extra_path[512] = "";
 
     client = gconf_client_get_default();
 
@@ -291,359 +295,359 @@
     {
         profile_name = mud_profile_get_name(view->priv->profile);
 
-	    if (strcmp(profile_name, "Default"))
-	    {
-	    	g_snprintf(extra_path, 512, "profiles/%s/", profile_name);
-	    }
+        if (strcmp(profile_name, "Default"))
+        {
+            g_snprintf(extra_path, 512, "profiles/%s/", profile_name);
+        }
 
-	    g_snprintf(key, 2048, "/apps/gnome-mud/%s%s", extra_path, "functionality/encoding");
-	    encoding = gconf_client_get_string(client, key, NULL);
+        g_snprintf(key, 2048, "/apps/gnome-mud/%s%s", extra_path, "functionality/encoding");
+        encoding = gconf_client_get_string(client, key, NULL);
     }
 
     vte_terminal_set_encoding(VTE_TERMINAL(view->priv->terminal), encoding);
 
     switch (type)
     {
-		case Sent:
-			mud_connection_view_feed_text(view, "\e[1;33m");
-			break;
-
-		case Error:
-			mud_connection_view_feed_text(view, "\e[1;31m");
-			break;
-
-		case System:
-			mud_connection_view_feed_text(view, "\e[1;32m");
-			break;
-
-		case Normal:
-		default:
-			break;
+    case Sent:
+        mud_connection_view_feed_text(view, "\e[1;33m");
+        break;
+
+    case Error:
+        mud_connection_view_feed_text(view, "\e[1;31m");
+        break;
+
+    case System:
+        mud_connection_view_feed_text(view, "\e[1;32m");
+        break;
+
+    case Normal:
+    default:
+        break;
     }
 
     if(view->local_echo)
-	    mud_connection_view_feed_text(view, message);
-	mud_connection_view_feed_text(view, "\e[0m");
+        mud_connection_view_feed_text(view, message);
+    mud_connection_view_feed_text(view, "\e[0m");
 }
 
 
 static void
 mud_connection_view_init (MudConnectionView *connection_view)
 {
-	GtkWidget *box;
-	GtkWidget *dl_vbox;
-	GtkWidget *dl_hbox;
-	GtkWidget *term_box;
+    GtkWidget *box;
+    GtkWidget *dl_vbox;
+    GtkWidget *dl_hbox;
+    GtkWidget *term_box;
 
-  	connection_view->priv = g_new0(MudConnectionViewPrivate, 1);
+    connection_view->priv = g_new0(MudConnectionViewPrivate, 1);
 
-	connection_view->priv->history = g_queue_new();
-	connection_view->priv->current_history_index = 0;
+    connection_view->priv->history = g_queue_new();
+    connection_view->priv->current_history_index = 0;
 
 #ifdef ENABLE_GST
-	connection_view->priv->download_queue = g_queue_new();
-	connection_view->priv->dl_conn = NULL;
+    connection_view->priv->download_queue = g_queue_new();
+    connection_view->priv->dl_conn = NULL;
 #endif
 
-	connection_view->priv->processed = NULL;
+    connection_view->priv->processed = NULL;
 
-	connection_view->priv->parse = mud_parse_base_new(connection_view);
+    connection_view->priv->parse = mud_parse_base_new(connection_view);
 
-	connection_view->priv->connect_hook = FALSE;
+    connection_view->priv->connect_hook = FALSE;
 
-	box = gtk_vbox_new(FALSE, 0);
-	dl_vbox = gtk_vbox_new(FALSE, 0);
-	dl_hbox = gtk_hbox_new(FALSE, 0);
-	term_box = gtk_hbox_new(FALSE, 0);
+    box = gtk_vbox_new(FALSE, 0);
+    dl_vbox = gtk_vbox_new(FALSE, 0);
+    dl_hbox = gtk_hbox_new(FALSE, 0);
+    term_box = gtk_hbox_new(FALSE, 0);
 
-	connection_view->priv->dl_label = gtk_label_new("Downloading...");
-	connection_view->priv->progressbar = gtk_progress_bar_new();
-	gtk_progress_bar_set_pulse_step (GTK_PROGRESS_BAR(connection_view->priv->progressbar), 0.1);
-	connection_view->priv->dl_button = gtk_button_new_from_stock("gtk-cancel");
+    connection_view->priv->dl_label = gtk_label_new("Downloading...");
+    connection_view->priv->progressbar = gtk_progress_bar_new();
+    gtk_progress_bar_set_pulse_step (GTK_PROGRESS_BAR(connection_view->priv->progressbar), 0.1);
+    connection_view->priv->dl_button = gtk_button_new_from_stock("gtk-cancel");
 
 #ifdef ENABLE_GST
-	connection_view->priv->downloading = FALSE;
+    connection_view->priv->downloading = FALSE;
 #endif
 
-	gtk_box_pack_start(GTK_BOX(dl_vbox), connection_view->priv->dl_label, FALSE, FALSE, 0);
-
-	gtk_box_pack_start(GTK_BOX(dl_hbox), connection_view->priv->progressbar, TRUE, TRUE, 0);
+    gtk_box_pack_start(GTK_BOX(dl_vbox), connection_view->priv->dl_label, FALSE, FALSE, 0);
 
-	gtk_box_pack_end(GTK_BOX(dl_hbox), connection_view->priv->dl_button, FALSE, FALSE, 0);
+    gtk_box_pack_start(GTK_BOX(dl_hbox), connection_view->priv->progressbar, TRUE, TRUE, 0);
 
-	gtk_box_pack_end(GTK_BOX(dl_vbox), dl_hbox, TRUE, TRUE, 0);
+    gtk_box_pack_end(GTK_BOX(dl_hbox), connection_view->priv->dl_button, FALSE, FALSE, 0);
 
-	connection_view->priv->terminal = vte_terminal_new();
-	vte_terminal_set_encoding(VTE_TERMINAL(connection_view->priv->terminal), "ISO-8859-1");
-	vte_terminal_set_emulation(VTE_TERMINAL(connection_view->priv->terminal), "xterm");
-	
-	connection_view->priv->width = VTE_TERMINAL(connection_view->priv->terminal)->column_count;
-	connection_view->priv->height = VTE_TERMINAL(connection_view->priv->terminal)->row_count;
-	
-	gtk_box_pack_start(GTK_BOX(term_box), connection_view->priv->terminal, TRUE, TRUE, 0);
-	g_signal_connect(G_OBJECT(connection_view->priv->terminal),
-					 "button_press_event",
-					 G_CALLBACK(mud_connection_view_button_press_event),
-					 connection_view);
-	g_object_set_data(G_OBJECT(connection_view->priv->terminal),
-					  "connection-view", connection_view);
+    gtk_box_pack_end(GTK_BOX(dl_vbox), dl_hbox, TRUE, TRUE, 0);
 
-#ifdef ENABLE_GST
-	g_signal_connect(connection_view->priv->dl_button, "clicked",
-		G_CALLBACK(mud_connection_view_cancel_dl_cb), connection_view);
+    connection_view->priv->terminal = vte_terminal_new();
+    vte_terminal_set_encoding(VTE_TERMINAL(connection_view->priv->terminal), "ISO-8859-1");
+    vte_terminal_set_emulation(VTE_TERMINAL(connection_view->priv->terminal), "xterm");
+        
+    connection_view->priv->width = VTE_TERMINAL(connection_view->priv->terminal)->column_count;
+    connection_view->priv->height = VTE_TERMINAL(connection_view->priv->terminal)->row_count;
+        
+    gtk_box_pack_start(GTK_BOX(term_box), connection_view->priv->terminal, TRUE, TRUE, 0);
+    g_signal_connect(G_OBJECT(connection_view->priv->terminal),
+                     "button_press_event",
+                     G_CALLBACK(mud_connection_view_button_press_event),
+                     connection_view);
+    g_object_set_data(G_OBJECT(connection_view->priv->terminal),
+                      "connection-view", connection_view);
+
+#ifdef ENABLE_GST                                                       
+    g_signal_connect(connection_view->priv->dl_button, "clicked",
+    G_CALLBACK(mud_connection_view_cancel_dl_cb), connection_view);
 #endif
 
-	connection_view->priv->scrollbar = gtk_vscrollbar_new(NULL);
-	gtk_range_set_adjustment(GTK_RANGE(connection_view->priv->scrollbar), VTE_TERMINAL(connection_view->priv->terminal)->adjustment);
-	gtk_box_pack_end(GTK_BOX(term_box), connection_view->priv->scrollbar, FALSE, FALSE, 0);
+    connection_view->priv->scrollbar = gtk_vscrollbar_new(NULL);
+    gtk_range_set_adjustment(
+            GTK_RANGE(connection_view->priv->scrollbar),
+            VTE_TERMINAL(connection_view->priv->terminal)->adjustment);
+    gtk_box_pack_end(GTK_BOX(term_box), connection_view->priv->scrollbar, 
+            FALSE, FALSE, 0);
+
+    gtk_box_pack_start(GTK_BOX(box), dl_vbox, FALSE, FALSE, 0);
+    gtk_box_pack_end(GTK_BOX(box), term_box, TRUE, TRUE, 0);
+
+    gtk_widget_show_all(box);
+
+    gtk_widget_hide(connection_view->priv->progressbar);
+    gtk_widget_hide(connection_view->priv->dl_label);
+    gtk_widget_hide(connection_view->priv->dl_button);
 
-	gtk_box_pack_start(GTK_BOX(box), dl_vbox, FALSE, FALSE, 0);
-	gtk_box_pack_end(GTK_BOX(box), term_box, TRUE, TRUE, 0);
+    g_object_set_data(G_OBJECT(box), "connection-view", connection_view);
 
-	gtk_widget_show_all(box);
-
-	gtk_widget_hide(connection_view->priv->progressbar);
-	gtk_widget_hide(connection_view->priv->dl_label);
-	gtk_widget_hide(connection_view->priv->dl_button);
-
-	g_object_set_data(G_OBJECT(box), "connection-view", connection_view);
-
-	connection_view->priv->box = box;
-	connection_view->priv->connected = FALSE;
+    connection_view->priv->box = box;
+    connection_view->priv->connected = FALSE;
 
 }
 
 static void
 mud_connection_view_reread_profile(MudConnectionView *view)
 {
-	mud_connection_view_set_terminal_colors(view);
-	mud_connection_view_set_terminal_scrollback(view);
-	mud_connection_view_set_terminal_scrolloutput(view);
-	mud_connection_view_set_terminal_font(view);
-	mud_connection_view_set_terminal_type(view);
+    mud_connection_view_set_terminal_colors(view);
+    mud_connection_view_set_terminal_scrollback(view);
+    mud_connection_view_set_terminal_scrolloutput(view);
+    mud_connection_view_set_terminal_font(view);
+    mud_connection_view_set_terminal_type(view);
 }
 
 static void
 mud_connection_view_class_init (MudConnectionViewClass *klass)
 {
-	GObjectClass *object_class = G_OBJECT_CLASS(klass);
+    GObjectClass *object_class = G_OBJECT_CLASS(klass);
 
-	object_class->finalize = mud_connection_view_finalize;
+    object_class->finalize = mud_connection_view_finalize;
 }
 
 static void
 mud_connection_view_finalize (GObject *object)
 {
-	MudConnectionView *connection_view;
-	GObjectClass *parent_class;
-	gchar *history_item;
+    MudConnectionView *connection_view;
+    GObjectClass *parent_class;
+    gchar *history_item;
 
-#ifdef ENABLE_GST
-	MudMSPDownloadItem *item;
+#ifdef ENABLE_GST                               
+    MudMSPDownloadItem *item;
 #endif
 
-	connection_view = MUD_CONNECTION_VIEW(object);
+    connection_view = MUD_CONNECTION_VIEW(object);
 
     if(connection_view->priv->history && !g_queue_is_empty(connection_view->priv->history))
         while((history_item = (gchar *)g_queue_pop_head(connection_view->priv->history)) != NULL)
-		    g_free(history_item);
+            g_free(history_item);
 
-	if(connection_view->priv->history)
-		g_queue_free(connection_view->priv->history);
+    if(connection_view->priv->history)
+        g_queue_free(connection_view->priv->history);
 
-#ifdef ENABLE_GST
+#ifdef ENABLE_GST                               
     if(connection_view->priv->download_queue
-        && !g_queue_is_empty(connection_view->priv->download_queue))
-        	while(
-        	    (item = (MudMSPDownloadItem *)g_queue_pop_head(
-        	    connection_view->priv->download_queue)) != NULL)
-        		    mud_telnet_msp_download_item_free(item);
+    && !g_queue_is_empty(connection_view->priv->download_queue))
+    while(
+        (item = (MudMSPDownloadItem *)g_queue_pop_head(
+            connection_view->priv->download_queue)) != NULL)
+        mud_telnet_msp_download_item_free(item);
 
-	if(connection_view->priv->download_queue)
-        g_queue_free(connection_view->priv->download_queue);
+if(connection_view->priv->download_queue)
+    g_queue_free(connection_view->priv->download_queue);
 #endif
 
-    	mud_zmp_finalize(connection_view->priv->telnet);
+    gnet_conn_disconnect(connection_view->connection);
+    gnet_conn_unref(connection_view->connection);
 
-    	gnet_conn_disconnect(connection_view->connection);
-    	gnet_conn_unref(connection_view->connection);
+    g_free(connection_view->priv);
 
-	g_free(connection_view->priv);
-
-	parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
-	parent_class->finalize(object);
+    parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
+    parent_class->finalize(object);
 }
 
 void
 mud_connection_view_set_connect_string(MudConnectionView *view, gchar *connect_string)
 {
-	g_assert(view != NULL);
-	view->priv->connect_hook = TRUE;
-	view->priv->connect_string = g_strdup(connect_string);
+    g_assert(view != NULL);
+    view->priv->connect_hook = TRUE;
+    view->priv->connect_string = g_strdup(connect_string);
 }
 
 void
 mud_connection_view_disconnect(MudConnectionView *view)
 {
 #ifdef ENABLE_GST
-	MudMSPDownloadItem *item;
+    MudMSPDownloadItem *item;
 #endif
 
-	g_assert(view != NULL);
+    g_assert(view != NULL);
 
 #ifdef ENABLE_GST
     if(view->priv->download_queue)
-	    while((item = (MudMSPDownloadItem *)g_queue_pop_head(view->priv->download_queue)) != NULL)
-		    mud_telnet_msp_download_item_free(item);
+    while((item = (MudMSPDownloadItem *)g_queue_pop_head(view->priv->download_queue)) != NULL)
+        mud_telnet_msp_download_item_free(item);
 
-	if(view->priv->download_queue)
-        	g_queue_free(view->priv->download_queue);
+    if(view->priv->download_queue)
+        g_queue_free(view->priv->download_queue);
 
-	view->priv->download_queue = NULL;
+    view->priv->download_queue = NULL;
 #endif
 
-	if(view->priv->processed)
-		g_string_free(view->priv->processed, TRUE);
-
-	view->priv->processed = NULL;
+    if(view->priv->processed)
+        g_string_free(view->priv->processed, TRUE);
 
-	mud_zmp_finalize(view->priv->telnet);
+    view->priv->processed = NULL;
 
-	gnet_conn_disconnect(view->connection);
+    gnet_conn_disconnect(view->connection);
 
-	g_object_unref(view->priv->telnet);
+    if(view->priv->telnet)
+        g_object_unref(view->priv->telnet);
 
-	mud_connection_view_add_text(view, _("*** Connection closed.\n"), System);
+    mud_connection_view_add_text(view, _("*** Connection closed.\n"), System);
 }
 
 void
 mud_connection_view_reconnect(MudConnectionView *view)
 {
-	gchar *buf;
+    gchar *buf;
 
 #ifdef ENABLE_GST
-	MudMSPDownloadItem *item;
+    MudMSPDownloadItem *item;
 #endif
 
-	g_assert(view != NULL);
+    g_assert(view != NULL);
 
 
-	if(gnet_conn_is_connected(view->connection))
-	{
+    if(gnet_conn_is_connected(view->connection))
+    {
 
 #ifdef ENABLE_GST
-		while((item = (MudMSPDownloadItem *)g_queue_pop_head(view->priv->download_queue)) != NULL)
-			mud_telnet_msp_download_item_free(item);
+        while((item = (MudMSPDownloadItem *)g_queue_pop_head(view->priv->download_queue)) != NULL)
+        mud_telnet_msp_download_item_free(item);
 
-		if(view->priv->download_queue)
-	        g_queue_free(view->priv->download_queue);
+        if(view->priv->download_queue)
+            g_queue_free(view->priv->download_queue);
 
-		view->priv->download_queue = NULL;
+        view->priv->download_queue = NULL;
 #endif
 
-		if(view->priv->processed)
-			g_string_free(view->priv->processed, TRUE);
+        if(view->priv->processed)
+            g_string_free(view->priv->processed, TRUE);
 
-		view->priv->processed = NULL;
+        view->priv->processed = NULL;
 
-		mud_zmp_finalize(view->priv->telnet);
+        mud_zmp_finalize(view->priv->telnet);
 
-		gnet_conn_disconnect(view->connection);
+        gnet_conn_disconnect(view->connection);
 
-		g_object_unref(view->priv->telnet);
+        g_object_unref(view->priv->telnet);
 
-		mud_connection_view_add_text(view, _("*** Connection closed.\n"), System);
+        mud_connection_view_add_text(view, _("*** Connection closed.\n"), System);
 
 #ifdef ENABLE_GST
-		view->priv->download_queue = g_queue_new();
+        view->priv->download_queue = g_queue_new();
 #endif
 
-		view->naws_enabled = FALSE;
+        view->naws_enabled = FALSE;
 
-		view->priv->telnet = mud_telnet_new(view, view->connection, view->priv->mud_name);
+        view->priv->telnet = mud_telnet_new(view, view->connection, view->priv->mud_name);
 
-		view->local_echo = TRUE;
-	}
+        view->local_echo = TRUE;
+    }
 
-	buf = g_strdup_printf(_("*** Making connection to %s, port %d.\n"),
-	    view->priv->hostname, view->priv->port);
-	mud_connection_view_add_text(view, buf, System);
+    buf = g_strdup_printf(_("*** Making connection to %s, port %d.\n"),
+                          view->priv->hostname, view->priv->port);
+    mud_connection_view_add_text(view, buf, System);
 
-	gnet_conn_connect(view->connection);
+    gnet_conn_connect(view->connection);
 }
 
 void
 mud_connection_view_send(MudConnectionView *view, const gchar *data)
 {
-	GList *commands, *command;
-	gchar *text;
+    GList *commands, *command;
+    gchar *text;
+
+    if(view->local_echo) // Prevent password from being cached.
+    {
+        gchar *head = g_queue_peek_head(view->priv->history);
+
+        if( (head && strcmp(head, data) != 0 && head[0] != '\n') 
+            || g_queue_is_empty(view->priv->history))
+            g_queue_push_head(view->priv->history,
+                              (gpointer)g_strdup(data));
+    }
+    else
+        g_queue_push_head(view->priv->history,
+                          (gpointer)g_strdup(_("<password removed>")));
+
+    view->priv->current_history_index = 0;
+    commands = mud_profile_process_commands(view->priv->profile, data);
+
+    for (command = g_list_first(commands); command != NULL; command = command->next)
+    {
+        text = g_strdup_printf("%s\r\n", (gchar *) command->data);
+
+        // Give plugins first crack at it.
+        mud_window_handle_plugins(view->priv->window, view->priv->id,
+                                  (gchar *)text, strlen(text), 0);
 
-	if(view->local_echo) // Prevent password from being cached.
-	{
-		gchar *head = g_queue_peek_head(view->priv->history);
-
-		if( (head && strcmp(head, data) != 0 && head[0] != '\n') 
-		     || g_queue_is_empty(view->priv->history))
-			g_queue_push_head(view->priv->history,
-					(gpointer)g_strdup(data));
-	}
-	else
-		g_queue_push_head(view->priv->history,
-			(gpointer)g_strdup(_("<password removed>")));
-
-	view->priv->current_history_index = 0;
-	commands = mud_profile_process_commands(view->priv->profile, data);
-
-	for (command = g_list_first(commands); command != NULL; command = command->next)
-	{
-		text = g_strdup_printf("%s\r\n", (gchar *) command->data);
-
-		// Give plugins first crack at it.
-		mud_window_handle_plugins(view->priv->window, view->priv->id,
-		    (gchar *)text, strlen(text), 0);
-
-		gnet_conn_write(view->connection, text, strlen(text));
-
-		if (view->priv->profile->preferences->EchoText && view->local_echo)
-			mud_connection_view_add_text(view, text, Sent);
-		g_free(text);
-	}
+        gnet_conn_write(view->connection, text, strlen(text));
 
-	g_list_free(commands);
+        if (view->priv->profile->preferences->EchoText && view->local_echo)
+            mud_connection_view_add_text(view, text, Sent);
+        g_free(text);
+    }
+
+    g_list_free(commands);
 }
 
 static void
 mud_connection_view_set_terminal_colors(MudConnectionView *view)
 {
-	vte_terminal_set_colors(VTE_TERMINAL(view->priv->terminal),
-							&view->priv->profile->preferences->Foreground,
-							&view->priv->profile->preferences->Background,
-							view->priv->profile->preferences->Colors, C_MAX);
+    vte_terminal_set_colors(VTE_TERMINAL(view->priv->terminal),
+                            &view->priv->profile->preferences->Foreground,
+                            &view->priv->profile->preferences->Background,
+                            view->priv->profile->preferences->Colors, C_MAX);
 }
 
 void
 mud_connection_view_start_logging(MudConnectionView *view)
 {
-	mud_log_open(view->priv->log);
+    mud_log_open(view->priv->log);
 }
 
 void
 mud_connection_view_stop_logging(MudConnectionView *view)
 {
-	mud_log_close(view->priv->log);
+    mud_log_close(view->priv->log);
 }
 
 gboolean
 mud_connection_view_islogging(MudConnectionView *view)
 {
-	return mud_log_islogging(view->priv->log);
+    return mud_log_islogging(view->priv->log);
 }
 
 static void
 mud_connection_view_set_terminal_scrollback(MudConnectionView *view)
 {
-	vte_terminal_set_scrollback_lines(VTE_TERMINAL(view->priv->terminal),
-									  view->priv->profile->preferences->Scrollback);
+    vte_terminal_set_scrollback_lines(VTE_TERMINAL(view->priv->terminal),
+                                      view->priv->profile->preferences->Scrollback);
 }
 
 static void
@@ -651,8 +655,8 @@
 {
 
     if(view->priv->terminal)
-	vte_terminal_set_scroll_on_output(VTE_TERMINAL(view->priv->terminal),
-									  view->priv->profile->preferences->ScrollOnOutput);
+        vte_terminal_set_scroll_on_output(VTE_TERMINAL(view->priv->terminal),
+                                          view->priv->profile->preferences->ScrollOnOutput);
 }
 
 static void
@@ -675,296 +679,296 @@
 static void
 mud_connection_view_set_terminal_type(MudConnectionView *view)
 {
-	vte_terminal_set_emulation(VTE_TERMINAL(view->priv->terminal),
-							   view->priv->profile->preferences->TerminalType);
+    vte_terminal_set_emulation(VTE_TERMINAL(view->priv->terminal),
+                               view->priv->profile->preferences->TerminalType);
 }
 
 static void
 mud_connection_view_profile_changed_cb(MudProfile *profile, MudProfileMask *mask, MudConnectionView *view)
 {
-	if (mask->ScrollOnOutput)
-		mud_connection_view_set_terminal_scrolloutput(view);
-	if (mask->TerminalType)
-		mud_connection_view_set_terminal_type(view);
-	if (mask->Scrollback)
-		mud_connection_view_set_terminal_scrollback(view);
-	if (mask->FontName)
-		mud_connection_view_set_terminal_font(view);
-	if (mask->Foreground || mask->Background || mask->Colors)
-		mud_connection_view_set_terminal_colors(view);
+    if (mask->ScrollOnOutput)
+        mud_connection_view_set_terminal_scrolloutput(view);
+    if (mask->TerminalType)
+        mud_connection_view_set_terminal_type(view);
+    if (mask->Scrollback)
+        mud_connection_view_set_terminal_scrollback(view);
+    if (mask->FontName)
+        mud_connection_view_set_terminal_font(view);
+    if (mask->Foreground || mask->Background || mask->Colors)
+        mud_connection_view_set_terminal_colors(view);
 }
 
 static gboolean
 mud_connection_view_button_press_event(GtkWidget *widget, GdkEventButton *event, MudConnectionView *view)
 {
-	if ((event->button == 3) &&
-		!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)))
-	{
-		mud_connection_view_popup(view, event);
-		return TRUE;
-	}
+    if ((event->button == 3) &&
+        !(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK)))
+    {
+        mud_connection_view_popup(view, event);
+        return TRUE;
+    }
 
-	return FALSE;
+    return FALSE;
 }
 
 static void
 mud_connection_view_popup(MudConnectionView *view, GdkEventButton *event)
 {
-	GtkWidget *im_menu;
-	GtkWidget *menu_item;
-	GtkWidget *profile_menu;
-	const GList *profiles;
-	const GList *profile;
-	GSList *group;
-
-	if (view->priv->popup_menu)
-		gtk_widget_destroy(view->priv->popup_menu);
-
-	g_assert(view->priv->popup_menu == NULL);
-
-	view->priv->popup_menu = gtk_menu_new();
-	gtk_menu_attach_to_widget(GTK_MENU(view->priv->popup_menu),
-							  view->priv->terminal,
-							  popup_menu_detach);
-
-	append_menuitem(view->priv->popup_menu,
-					_("Close"),
-					G_CALLBACK(mud_connection_view_close_current_cb),
-					view);
-
-	menu_item = gtk_separator_menu_item_new();
-	gtk_menu_shell_append(GTK_MENU_SHELL(view->priv->popup_menu), menu_item);
-
-	append_stock_menuitem(view->priv->popup_menu,
-						  GTK_STOCK_COPY,
-						  NULL,
-						  view);
-	append_stock_menuitem(view->priv->popup_menu,
-						  GTK_STOCK_PASTE,
-						  NULL,
-						  view);
-
-	menu_item = gtk_separator_menu_item_new();
-	gtk_menu_shell_append(GTK_MENU_SHELL(view->priv->popup_menu), menu_item);
-
-	profile_menu = gtk_menu_new();
-	menu_item = gtk_menu_item_new_with_mnemonic(_("Change P_rofile"));
-	gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), profile_menu);
-	gtk_menu_shell_append(GTK_MENU_SHELL(view->priv->popup_menu), menu_item);
-
-	group = NULL;
-	profiles = mud_profile_get_profiles();
-	profile = profiles;
-	while (profile != NULL)
-	{
-		MudProfile *prof;
-
-		prof = profile->data;
-
-		/* Profiles can go away while the menu is up. */
-		g_object_ref(G_OBJECT(prof));
-
-		menu_item = gtk_radio_menu_item_new_with_label(group,
-													   prof->name);
-		group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menu_item));
-		gtk_menu_shell_append(GTK_MENU_SHELL(profile_menu), menu_item);
-
-		if (prof == view->priv->profile)
-			gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_item), TRUE);
-
-		g_signal_connect(G_OBJECT(menu_item),
-						 "toggled",
-						 G_CALLBACK(choose_profile_callback),
-						 view);
-		g_object_set_data_full(G_OBJECT(menu_item),
-							   "profile",
-							   prof,
-							   (GDestroyNotify) g_object_unref);
-		profile = profile->next;
-	}
-
-	menu_item = gtk_separator_menu_item_new();
-	gtk_menu_shell_append(GTK_MENU_SHELL(view->priv->popup_menu), menu_item);
-
-	im_menu = gtk_menu_new();
-	menu_item = gtk_menu_item_new_with_mnemonic(_("_Input Methods"));
-	gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), im_menu);
-	vte_terminal_im_append_menuitems(VTE_TERMINAL(view->priv->terminal),
-									 GTK_MENU_SHELL(im_menu));
-	gtk_menu_shell_append(GTK_MENU_SHELL(view->priv->popup_menu), menu_item);
-
-	gtk_widget_show_all(view->priv->popup_menu);
-	gtk_menu_popup(GTK_MENU(view->priv->popup_menu),
-				   NULL, NULL,
-				   NULL, NULL,
-				   event ? event->button : 0,
-				   event ? event->time : gtk_get_current_event_time());
+    GtkWidget *im_menu;
+    GtkWidget *menu_item;
+    GtkWidget *profile_menu;
+    const GList *profiles;
+    const GList *profile;
+    GSList *group;
+
+    if (view->priv->popup_menu)
+        gtk_widget_destroy(view->priv->popup_menu);
+
+    g_assert(view->priv->popup_menu == NULL);
+
+    view->priv->popup_menu = gtk_menu_new();
+    gtk_menu_attach_to_widget(GTK_MENU(view->priv->popup_menu),
+                              view->priv->terminal,
+                              popup_menu_detach);
+
+    append_menuitem(view->priv->popup_menu,
+                    _("Close"),
+                    G_CALLBACK(mud_connection_view_close_current_cb),
+                    view);
+
+    menu_item = gtk_separator_menu_item_new();
+    gtk_menu_shell_append(GTK_MENU_SHELL(view->priv->popup_menu), menu_item);
+
+    append_stock_menuitem(view->priv->popup_menu,
+                          GTK_STOCK_COPY,
+                          NULL,
+                          view);
+    append_stock_menuitem(view->priv->popup_menu,
+                          GTK_STOCK_PASTE,
+                          NULL,
+                          view);
+
+    menu_item = gtk_separator_menu_item_new();
+    gtk_menu_shell_append(GTK_MENU_SHELL(view->priv->popup_menu), menu_item);
+
+    profile_menu = gtk_menu_new();
+    menu_item = gtk_menu_item_new_with_mnemonic(_("Change P_rofile"));
+    gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), profile_menu);
+    gtk_menu_shell_append(GTK_MENU_SHELL(view->priv->popup_menu), menu_item);
+
+    group = NULL;
+    profiles = mud_profile_get_profiles();
+    profile = profiles;
+    while (profile != NULL)
+    {
+        MudProfile *prof;
+
+        prof = profile->data;
+
+        /* Profiles can go away while the menu is up. */
+        g_object_ref(G_OBJECT(prof));
+
+        menu_item = gtk_radio_menu_item_new_with_label(group,
+                                                       prof->name);
+        group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menu_item));
+        gtk_menu_shell_append(GTK_MENU_SHELL(profile_menu), menu_item);
+
+        if (prof == view->priv->profile)
+            gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_item), TRUE);
+
+        g_signal_connect(G_OBJECT(menu_item),
+                         "toggled",
+                         G_CALLBACK(choose_profile_callback),
+                         view);
+        g_object_set_data_full(G_OBJECT(menu_item),
+                               "profile",
+                               prof,
+                               (GDestroyNotify) g_object_unref);
+        profile = profile->next;
+    }
+
+    menu_item = gtk_separator_menu_item_new();
+    gtk_menu_shell_append(GTK_MENU_SHELL(view->priv->popup_menu), menu_item);
+
+    im_menu = gtk_menu_new();
+    menu_item = gtk_menu_item_new_with_mnemonic(_("_Input Methods"));
+    gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), im_menu);
+    vte_terminal_im_append_menuitems(VTE_TERMINAL(view->priv->terminal),
+                                     GTK_MENU_SHELL(im_menu));
+    gtk_menu_shell_append(GTK_MENU_SHELL(view->priv->popup_menu), menu_item);
+
+    gtk_widget_show_all(view->priv->popup_menu);
+    gtk_menu_popup(GTK_MENU(view->priv->popup_menu),
+                   NULL, NULL,
+                   NULL, NULL,
+                   event ? event->button : 0,
+                   event ? event->time : gtk_get_current_event_time());
 }
 
 void
 mud_connection_view_set_id(MudConnectionView *view, gint id)
 {
-	view->priv->id = id;
+    view->priv->id = id;
 }
 
 void
 mud_connection_view_set_parent(MudConnectionView *view, MudWindow *window)
 {
-	view->priv->window = window;
+    view->priv->window = window;
 }
 
 
 MudConnectionView*
 mud_connection_view_new (const gchar *profile, const gchar *hostname, const gint port, GtkWidget *window, GtkWidget *tray, gchar *name)
 {
-	gchar *profile_name;
-	GConfClient *client;
+    gchar *profile_name;
+    GConfClient *client;
 
     gchar key[2048];
-	gchar extra_path[512] = "";
-	gboolean use_proxy;
-	gchar *proxy_host;
-	gchar *version;
+    gchar extra_path[512] = "";
+    gboolean use_proxy;
+    gchar *proxy_host;
+    gchar *version;
 
-	MudConnectionView *view;
-   	GdkGeometry hints;
-   	gint xpad, ypad;
-   	gint char_width, char_height;
-   	gchar *buf;
+    MudConnectionView *view;
+    GdkGeometry hints;
+    gint xpad, ypad;
+    gint char_width, char_height;
+    gchar *buf;
 
-	g_assert(hostname != NULL);
-	g_assert(port > 0);
+    g_assert(hostname != NULL);
+    g_assert(port > 0);
 
-	view = g_object_new(MUD_TYPE_CONNECTION_VIEW, NULL);
+    view = g_object_new(MUD_TYPE_CONNECTION_VIEW, NULL);
 
-	view->priv->hostname = g_strdup(hostname);
-	view->priv->port = port;
+    view->priv->hostname = g_strdup(hostname);
+    view->priv->port = port;
 
-	view->connection = gnet_conn_new(hostname, port,
-	    mud_connection_view_network_event_cb, view);
-	gnet_conn_ref(view->connection);
-	gnet_conn_set_watch_error(view->connection, TRUE);
+    view->connection = gnet_conn_new(hostname, port,
+                                     mud_connection_view_network_event_cb, view);
+    gnet_conn_ref(view->connection);
+    gnet_conn_set_watch_error(view->connection, TRUE);
 
-	view->naws_enabled = FALSE;
+    view->naws_enabled = FALSE;
 
-	view->priv->telnet = mud_telnet_new(view, view->connection, name);
+    view->priv->telnet = mud_telnet_new(view, view->connection, name);
 
-	view->local_echo = TRUE;
+    view->local_echo = TRUE;
 
-	mud_connection_view_set_profile(view, mud_profile_new(profile));
+    mud_connection_view_set_profile(view, mud_profile_new(profile));
 
-	/* Let us resize the gnome-mud window */
-	vte_terminal_get_padding(VTE_TERMINAL(view->priv->terminal), &xpad, &ypad);
-	char_width = VTE_TERMINAL(view->priv->terminal)->char_width;
-	char_height = VTE_TERMINAL(view->priv->terminal)->char_height;
+    /* Let us resize the gnome-mud window */
+    vte_terminal_get_padding(VTE_TERMINAL(view->priv->terminal), &xpad, &ypad);
+    char_width = VTE_TERMINAL(view->priv->terminal)->char_width;
+    char_height = VTE_TERMINAL(view->priv->terminal)->char_height;
 
-	hints.base_width = xpad;
-	hints.base_height = ypad;
-	hints.width_inc = char_width;
-	hints.height_inc = char_height;
+    hints.base_width = xpad;
+    hints.base_height = ypad;
+    hints.width_inc = char_width;
+    hints.height_inc = char_height;
 
-	hints.min_width =  hints.base_width + hints.width_inc * 4;
-	hints.min_height = hints.base_height+ hints.height_inc * 2;
+    hints.min_width =  hints.base_width + hints.width_inc * 4;
+    hints.min_height = hints.base_height+ hints.height_inc * 2;
 
-	gtk_window_set_geometry_hints(GTK_WINDOW(window),
-					GTK_WIDGET(view->priv->terminal),
-  					&hints,
-  					GDK_HINT_RESIZE_INC |
-  					GDK_HINT_MIN_SIZE |
-  					GDK_HINT_BASE_SIZE);
+    gtk_window_set_geometry_hints(GTK_WINDOW(window),
+                                  GTK_WIDGET(view->priv->terminal),
+                                  &hints,
+                                  GDK_HINT_RESIZE_INC |
+                                  GDK_HINT_MIN_SIZE |
+                                  GDK_HINT_BASE_SIZE);
 
-	view->priv->tray = MUD_TRAY(tray);
+    view->priv->tray = MUD_TRAY(tray);
 
-	view->priv->log = mud_log_new(name);
+    view->priv->log = mud_log_new(name);
 
-	buf = g_strdup_printf(_("*** Making connection to %s, port %d.\n"),
-	    view->priv->hostname, view->priv->port);
-	mud_connection_view_add_text(view, buf, System);
-	g_free(buf);
-	buf = NULL;
+    buf = g_strdup_printf(_("*** Making connection to %s, port %d.\n"),
+                          view->priv->hostname, view->priv->port);
+    mud_connection_view_add_text(view, buf, System);
+    g_free(buf);
+    buf = NULL;
 
-	profile_name = mud_profile_get_name(view->priv->profile);
+    profile_name = mud_profile_get_name(view->priv->profile);
 
-	if (strcmp(profile_name, "Default"))
-	{
-		g_snprintf(extra_path, 512, "profiles/%s/", profile_name);
-	}
+    if (strcmp(profile_name, "Default"))
+    {
+        g_snprintf(extra_path, 512, "profiles/%s/", profile_name);
+    }
 
-	g_snprintf(key, 2048, "/apps/gnome-mud/%s%s", extra_path, "functionality/use_proxy");
-	client = gconf_client_get_default();
-	use_proxy = gconf_client_get_bool(client, key, NULL);
+    g_snprintf(key, 2048, "/apps/gnome-mud/%s%s", extra_path, "functionality/use_proxy");
+    client = gconf_client_get_default();
+    use_proxy = gconf_client_get_bool(client, key, NULL);
 
-	g_snprintf(key, 2048, "/apps/gnome-mud/%s%s", extra_path, "functionality/proxy_hostname");
-	proxy_host = gconf_client_get_string(client, key, NULL);
+    g_snprintf(key, 2048, "/apps/gnome-mud/%s%s", extra_path, "functionality/proxy_hostname");
+    proxy_host = gconf_client_get_string(client, key, NULL);
 
-	g_snprintf(key, 2048, "/apps/gnome-mud/%s%s", extra_path, "functionality/proxy_version");
-	version = gconf_client_get_string(client, key, NULL);
+    g_snprintf(key, 2048, "/apps/gnome-mud/%s%s", extra_path, "functionality/proxy_version");
+    version = gconf_client_get_string(client, key, NULL);
 
-	if(use_proxy)
-	{
-	    if(proxy_host && version)
-	    {
+    if(use_proxy)
+    {
+        if(proxy_host && version)
+        {
             gnet_socks_set_enabled(TRUE);
             gnet_socks_set_server(gnet_inetaddr_new(proxy_host,GNET_SOCKS_PORT));
             gnet_socks_set_version((strcmp(version, "4") == 0) ? 4 : 5);
         }
-	}
-	else
-	    gnet_socks_set_enabled(FALSE);
+    }
+    else
+        gnet_socks_set_enabled(FALSE);
 
-	gnet_conn_connect(view->connection);
+    gnet_conn_connect(view->connection);
 
-	return view;
+    return view;
 }
 
 void
 mud_connection_view_set_profile(MudConnectionView *view, MudProfile *profile)
 {
-	if (profile == view->priv->profile)
-		return;
+    if (profile == view->priv->profile)
+        return;
 
-	if (view->priv->profile)
-	{
-		g_signal_handler_disconnect(view->priv->profile, view->priv->signal_profile_changed);
-		g_object_unref(G_OBJECT(view->priv->profile));
-	}
-
-	view->priv->profile = profile;
-	g_object_ref(G_OBJECT(profile));
-	view->priv->signal_profile_changed =
-		g_signal_connect(G_OBJECT(view->priv->profile), "changed",
-				 G_CALLBACK(mud_connection_view_profile_changed_cb),
-				 view);
-	mud_connection_view_reread_profile(view);
+    if (view->priv->profile)
+    {
+        g_signal_handler_disconnect(view->priv->profile, view->priv->signal_profile_changed);
+        g_object_unref(G_OBJECT(view->priv->profile));
+    }
+
+    view->priv->profile = profile;
+    g_object_ref(G_OBJECT(profile));
+    view->priv->signal_profile_changed =
+        g_signal_connect(G_OBJECT(view->priv->profile), "changed",
+                         G_CALLBACK(mud_connection_view_profile_changed_cb),
+                         view);
+    mud_connection_view_reread_profile(view);
 }
 
 MudProfile *
 mud_connection_view_get_current_profile(MudConnectionView *view)
 {
-	return view->priv->profile;
+    return view->priv->profile;
 }
 
 GtkWidget *
 mud_connection_view_get_viewport (MudConnectionView *view)
 {
-	return view->priv->box;
+    return view->priv->box;
 }
 
 GtkWidget *
 mud_connection_view_get_terminal(MudConnectionView *view)
 {
-	return view->priv->terminal;
+    return view->priv->terminal;
 }
 
 MudParseBase *
 mud_connection_view_get_parsebase(MudConnectionView *view)
 {
-	return view->priv->parse;
+    return view->priv->parse;
 }
 
 gchar *
 mud_connection_view_get_history_item(MudConnectionView *view, enum
-MudConnectionHistoryDirection direction)
+                                     MudConnectionHistoryDirection direction)
 {
     gchar *history_item;
 
@@ -973,23 +977,23 @@
             view->priv->current_history_index--;
 
     history_item = (gchar *)g_queue_peek_nth(view->priv->history,
-                            view->priv->current_history_index);
+                                             view->priv->current_history_index);
 
     if(direction == HISTORY_UP)
         if(view->priv->current_history_index <
-            g_queue_get_length(view->priv->history) - 1)
-                view->priv->current_history_index++;
+           g_queue_get_length(view->priv->history) - 1)
+            view->priv->current_history_index++;
 
     return history_item;
 }
 
 static void
- mud_connection_view_network_event_cb(GConn *conn, GConnEvent *event, gpointer pview)
+mud_connection_view_network_event_cb(GConn *conn, GConnEvent *event, gpointer pview)
 {
     gint gag;
-	gint pluggag;
-	gchar *buf;
-	gboolean temp;
+    gint pluggag;
+    gchar *buf;
+    gboolean temp;
     MudConnectionView *view = MUD_CONNECTION_VIEW(pview);
     gint length;
 
@@ -997,86 +1001,86 @@
 
     switch(event->type)
     {
-        case GNET_CONN_ERROR:
-            mud_connection_view_add_text(view, _("*** Could not connect.\n"), Error);
+    case GNET_CONN_ERROR:
+        mud_connection_view_add_text(view, _("*** Could not connect.\n"), Error);
         break;
 
-        case GNET_CONN_CONNECT:
-            mud_connection_view_add_text(view, _("*** Connected.\n"), System);
-            gnet_conn_read(view->connection);
+    case GNET_CONN_CONNECT:
+        mud_connection_view_add_text(view, _("*** Connected.\n"), System);
+        gnet_conn_read(view->connection);
         break;
 
-        case GNET_CONN_CLOSE:
-            mud_connection_view_add_text(view, _("*** Connection closed.\n"), Error);
+    case GNET_CONN_CLOSE:
+        mud_connection_view_add_text(view, _("*** Connection closed.\n"), Error);
         break;
 
-        case GNET_CONN_TIMEOUT:
+    case GNET_CONN_TIMEOUT:
         break;
 
-        case GNET_CONN_READ:
-	       if(!view->priv->connected)
-	       {
-		      view->priv->connected = TRUE;
-		      mud_tray_update_icon(view->priv->tray, online);
-	       }
+    case GNET_CONN_READ:
+        if(!view->priv->connected)
+        {
+            view->priv->connected = TRUE;
+            mud_tray_update_icon(view->priv->tray, online);
+        }
 
-	       mud_telnet_process(view->priv->telnet, (guchar *)event->buffer,
-	        event->length, &length, &(view->priv->processed));
+        mud_telnet_process(view->priv->telnet, (guchar *)event->buffer,
+                           event->length, &length, &(view->priv->processed));
 
-	       if(view->priv->processed != NULL)
-	       {
+        if(view->priv->processed != NULL)
+        {
 #ifdef ENABLE_GST
-	       	   if(view->priv->telnet->msp_parser.enabled)
-	       	   {
-					view->priv->processed = mud_telnet_msp_parse(
-						view->priv->telnet, view->priv->processed, &length);
-			   }
+            if(view->priv->telnet->msp_parser.enabled)
+            {
+                view->priv->processed = mud_telnet_msp_parse(
+                    view->priv->telnet, view->priv->processed, &length);
+            }
 #endif
-			   if(view->priv->processed != NULL)
-			   {
+            if(view->priv->processed != NULL)
+            {
 #ifdef ENABLE_GST
-			   	   mud_telnet_msp_parser_clear(view->priv->telnet);
-#endif
-		           buf = view->priv->processed->str;
+                mud_telnet_msp_parser_clear(view->priv->telnet);
+#endif 
+                buf = view->priv->processed->str;
+
+                temp = view->local_echo;
+                view->local_echo = FALSE;
+                gag = mud_parse_base_do_triggers(view->priv->parse,
+                                                 buf);
+                view->local_echo = temp;
+
+                mud_window_handle_plugins(view->priv->window, view->priv->id,
+                                          buf, length, 1);
+
+                pluggag = PluginGag;
+                PluginGag = FALSE;
+
+                if(!gag && !pluggag)
+                {
+                    vte_terminal_feed(VTE_TERMINAL(view->priv->terminal),
+                                      buf, length);
+                    mud_log_write_hook(view->priv->log, buf, length);
+                }
+
+                if (view->priv->connect_hook) {
+                    mud_connection_view_send (view, view->priv->connect_string);
+                    view->priv->connect_hook = FALSE;
+                }
 
-		           temp = view->local_echo;
-		           view->local_echo = FALSE;
-		           gag = mud_parse_base_do_triggers(view->priv->parse,
-		                    buf);
-		           view->local_echo = temp;
-
-		           mud_window_handle_plugins(view->priv->window, view->priv->id,
-		                    buf, length, 1);
-
-		           pluggag = PluginGag;
-		           PluginGag = FALSE;
-
-		            if(!gag && !pluggag)
-		            {
-		    	        vte_terminal_feed(VTE_TERMINAL(view->priv->terminal),
-		    	            buf, length);
-		    	        mud_log_write_hook(view->priv->log, buf, length);
-		            }
-
-	                if (view->priv->connect_hook) {
-	                    mud_connection_view_send (view, view->priv->connect_string);
-	                    view->priv->connect_hook = FALSE;
-	               }
-
-	               buf = NULL;
-	            }
+                buf = NULL;
             }
+        }
 
-            gnet_conn_read(view->connection);
+        gnet_conn_read(view->connection);
         break;
 
-        case GNET_CONN_WRITE:
+    case GNET_CONN_WRITE:
         break;
 
-        case GNET_CONN_READABLE:
+    case GNET_CONN_READABLE:
         break;
 
-        case GNET_CONN_WRITABLE:
+    case GNET_CONN_WRITABLE:
         break;
     }
 }
@@ -1100,14 +1104,14 @@
 {
     if(view && view->naws_enabled)
     {
-	guint curr_width = VTE_TERMINAL(view->priv->terminal)->column_count;
-	guint curr_height = VTE_TERMINAL(view->priv->terminal)->row_count;
+        guint curr_width = VTE_TERMINAL(view->priv->terminal)->column_count;
+        guint curr_height = VTE_TERMINAL(view->priv->terminal)->row_count;
 
-	if(curr_width != view->priv->width || curr_height != view->priv->height)
-        	mud_telnet_send_naws(view->priv->telnet, curr_width, curr_height);
+        if(curr_width != view->priv->width || curr_height != view->priv->height)
+            mud_telnet_send_naws(view->priv->telnet, curr_width, curr_height);
 
-	view->priv->width = curr_width;
-	view->priv->height = curr_height;
+        view->priv->width = curr_width;
+        view->priv->height = curr_height;
     }
 }
 
@@ -1115,40 +1119,40 @@
 static void
 mud_connection_view_start_download(MudConnectionView *view)
 {
-	MudMSPDownloadItem *item;
+    MudMSPDownloadItem *item;
 
-	gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(view->priv->progressbar), 0.0);
-	gtk_label_set_text(GTK_LABEL(view->priv->dl_label), _("Connecting..."));
-	gtk_widget_show(view->priv->progressbar);
-	gtk_widget_show(view->priv->dl_label);
-	gtk_widget_show(view->priv->dl_button);
-
-	if(!view->priv->downloading && view->priv->dl_conn)
-		gnet_conn_http_delete(view->priv->dl_conn);
-
-	item = g_queue_peek_head(view->priv->download_queue);
-	view->priv->dl_conn = gnet_conn_http_new();
-	gnet_conn_http_set_uri(view->priv->dl_conn, item->url);
-	gnet_conn_http_set_user_agent (view->priv->dl_conn, "gnome-mud");
-	// 30 minute timeout, if the file didn't download in 30 minutes, its not going to happen.
-	gnet_conn_http_set_timeout(view->priv->dl_conn, 1800000);
+    gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(view->priv->progressbar), 0.0);
+    gtk_label_set_text(GTK_LABEL(view->priv->dl_label), _("Connecting..."));
+    gtk_widget_show(view->priv->progressbar);
+    gtk_widget_show(view->priv->dl_label);
+    gtk_widget_show(view->priv->dl_button);
+
+    if(!view->priv->downloading && view->priv->dl_conn)
+        gnet_conn_http_delete(view->priv->dl_conn);
+
+    item = g_queue_peek_head(view->priv->download_queue);
+    view->priv->dl_conn = gnet_conn_http_new();
+    gnet_conn_http_set_uri(view->priv->dl_conn, item->url);
+    gnet_conn_http_set_user_agent (view->priv->dl_conn, "gnome-mud");
+    // 30 minute timeout, if the file didn't download in 30 minutes, its not going to happen.
+    gnet_conn_http_set_timeout(view->priv->dl_conn, 1800000);
 
-	view->priv->downloading = TRUE;
+    view->priv->downloading = TRUE;
 
-	gnet_conn_http_run_async(view->priv->dl_conn,
-		mud_connection_view_http_cb, view);
+    gnet_conn_http_run_async(view->priv->dl_conn,
+                             mud_connection_view_http_cb, view);
 }
 
 void
 mud_connection_view_queue_download(MudConnectionView *view, gchar *url, gchar *file)
 {
-	MudMSPDownloadItem *item;
-	guint i, size;
-	GConfClient *client;
-	gboolean download;
+    MudMSPDownloadItem *item;
+    guint i, size;
+    GConfClient *client;
+    gboolean download;
 
     gchar key[2048];
-	gchar extra_path[512] = "";
+    gchar extra_path[512] = "";
 
     client = gconf_client_get_default();
 
@@ -1157,157 +1161,157 @@
 
     if(download)
     {
-		size = g_queue_get_length(view->priv->download_queue);
+        size = g_queue_get_length(view->priv->download_queue);
 
-		for(i = 0; i < size; ++i) // Don't add items twice.
-		{
-			item = (MudMSPDownloadItem *)g_queue_peek_nth(view->priv->download_queue, i);
+        for(i = 0; i < size; ++i) // Don't add items twice.
+        {
+            item = (MudMSPDownloadItem *)g_queue_peek_nth(view->priv->download_queue, i);
 
-			if(strcmp(item->url, url) == 0)
-				return;
-		}
+            if(strcmp(item->url, url) == 0)
+                return;
+        }
 
-		item = NULL;
-		item = g_malloc(sizeof(MudMSPDownloadItem));
+        item = NULL;
+        item = g_malloc(sizeof(MudMSPDownloadItem));
 
-		item->url = g_strdup(url);
-		item->file = g_strdup(file);
+        item->url = g_strdup(url);
+        item->file = g_strdup(file);
 
-		g_queue_push_tail(view->priv->download_queue, item);
+        g_queue_push_tail(view->priv->download_queue, item);
 
-		item = NULL;
+        item = NULL;
 
-		if(view->priv->downloading == FALSE)
-			mud_connection_view_start_download(view);
-	}
+        if(view->priv->downloading == FALSE)
+            mud_connection_view_start_download(view);
+    }
 }
 
 static void
 mud_connection_view_http_cb(GConnHttp *conn, GConnHttpEvent *event, gpointer data)
 {
-	MudConnectionView *view = (MudConnectionView *)data;
-	MudMSPDownloadItem *item;
-	gchar **uri;
-	GString *file_name;
-	GConnHttpEventData *event_data;
+    MudConnectionView *view = (MudConnectionView *)data;
+    MudMSPDownloadItem *item;
+    gchar **uri;
+    GString *file_name;
+    GConnHttpEventData *event_data;
 
-	switch(event->type)
-	{
-		case GNET_CONN_HTTP_CONNECTED:
-		break;
+    switch(event->type)
+    {
+    case GNET_CONN_HTTP_CONNECTED:
+        break;
 
-		case GNET_CONN_HTTP_DATA_PARTIAL:
-			event_data = (GConnHttpEventData *)event;
+    case GNET_CONN_HTTP_DATA_PARTIAL:
+        event_data = (GConnHttpEventData *)event;
 
-			if(event_data->content_length == 0)
-				gtk_progress_bar_pulse(GTK_PROGRESS_BAR(view->priv->progressbar));
-			else
-				gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(view->priv->progressbar),
-					(gdouble)((gdouble)event_data->data_received / (gdouble)event_data->content_length));
-		break;
+        if(event_data->content_length == 0)
+            gtk_progress_bar_pulse(GTK_PROGRESS_BAR(view->priv->progressbar));
+        else
+            gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(view->priv->progressbar),
+                                          (gdouble)((gdouble)event_data->data_received / (gdouble)event_data->content_length));
+        break;
 
-		case GNET_CONN_HTTP_DATA_COMPLETE:
-			event_data = (GConnHttpEventData *)event;
+    case GNET_CONN_HTTP_DATA_COMPLETE:
+        event_data = (GConnHttpEventData *)event;
 
-			gtk_widget_hide(view->priv->progressbar);
-			gtk_widget_hide(view->priv->dl_label);
-			gtk_widget_hide(view->priv->dl_button);
+        gtk_widget_hide(view->priv->progressbar);
+        gtk_widget_hide(view->priv->dl_label);
+        gtk_widget_hide(view->priv->dl_button);
 
-			item = g_queue_pop_head(view->priv->download_queue);
+        item = g_queue_pop_head(view->priv->download_queue);
 
-			g_file_set_contents(item->file, event_data->buffer,
-				event_data->buffer_length, NULL);
+        g_file_set_contents(item->file, event_data->buffer,
+                            event_data->buffer_length, NULL);
 
-            mud_telnet_msp_download_item_free(item);
-			view->priv->downloading = FALSE;
+        mud_telnet_msp_download_item_free(item);
+        view->priv->downloading = FALSE;
 
-			if(!g_queue_is_empty(view->priv->download_queue))
-				mud_connection_view_start_download(view);
-		break;
+        if(!g_queue_is_empty(view->priv->download_queue))
+            mud_connection_view_start_download(view);
+        break;
 
-		case GNET_CONN_HTTP_TIMEOUT:
-			if(!view->priv->downloading)
-				break;
+    case GNET_CONN_HTTP_TIMEOUT:
+        if(!view->priv->downloading)
+            break;
 
-			gtk_widget_hide(view->priv->progressbar);
-			gtk_widget_hide(view->priv->dl_label);
-			gtk_widget_hide(view->priv->dl_button);
+        gtk_widget_hide(view->priv->progressbar);
+        gtk_widget_hide(view->priv->dl_label);
+        gtk_widget_hide(view->priv->dl_button);
 
-			g_warning(_("Connection timed out."));
+        g_warning(_("Connection timed out."));
 
-			item = g_queue_pop_head(view->priv->download_queue);
-			mud_telnet_msp_download_item_free(item);
+        item = g_queue_pop_head(view->priv->download_queue);
+        mud_telnet_msp_download_item_free(item);
 
-			view->priv->downloading = FALSE;
+        view->priv->downloading = FALSE;
 
-			if(!g_queue_is_empty(view->priv->download_queue))
-				mud_connection_view_start_download(view);
-		break;
+        if(!g_queue_is_empty(view->priv->download_queue))
+            mud_connection_view_start_download(view);
+        break;
 
-		case GNET_CONN_HTTP_ERROR:
-			gtk_widget_hide(view->priv->progressbar);
-			gtk_widget_hide(view->priv->dl_label);
-			gtk_widget_hide(view->priv->dl_button);
+    case GNET_CONN_HTTP_ERROR:
+        gtk_widget_hide(view->priv->progressbar);
+        gtk_widget_hide(view->priv->dl_label);
+        gtk_widget_hide(view->priv->dl_button);
 
-			g_warning(_("There was an internal http connection error."));
+        g_warning(_("There was an internal http connection error."));
 
-			item = g_queue_pop_head(view->priv->download_queue);
-			mud_telnet_msp_download_item_free(item);
+        item = g_queue_pop_head(view->priv->download_queue);
+        mud_telnet_msp_download_item_free(item);
 
-			view->priv->downloading = FALSE;
+        view->priv->downloading = FALSE;
 
-			if(!g_queue_is_empty(view->priv->download_queue))
-				mud_connection_view_start_download(view);
+        if(!g_queue_is_empty(view->priv->download_queue))
+            mud_connection_view_start_download(view);
 
-		break;
+        break;
 
-		case GNET_CONN_HTTP_RESOLVED:
-			break;
+    case GNET_CONN_HTTP_RESOLVED:
+        break;
 
-		case GNET_CONN_HTTP_RESPONSE:
-			item = g_queue_peek_head(view->priv->download_queue);
+    case GNET_CONN_HTTP_RESPONSE:
+        item = g_queue_peek_head(view->priv->download_queue);
 
-			uri = g_strsplit(item->url, "/", 0);
+        uri = g_strsplit(item->url, "/", 0);
 
-			file_name = g_string_new(NULL);
+        file_name = g_string_new(NULL);
 
-			g_string_append(file_name, _("Downloading"));
-			g_string_append_c(file_name, ' ');
-			g_string_append(file_name, uri[g_strv_length(uri) - 1]);
-			g_string_append(file_name, "...");
+        g_string_append(file_name, _("Downloading"));
+        g_string_append_c(file_name, ' ');
+        g_string_append(file_name, uri[g_strv_length(uri) - 1]);
+        g_string_append(file_name, "...");
 
-			gtk_label_set_text(GTK_LABEL(view->priv->dl_label), file_name->str);
+        gtk_label_set_text(GTK_LABEL(view->priv->dl_label), file_name->str);
 
-			g_string_free(file_name, TRUE);
-			g_strfreev(uri);
-			break;
+        g_string_free(file_name, TRUE);
+        g_strfreev(uri);
+        break;
 
-		case GNET_CONN_HTTP_REDIRECT:
-			break;
-	}
+    case GNET_CONN_HTTP_REDIRECT:
+        break;
+    }
 }
 
 static void
 mud_connection_view_cancel_dl_cb(GtkWidget *widget, MudConnectionView *view)
 {
-	MudMSPDownloadItem *item;
+    MudMSPDownloadItem *item;
 
-	gtk_widget_hide(view->priv->progressbar);
-	gtk_widget_hide(view->priv->dl_label);
-	gtk_widget_hide(view->priv->dl_button);
+    gtk_widget_hide(view->priv->progressbar);
+    gtk_widget_hide(view->priv->dl_label);
+    gtk_widget_hide(view->priv->dl_button);
 
-	if(view->priv->dl_conn)
-	{
-		gnet_conn_http_delete(view->priv->dl_conn);
-		view->priv->dl_conn = NULL;
-	}
+    if(view->priv->dl_conn)
+    {
+        gnet_conn_http_delete(view->priv->dl_conn);
+        view->priv->dl_conn = NULL;
+    }
 
-	item = g_queue_pop_head(view->priv->download_queue);
-	mud_telnet_msp_download_item_free(item);
+    item = g_queue_pop_head(view->priv->download_queue);
+    mud_telnet_msp_download_item_free(item);
 
-	view->priv->downloading = FALSE;
+    view->priv->downloading = FALSE;
 
-	if(!g_queue_is_empty(view->priv->download_queue))
-		mud_connection_view_start_download(view);
+    if(!g_queue_is_empty(view->priv->download_queue))
+        mud_connection_view_start_download(view);
 }
 #endif

Modified: trunk/src/mud-telnet-handlers.c
==============================================================================
--- trunk/src/mud-telnet-handlers.c	(original)
+++ trunk/src/mud-telnet-handlers.c	Sun Feb 15 19:29:27 2009
@@ -35,7 +35,13 @@
 #include "mud-telnet-zmp.h"
 
 #ifdef ENABLE_GST
-	#include "mud-telnet-msp.h"
+#include "mud-telnet-msp.h"
+#endif
+
+#ifdef ENABLE_MCCP
+#include <zlib.h>
+#include <stdlib.h>
+#include "mud-telnet-mccp.h"
 #endif
 
 /* TTYPE */
@@ -55,52 +61,52 @@
 
 void
 MudHandler_TType_HandleSubNeg(MudTelnet *telnet, guchar *buf,
-                              guint len, MudTelnetHandler *handler)
+        guint len, MudTelnetHandler *handler)
 {
-	    switch(telnet->ttype_iteration)
-	    {
-	        case 0:
-	            mud_telnet_send_sub_req(telnet, 11,
-	                                (guchar)TELOPT_TTYPE,
-                                    (guchar)TEL_TTYPE_IS,
-	                                 'g','n','o','m','e','-','m','u','d');
-	            telnet->ttype_iteration++;
-	        break;
-
-	        case 1:
-	            mud_telnet_send_sub_req(telnet, 7,
-	                                (guchar)TELOPT_TTYPE,
-                                    (guchar)TEL_TTYPE_IS,
-	                                 'x','t','e','r','m');
-	            telnet->ttype_iteration++;
-	        break;
-
-	        case 2:
-	            mud_telnet_send_sub_req(telnet, 6,
-	                                (guchar)TELOPT_TTYPE,
-                                    (guchar)TEL_TTYPE_IS,
-	                                 'a','n','s','i');
-	            telnet->ttype_iteration++;
-	        break;
-
-	        case 3:
-	            mud_telnet_send_sub_req(telnet, 9,
-	                                (guchar)TELOPT_TTYPE,
-                                    (guchar)TEL_TTYPE_IS,
-	                                 'U','N','K','N','O','W','N');
-	            telnet->ttype_iteration++;
-	        break;
-
-		/* RFC 1091 says we need to repeat the last type */
-		case 4:
-		    mud_telnet_send_sub_req(telnet, 9,
-				    (guchar)TELOPT_TTYPE,
-				    (gchar)TEL_TTYPE_IS,
-				    'U','N','K','N','O','W','N');
-		    telnet->ttype_iteration = 0;
-		    break;
-			
-	       }
+    switch(telnet->ttype_iteration)
+    {
+        case 0:
+            mud_telnet_send_sub_req(telnet, 11,
+                    (guchar)TELOPT_TTYPE,
+                    (guchar)TEL_TTYPE_IS,
+                    'g','n','o','m','e','-','m','u','d');
+            telnet->ttype_iteration++;
+            break;
+
+        case 1:
+            mud_telnet_send_sub_req(telnet, 7,
+                    (guchar)TELOPT_TTYPE,
+                    (guchar)TEL_TTYPE_IS,
+                    'x','t','e','r','m');
+            telnet->ttype_iteration++;
+            break;
+
+        case 2:
+            mud_telnet_send_sub_req(telnet, 6,
+                    (guchar)TELOPT_TTYPE,
+                    (guchar)TEL_TTYPE_IS,
+                    'a','n','s','i');
+            telnet->ttype_iteration++;
+            break;
+
+        case 3:
+            mud_telnet_send_sub_req(telnet, 9,
+                    (guchar)TELOPT_TTYPE,
+                    (guchar)TEL_TTYPE_IS,
+                    'U','N','K','N','O','W','N');
+            telnet->ttype_iteration++;
+            break;
+
+            /* RFC 1091 says we need to repeat the last type */
+        case 4:
+            mud_telnet_send_sub_req(telnet, 9,
+                    (guchar)TELOPT_TTYPE,
+                    (gchar)TEL_TTYPE_IS,
+                    'U','N','K','N','O','W','N');
+            telnet->ttype_iteration = 0;
+            break;
+
+    }
 }
 
 /* NAWS */
@@ -126,7 +132,7 @@
 
 void
 MudHandler_NAWS_HandleSubNeg(MudTelnet *telnet, guchar *buf,
-    guint len, MudTelnetHandler *handler)
+        guint len, MudTelnetHandler *handler)
 {
     return;
 }
@@ -146,7 +152,7 @@
 
 void
 MudHandler_ECHO_HandleSubNeg(MudTelnet *telnet, guchar *buf,
-    guint len, MudTelnetHandler *handler)
+        guint len, MudTelnetHandler *handler)
 {
     return;
 }
@@ -166,7 +172,7 @@
 
 void
 MudHandler_EOR_HandleSubNeg(MudTelnet *telnet, guchar *buf,
-    guint len, MudTelnetHandler *handler)
+        guint len, MudTelnetHandler *handler)
 {
     return;
 }
@@ -187,7 +193,7 @@
 
 void
 MudHandler_CHARSET_HandleSubNeg(MudTelnet *telnet, guchar *buf,
-    guint len, MudTelnetHandler *handler)
+        guint len, MudTelnetHandler *handler)
 {
     gint index = 0;
     guchar sep;
@@ -206,9 +212,9 @@
 
             if(strcmp((gchar *)tbuf, "[TTABLE]") == 0)
             {
-	            mud_telnet_send_sub_req(telnet, 2,
-	                                (guchar)TELOPT_CHARSET,
-                                    (guchar)TEL_CHARSET_TTABLE_REJECTED);
+                mud_telnet_send_sub_req(telnet, 2,
+                        (guchar)TELOPT_CHARSET,
+                        (guchar)TEL_CHARSET_TTABLE_REJECTED);
                 return;
             }
 
@@ -236,7 +242,7 @@
             g_string_free(encoding, TRUE);
             g_strfreev(encodings);
 
-        break;
+            break;
     }
 }
 
@@ -251,55 +257,55 @@
 void
 MudHandler_ZMP_Disable(MudTelnet *telnet, MudTelnetHandler *handler)
 {
-	/* Cannot disable ZMP once enabled per specification */
+    /* Cannot disable ZMP once enabled per specification */
     return;
 }
 
 void
 MudHandler_ZMP_HandleSubNeg(MudTelnet *telnet, guchar *buf,
-    guint len, MudTelnetHandler *handler)
+        guint len, MudTelnetHandler *handler)
 {
-	gchar command_buf[1024];
-	gint count = 0;
-	gint index = 0;
-	GString *args = g_string_new(NULL);
-	gchar **argv;
-	gint argc;
-	MudZMPFunction zmp_handler = NULL;
-
-	while(buf[count] != '\0' && count < len)
-		command_buf[index++] = buf[count++];
-	command_buf[index] = '\0';
-
-	while(count < len - 1)
-	{
-		if(buf[count] == '\0')
-		{
-			g_string_append(args,"|gmud_sep|");
-			count++;
-			continue;
-		}
-
-		g_string_append_c(args, buf[count++]);
-	}
-
-	g_string_prepend(args, command_buf);
-
-	argv = g_strsplit(args->str, "|gmud_sep|", -1);
-	argc = g_strv_length(argv);
-
-	if(mud_zmp_has_command(telnet, command_buf))
-	{
-		zmp_handler = mud_zmp_get_function(telnet, command_buf);
-
-		if(zmp_handler)
-			zmp_handler(telnet, argc, argv);
-		else
-			g_warning("NULL ZMP functioned returned.");
-	}
+    gchar command_buf[1024];
+    gint count = 0;
+    gint index = 0;
+    GString *args = g_string_new(NULL);
+    gchar **argv;
+    gint argc;
+    MudZMPFunction zmp_handler = NULL;
+
+    while(buf[count] != '\0' && count < len)
+        command_buf[index++] = buf[count++];
+    command_buf[index] = '\0';
+
+    while(count < len - 1)
+    {
+        if(buf[count] == '\0')
+        {
+            g_string_append(args,"|gmud_sep|");
+            count++;
+            continue;
+        }
+
+        g_string_append_c(args, buf[count++]);
+    }
+
+    g_string_prepend(args, command_buf);
 
-	g_strfreev(argv);
-	g_string_free(args, TRUE);
+    argv = g_strsplit(args->str, "|gmud_sep|", -1);
+    argc = g_strv_length(argv);
+
+    if(mud_zmp_has_command(telnet, command_buf))
+    {
+        zmp_handler = mud_zmp_get_function(telnet, command_buf);
+
+        if(zmp_handler)
+            zmp_handler(telnet, argc, argv);
+        else
+            g_warning("NULL ZMP functioned returned.");
+    }
+
+    g_strfreev(argv);
+    g_string_free(args, TRUE);
 
 }
 
@@ -308,9 +314,9 @@
 void
 MudHandler_MSP_Enable(MudTelnet *telnet, MudTelnetHandler *handler)
 {
-	handler->enabled = TRUE;
-	mud_telnet_msp_init(telnet);
-	telnet->msp_parser.enabled = TRUE;
+    handler->enabled = TRUE;
+    mud_telnet_msp_init(telnet);
+    telnet->msp_parser.enabled = TRUE;
 }
 
 void
@@ -321,9 +327,62 @@
 
 void
 MudHandler_MSP_HandleSubNeg(MudTelnet *telnet, guchar *buf,
-    guint len, MudTelnetHandler *handler)
+        guint len, MudTelnetHandler *handler)
 {
     return;
 }
 #endif
 
+#ifdef ENABLE_MCCP
+void
+MudHandler_MCCP_Enable(MudTelnet *telnet, MudTelnetHandler *handler)
+{
+    handler->enabled = TRUE;
+    telnet->mccp = FALSE;
+}
+
+void
+MudHandler_MCCP_Disable(MudTelnet *telnet, MudTelnetHandler *handler)
+{
+    handler->enabled = FALSE;
+    telnet->mccp = FALSE;
+
+    if (telnet->compress_out != NULL)
+    {
+        inflateEnd(telnet->compress_out);
+
+        g_free(telnet->compress_out);
+        g_free(telnet->compress_out_buf);
+        
+        telnet->compress_out = NULL;
+    }
+}
+
+void
+MudHandler_MCCP_HandleSubNeg(MudTelnet *telnet, guchar *buf, 
+        guint len, MudTelnetHandler *handler)
+{
+    telnet->mccp = TRUE;
+    telnet->mccp_new = TRUE;
+
+    telnet->compress_out = (z_stream *) calloc(1, sizeof(z_stream));
+    telnet->compress_out_buf = (guchar *) calloc(4096, sizeof(guchar));
+
+    telnet->compress_out->next_out = telnet->compress_out_buf;
+    telnet->compress_out->avail_out = 4096;
+
+    if(inflateInit(telnet->compress_out) != Z_OK)
+    {
+        g_critical("Failed to initialize compression.");
+
+        g_free(telnet->compress_out);
+        g_free(telnet->compress_out_buf);
+
+        telnet->compress_out = NULL;
+        telnet->compress_out_buf = NULL;
+
+        mud_connection_view_disconnect(telnet->parent);
+    }
+}
+#endif
+

Modified: trunk/src/mud-telnet-handlers.h
==============================================================================
--- trunk/src/mud-telnet-handlers.h	(original)
+++ trunk/src/mud-telnet-handlers.h	Sun Feb 15 19:29:27 2009
@@ -70,4 +70,12 @@
     guint len, MudTelnetHandler *handler);
 #endif
 
+#ifdef ENABLE_MCCP
+/* MCCP */
+void MudHandler_MCCP_Enable(MudTelnet *telnet, MudTelnetHandler *handler);
+void MudHandler_MCCP_Disable(MudTelnet *telnet, MudTelnetHandler *handler);
+void MudHandler_MCCP_HandleSubNeg(MudTelnet *telnet, guchar *buf,
+    guint len, MudTelnetHandler *handler);
+#endif
+
 #endif // MUD_TELNET_HANDLERS_H

Added: trunk/src/mud-telnet-mccp.c
==============================================================================
--- (empty file)
+++ trunk/src/mud-telnet-mccp.c	Sun Feb 15 19:29:27 2009
@@ -0,0 +1,103 @@
+/* GNOME-Mud - A simple Mud CLient
+ * Copyright (C) 1998-2006 Robin Ericsson <lobbin localhost nu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <zlib.h>
+
+#include "gnome-mud.h"
+#include "mud-connection-view.h"
+#include "mud-telnet.h"
+
+GString *
+mud_mccp_decompress(MudTelnet *telnet, guchar *buffer, guint32 length)
+{
+    GString *ret = g_string_new(NULL);
+    gint zstatus;
+    gint i;
+
+    if(!telnet->compress_out)
+        return NULL;
+
+    telnet->compress_out->next_in = buffer;
+    telnet->compress_out->avail_in = length;
+
+    while(1)
+    {
+        if(telnet->compress_out->avail_in < 1)
+            break;
+
+        telnet->compress_out->avail_out = 4096;
+        telnet->compress_out->next_out = telnet->compress_out_buf;
+
+        zstatus = inflate(telnet->compress_out, Z_SYNC_FLUSH);
+
+        if(zstatus == Z_OK)
+        {
+            for(i = 0; i < (4096 - telnet->compress_out->avail_out); ++i)
+                    g_string_append_c(ret,
+                        (gchar)telnet->compress_out_buf[i]);
+            continue;
+        }
+
+        if(zstatus == Z_STREAM_END)
+        {
+            for(i = 0; i < (4096 - telnet->compress_out->avail_out); ++i)
+                g_string_append_c(ret, (gchar)telnet->compress_out_buf[i]);
+
+            if(telnet->compress_out->avail_in > 0)
+                for(i = 0; i < telnet->compress_out->avail_in; ++i)
+                    g_string_append_c(ret,
+                            (gchar)telnet->compress_out->next_in[i]);
+
+            inflateEnd(telnet->compress_out);
+
+            g_free(telnet->compress_out);
+            g_free(telnet->compress_out_buf);
+
+            telnet->compress_out = NULL;
+            telnet->compress_out_buf = NULL;
+
+            telnet->mccp = FALSE;
+            telnet->mccp_new = TRUE;
+
+            return ret;
+        }
+
+        if(zstatus == Z_BUF_ERROR)
+        {
+            break;
+        }
+
+        if(zstatus == Z_DATA_ERROR)
+        {
+            mud_connection_view_add_text(telnet->parent,
+                    _("\nMCCP data corrupted. Aborting connection.\n"),
+                    Error);
+            mud_connection_view_disconnect (telnet->parent);
+            return NULL; 
+        }
+    }
+
+    return ret;
+}
+

Added: trunk/src/mud-telnet-mccp.h
==============================================================================
--- (empty file)
+++ trunk/src/mud-telnet-mccp.h	Sun Feb 15 19:29:27 2009
@@ -0,0 +1,28 @@
+/* GNOME-Mud - A simple Mud CLient
+ * Copyright (C) 1998-2006 Robin Ericsson <lobbin localhost nu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef MUD_TELNET_MCCP_H
+#define MUD_TELNET_MCCP_H
+
+#include <glib.h>
+#include "mud-telnet.h"
+
+GString *mud_mccp_decompress(MudTelnet *telnet, guchar *buffer, guint32 length);
+
+#endif // MUD_TELNET_MCCP_H
+

Modified: trunk/src/mud-telnet-zmp.c
==============================================================================
--- trunk/src/mud-telnet-zmp.c	(original)
+++ trunk/src/mud-telnet-zmp.c	Sun Feb 15 19:29:27 2009
@@ -213,7 +213,7 @@
 ZMP_ident(MudTelnet *telnet, gint argc, gchar **argv)
 {
 	mud_zmp_send_command(telnet, 4,
-		"zmp.ident", "gnome-mud", "0.11",
+		"zmp.ident", "gnome-mud", VERSION,
 		"A mud client written for the GNOME environment.");
 }
 

Modified: trunk/src/mud-telnet.c
==============================================================================
--- trunk/src/mud-telnet.c	(original)
+++ trunk/src/mud-telnet.c	Sun Feb 15 19:29:27 2009
@@ -35,6 +35,10 @@
 #include "mud-telnet-handlers.h"
 #include "mud-telnet-zmp.h"
 
+#ifdef ENABLE_MCCP
+#include "mud-telnet-mccp.h"
+#endif
+
 struct _MudTelnetPrivate
 {
 };
@@ -130,6 +134,16 @@
         g_string_free(telnet->processed, TRUE);
     g_free(telnet->priv);
 
+#ifdef ENABLE_MCCP
+    if(telnet->compress_out != NULL)
+    {
+        inflateEnd(telnet->compress_out);
+
+        g_free(telnet->compress_out);
+        g_free(telnet->compress_out_buf);
+    }
+#endif
+
     parent_class = g_type_class_peek_parent(G_OBJECT_GET_CLASS(object));
     parent_class->finalize(object);
 }
@@ -176,6 +190,10 @@
 
 #endif
 
+#ifdef ENABLE_MCCP
+    telnet->mccp_new = TRUE;
+#endif
+
     return telnet;
 }
 
@@ -252,6 +270,16 @@
     telnet->handlers[6].handle_sub_neg = MudHandler_MSP_HandleSubNeg;
 #endif
 
+#ifdef ENABLE_MCCP
+    /* MCCP */
+    telnet->handlers[7].type = HANDLER_MCCP2;
+    telnet->handlers[7].option_number = (guchar)TELOPT_MCCP2;
+    telnet->handlers[7].enabled = TRUE;
+    telnet->handlers[7].enable = MudHandler_MCCP_Enable;
+    telnet->handlers[7].disable = MudHandler_MCCP_Disable;
+    telnet->handlers[7].handle_sub_neg = MudHandler_MCCP_HandleSubNeg;
+#endif
+
 }
 
 gint
@@ -315,12 +343,32 @@
 {
     guint32 i;
     guint32 count;
-    gchar *opt;
     g_assert(telnet != NULL);
 
     telnet->buffer = g_string_new(NULL);
 
-    g_string_append_len(telnet->buffer, (gchar *)buf, c);
+#ifdef ENABLE_MCCP
+    if(telnet->mccp)
+    {
+        GString *ret = NULL;
+        gchar *str;
+
+        // decompress the buffer.
+        ret = mud_mccp_decompress(telnet, buf, c);
+
+        if(ret == NULL)
+            return;
+        else
+        {
+            str = g_strdup(ret->str);
+            g_string_append(telnet->buffer, str);
+            g_string_free(ret, TRUE);
+            g_free(str);
+        }
+    }
+    else
+#endif
+        g_string_append_len(telnet->buffer, (gchar *)buf, c);
 
     count = telnet->buffer->len;
 
@@ -329,6 +377,75 @@
 	switch (telnet->tel_state)
 	{
 	case TEL_STATE_TEXT:
+#ifdef ENABLE_MCCP
+            /* The following is only done when compressing is first
+               enabled in order to decompress any part of the buffer
+               that remains after the subnegotation takes place */
+            if(telnet->mccp && telnet->mccp_new)
+            {
+                GString *ret = NULL;
+                telnet->mccp_new = FALSE;
+
+                // decompress the rest of the buffer.
+                ret = mud_mccp_decompress(telnet, &buf[i], c - i);
+
+                if(ret == NULL)
+                {
+                    if(*out_buf != NULL) g_string_free(*out_buf, TRUE);
+                    *out_buf = g_string_new_len(telnet->processed->str, telnet->pos);
+                    *len = telnet->pos;
+
+                    telnet->pos= 0;
+
+                    if(telnet->processed)
+                    {
+                        g_string_free(telnet->processed, TRUE);
+                        telnet->processed = g_string_new(NULL);
+                    }
+
+                    if(telnet->buffer)
+                    {
+                        g_string_free(telnet->buffer, TRUE);
+                        telnet->buffer = NULL;
+                    }
+
+                    return;
+                }
+
+                if(telnet->buffer)
+                {
+                    g_string_free(telnet->buffer, TRUE);
+                    telnet->buffer = NULL;
+                }
+
+                telnet->buffer = g_string_new(ret->str);
+
+                if(telnet->buffer->len == 0)
+                {
+                    if(*out_buf != NULL) g_string_free(*out_buf, TRUE);
+                    *out_buf = g_string_new_len(telnet->processed->str, telnet->pos);
+                    *len = telnet->pos;
+
+                    telnet->pos= 0;
+
+                    if(telnet->processed)
+                    {
+                        g_string_free(telnet->processed, TRUE);
+                        telnet->processed = g_string_new(NULL);
+                    }
+
+                    if(telnet->buffer)
+                    {
+                        g_string_free(telnet->buffer, TRUE);
+                        telnet->buffer = NULL;
+                    }
+                    return;
+                }
+
+                i = 0;
+                count = telnet->buffer->len;
+            }
+#endif
 	    if ((guchar)telnet->buffer->str[i] == (guchar)TEL_IAC)
 		telnet->tel_state = TEL_STATE_IAC;
 	    else
@@ -388,40 +505,24 @@
 	    break;
 
 	case TEL_STATE_DO:
-	    opt = mud_telnet_get_telopt_string((guchar)telnet->buffer->str[i]);
-	    g_message("Tel State DO %s", opt);
-	    g_free(opt);
-
 	    mud_telnet_handle_positive_nego(telnet, (guchar)telnet->buffer->str[i],
 					    (guchar)TEL_WILL, (guchar)TEL_WONT, FALSE);
 	    telnet->tel_state = TEL_STATE_TEXT;
 	    break;
 
 	case TEL_STATE_WILL:
-	    opt = mud_telnet_get_telopt_string((guchar)telnet->buffer->str[i]);
-	    g_message("Tel State WILL %s", opt);
-	    g_free(opt);
-	   
 	    mud_telnet_handle_positive_nego(telnet, (guchar)telnet->buffer->str[i],
 					    (guchar)TEL_DO, (guchar)TEL_DONT, TRUE);
 	    telnet->tel_state = TEL_STATE_TEXT;
 	    break;
 
 	case TEL_STATE_DONT:
-	    opt = mud_telnet_get_telopt_string((guchar)telnet->buffer->str[i]);
-	    g_message("Tel State DONT %s", opt);
-	    g_free(opt);
-	    
 	    mud_telnet_handle_negative_nego(telnet,
 					    (guchar)telnet->buffer->str[i], (guchar)TEL_WILL, (guchar)TEL_WONT, FALSE);
 	    telnet->tel_state = TEL_STATE_TEXT;
 	    break;
 
 	case TEL_STATE_WONT:
-	    opt = mud_telnet_get_telopt_string((guchar)telnet->buffer->str[i]);
-	    g_message("Tel State WONT %s", opt);
-	    g_free(opt);
-
 	    mud_telnet_handle_negative_nego(telnet,
 					    (guchar)telnet->buffer->str[i], (guchar)TEL_DO, (guchar)TEL_DONT, TRUE);
 	    telnet->tel_state = TEL_STATE_TEXT;
@@ -506,16 +607,22 @@
     {
     case TEL_WILL:
 	g_string_append(string, "WILL");
+	break;
     case TEL_WONT:
 	g_string_append(string, "WONT");
+	break;
     case TEL_DO:
 	g_string_append(string, "DO");
+	break;
     case TEL_DONT:
 	g_string_append(string, "DONT");
+	break;
     case TEL_IAC:
 	g_string_append(string, "IAC");
+	break;
     default:
 	g_string_append_c(string,ch);
+	break;
     }
 
     ret = g_strdup(string->str);
@@ -528,7 +635,6 @@
 mud_telnet_get_telopt_string(guchar ch)
 {
     GString *string = g_string_new(NULL);
-    gchar *ret;
 
     switch (ch)
     {
@@ -581,10 +687,7 @@
 	break;
     }
 
-    ret = g_strdup(string->str);
-    g_string_free(string, TRUE);
-
-    return ret;
+    return g_string_free(string, FALSE);
 }
 
 void
@@ -766,10 +869,6 @@
 				const guchar negative,
 				gint him)
 {
-
-    if(opt_no == TELOPT_TTYPE)
-	   g_message("Handling Positive TTYPE");
-
     const guint bitshift = him ? 4 : 0;
     guchar * opt = &(telnet->telopt_states[opt_no]);
 

Modified: trunk/src/mud-telnet.h
==============================================================================
--- trunk/src/mud-telnet.h	(original)
+++ trunk/src/mud-telnet.h	Sun Feb 15 19:29:27 2009
@@ -16,10 +16,10 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
- /* Code originally from wxMUD. Converted to a GObject by Les Harris.
-  * wxMUD - an open source cross-platform MUD client.
-  * Copyright (C) 2003-2008 Mart Raudsepp
-  */
+/* Code originally from wxMUD. Converted to a GObject by Les Harris.
+ * wxMUD - an open source cross-platform MUD client.
+ * Copyright (C) 2003-2008 Mart Raudsepp
+ */
 
 #ifndef MUD_TELNET_H
 #define MUD_TELNET_H
@@ -42,7 +42,7 @@
 #define TEL_DO				253	// Please, you use this option
 #define TEL_DONT			254	// You are not to use this option
 #define TEL_IAC				255	// Interpret as command escape sequence - prefix to all telnet commands
-								// Two IAC's in a row means Data Byte 255
+// Two IAC's in a row means Data Byte 255
 
 #define TELOPT_ECHO			  1	// Echo					- RFC  857
 #define TELOPT_TTYPE		 24	// Terminal type		- RFC 1091
@@ -82,26 +82,26 @@
 typedef void(*MudTelnetOnEnableFunc)(MudTelnet *telnet, MudTelnetHandler *handler);
 typedef void(*MudTelnetOnDisableFunc)(MudTelnet *telnet, MudTelnetHandler *handler);
 typedef void(*MudTelnetOnHandleSubNegFunc)(MudTelnet *telnet,
-    guchar *buf, guint len, MudTelnetHandler *handler);
+        guchar *buf, guint len, MudTelnetHandler *handler);
 
 enum TelnetState
 {
-	TEL_STATE_TEXT,
-	TEL_STATE_IAC,
-	TEL_STATE_WILL,
-	TEL_STATE_WONT,
-	TEL_STATE_DO,
-	TEL_STATE_DONT,
-	TEL_STATE_SB,
-	TEL_STATE_SB_IAC
+    TEL_STATE_TEXT,
+    TEL_STATE_IAC,
+    TEL_STATE_WILL,
+    TEL_STATE_WONT,
+    TEL_STATE_DO,
+    TEL_STATE_DONT,
+    TEL_STATE_SB,
+    TEL_STATE_SB_IAC
 };
 
 enum TelnetOptionState
 {
-	TELOPT_STATE_NO = 0,      // bits 00
-	TELOPT_STATE_WANTNO = 1,  // bits 01
-	TELOPT_STATE_WANTYES = 2, // bits 10
-	TELOPT_STATE_YES = 3,     // bits 11
+    TELOPT_STATE_NO = 0,      // bits 00
+    TELOPT_STATE_WANTNO = 1,  // bits 01
+    TELOPT_STATE_WANTYES = 2, // bits 10
+    TELOPT_STATE_YES = 3,     // bits 11
 };
 
 enum TelnetHandlerType
@@ -119,7 +119,7 @@
 
 struct _MudTelnetClass
 {
-	GObjectClass parent_class;
+    GObjectClass parent_class;
 };
 
 struct _MudTelnetHandler
@@ -141,49 +141,56 @@
 #include "mud-telnet-zmp.h"
 
 #ifdef ENABLE_GST
-	#include "mud-telnet-msp.h"
+#include "mud-telnet-msp.h"
 #endif
 
 #ifdef ENABLE_MCCP
-    #include <zlib.h>
-    typedef struct z_stream_s z_stream;
+#include <zlib.h>
+typedef struct z_stream_s z_stream;
 #endif
 
 struct _MudTelnet
 {
-	GObject parent_instance;
+    GObject parent_instance;
 
-	MudTelnetPrivate *priv;
+    MudTelnetPrivate *priv;
 
-	enum TelnetState tel_state;
-	guchar subreq_buffer[TEL_SUBREQ_BUFFER_SIZE];
-	guint32 subreq_pos;
+    enum TelnetState tel_state;
+    guchar subreq_buffer[TEL_SUBREQ_BUFFER_SIZE];
+    guint32 subreq_pos;
 
-	guchar telopt_states[256];
-	gint eor_enabled;
-	gint ttype_iteration;
+    guchar telopt_states[256];
+    gint eor_enabled;
+    gint ttype_iteration;
 
-	GConn *conn;
-	MudConnectionView *parent;
+    GConn *conn;
+    MudConnectionView *parent;
 
-	MudTelnetHandler handlers[TEL_HANDLERS_SIZE];
+    MudTelnetHandler handlers[TEL_HANDLERS_SIZE];
 
-	GHashTable *zmp_commands;
-	MudZMPCommand commands[2048];
+    GHashTable *zmp_commands;
+    MudZMPCommand commands[2048];
 
 #ifdef ENABLE_GST
-	MudMSPParser msp_parser;
-	MudMSPTypes msp_type;
-	MudMSPSound sound[2];
-	gchar *base_url;
+    MudMSPParser msp_parser;
+    MudMSPTypes msp_type;
+    MudMSPSound sound[2];
+    gchar *base_url;
+#endif
+
+#ifdef ENABLE_MCCP
+    z_stream *compress_out;
+    guchar *compress_out_buf;
+    gboolean mccp;
+    gboolean mccp_new;
 #endif
 
-	GString *prev_buffer;
-	GString *processed;
-	GString *buffer;
-	size_t pos;
+    GString *prev_buffer;
+    GString *processed;
+    GString *buffer;
+    size_t pos;
 
-	gchar *mud_name;
+    gchar *mud_name;
 };
 
 GType mud_telnet_get_type (void) G_GNUC_CONST;

Modified: trunk/src/mud-window.c
==============================================================================
--- trunk/src/mud-window.c	(original)
+++ trunk/src/mud-window.c	Sun Feb 15 19:29:27 2009
@@ -387,7 +387,7 @@
 mud_window_about_cb(GtkWidget *widget, MudWindow *window)
 {
     static const gchar * const authors[] = {
-        "Les Harris <me lesharris com>",
+        "Les Harris <lharris gnome org>",
         "Jordi Mallach <jordi sindominio net>",
         "Daniel Patton <seven-nation army com>",
 	"Robin Ericsson <lobbin localhost nu>",

Modified: trunk/ui/main.glade
==============================================================================
--- trunk/ui/main.glade	(original)
+++ trunk/ui/main.glade	Sun Feb 15 19:29:27 2009
@@ -274,58 +274,52 @@
           </packing>
         </child>
         <child>
-          <widget class="GtkHandleBox" id="handlebox1">
+          <widget class="GtkToolbar" id="toolbar1">
             <property name="visible">True</property>
-            <property name="shadow_type">GTK_SHADOW_OUT</property>
+            <property name="toolbar_style">GTK_TOOLBAR_BOTH</property>
             <child>
-              <widget class="GtkToolbar" id="toolbar1">
+              <widget class="GtkToolButton" id="toolbar_connect">
                 <property name="visible">True</property>
-                <property name="toolbar_style">GTK_TOOLBAR_BOTH</property>
-                <child>
-                  <widget class="GtkToolButton" id="toolbar_connect">
-                    <property name="visible">True</property>
-                    <property name="tooltip" translatable="yes">Connect to MUD</property>
-                    <property name="label" translatable="yes">Connect</property>
-                    <property name="use_underline">True</property>
-                    <property name="stock_id">gtk-connect</property>
-                    <accessibility>
-                      <atkproperty name="AtkObject::accessible_name" translatable="yes">Connect</atkproperty>
-                      <atkproperty name="AtkObject::accessible_description" translatable="yes">Connect to host</atkproperty>
-                    </accessibility>
-                  </widget>
-                  <packing>
-                    <property name="expand">False</property>
-                  </packing>
-                </child>
-                <child>
-                  <widget class="GtkToolButton" id="toolbar_disconnect">
-                    <property name="visible">True</property>
-                    <property name="tooltip" translatable="yes">Disconnect from current MUD</property>
-                    <property name="label" translatable="yes">Disconnect</property>
-                    <property name="use_underline">True</property>
-                    <property name="stock_id">gtk-disconnect</property>
-                    <accessibility>
-                      <atkproperty name="AtkObject::accessible_name" translatable="yes">Disconnect</atkproperty>
-                      <atkproperty name="AtkObject::accessible_description" translatable="yes">Disconnect from current host</atkproperty>
-                    </accessibility>
-                  </widget>
-                  <packing>
-                    <property name="expand">False</property>
-                  </packing>
-                </child>
-                <child>
-                  <widget class="GtkToolButton" id="toolbar_reconnect">
-                    <property name="visible">True</property>
-                    <property name="tooltip" translatable="yes">Reconnect to current MUD</property>
-                    <property name="label" translatable="yes">Reconnect</property>
-                    <property name="use_underline">True</property>
-                    <property name="stock_id">gtk-refresh</property>
-                  </widget>
-                  <packing>
-                    <property name="expand">False</property>
-                  </packing>
-                </child>
+                <property name="tooltip" translatable="yes">Connect to MUD</property>
+                <property name="label" translatable="yes">Connect</property>
+                <property name="use_underline">True</property>
+                <property name="stock_id">gtk-connect</property>
+                <accessibility>
+                  <atkproperty name="AtkObject::accessible_name" translatable="yes">Connect</atkproperty>
+                  <atkproperty name="AtkObject::accessible_description" translatable="yes">Connect to host</atkproperty>
+                </accessibility>
+              </widget>
+              <packing>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkToolButton" id="toolbar_disconnect">
+                <property name="visible">True</property>
+                <property name="tooltip" translatable="yes">Disconnect from current MUD</property>
+                <property name="label" translatable="yes">Disconnect</property>
+                <property name="use_underline">True</property>
+                <property name="stock_id">gtk-disconnect</property>
+                <accessibility>
+                  <atkproperty name="AtkObject::accessible_name" translatable="yes">Disconnect</atkproperty>
+                  <atkproperty name="AtkObject::accessible_description" translatable="yes">Disconnect from current host</atkproperty>
+                </accessibility>
               </widget>
+              <packing>
+                <property name="homogeneous">True</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkToolButton" id="toolbar_reconnect">
+                <property name="visible">True</property>
+                <property name="tooltip" translatable="yes">Reconnect to current MUD</property>
+                <property name="label" translatable="yes">Reconnect</property>
+                <property name="use_underline">True</property>
+                <property name="stock_id">gtk-refresh</property>
+              </widget>
+              <packing>
+                <property name="homogeneous">True</property>
+              </packing>
             </child>
           </widget>
           <packing>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]