# HG changeset patch # User Markus Bröker # Date 1229179295 -3600 # Node ID 4435146391ae67a13b1cb69a69999dbaf9095050 # Parent 9a32b52423200c849ffeea7de17ed84fd99951e1 LOGIN without Password added * the bot can access an irc server without a password * the help system won't start a botwar anymore committer: Markus Bröker diff --git a/TODO b/TODO --- a/TODO +++ b/TODO @@ -10,10 +10,12 @@ Todo: * UTF-8 aware Character-Encoding * Dynamic Loading of plugins with dlopen - * implementation of some fun stuff + * implementation of some fun stuff + * AUTO-RECONNECT must be implemented Author: * Markus Broeker mbroeker@largo.homelinux.org Comments: * scanner/parser rewritten + * a flex / bison parser will be better and safer than pointer arithmetics diff --git a/config/.mcbotrc b/config/.mcbotrc --- a/config/.mcbotrc +++ b/config/.mcbotrc @@ -2,8 +2,8 @@ # This is a simple ~/.mcbotrc # NO SPACING, PLEASE !! # -NICK:test -PASSWORD:test +NICK:mcbot278 +PASSWORD: SERVER:irc.freenode.net PORT:6667 CHANNEL:#test diff --git a/debian/changelog b/debian/changelog --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -mcbot (0.95-0) unstable; urgency=low +mcbot (0.95-1) unstable; urgency=low * Initial Release * the location of mcbot.cgi is stored in the db @@ -14,5 +14,7 @@ * compat.c added for XOPEN_SOURCE features - not finished yet * SOURCE_URL points to the proper git-location. * many small improvements, reduced codebase + * IRC access without password added + * Help System was able to start a botwar. Fixed - -- Markus Broeker Mon, 11 Aug 2008 00:00:54 +0200 + -- Markus Broeker Mon, 11 Aug 2008 20:45:54 +0200 diff --git a/src/config.c b/src/config.c --- a/src/config.c +++ b/src/config.c @@ -103,7 +103,7 @@ if (line != NULL) free (line); - if (!(uc->nick && uc->pass && uc->server && uc->channel)) + if (!(uc->nick && uc->server && uc->channel)) return -2; return 0; diff --git a/src/irc.c b/src/irc.c --- a/src/irc.c +++ b/src/irc.c @@ -105,9 +105,6 @@ if ((pwd = getpwnam (user)) == NULL) return IRC_GENERAL_ERROR; - if (password == NULL) - return IRC_LOGIN_ERROR; - if (stream == NULL) return IRC_GENERAL_ERROR; else @@ -115,7 +112,9 @@ fprintf (stream, "NICK %s\r\n", nick); fprintf (stream, "USER %s 0 %s %s\r\n", user, server, pwd->pw_gecos); - fprintf (stream, "PRIVMSG NICKSERV :IDENTIFY %s\r\n", password); + + if (password != NULL) + fprintf (stream, "PRIVMSG NICKSERV :IDENTIFY %s\r\n", password); for (;;) { *msg = '\0'; @@ -148,6 +147,12 @@ if (strstr (msg, "is not registered") != NULL) { return IRC_LOGIN_ERROR; } + if (strstr (msg, ":Nickname is already in use") != NULL) { + return IRC_LOGIN_ERROR; + } + + if (password == NULL) + break; } sleep (2); @@ -329,6 +334,9 @@ message->line = strtok (NULL, "\r\n"); fprintf (message->stream, "PRIVMSG %s :%s\r\n", message->current_channel, message->line); return command; + case 433: /* NICK ALREADY IN USE */ + case 451: /* REGISTER FIRST */ + return command; case 474: case 475: case 476: diff --git a/src/main.c b/src/main.c --- a/src/main.c +++ b/src/main.c @@ -53,9 +53,7 @@ printf ("You need to create a config file %s\n", CONFIG_FILE); break; case -2: - printf - ("You need at least entries for user, password, server and channel in your config file %s\n", - CONFIG_FILE); + printf ("You need at least entries for user, server and channel in your config file %s\n", CONFIG_FILE); break; } return len; diff --git a/src/parse.c b/src/parse.c --- a/src/parse.c +++ b/src/parse.c @@ -46,21 +46,21 @@ const char *COMMAND_LIST[] = { - "!help Known Commands: join(1), leave(2), add(3), replace(4), delete(5), list(6), search(7), info(8)\r\n", - "!join: Joins a new channel\r\n", - "!leave: Parts from the current channel\r\n", - "!add: adds an entry\r\n", - "!replace: replaces an entry\r\n", - "!delete: deletes an entry\r\n", - "!list: lists the number of stored values\r\n", - "!search: searches an entry up\r\n", - "!info: Prints the current Bot-Version\r\n", - "!ping: pings an host\r\n", - "!on: enables autolearning mode\r\n", - "!off: disables autolearning\r\n", - "!debug: prints some debug infos\r\n", - "!vaccuum: reorganizes the database\r\n", - "!logout: Protected logout function\r\n", + "help Known Commands: join(1), leave(2), add(3), replace(4), delete(5), list(6), search(7), info(8)\r\n", + "join: Joins a new channel\r\n", + "leave: Parts from the current channel\r\n", + "add: adds an entry\r\n", + "replace: replaces an entry\r\n", + "delete: deletes an entry\r\n", + "list: lists the number of stored values\r\n", + "search: searches an entry up\r\n", + "info: Prints the current Bot-Version\r\n", + "ping: pings an host\r\n", + "on: enables autolearning mode\r\n", + "off: disables autolearning\r\n", + "debug: prints some debug infos\r\n", + "vaccuum: reorganizes the database\r\n", + "logout: Protected logout function\r\n", NULL, };