diff --git a/CHANGELOG b/CHANGELOG index 59011fe..72982b3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,13 +8,15 @@ Pruned pair parser Reduced creds struct ADDED NVULN=1 build option to remove kill, raw and dump -ADDED new -url option +ADDED option -url -VERSION X +VERSION 2 -Added -identify -ircmsg is now more useful -Fixed some error return values being too high -Changed NVULN to NO_VULN -Added ENABLE_SSL=1 to enable SSL incomplete support +Added option -identify +Added commands !magic, !say +Added ENABLE_SSL=1 to enable SSL non-functional support Added libircclient submodule +Fixed some error return values being too high +Fixed commands with more than 1 argument +Changed some macro naming +Fixed Build system to be properly split amongst include/config.h and Makefile diff --git a/include/config.mk.h b/include/config.mk.h index 6e718b6..8233663 100644 --- a/include/config.mk.h +++ b/include/config.mk.h @@ -1,10 +1,12 @@ +/* The database file */ #define DBFILE "data.sqlite" /* Disables vulnerable commands */ -/* #define NO_VULN_COMMANDS */ +#define NO_VULN_COMMANDS -/* Enables SSL support */ -/* #define IRC_SSL_SUPPORT */ +/* Disables all logging */ +/* #define NO_LOGGING */ -/* Spits out a message when connected */ -/* #define INITIAL_ASSIGNMENT_MESSAGE */ +/* Enables SSL support + * FIXME broken at the moment */ +/* #define IRC_SSL_SUPPORT */ diff --git a/src/irc.c b/src/irc.c index 838dc7d..7c229f8 100644 --- a/src/irc.c +++ b/src/irc.c @@ -137,6 +137,8 @@ event_channel(irc_session_t * lsession, /* (void) channel; */ (void) message; (void) count; + /* Logs the message */ + printf(message); /* parses the command */ if (*message == PREFIX_COMMAND_CHAR) { current_username = get_username(origin); } @@ -210,7 +212,7 @@ parse_command(char const * cmd) char const * const arg = cmd + i; printf("argoff: %p; i: %ld; arg: %sEOA\n", cmd + i + 1, i, arg); #ifndef NO_VULN_COMMANDS - if (strncmp(cmd, "raw", i) == 0) + if (strncmp(cmd, "raw", 3) == 0) { printf("RAW\n"); /* ircmsg(creds.channel, "%s: Executing SQL `%s'.", current_username, arg); */ @@ -218,13 +220,17 @@ parse_command(char const * cmd) ircmsg(creds.channel, msgswp); } else #endif /* !NO_VULN_COMMANDS */ - if (strncmp(cmd, "repo", i) == 0) + if (strncmp(cmd, "repo", 4) == 0) { /* ircmsg(creds.channel, "%s: Setting project repository...", current_username); */ set_repo(creds.channel, arg); msgswp = remind(creds.channel); ircmsg(creds.channel, "%s: %s", current_username, msgswp); } + else if (strncmp(cmd, "magic", 5) == 0) + { ircmsg(creds.channel, "%s: " IRC_YELLOW "%d" IRC_STOP, current_username, (rand() % atoi(arg)) + 1); } + else if (strncmp(cmd, "say", 3) == 0) + { ircmsg(creds.channel, "%s", arg); } } free(msgswp); } diff --git a/src/main.c b/src/main.c index 941f0ae..ca6861a 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,6 @@ /* main.c */ -#define VERSION_STRING "1" +#define VERSION_STRING "2" /* Parses the format username[:password]@server[:port] * user:password@server:port = userNULpasswordNULserverNUL (port N/A) @@ -122,6 +122,10 @@ int main (int argc, char ** argv) { +#ifdef NO_LOGGING + freopen(stdout, "/dev/null"); + freopen(stderr, "/dev/null"); +#endif if (argc > 1) { char * arg;