fixed funcmd_reply and added missing include
authorpk910 <philipp@zoelle1.de>
Tue, 15 Nov 2011 15:09:08 +0000 (16:09 +0100)
committerpk910 <philipp@zoelle1.de>
Tue, 15 Nov 2011 15:14:00 +0000 (16:14 +0100)
src/cmd_funcmds.c
src/cmd_funcmds.h
src/commands.c

index 7578f10a0a51b8736ee9f656af19386538dc6704..dca41a6c670f2bd18db1f8d68d729f19c3185cbd 100644 (file)
 #include "ChanNode.h"
 #include "lang.h"
 #include "tools.h"
+#include "DBHelper.h"
 
 static const struct default_language_entry msgtab[] = {
     {"FUN_DICE", "$b%s$b: A $b%d$b shows on the %d-sided die."}, /* {ARGS: "TestUser", 5, 6} */
     {"FUN_DICE_NUM", "I do not understand $b%s$b. Please use a single number above 1."}, /* {ARGS: "bla"} */
     {"FUN_8BALL", "$b%s$b: %s"}, /* {ARGS: "TestUser", "Not a chance."} */
     {"FUN_8BALL_REPLIES", "Not a chance.|In your dreams.|Absolutely!|Could be, could be.|No!"},
-    {"FUN_COOKIE", "gives %1%s a very big chocolate cookie. (%1$s got %2$d cookies - %3$d in this channel)"}, /* {ARGS: "TestUser", 20, 50} */
+    {"FUN_COOKIE", "gives %1$s a very big chocolate cookie. %1$s has got %2$d cookies until now (%3$d in this channel)."}, /* {ARGS: "TestUser", 20, 50} */
     {NULL, NULL}
 };
 
@@ -90,7 +91,7 @@ static void funcmd_reply(const char *text, int type, ...) {
     char sendBuf[MAXLEN];
     int pos;
     sendBuf[0] = '\0';
-    va_start(arg_list, text);
+    va_start(arg_list, type);
     pos = vsnprintf(sendBuf, MAXLEN - 2, formatBuf, arg_list);
     va_end(arg_list);
     if (pos < 0 || pos > (MAXLEN - 2)) pos = MAXLEN - 2;
index 000b918f9fe86039e722a54b15aa25ab1312e0ef..0e58c0865bfbf5513f30d30259ac64bd23b5320e 100644 (file)
@@ -25,5 +25,6 @@ CMD_BIND(funcmd_ping);
 CMD_BIND(funcmd_pong);
 CMD_BIND(funcmd_dice);
 CMD_BIND(funcmd_8ball);
+CMD_BIND(funcmd_cookie);
 
 #endif
\ No newline at end of file
index cece07df07e5d5585372f0626608a89cb09b1732..c41a673c233d8667ecd6ff61bdfecf3127b76e7d 100644 (file)
@@ -142,6 +142,7 @@ void register_commands() {
     USER_COMMAND("pong",         funcmd_pong,            0,  CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN | CMDFLAG_FUNCMD);
     USER_COMMAND("dice",         funcmd_dice,            1,  CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN | CMDFLAG_FUNCMD);
     USER_COMMAND("8ball",        funcmd_8ball,           1,  CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN | CMDFLAG_FUNCMD);
+    USER_COMMAND("cookie",       funcmd_cookie,          0,  CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN | CMDFLAG_FUNCMD);
     #undef USER_COMMAND