#include "ChanUser.h"
#include "WHOHandler.h"
#include "lang.h"
+#include "mysqlConn.h"
+#include "DBHelper.h"
struct trigger_callback {
int botid;
reply(tmp_text_client, user, "MODCMD_CHAN_REQUIRED");
break;
}
+ if((cbind->func->flags & CMDFLAG_REGISTERED_CHAN)) {
+ loadChannelSettings(chan);
+ if(!(chan->flags & CHANFLAG_CHAN_REGISTERED)) {
+ reply(tmp_text_client, user, "MODCMD_CHAN_REQUIRED");
+ break;
+ }
+ check_mysql();
+ MYSQL_RES *res;
+ MYSQL_ROW row;
+ printf_mysql_query("SELECT `botid` FROM `bot_channels` LEFT JOIN `bots` ON `bot_channels`.`botid` = `bots`.`id` WHERE `chanid` = '%d' AND `botclass` = '%d'", chan->channel_id, client->botid);
+ res = mysql_use();
+ if ((row = mysql_fetch_row(res)) == NULL) {
+ reply(tmp_text_client, user, "MODCMD_CHAN_REQUIRED");
+ break;
+ }
+ }
if((cbind->func->flags & CMDFLAG_CHECK_AUTH) && !(user->flags & USERFLAG_ISAUTHED)) {
//check auth...
struct command_check_user_cache *data = malloc(sizeof(*data));
cmdfunc->botid = botid;
cmdfunc->name = strdup(name);
cmdfunc->func = func;
- cmdfunc->flags = 0;
+ cmdfunc->flags = flags;
cmdfunc->paramcount = paramcount;
cmdfunc->next = cmd_functions;
cmd_functions = cmdfunc;
cbind->cmd = strdup(cmd);
cbind->func = func;
cbind->parameters = NULL;
- cbind->access = 0;
+ cbind->gaccess = 0;
cbind->flags = 0;
cbind->next = cmd_binds[bind_index];
cmd_binds[bind_index] = cbind;
cbind->func = cmdfunc;
cbind->next = cmd_binds[bind_index];
cbind->parameters = NULL;
- cbind->access = 0;
+ cbind->gaccess = 0;
cbind->flags = 0;
cmd_binds[bind_index] = cbind;
return 1;
}
void bind_set_parameters(int botid, char *cmd, char *parameters) {
-
+ int bind_index = get_binds_index(cmd[0]);
+ struct cmd_binding *cbind;
+ for(cbind = cmd_binds[bind_index]; cbind; cbind = cbind->next) {
+ if(cbind->botid == botid && strcmp(cbind->cmd, cmd) == 0) {
+ if(cbind->parameters)
+ free(cbind->parameters);
+ cbind->parameters = strdup(parameters);
+ return;
+ }
+ }
}
-void bind_set_gaccess(int botid, char *cmd, int access) {
+void bind_set_gaccess(int botid, char *cmd, int gaccess) {
}