Skip to content

Commit

Permalink
Add CTCP support. Only does VERSION for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
tm512 committed Feb 17, 2012
1 parent 1e0b92e commit 0bdfff7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/modules/core/main.c
Expand Up @@ -35,18 +35,31 @@ const char modname [] = "core";


void die (char *msg); 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) void corePrivmsg (ircclient_t *cl, char *nick, char *host, char *source, char *message)
{ {
char *tokbuf = alloca (strlen (message)); char *tokbuf = alloca (strlen (message));
char *buf = alloca (strlen (message) + 1); char *buf = alloca (strlen (message) + 1);


// check for prefix: // check for prefix:
if (message [0] != globalcfg.prefix) if (message [0] != globalcfg.prefix && message [0] != '\001')
return; return;


// back up message: // back up message:
strncpy (buf, message, strlen (message) + 1); strncpy (buf, message, strlen (message) + 1);


if (buf [0] == '\001')
ctcpHandler (cl, nick, host, source, buf);

buf ++; buf ++;


if (strstr (buf, "info") == buf) if (strstr (buf, "info") == buf)
Expand Down

0 comments on commit 0bdfff7

Please sign in to comment.