RXINFO command to show state of the plugin
authorChristian Thaeter <ct@pipapo.org>
Sat, 3 Nov 2007 19:34:52 +0000 (20:34 +0100)
committerChristian Thaeter <ct@pipapo.org>
Sat, 3 Nov 2007 19:34:52 +0000 (20:34 +0100)
contrib/irc/xchat/rx.c

index b600eba..9496217 100644 (file)
@@ -221,6 +221,22 @@ rxdebug_cb (char *word[], char *word_eol[], void *userdata)
   return XCHAT_EAT_ALL;
 }
 
+static int
+rxinfo_cb (char *word[], char *word_eol[], void *userdata)
+{
+  struct rx_plugin_data* rx = (struct rx_plugin_data*)userdata;
+  xchat_printf (ph, "RX: debugging is %s\n", rx->debug?"on":"off");  
+  if (rx->fd != -1)
+    {
+      xchat_printf (ph, "RX: connected to %s:%s\n", rx->server, rx->port);  
+      xchat_printf (ph, "RX: using list %s\n", rx->list);
+    }
+  else
+    xchat_printf (ph, "RX: not connected\n");  
+
+  return XCHAT_EAT_ALL;
+}
+
 static int
 rxhook_cb (char *word[], char *word_eol[], void *userdata)
 {
@@ -307,6 +323,9 @@ xchat_plugin_init(xchat_plugin *plugin_handle,
   xchat_hook_command (ph, "RXDEBUG", XCHAT_PRI_NORM, rxdebug_cb,
                       "Usage: RXDEBUG; toggle rxpd plugin debugging", &rx_private);
 
+  xchat_hook_command (ph, "RXINFO", XCHAT_PRI_NORM, rxinfo_cb,
+                      "Usage: RXINFO; show some information about the rxpd plugin", &rx_private);
+
   xchat_hook_server (ph, "RAW LINE", XCHAT_PRI_NORM, rxhook_cb, &rx_private);
 
   xchat_print (ph, "Rxpd plugin loaded successfully!\n");