{NULL, NULL}
};
-static CMD_BIND(neonserv_cmd_users) {
- struct ChanUser *chanuser;
- putsock(client, "PRIVMSG %s :[BOT JOIN] Users on this Channel:", chan->name);
- for(chanuser = getChannelUsers(chan, NULL); chanuser; chanuser = getChannelUsers(chan, chanuser)) {
- putsock(client, "PRIVMSG %s : %s!%s@%s [%s] rights: %d", chan->name, chanuser->user->nick, chanuser->user->ident, chanuser->user->host, ((chanuser->user->flags & USERFLAG_ISAUTHED) ? chanuser->user->auth : "*"), chanuser->flags);
- }
-}
-
-static CMD_BIND(neonserv_cmd_modes) {
- char modeBuf[MAXLEN];
- getModeString(chan, modeBuf);
- putsock(client, "PRIVMSG %s :Modes: %s", chan->name, modeBuf);
-}
+/*
+INCLUDE ALL CMD's HERE
+*/
+#include "cmd_neonserv_users.c"
+#include "cmd_neonserv_modes.c"
static void neonserv_bot_ready(struct ClientSocket *client) {
MYSQL_RES *res;
printf_mysql_query("SELECT `command`, `function`, `parameters`, `global_access` FROM `bot_binds` WHERE `botid` = '%d'", client->clientid);
res2 = mysql_use();
while ((row = mysql_fetch_row(res2)) != NULL) {
-
+ if(bind_cmd_to_command(BOTID, row[0], row[1])) {
+ if(row[2] && strcmp(row[2], "")) {
+ bind_set_parameters(BOTID, row[0], row[2]);
+ }
+ if(atoi(row[3]) > 0) {
+ bind_set_gaccess(BOTID, row[0], atoi(row[3]));
+ }
+ }
}
}
}
start_bots();
bind_bot_ready(neonserv_bot_ready);
set_trigger_callback(BOTID, neonserv_trigger_callback);
- bind_cmd_to_command(BOTID, "users", "users");
- bind_cmd_to_command(BOTID, "modes", "modes");
register_default_language_table(msgtab);
}
--- /dev/null
+
+static CMD_BIND(neonserv_cmd_modes) {
+ char modeBuf[MAXLEN];
+ getModeString(chan, modeBuf);
+ putsock(client, "PRIVMSG %s :Modes: %s", chan->name, modeBuf);
+}
--- /dev/null
+
+static CMD_BIND(neonserv_cmd_users) {
+ struct ChanUser *chanuser;
+ putsock(client, "PRIVMSG %s :[BOT JOIN] Users on this Channel:", chan->name);
+ for(chanuser = getChannelUsers(chan, NULL); chanuser; chanuser = getChannelUsers(chan, chanuser)) {
+ putsock(client, "PRIVMSG %s : %s!%s@%s [%s] rights: %d", chan->name, chanuser->user->nick, chanuser->user->ident, chanuser->user->host, ((chanuser->user->flags & USERFLAG_ISAUTHED) ? chanuser->user->auth : "*"), chanuser->flags);
+ }
+}
cbind->cmd = strdup(cmd);
cbind->func = func;
cbind->parameters = NULL;
+ cbind->access = 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->flags = 0;
cmd_binds[bind_index] = cbind;
return 1;
trigger_callbacks = NULL;
}
+void bind_set_parameters(int botid, char *cmd, char *parameters) {
+
+}
+
+void bind_set_gaccess(int botid, char *cmd, int access) {
+
+}
+
struct cmd_function *func;
unsigned int flags;
char *parameters;
+ int access;
struct cmd_binding *next;
};
int bind_cmd_to_command(int botid, char *cmd, char *func);
int unbind_cmd(int botid, char *cmd);
struct ClientSocket *getTextBot();
+void bind_set_parameters(int botid, char *cmd, char *parameters);
+void bind_set_gaccess(int botid, char *cmd, int access);
#endif
\ No newline at end of file