summary refs log tree commit diff stats
path: root/src/common/plugin-identd.c
diff options
context:
space:
mode:
authorPatrick Griffis <tingping@tingping.se>2016-01-25 21:01:56 -0500
committerPatrick Griffis <tingping@tingping.se>2016-01-25 22:51:11 -0500
commitf14ad5e9dd7fba1c1c7bb39b47bce38f9de01316 (patch)
tree50d86308cc789266e27faa069362ccf9c0746c2a /src/common/plugin-identd.c
parent2226363fd0fb99aac2f4d2fcad07a1cca741e371 (diff)
Add identd to preferences
Diffstat (limited to 'src/common/plugin-identd.c')
-rw-r--r--src/common/plugin-identd.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/common/plugin-identd.c b/src/common/plugin-identd.c
index 9501458c..acf3a093 100644
--- a/src/common/plugin-identd.c
+++ b/src/common/plugin-identd.c
@@ -22,6 +22,7 @@
 #include "hexchat-plugin.h"
 
 #define _(x) hexchat_gettext(ph,x)
+static void identd_start_server (void);
 
 static hexchat_plugin *ph;
 static GSocketService *service;
@@ -49,6 +50,20 @@ identd_command_cb (char *word[], char *word_eol[], void *userdata)
 {
 	g_return_val_if_fail (responses != NULL, HEXCHAT_EAT_ALL);
 
+	if (!g_strcmp0 (word[2], "reload"))
+	{
+		if (service)
+		{
+			g_socket_service_stop (service);
+			g_clear_object (&service);
+		}
+
+		identd_start_server ();
+
+		if (service)
+			return HEXCHAT_EAT_ALL;
+	}
+
 	if (service == NULL) /* If we are not running plugins can handle it */
 		return HEXCHAT_EAT_HEXCHAT;
 
@@ -176,8 +191,7 @@ identd_start_server (void)
 	{
 		hexchat_printf (ph, _("*\tError starting identd server: %s"), error->message);
 
-		g_object_unref (service);
-		service = NULL;
+		g_clear_object (&service);
 		return;
 	}
 	/*hexchat_printf (ph, "*\tIdentd listening on port: %d", port); */