projects
/
NeonServV5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6e415e2
)
fixed last commit
author
pk910
<philipp@zoelle1.de>
Fri, 12 Aug 2011 22:37:29 +0000
(
00:37
+0200)
committer
pk910
<philipp@zoelle1.de>
Fri, 12 Aug 2011 22:37:29 +0000
(
00:37
+0200)
modcmd.c
patch
|
blob
|
history
modcmd.h
patch
|
blob
|
history
diff --git
a/modcmd.c
b/modcmd.c
index 180c9689ccf4bf523ae26b7f69d114d78626c0b6..bd39a47bf43455ac15a125e99813ee2181f0df80 100644
(file)
--- a/
modcmd.c
+++ b/
modcmd.c
@@
-163,21
+163,21
@@
int changeChannelTrigger(int botid, struct ChanNode *chan, char *new_trigger) {
int bind_cmd_to_function(int botid, char *cmd, struct cmd_function *func) {
int bind_index = get_binds_index(cmd[0]);
int bind_cmd_to_function(int botid, char *cmd, struct cmd_function *func) {
int bind_index = get_binds_index(cmd[0]);
- struct cmd_binding *bind;
- for(
bind = cmd_binds[bind_index]; bind; bind =
bind->next) {
- if(
bind->botid == botid && strcmp(
bind->cmd, cmd) == 0)
+ struct cmd_binding *
c
bind;
+ for(
cbind = cmd_binds[bind_index]; cbind; cbind = c
bind->next) {
+ if(
cbind->botid == botid && strcmp(c
bind->cmd, cmd) == 0)
return 0;
}
return 0;
}
-
bind = malloc(sizeof(*
bind));
- if (!bind) {
+
cbind = malloc(sizeof(*c
bind));
+ if (!
c
bind) {
perror("malloc() failed");
return 0;
}
perror("malloc() failed");
return 0;
}
- bind->botid = botid;
- bind->cmd = strdup(cmd);
- bind->func = func;
- bind->next = cmd_binds[bind_index];
- cmd_binds[bind_index] = bind;
+
c
bind->botid = botid;
+
c
bind->cmd = strdup(cmd);
+
c
bind->func = func;
+
c
bind->next = cmd_binds[bind_index];
+ cmd_binds[bind_index] =
c
bind;
return 1;
}
return 1;
}
@@
-189,38
+189,38
@@
int bind_cmd_to_command(int botid, char *cmd, char *func) {
}
if(!cmdfunc) return 0;
int bind_index = get_binds_index(cmd[0]);
}
if(!cmdfunc) return 0;
int bind_index = get_binds_index(cmd[0]);
- struct cmd_binding *bind;
- for(
bind = cmd_binds[bind_index]; bind; bind =
bind->next) {
- if(
bind->botid == botid && strcmp(
bind->cmd, cmd) == 0)
+ struct cmd_binding *
c
bind;
+ for(
cbind = cmd_binds[bind_index]; cbind; cbind = c
bind->next) {
+ if(
cbind->botid == botid && strcmp(c
bind->cmd, cmd) == 0)
return 0;
}
return 0;
}
-
bind = malloc(sizeof(*
bind));
- if (!bind) {
+
cbind = malloc(sizeof(*c
bind));
+ if (!
c
bind) {
perror("malloc() failed");
return 0;
}
perror("malloc() failed");
return 0;
}
- bind->botid = botid;
- bind->cmd = strdup(cmd);
- bind->func = cmdfunc;
- bind->next = cmd_binds[bind_index];
- cmd_binds[bind_index] = bind;
+
c
bind->botid = botid;
+
c
bind->cmd = strdup(cmd);
+
c
bind->func = cmdfunc;
+
c
bind->next = cmd_binds[bind_index];
+ cmd_binds[bind_index] =
c
bind;
return 1;
}
int unbind_cmd(int botid, char *cmd) {
int bind_index = get_binds_index(cmd[0]);
return 1;
}
int unbind_cmd(int botid, char *cmd) {
int bind_index = get_binds_index(cmd[0]);
- struct cmd_binding *bind, *last = NULL;
- for(
bind = cmd_binds[bind_index]; bind; bind =
bind->next) {
- if(
bind->botid == botid && strcmp(
bind->cmd, cmd) == 0) {
+ struct cmd_binding *
c
bind, *last = NULL;
+ for(
cbind = cmd_binds[bind_index]; cbind; cbind = c
bind->next) {
+ if(
cbind->botid == botid && strcmp(c
bind->cmd, cmd) == 0) {
if(last)
if(last)
- last->next = bind->next;
+ last->next =
c
bind->next;
else
else
- cmd_binds[bind_index] = bind->next;
- free(bind->cmd);
- free(bind);
+ cmd_binds[bind_index] =
c
bind->next;
+ free(
c
bind->cmd);
+ free(
c
bind);
return 1;
} else
return 1;
} else
- last = bind;
+ last =
c
bind;
}
return 0;
}
}
return 0;
}
diff --git
a/modcmd.h
b/modcmd.h
index 4bff7d9110ddc47c6fa7a7ca5510c820bf671a9b..673f74c92716c9c1c1b2a3509b67539d843da911 100644
(file)
--- a/
modcmd.h
+++ b/
modcmd.h
@@
-14,8
+14,8
@@
struct cmd_function {
int botid;
cmd_bind_t *func;
int botid;
cmd_bind_t *func;
- struct cmd_
binding
*next;
-}
+ struct cmd_
function
*next;
+}
;
struct cmd_binding {
char *cmd;
struct cmd_binding {
char *cmd;
@@
-23,14
+23,14
@@
struct cmd_binding {
struct cmd_function *func;
struct cmd_binding *next;
struct cmd_function *func;
struct cmd_binding *next;
-}
+}
;
struct trigger_cache {
int botid;
char *trigger;
struct trigger_cache *next;
struct trigger_cache {
int botid;
char *trigger;
struct trigger_cache *next;
-}
+}
;
void init_modcmd();
struct* ClientSocket get_prefered_bot(int botid);
void init_modcmd();
struct* ClientSocket get_prefered_bot(int botid);