diff -ru xchat-gnome-0.26.1.orig/src/fe-gnome/main-window.c xchat-gnome-0.26.1/src/fe-gnome/main-window.c
--- xchat-gnome-0.26.1.orig/src/fe-gnome/main-window.c	2011-02-20 23:53:56.828151044 -0700
+++ xchat-gnome-0.26.1/src/fe-gnome/main-window.c	2011-02-20 23:55:04.386738750 -0700
@@ -48,8 +48,10 @@
 #include "../common/xchatc.h"
 #include "../common/outbound.h"
 #include "../common/fe.h"
+#include "../common/xchat-plugin.h"
+#include "../common/plugin.h"
 
-static void on_main_window_close (GtkWidget *widget, GdkEvent *event, gpointer data);
+static gboolean on_main_window_close (GtkWidget *widget, GdkEvent *event, gpointer data);
 static void on_pgup (GtkAccelGroup *accelgroup, GObject *arg1, guint arg2, GdkModifierType arg3, gpointer data);
 static void on_pgdn (GtkAccelGroup *accelgroup, GObject *arg1, guint arg2, GdkModifierType arg3, gpointer data);
 
@@ -323,15 +325,21 @@
 	g_object_unref (client);
 }
 
-static void
+static gboolean
 on_main_window_close (GtkWidget *widget, GdkEvent *event, gpointer data)
 {
+	session *s = gui.current_session;
+	int r = plugin_emit_dummy_print (s, "Close Main");
+	if (r & XCHAT_EAT_XCHAT) {
+	  return TRUE;
+	}
 	save_main_window ();
 	gui.quit = TRUE;
 
 	gtk_widget_hide (GTK_WIDGET (gui.dcc));
 	userlist_gui_hide ();
 	xchat_exit ();
+	return FALSE;
 }
 
 static void
