projects
/
NeonServV5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
changed Makefile; build all commands as an own file
[NeonServV5.git]
/
cmd_neonserv_delban.c
diff --git
a/cmd_neonserv_delban.c
b/cmd_neonserv_delban.c
index 2bd56997609407864311d83b76bfb87ba8001490..ac8b6964b15ce62e27d8ccc91d30c40ef44011cd 100644
(file)
--- a/
cmd_neonserv_delban.c
+++ b/
cmd_neonserv_delban.c
@@
-1,9
+1,11
@@
+#include "cmd_neonserv.h"
+
/*
* argv[0] nick|*auth|*!*@mask
*/
/*
* argv[0] nick|*auth|*!*@mask
*/
-
static
CMD_BIND(neonserv_cmd_delban) {
+CMD_BIND(neonserv_cmd_delban) {
char hostmask_buffer[NICKLEN+USERLEN+HOSTLEN+3];
char *mask = make_banmask(argv[0], hostmask_buffer);
int matching_bans = 0;
char hostmask_buffer[NICKLEN+USERLEN+HOSTLEN+3];
char *mask = make_banmask(argv[0], hostmask_buffer);
int matching_bans = 0;
@@
-16,11
+18,16
@@
static CMD_BIND(neonserv_cmd_delban) {
return;
}
//check if the provided mask affects any existing bans
return;
}
//check if the provided mask affects any existing bans
- printf_mysql_query("SELECT `ban_mask`, `ban_id` FROM `bans` WHERE `ban_channel` = '%d'", chan->channel_id);
+ char nameBuf[20];
+ printf_mysql_query("SELECT `ban_mask`, `ban_id`, `ban_timeout` FROM `bans` WHERE `ban_channel` = '%d'", chan->channel_id);
res = mysql_use();
while ((row = mysql_fetch_row(res)) != NULL) {
if(!match(mask, row[0])) {
//remove the ban
res = mysql_use();
while ((row = mysql_fetch_row(res)) != NULL) {
if(!match(mask, row[0])) {
//remove the ban
+ if(strcmp(row[2], "0")) {
+ sprintf(nameBuf, "ban_%s", row[1]);
+ timeq_del_name(nameBuf);
+ }
printf_mysql_query("DELETE FROM `bans` WHERE `ban_id` = '%s'", row[1]);
matching_bans++;
}
printf_mysql_query("DELETE FROM `bans` WHERE `ban_id` = '%s'", row[1]);
matching_bans++;
}