Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add CTCP support. Only does VERSION for now.

  • Loading branch information...
commit 0bdfff7cfb66178952e00e27961eaf752d684b94 1 parent 1e0b92e
tm512 authored
Showing with 14 additions and 1 deletion.
  1. +14 −1 src/modules/core/main.c
15 src/modules/core/main.c
View
@@ -35,18 +35,31 @@ const char modname [] = "core";
void die (char *msg);
+void ctcpHandler (ircclient_t *cl, char *nick, char *host, char *source, char *message)
+{
+ message ++;
+
+ if (strstr (message, "VERSION") == message && strstr (nick, source))
+ irc_notice (cl, source, "\001VERSION ispolin " ISP_VERSION GIT_VERSION " compiled " __DATE__ "\001");
+
+ return;
+}
+
void corePrivmsg (ircclient_t *cl, char *nick, char *host, char *source, char *message)
{
char *tokbuf = alloca (strlen (message));
char *buf = alloca (strlen (message) + 1);
// check for prefix:
- if (message [0] != globalcfg.prefix)
+ if (message [0] != globalcfg.prefix && message [0] != '\001')
return;
// back up message:
strncpy (buf, message, strlen (message) + 1);
+ if (buf [0] == '\001')
+ ctcpHandler (cl, nick, host, source, buf);
+
buf ++;
if (strstr (buf, "info") == buf)
Please sign in to comment.
Something went wrong with that request. Please try again.