ChangeLog for mcbot-0.96
authorMarkus Bröker <mbroeker@largo.dyndns.tv>
Sat, 13 Dec 2008 15:41:52 +0100
changeset 23 1cd79bb84e9c
parent 22 b786b5f92a93
child 24 f68808ae40b9
ChangeLog for mcbot-0.96 * Build Timestamp added to the Project * more IRC CODES added committer: Markus Bröker <mbroeker@largo.homelinux.org>
debian/changelog
include/mcbot.h
src/CMakeLists.txt
src/irc.c
src/main.c
src/parse.c
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-mcbot (0.95-5) unstable; urgency=low
+mcbot (0.96-0) unstable; urgency=low
 
   * Initial Release
   * the location of mcbot.cgi is stored in the db
@@ -20,6 +20,8 @@
   * database.c: key=alloc(dbf, key); free(key.dptr) :) fixed
   * only one memory hole is left: who can fix getpwnam in irc.c
   * admin commands secured (works well on irc.freenode.net)
-  * bot responses reduced, error code 486 added
+  * bot responses reduced, irc code 486 added
+  * more irc codes added
+  * build timestamp added
 
- -- Markus Broeker <mbroeker@largo.homelinux.org>  Wed, 13 Aug 2008 12:44:01 +0200
+ -- Markus Broeker <mbroeker@largo.homelinux.org>  Thu, 14 Aug 2008 16:00:01 +0200
--- a/include/mcbot.h
+++ b/include/mcbot.h
@@ -8,7 +8,13 @@
 #define MCBOT_H
 
 #ifndef BOT_VERSION
-#define BOT_VERSION 0.95
+#define BOT_VERSION 0.96
+#endif
+
+#ifdef __DATE__
+#define BOT_BUILD __DATE__
+#else
+#define BOT_BUILD "Default"
 #endif
 
 #ifndef IRC_H
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -10,7 +10,7 @@
 # C-Definitions
 ADD_DEFINITIONS(-Wall -O2 -ansi -pedantic)
 ADD_DEFINITIONS(-D_XOPEN_SOURCE=500)
-ADD_DEFINITIONS(-DBOT_VERSION=0.95)
+ADD_DEFINITIONS(-DBOT_VERSION=0.96)
 
 # Includes
 INCLUDE_DIRECTORIES(../include)
--- a/src/irc.c
+++ b/src/irc.c
@@ -292,12 +292,12 @@
             case 4:
             case 5:
             case 250:
-            case 251:
-            case 252:
-            case 254:
-            case 255:
-            case 265:
-            case 266:
+            case 251:          /* NUMBER OF USERS */
+            case 252:          /* STAFF MEMBERS */
+            case 254:          /* CHANNELS */
+            case 255:          /* CLIENTS */
+            case 265:          /* LOCAL USERS */
+            case 266:          /* GLOBAL USERS */
                 /*
                  * prints as is in irc_login
                  */
@@ -336,7 +336,6 @@
             case 441:          /* THEY AREN'T ON THIS CHANNEL */
                 message->channel = strtok (message->line, " ");
                 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 */
@@ -344,7 +343,7 @@
             case 474:
             case 475:
             case 476:
-            case 477:
+            case 477:          /* HOW TO GET HELP */
             case 486:          /* MUST BE REGISTERED TO SEND PRIVATE MESSAGES */
             case 482:
             case 901:          /* notify or some crap */
--- a/src/main.c
+++ b/src/main.c
@@ -45,7 +45,7 @@
         (void)setlocale (LC_MESSAGES, "");
     }
 
-    printf ("mcbot-%1.2f\n", BOT_VERSION);
+    printf ("mcbot-%1.2f Build %s\n", BOT_VERSION, BOT_BUILD);
 
     if ((len = config (&uc, CONFIG_FILE)) != 0) {
         switch (len) {
--- a/src/parse.c
+++ b/src/parse.c
@@ -48,6 +48,7 @@
 #define     BAN 22
 #define   UNBAN 23
 #define KICKBAN 24
+#define   HELLO 25
 
 const
 char *COMMAND_LIST[] = {
@@ -82,7 +83,7 @@
     "!who", "!whois", "!time",
     "!tell", "!op", "!deop",
     "!kick", "!ban", "!unban",
-    "!kickban",
+    "!kickban", "!hello",
     NULL
 };
 
@@ -96,7 +97,6 @@
 
     time_t t;
     struct tm *timeptr;
-    static int counter = 0;
 
     /*
      * default message
@@ -109,23 +109,6 @@
     if (!strcmp (message->channel, message->nick))
         message->channel = message->user;
 
-    if (strstr (message->line, message->nick)) {
-        if (*message->line != '!') {
-            /*
-             * DEADLOCK-CHECK
-             */
-            if (strcmp (message->user, message->nick)) {
-                snprintf (msg, 512, "PRIVMSG %s :%s, %s?\r\n", message->channel, gettext ("What's up"), message->user);
-                if (counter++ > 2)
-                    return NULL;
-                return msg;
-            }
-        }
-        return NULL;
-    }
-
-    counter = 0;
-
     /*
      * NO BOT Commands
      */
@@ -215,8 +198,8 @@
                 return msg;
 
             case INFO:
-                snprintf (msg, 512, "PRIVMSG %s :I am MCBot-%1.2f and my source code can be found on %s\r\n",
-                          message->channel, BOT_VERSION, SOURCE_URL);
+                snprintf (msg, 512, "PRIVMSG %s :I am MCBot-%1.2f Build %s and my source code can be found at %s\r\n",
+                          message->channel, BOT_VERSION, BOT_BUILD, SOURCE_URL);
                 return msg;
 
             case PING:
@@ -343,6 +326,10 @@
                     }
                 }
                 return msg;
+
+            case HELLO:
+                snprintf (msg, 512, "PRIVMSG %s :%s, %s?\r\n", message->channel, gettext ("What's up"), message->user);
+                return msg;
             }
         }
         i++;