Index: autoaway.h
===================================================================
--- autoaway.h	(revision 10513)
+++ autoaway.h	(arbetskopia)
@@ -26,11 +26,11 @@
 # include <config.h>
 #endif
 #include <glib.h>
-#define AUTOAWAY_VERSION "0.3"
+#define AUTOAWAY_VERSION "0.4"
 
-//#define DEBUG
+#define AUTOAWAY_DEBUG 0
 
-#ifdef DEBUG
+#if AUTOAWAY_DEBUG == 1
 //# define trace(...) do{ if (xchat_get_context(ph)) xchat_printf(ph, __VA_ARGS__); }while(0);
 # define trace(...) do { g_print (__VA_ARGS__); g_print ("\n"); }while (0);
 #else
Index: autoaway.c
===================================================================
--- autoaway.c	(revision 10513)
+++ autoaway.c	(arbetskopia)
@@ -192,10 +192,16 @@
 	GList *node = NULL;
 
 	servername = xchat_get_info (ph, "network");
+	
+	if (servername == NULL)
+		return XCHAT_EAT_NONE;
+	
 	if (new_conn) {
+		trace ("New connection on nw %s", servername);
 		networks = g_list_append (networks, g_strdup (servername));
 	} else {
-		node = g_list_find_custom (networks, servername, (GCompareFunc) strcmp);
+		trace ("Connection closed on nw %s", servername);
+		node = g_list_find_custom (networks, servername, (GCompareFunc) g_utf8_collate);
 		if (node) {
 			g_free (node->data);
 			networks = g_list_delete_link (networks, node);
