summaryrefslogtreecommitdiff
path: root/src/irc/proxy/proxy.c
diff options
context:
space:
mode:
authorHans Nielsen <hans@stackallocated.com>2014-06-24 23:45:35 -0700
committerHans Nielsen <hans@stackallocated.com>2015-02-24 19:52:17 -0800
commitaaa0f73eac88316978c65fb0f0c8b5d23d1dc100 (patch)
treeb69ae89b011fea5f113ee48b7d16895ec9e75b52 /src/irc/proxy/proxy.c
parentd27c54486f3e5656445b43affd37f17d1338a6ce (diff)
downloadirssi-aaa0f73eac88316978c65fb0f0c8b5d23d1dc100.zip
Make proxy messages include more detail and add status command
Diffstat (limited to 'src/irc/proxy/proxy.c')
-rw-r--r--src/irc/proxy/proxy.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/irc/proxy/proxy.c b/src/irc/proxy/proxy.c
index c8f47bdf..75da112c 100644
--- a/src/irc/proxy/proxy.c
+++ b/src/irc/proxy/proxy.c
@@ -23,6 +23,37 @@
#include "settings.h"
#include "levels.h"
+#include "fe-common/core/printtext.h"
+
+static void cmd_proxy_status(const char *data, IRC_SERVER_REC *server)
+{
+ GSList *tmp;
+
+ printtext(server, NULL, MSGLEVEL_CLIENTNOTICE,
+ "Proxy: Currently connected clients: %d",
+ g_slist_length(proxy_clients));
+
+ for (tmp = proxy_clients; tmp != NULL; tmp = tmp->next) {
+ CLIENT_REC *rec = tmp->data;
+
+ printtext(server, NULL, MSGLEVEL_CLIENTNOTICE,
+ " %s:%d connect%s to %d (%s)",
+ rec->host, rec->port,
+ rec->connected ? "ed" : "ing",
+ rec->listen->port, rec->listen->ircnet);
+ }
+}
+
+static void cmd_proxy(const char *data, IRC_SERVER_REC *server, void *item)
+{
+ if (*data == '\0') {
+ cmd_proxy_status(data, server);
+ return;
+ }
+
+ command_runsub("proxy", data, server, item);
+}
+
void irc_proxy_init(void)
{
settings_add_str("irssiproxy", "irssiproxy_ports", "");
@@ -43,6 +74,9 @@ void irc_proxy_init(void)
"... to set them.");
}
+ command_bind("proxy", NULL, (SIGNAL_FUNC) cmd_proxy);
+ command_bind("proxy status", NULL, (SIGNAL_FUNC) cmd_proxy_status);
+
proxy_listen_init();
settings_check();
module_register("proxy", "irc");