fixed last commit
authorpk910 <philipp@zoelle1.de>
Mon, 15 Aug 2011 04:05:25 +0000 (06:05 +0200)
committerpk910 <philipp@zoelle1.de>
Mon, 15 Aug 2011 04:05:25 +0000 (06:05 +0200)
modcmd.c

index 07820afdd7989c836168e732bc6f361d49248b65..38f557edddbd1405815f124b70bd0c4250c08c63 100644 (file)
--- a/modcmd.c
+++ b/modcmd.c
@@ -5,6 +5,7 @@
 #include "UserNode.h"
 #include "ChanNode.h"
 #include "ChanUser.h"
+#include "WHOHandler.h"
 
 struct trigger_callback {
     int botid;
@@ -74,7 +75,7 @@ static char* get_channel_trigger(int botid, struct ChanNode *chan) {
 static USERAUTH_CALLBACK(command_checked_auth) {
     struct command_check_user_cache *cache = data;
     int execute_cmd = 1;
-    if((cbind->func->flags & CMDFLAG_REQUIRE_AUTH) && !(user->flags & USERFLAG_ISAUTHED)) {
+    if((cache->cbind->func->flags & CMDFLAG_REQUIRE_AUTH) && !(user->flags & USERFLAG_ISAUTHED)) {
         //AUTH_REQUIRED
         execute_cmd = 0;
     }
@@ -131,13 +132,14 @@ static void handle_command(struct ClientSocket *client, struct UserNode *user, s
                     chan = chan2;
                 }
             }
-            if(cbind->func->parameters) {
+            if(cbind->parameters) {
                 //userdefined parameters...
                 char *uarga[MAXNUMPARAMS];
-                char params[strlen(cbind->func->parameters)+1];
-                strcpy(params, cbind->func->parameters);
+                char params[strlen(cbind->parameters)+1];
+                strcpy(params, cbind->parameters);
                 int uargpos = 0, argi, allargs = 0;
-                char *ppos = params, *prev_ppos = params;
+                char *ppos = params;
+                char *prev_ppos = params;
                 while(ppos = strstr(ppos, " ")) {
                     ppos = '\0';
                     if(prev_ppos[0] == '%') {
@@ -147,7 +149,8 @@ static void handle_command(struct ClientSocket *client, struct UserNode *user, s
                             prev_ppos[strlen(prev_ppos)-1] = '\0';
                         } else
                             allargs = 0;
-                        if((argi = atoi(prev_ppos)) > 0) {
+                        argi = atoi(prev_ppos);
+                        if(argi > 0) {
                             if(argi <= argc) continue;
                             uarga[uargpos++] = argv[argi-1]
                             if(allargs) {
@@ -192,7 +195,7 @@ static void handle_command(struct ClientSocket *client, struct UserNode *user, s
                 data->chan = chan;
                 data->message = message;
                 data->cbind = cbind;
-                get_userauth(user, command_checked_auth, data)
+                get_userauth(user, command_checked_auth, data);
                 return;
             }
             if((cbind->func->flags & CMDFLAG_REQUIRE_AUTH) && !(user->flags & USERFLAG_ISAUTHED)) {