srvx-commits Mailing List for srvx IRC Services (Page 36)
Brought to you by:
entrope
You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(80) |
Sep
(51) |
Oct
(94) |
Nov
(132) |
Dec
(85) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(163) |
Feb
(96) |
Mar
(70) |
Apr
(182) |
May
(173) |
Jun
(73) |
Jul
(101) |
Aug
(101) |
Sep
(71) |
Oct
(76) |
Nov
(58) |
Dec
(60) |
| 2003 |
Jan
(61) |
Feb
(14) |
Mar
(3) |
Apr
|
May
(7) |
Jun
(22) |
Jul
(81) |
Aug
(41) |
Sep
(34) |
Oct
(41) |
Nov
(16) |
Dec
(28) |
| 2004 |
Jan
(7) |
Feb
|
Mar
(3) |
Apr
(15) |
May
(11) |
Jun
(1) |
Jul
(4) |
Aug
(1) |
Sep
(4) |
Oct
(1) |
Nov
(1) |
Dec
(1) |
| 2005 |
Jan
(13) |
Feb
(6) |
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2009 |
Jan
|
Feb
|
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
(2) |
Feb
(3) |
Mar
(4) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
| 2012 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(4) |
Jun
|
Jul
(1) |
Aug
|
Sep
(3) |
Oct
(2) |
Nov
|
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2023 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
| 2025 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Entrope <en...@us...> - 2002-07-11 18:15:53
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv29536/src
Modified Files:
nickserv.c nickserv.h opserv.c
Log Message:
move some access-checking code into separate functions
s/strcasestr/irccasestr/g in opserv.c
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.179
retrieving revision 1.180
diff -C2 -r1.179 -r1.180
*** nickserv.c 8 Jul 2002 15:45:32 -0000 1.179
--- nickserv.c 11 Jul 2002 18:15:49 -0000 1.180
***************
*** 485,508 ****
}
! static int
! is_valid_oper(struct userNode *user, unsigned int min_level, unsigned int quiet)
! {
if (!user->handle_info) {
! if (!quiet) nickserv_notice(user, MSG_AUTHENTICATE);
return 0;
}
if (!IsOper(user) && (!IsHelping(user) || min_level)) {
! if (!quiet) nickserv_notice(user, NSMSG_NO_ACCESS);
return 0;
}
if (HANDLE_FLAGGED(user->handle_info, OPER_SUSPENDED)) {
! if (!quiet) nickserv_notice(user, MSG_OPER_SUSPENDED);
return 0;
}
if (user->handle_info->opserv_level < min_level) {
! if (!quiet) nickserv_notice(user, NSMSG_NO_ACCESS);
return 0;
}
--- 485,507 ----
}
! int
! oper_has_access(struct userNode *user, struct userNode *bot, unsigned int min_level, unsigned int quiet) {
if (!user->handle_info) {
! if (!quiet) send_message(user, bot, MSG_AUTHENTICATE);
return 0;
}
if (!IsOper(user) && (!IsHelping(user) || min_level)) {
! if (!quiet) send_message(user, bot, NSMSG_NO_ACCESS);
return 0;
}
if (HANDLE_FLAGGED(user->handle_info, OPER_SUSPENDED)) {
! if (!quiet) send_message(user, bot, MSG_OPER_SUSPENDED);
return 0;
}
if (user->handle_info->opserv_level < min_level) {
! if (!quiet) send_message(user, bot, NSMSG_NO_ACCESS);
return 0;
}
***************
*** 511,514 ****
--- 510,515 ----
}
+ #define is_valid_oper(USER, MIN_LEVEL, QUIET) oper_has_access(USER, nickserv, MIN_LEVEL, QUIET)
+
static int
is_valid_handle(const char *handle)
***************
*** 1704,1733 ****
}
! static int
! nickserv_apply_flags(struct userNode *user, struct handle_info *hi, const unsigned char *flags)
! {
! unsigned int n, add = 1, pos, before, after;
! struct userNode *uNode;
! before = hi->flags & (HI_FLAG_SUPPORT_HELPER|HI_FLAG_NETWORK_HELPER);
! for (n=0; flags[n]; n++) {
! switch (flags[n]) {
case '+': add = 1; break;
case '-': add = 0; break;
default:
! if (!(pos = handle_inverse_flags[flags[n]])) {
! nickserv_notice(user, NSMSG_INVALID_FLAG, flags[n]);
return 0;
}
if (user->handle_info->opserv_level < flag_access_levels[pos-1]) {
/* cheesy avoidance of looking up the flag name.. */
! nickserv_notice(user, MSG_SETTING_PRIVILEGED, "That flag");
return 0;
}
! if (add) hi->flags |= 1 << (pos - 1);
! else hi->flags &= ~(1 << (pos - 1));
break;
}
}
after = hi->flags & (HI_FLAG_SUPPORT_HELPER|HI_FLAG_NETWORK_HELPER);
--- 1705,1747 ----
}
! int
! nickserv_modify_handle_flags(struct userNode *user, struct userNode *bot, const unsigned char *str, unsigned long *padded, unsigned long *premoved) {
! unsigned int nn, add = 1, pos;
! unsigned long added, removed, flag;
! for (added=removed=nn=0; str[nn]; nn++) {
! switch (str[nn]) {
case '+': add = 1; break;
case '-': add = 0; break;
default:
! if (!(pos = handle_inverse_flags[str[nn]])) {
! send_message(user, bot, NSMSG_INVALID_FLAG, str[nn]);
return 0;
}
if (user->handle_info->opserv_level < flag_access_levels[pos-1]) {
/* cheesy avoidance of looking up the flag name.. */
! send_message(user, bot, MSG_SETTING_PRIVILEGED, "That flag");
return 0;
}
! flag = 1 << (pos - 1);
! if (add) added |= flag, removed &= ~flag;
! else removed |= flag, added &= ~flag;
break;
}
}
+ *padded = added;
+ *premoved = removed;
+ return 1;
+ }
+
+ static int
+ nickserv_apply_flags(struct userNode *user, struct handle_info *hi, const unsigned char *flags)
+ {
+ unsigned long before, after, added, removed;
+ struct userNode *uNode;
+
+ before = hi->flags & (HI_FLAG_SUPPORT_HELPER|HI_FLAG_NETWORK_HELPER);
+ if (!nickserv_modify_handle_flags(user, nickserv, flags, &added, &removed)) return 0;
+ hi->flags = (hi->flags | added) & ~removed;
after = hi->flags & (HI_FLAG_SUPPORT_HELPER|HI_FLAG_NETWORK_HELPER);
***************
*** 2038,2043 ****
int
! oper_can_set_access(struct userNode *user) {
! return is_valid_oper(user, nickserv_conf.modoper_level, 0);
}
--- 2052,2057 ----
int
! oper_can_set_access(struct userNode *user, struct userNode *bot) {
! return oper_has_access(user, bot, nickserv_conf.modoper_level, 0);
}
***************
*** 2050,2054 ****
if (argc > 1) {
! if (oper_can_set_access(user)) {
unsigned int new_level = strtoul(argv[1], NULL, 0);
if (user->handle_info->opserv_level < new_level) {
--- 2064,2068 ----
if (argc > 1) {
! if (oper_can_set_access(user, nickserv)) {
unsigned int new_level = strtoul(argv[1], NULL, 0);
if (user->handle_info->opserv_level < new_level) {
***************
*** 2638,2642 ****
nickserv_discrim_create(struct userNode *user, unsigned int argc, unsigned char *argv[])
{
! unsigned int i, j;
struct nickserv_discrim *discrim;
--- 2652,2656 ----
nickserv_discrim_create(struct userNode *user, unsigned int argc, unsigned char *argv[])
{
! unsigned int i;
struct nickserv_discrim *discrim;
***************
*** 2657,2676 ****
discrim->limit = atoi(argv[++i]);
} else if (!irccasecmp(argv[i], "flags")) {
! int is_on = 1, pos;
! i++;
! for (j=0; argv[i][j]; j++) {
! switch (argv[i][j]) {
! case '+': is_on = 1; break;
! case '-': is_on = 0; break;
! default:
! pos = handle_inverse_flags[argv[i][j]];
! if (!pos) break;
! if (is_on) {
! discrim->flags_on |= 1 << (pos-1);
! } else {
! discrim->flags_off |= 1 << (pos-1);
! }
! }
! }
} else if (!irccasecmp(argv[i], "registered")) {
discrim->registered = now - ParseInterval(argv[++i]);
--- 2671,2675 ----
discrim->limit = atoi(argv[++i]);
} else if (!irccasecmp(argv[i], "flags")) {
! nickserv_modify_handle_flags(user, nickserv, argv[i], &discrim->flags_on, &discrim->flags_off);
} else if (!irccasecmp(argv[i], "registered")) {
discrim->registered = now - ParseInterval(argv[++i]);
Index: nickserv.h
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -r1.33 -r1.34
*** nickserv.h 4 Jul 2002 02:47:30 -0000 1.33
--- nickserv.h 11 Jul 2002 18:15:50 -0000 1.34
***************
*** 109,116 ****
struct handle_info *get_handle_info(const char *handle);
struct handle_info *smart_get_handle_info(struct userNode *service, struct userNode *user, const unsigned char *name);
! int oper_can_set_access(struct userNode *user);
int oper_outranks(struct userNode *user, struct handle_info *hi);
struct nick_info *get_nick_info(const char *nick);
struct modeNode *find_handle_in_channel(struct chanNode *channel, struct handle_info *handle, struct userNode *except);
/* auth_funcs are called when a user gets a new handle_info. They are
--- 109,118 ----
struct handle_info *get_handle_info(const char *handle);
struct handle_info *smart_get_handle_info(struct userNode *service, struct userNode *user, const unsigned char *name);
! int oper_can_set_access(struct userNode *user, struct userNode *bot);
int oper_outranks(struct userNode *user, struct handle_info *hi);
struct nick_info *get_nick_info(const char *nick);
struct modeNode *find_handle_in_channel(struct chanNode *channel, struct handle_info *handle, struct userNode *except);
+ int nickserv_modify_handle_flags(struct userNode *user, struct userNode *bot, const unsigned char *str, unsigned long *add, unsigned long *remove);
+ int oper_has_access(struct userNode *user, struct userNode *bot, unsigned int min_level, unsigned int quiet);
/* auth_funcs are called when a user gets a new handle_info. They are
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.244
retrieving revision 1.245
diff -C2 -r1.244 -r1.245
*** opserv.c 8 Jul 2002 15:45:32 -0000 1.244
--- opserv.c 11 Jul 2002 18:15:50 -0000 1.245
***************
*** 470,478 ****
return;
}
- log(OS_LOG, LOG_INFO, "%s[%s]: %s\n", user->nick, user->handle_info->handle, text);
if (HANDLE_FLAGGED(user->handle_info, OPER_SUSPENDED)) {
opserv_notice(user, MSG_OPER_SUSPENDED);
return;
}
argv_shift = 1;
--- 470,478 ----
return;
}
if (HANDLE_FLAGGED(user->handle_info, OPER_SUSPENDED)) {
opserv_notice(user, MSG_OPER_SUSPENDED);
return;
}
+ log(OS_LOG, LOG_INFO, "%s[%s]: %s\n", user->nick, user->handle_info->handle, text);
argv_shift = 1;
***************
*** 501,512 ****
return;
}
- if (cmd->min_level > user->handle_info->opserv_level) {
- opserv_notice(user, OSMSG_LEVEL_TOO_LOW);
- return;
- }
if (cmd->disabled) {
opserv_notice(user, MSG_COMMAND_DISABLED, argv[argv_shift]);
return;
}
if (cmd->func) {
cmd->func(user, channel, argc, argv+argv_shift);
--- 501,509 ----
return;
}
if (cmd->disabled) {
opserv_notice(user, MSG_COMMAND_DISABLED, argv[argv_shift]);
return;
}
+ if (!oper_has_access(user, opserv, cmd->min_level, 0)) return;
if (cmd->func) {
cmd->func(user, channel, argc, argv+argv_shift);
***************
*** 556,560 ****
target = (argc > 1) ? (const char*)argv[1] : user->nick;
if (!(hi = smart_get_handle_info(opserv, user, target))) return 0;
! if ((argc > 2) && oper_can_set_access(user) && oper_outranks(user, hi)) {
new_level = strtoul(argv[2], NULL, 0);
if (user->handle_info->opserv_level < new_level) {
--- 553,557 ----
target = (argc > 1) ? (const char*)argv[1] : user->nick;
if (!(hi = smart_get_handle_info(opserv, user, target))) return 0;
! if ((argc > 2) && oper_can_set_access(user, opserv) && oper_outranks(user, hi)) {
new_level = strtoul(argv[2], NULL, 0);
if (user->handle_info->opserv_level < new_level) {
***************
*** 2254,2258 ****
for (found=0; found<opserv_bad_words->used; +++found) {
! if (strcasestr(name, opserv_bad_words->list[found])) return 1;
}
--- 2251,2255 ----
for (found=0; found<opserv_bad_words->used; +++found) {
! if (irccasestr(name, opserv_bad_words->list[found])) return 1;
}
***************
*** 2351,2358 ****
for (bad_idx = 0; bad_idx < opserv_bad_words->used; ++bad_idx) {
char *orig_bad = opserv_bad_words->list[bad_idx];
! if (strcasestr(new_bad, orig_bad)) {
if (user) opserv_notice(user, OSMSG_BAD_REDUNDANT, new_bad, orig_bad);
return 0;
! } else if (strcasestr(orig_bad, new_bad)) {
if (user) opserv_notice(user, OSMSG_BAD_GROWING, orig_bad, new_bad);
free(orig_bad);
--- 2348,2355 ----
for (bad_idx = 0; bad_idx < opserv_bad_words->used; ++bad_idx) {
char *orig_bad = opserv_bad_words->list[bad_idx];
! if (irccasestr(new_bad, orig_bad)) {
if (user) opserv_notice(user, OSMSG_BAD_REDUNDANT, new_bad, orig_bad);
return 0;
! } else if (irccasestr(orig_bad, new_bad)) {
if (user) opserv_notice(user, OSMSG_BAD_GROWING, orig_bad, new_bad);
free(orig_bad);
***************
*** 2360,2364 ****
for (bad_idx++; bad_idx < opserv_bad_words->used; bad_idx++) {
orig_bad = opserv_bad_words->list[bad_idx];
! if (!strcasestr(orig_bad, new_bad)) continue;
if (user) opserv_notice(user, OSMSG_BAD_NUKING, orig_bad);
string_list_delete(opserv_bad_words, bad_idx);
--- 2357,2361 ----
for (bad_idx++; bad_idx < opserv_bad_words->used; bad_idx++) {
orig_bad = opserv_bad_words->list[bad_idx];
! if (!irccasestr(orig_bad, new_bad)) continue;
if (user) opserv_notice(user, OSMSG_BAD_NUKING, orig_bad);
string_list_delete(opserv_bad_words, bad_idx);
|
|
From: Entrope <en...@us...> - 2002-07-08 15:45:36
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv25756/src
Modified Files:
chanserv.c common.h dict-splay.c gline.c global.c helpserv.c
log.c nickserv.c opserv.c policer.c proto-bahamut.c
sockcheck.c
Log Message:
simple s/strcase/irccase/g
(except for sockcheck.c, which has s/strncase/ircncase/g)
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.246
retrieving revision 1.247
diff -C2 -r1.246 -r1.247
*** chanserv.c 8 Jul 2002 14:42:55 -0000 1.246
--- chanserv.c 8 Jul 2002 15:45:31 -0000 1.247
***************
*** 610,614 ****
for(level = USER_LEVEL_LOWEST; level <= USER_LEVEL_HIGHEST; level++)
{
! if(!strcasecmp(name, accessNames[level]))
{
return level;
--- 610,614 ----
for(level = USER_LEVEL_LOWEST; level <= USER_LEVEL_HIGHEST; level++)
{
! if(!irccasecmp(name, accessNames[level]))
{
return level;
***************
*** 1062,1066 ****
if(spc) *spc = 0;
else if(text[tlen-1] == '\001') text[tlen-1] = 0;
! if(!strcasecmp(text, "ACTION")) return;
/* Figure out the minimum level needed to CTCP the channel */
switch(channel->channel_info->options[optCTCPUsers]) {
--- 1062,1066 ----
if(spc) *spc = 0;
else if(text[tlen-1] == '\001') text[tlen-1] = 0;
! if(!irccasecmp(text, "ACTION")) return;
/* Figure out the minimum level needed to CTCP the channel */
switch(channel->channel_info->options[optCTCPUsers]) {
***************
*** 1342,1350 ****
value[0] = 0;
! if(!strcasecmp(property, "weight"))
{
snprintf(value, sizeof(value), "%.1f", cmd->weight);
}
! else if(!strcasecmp(property, "access"))
{
if(cmd->flags & CMD_DISABLED)
--- 1342,1350 ----
value[0] = 0;
! if(!irccasecmp(property, "weight"))
{
snprintf(value, sizeof(value), "%.1f", cmd->weight);
}
! else if(!irccasecmp(property, "access"))
{
if(cmd->flags & CMD_DISABLED)
***************
*** 1390,1394 ****
int count;
! if(!strcasecmp(variable, "index"))
{
exp.type = HF_TABLE;
--- 1390,1394 ----
int count;
! if(!irccasecmp(variable, "index"))
{
exp.type = HF_TABLE;
***************
*** 1402,1406 ****
return exp;
}
! else if(!strcasecmp(variable, "notes"))
{
dict_iterator_t it;
--- 1402,1406 ----
return exp;
}
! else if(!irccasecmp(variable, "notes"))
{
dict_iterator_t it;
***************
*** 1448,1452 ****
}
! if(!strcasecmp(start, "command"))
{
exp.value.str = strdup(chanserv_expand_command(start + strlen(start) + 1));
--- 1448,1452 ----
}
! if(!irccasecmp(start, "command"))
{
exp.value.str = strdup(chanserv_expand_command(start + strlen(start) + 1));
***************
*** 2130,2134 ****
if(!(handle = chanserv_get_handle_info(user, argv[new_channel+1]))) return 0;
! force = (argc > (new_channel+2)) && !strcasecmp(argv[new_channel+2], "force");
dnr = chanserv_is_dnr(chan_name, handle);
}
--- 2130,2134 ----
if(!(handle = chanserv_get_handle_info(user, argv[new_channel+1]))) return 0;
! force = (argc > (new_channel+2)) && !irccasecmp(argv[new_channel+2], "force");
dnr = chanserv_is_dnr(chan_name, handle);
}
***************
*** 2256,2260 ****
}
! force = (argc > 2) && !strcasecmp(argv[2], "force") && IsPrivileged(user);
if((target = GetChannel(argv[1])))
{
--- 2256,2260 ----
}
! force = (argc > 2) && !irccasecmp(argv[2], "force") && IsPrivileged(user);
if((target = GetChannel(argv[1])))
{
***************
*** 2742,2746 ****
for(access = USER_LEVEL_LOWEST; access <= USER_LEVEL_HIGHEST; access++)
{
! if(!strcasecmp(argv[2], accessNames[access]))
{
new_access = access;
--- 2742,2746 ----
for(access = USER_LEVEL_LOWEST; access <= USER_LEVEL_HIGHEST; access++)
{
! if(!irccasecmp(argv[2], accessNames[access]))
{
new_access = access;
***************
*** 3347,3351 ****
/* The ban is redundant; there is already a ban
with the same effect in place. */
! if(bData->expires && !strcasecmp(bData->mask, ban))
{
int reset = 0;
--- 3347,3351 ----
/* The ban is redundant; there is already a ban
with the same effect in place. */
! if(bData->expires && !irccasecmp(bData->mask, ban))
{
int reset = 0;
***************
*** 4190,4194 ****
else if (cData->topic[0])
{
! return strcasecmp(new_topic, cData->topic);
}
else return 0;
--- 4190,4194 ----
else if (cData->topic[0])
{
! return irccasecmp(new_topic, cData->topic);
}
else return 0;
***************
*** 4370,4374 ****
chanserv_notice(user, MSG_VERSION);
! if(argc > 1 && !strcasecmp(argv[1], "cvs"))
{
chanserv_notice(user, CSMSG_VERSION_ID);
--- 4370,4374 ----
chanserv_notice(user, MSG_VERSION);
! if(argc > 1 && !irccasecmp(argv[1], "cvs"))
{
chanserv_notice(user, CSMSG_VERSION_ID);
***************
*** 4712,4716 ****
REQUIRE_PARAMS(2);
! if(!strcasecmp(argv[1], chanserv->nick))
{
chanserv_notice(user, CSMSG_IS_CHANSERV);
--- 4712,4716 ----
REQUIRE_PARAMS(2);
! if(!irccasecmp(argv[1], chanserv->nick))
{
chanserv_notice(user, CSMSG_IS_CHANSERV);
***************
*** 5238,5242 ****
}
! if(!strcasecmp(argv[2], "flags"))
{
/* Make sure locked flags don't get turned on or off. */
--- 5238,5242 ----
}
! if(!irccasecmp(argv[2], "flags"))
{
/* Make sure locked flags don't get turned on or off. */
***************
*** 5250,5259 ****
chanserv_notice(user, CSMSG_COMMAND_FLAGS, command->flags);
}
! else if(!strcasecmp(argv[2], "weight"))
{
command->weight = atof(argv[3]);
chanserv_notice(user, CSMSG_COMMAND_WEIGHT, command->weight);
}
! else if(!strcasecmp(argv[2], "access"))
{
enum userLevel level;
--- 5250,5259 ----
chanserv_notice(user, CSMSG_COMMAND_FLAGS, command->flags);
}
! else if(!irccasecmp(argv[2], "weight"))
{
command->weight = atof(argv[3]);
chanserv_notice(user, CSMSG_COMMAND_WEIGHT, command->weight);
}
! else if(!irccasecmp(argv[2], "access"))
{
enum userLevel level;
***************
*** 5314,5341 ****
}
! if(!strcasecmp(argv[i], "name"))
{
search->name = argv[++i];
}
! else if(!strcasecmp(argv[i], "registrar"))
{
search->registrar = argv[++i];
}
! else if(!strcasecmp(argv[i], "unvisited"))
{
search->unvisited = ParseInterval(argv[++i]);
}
! else if(!strcasecmp(argv[i], "registered"))
{
search->registered = ParseInterval(argv[++i]);
}
! else if(!strcasecmp(argv[i], "flags"))
{
i++;
! if(!strcasecmp(argv[i], "nodelete"))
{
search->flags |= CHANNEL_NODELETE;
}
! else if(!strcasecmp(argv[i], "suspended"))
{
search->flags |= CHANNEL_SUSPENDED;
--- 5314,5341 ----
}
! if(!irccasecmp(argv[i], "name"))
{
search->name = argv[++i];
}
! else if(!irccasecmp(argv[i], "registrar"))
{
search->registrar = argv[++i];
}
! else if(!irccasecmp(argv[i], "unvisited"))
{
search->unvisited = ParseInterval(argv[++i]);
}
! else if(!irccasecmp(argv[i], "registered"))
{
search->registered = ParseInterval(argv[++i]);
}
! else if(!irccasecmp(argv[i], "flags"))
{
i++;
! if(!irccasecmp(argv[i], "nodelete"))
{
search->flags |= CHANNEL_NODELETE;
}
! else if(!irccasecmp(argv[i], "suspended"))
{
search->flags |= CHANNEL_SUSPENDED;
***************
*** 5347,5351 ****
}
}
! else if(!strcasecmp(argv[i], "limit"))
{
search->limit = strtoul(argv[++i], NULL, 10);
--- 5347,5351 ----
}
}
! else if(!irccasecmp(argv[i], "limit"))
{
search->limit = strtoul(argv[++i], NULL, 10);
***************
*** 5429,5437 ****
REQUIRE_PARAMS(3);
! if(!strcasecmp(argv[1], "count"))
{
action = search_count;
}
! else if(!strcasecmp(argv[1], "print"))
{
action = search_print;
--- 5429,5437 ----
REQUIRE_PARAMS(3);
! if(!irccasecmp(argv[1], "count"))
{
action = search_count;
}
! else if(!irccasecmp(argv[1], "print"))
{
action = search_print;
***************
*** 5992,5996 ****
REQUIRE_PARAMS(2);
curr_user = GetChannelAccess(cData, user->handle_info);
! force = IsPrivileged(user) && (argc > 2) && !strcasecmp(argv[2], "force");
if(!curr_user || (curr_user->access != ulOwner))
{
--- 5992,5996 ----
REQUIRE_PARAMS(2);
curr_user = GetChannelAccess(cData, user->handle_info);
! force = IsPrivileged(user) && (argc > 2) && !irccasecmp(argv[2], "force");
if(!curr_user || (curr_user->access != ulOwner))
{
***************
*** 6912,6924 ****
if((str = database_get_data(obj, KEY_NOTE_VISIBILITY, RECDB_QSTRING)))
{
! if(!strcasecmp(str, KEY_NOTE_VIS_PRIVILEGED))
{
ntype->visible_type = NOTE_VIS_PRIVILEGED;
}
! else if(!strcasecmp(str, KEY_NOTE_VIS_CHANNEL_USERS))
{
ntype->visible_type = NOTE_VIS_CHANNEL_USERS;
}
! else if(!strcasecmp(str, KEY_NOTE_VIS_ALL))
{
ntype->visible_type = NOTE_VIS_ALL;
--- 6912,6924 ----
if((str = database_get_data(obj, KEY_NOTE_VISIBILITY, RECDB_QSTRING)))
{
! if(!irccasecmp(str, KEY_NOTE_VIS_PRIVILEGED))
{
ntype->visible_type = NOTE_VIS_PRIVILEGED;
}
! else if(!irccasecmp(str, KEY_NOTE_VIS_CHANNEL_USERS))
{
ntype->visible_type = NOTE_VIS_CHANNEL_USERS;
}
! else if(!irccasecmp(str, KEY_NOTE_VIS_ALL))
{
ntype->visible_type = NOTE_VIS_ALL;
Index: common.h
===================================================================
RCS file: /cvsroot/srvx/services/src/common.h,v
retrieving revision 1.74
retrieving revision 1.75
diff -C2 -r1.74 -r1.75
*** common.h 8 Jul 2002 15:19:30 -0000 1.74
--- common.h 8 Jul 2002 15:45:32 -0000 1.75
***************
*** 210,215 ****
void string_buffer_replace(struct string_buffer *buf, unsigned int from, unsigned int len, const char *repl);
! #define enabled_string(string) (!strcasecmp((string), "on") || !strcmp((string), "1") || !strcasecmp((string), "enabled"))
! #define disabled_string(string) (!strcasecmp((string), "off") || !strcmp((string), "0") || !strcasecmp((string), "disabled"))
#endif /* ifdef _COMMON_H_ */
--- 210,215 ----
void string_buffer_replace(struct string_buffer *buf, unsigned int from, unsigned int len, const char *repl);
! #define enabled_string(string) (!irccasecmp((string), "on") || !strcmp((string), "1") || !irccasecmp((string), "enabled"))
! #define disabled_string(string) (!irccasecmp((string), "off") || !strcmp((string), "0") || !irccasecmp((string), "disabled"))
#endif /* ifdef _COMMON_H_ */
Index: dict-splay.c
===================================================================
RCS file: /cvsroot/srvx/services/src/dict-splay.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** dict-splay.c 12 Jun 2002 18:21:05 -0000 1.7
--- dict-splay.c 8 Jul 2002 15:45:32 -0000 1.8
***************
*** 90,98 ****
while (1) {
! int res = strcasecmp(key, node->key);
if (!res) break;
if (res < 0) {
if (!node->l) break;
! res = strcasecmp(key, node->l->key);
if (res < 0) {
y = node->l;
--- 90,98 ----
while (1) {
! int res = irccasecmp(key, node->key);
if (!res) break;
if (res < 0) {
if (!node->l) break;
! res = irccasecmp(key, node->l->key);
if (res < 0) {
y = node->l;
***************
*** 107,111 ****
} else { /* res > 0 */
if (!node->r) break;
! res = strcasecmp(key, node->r->key);
if (res > 0) {
y = node->r;
--- 107,111 ----
} else { /* res > 0 */
if (!node->r) break;
! res = irccasecmp(key, node->r->key);
if (res > 0) {
y = node->r;
***************
*** 154,158 ****
int res;
dict->root = dict_splay(dict->root, key);
! res = strcasecmp(key, dict->root->key);
if (res < 0) {
/* insert just "before" current root */
--- 154,158 ----
int res;
dict->root = dict_splay(dict->root, key);
! res = irccasecmp(key, dict->root->key);
if (res < 0) {
/* insert just "before" current root */
***************
*** 161,165 ****
dict->root->l = NULL;
if (dict->root->prev) dict->root->prev->next = new_node;
! if (strcasecmp(key, dict->first->key) < 0) dict->first = new_node;
new_node->prev = dict->root->prev;
new_node->next = dict->root;
--- 161,165 ----
dict->root->l = NULL;
if (dict->root->prev) dict->root->prev->next = new_node;
! if (irccasecmp(key, dict->first->key) < 0) dict->first = new_node;
new_node->prev = dict->root->prev;
new_node->next = dict->root;
***************
*** 172,176 ****
dict->root->r = NULL;
if (dict->root->next) dict->root->next->prev = new_node;
! if (strcasecmp(key, dict->last->key) > 0) dict->last = new_node;
new_node->next = dict->root->next;
new_node->prev = dict->root;
--- 172,176 ----
dict->root->r = NULL;
if (dict->root->next) dict->root->next->prev = new_node;
! if (irccasecmp(key, dict->last->key) > 0) dict->last = new_node;
new_node->next = dict->root->next;
new_node->prev = dict->root;
***************
*** 204,208 ****
{
dict->root = dict_splay(dict->root, key);
! if (dict->root && !strcasecmp(key, dict->root->key)) {
struct dict_node *new_root;
if (!dict->root->l) {
--- 204,208 ----
{
dict->root = dict_splay(dict->root, key);
! if (dict->root && !irccasecmp(key, dict->root->key)) {
struct dict_node *new_root;
if (!dict->root->l) {
***************
*** 243,247 ****
}
dict->root = dict_splay(dict->root, key);
! was_found = !strcasecmp(key, dict->root->key);
if (found) *found = was_found;
return was_found ? dict->root->data : NULL;
--- 243,247 ----
}
dict->root = dict_splay(dict->root, key);
! was_found = !irccasecmp(key, dict->root->key);
if (found) *found = was_found;
return was_found ? dict->root->data : NULL;
***************
*** 278,282 ****
if (node->l) {
if (dict_sanity_check_node(node->l, dss)) return 1;
! if (strcasecmp(node->l->key, node->key) >= 0) {
snprintf(dss->error, sizeof(dss->error), "Node %p's left child's key '%s' >= its key '%s'", node, node->l->key, node->key);
return 1;
--- 278,282 ----
if (node->l) {
if (dict_sanity_check_node(node->l, dss)) return 1;
! if (irccasecmp(node->l->key, node->key) >= 0) {
snprintf(dss->error, sizeof(dss->error), "Node %p's left child's key '%s' >= its key '%s'", node, node->l->key, node->key);
return 1;
***************
*** 285,289 ****
if (node->r) {
if (dict_sanity_check_node(node->r, dss)) return 1;
! if (strcasecmp(node->key, node->r->key) >= 0) {
snprintf(dss->error, sizeof(dss->error), "Node %p's right child's key '%s' <= its key '%s'", node, node->r->key, node->key);
return 1;
--- 285,289 ----
if (node->r) {
if (dict_sanity_check_node(node->r, dss)) return 1;
! if (irccasecmp(node->key, node->r->key) >= 0) {
snprintf(dss->error, sizeof(dss->error), "Node %p's right child's key '%s' <= its key '%s'", node, node->r->key, node->key);
return 1;
Index: gline.c
===================================================================
RCS file: /cvsroot/srvx/services/src/gline.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** gline.c 27 Jun 2002 01:28:33 -0000 1.25
--- gline.c 8 Jul 2002 15:45:32 -0000 1.26
***************
*** 71,75 ****
struct gline *ge = data;
(void)key;
! return !strcasecmp(ge->target, extra);
}
--- 71,75 ----
struct gline *ge = data;
(void)key;
! return !irccasecmp(ge->target, extra);
}
***************
*** 80,84 ****
(void)key;
! if (!strcasecmp(ge->target, extra)) {
free_gline(ge);
return 1;
--- 80,84 ----
(void)key;
! if (!irccasecmp(ge->target, extra)) {
free_gline(ge);
return 1;
***************
*** 295,304 ****
goto fail;
}
! if (!strcasecmp(argv[i], "mask") || !strcasecmp(argv[i], "host")) {
! if (!strcasecmp(argv[++i], "exact")) {
discrim->target_mask_type = EXACT;
! } else if (!strcasecmp(argv[i], "subset")) {
discrim->target_mask_type = SUBSET;
! } else if (!strcasecmp(argv[i], "superset")) {
discrim->target_mask_type = SUPERSET;
} else {
--- 295,304 ----
goto fail;
}
! if (!irccasecmp(argv[i], "mask") || !irccasecmp(argv[i], "host")) {
! if (!irccasecmp(argv[++i], "exact")) {
discrim->target_mask_type = EXACT;
! } else if (!irccasecmp(argv[i], "subset")) {
discrim->target_mask_type = SUBSET;
! } else if (!irccasecmp(argv[i], "superset")) {
discrim->target_mask_type = SUPERSET;
} else {
***************
*** 315,327 ****
}
discrim->target_mask = argv[i];
! } else if (!strcasecmp(argv[i], "limit")) {
discrim->limit = strtoul(argv[++i], NULL, 0);
! } else if (!strcasecmp(argv[i], "reason")) {
discrim->reason_mask = argv[++i];
! } else if (!strcasecmp(argv[i], "issuer")) {
discrim->issuer_mask = argv[++i];
! } else if (!strcasecmp(argv[i], "after")) {
discrim->min_expire = now + ParseInterval(argv[++i]);
! } else if (!strcasecmp(argv[i], "before")) {
discrim->max_issued = now - ParseInterval(argv[++i]);
} else {
--- 315,327 ----
}
discrim->target_mask = argv[i];
! } else if (!irccasecmp(argv[i], "limit")) {
discrim->limit = strtoul(argv[++i], NULL, 0);
! } else if (!irccasecmp(argv[i], "reason")) {
discrim->reason_mask = argv[++i];
! } else if (!irccasecmp(argv[i], "issuer")) {
discrim->issuer_mask = argv[++i];
! } else if (!irccasecmp(argv[i], "after")) {
discrim->min_expire = now + ParseInterval(argv[++i]);
! } else if (!irccasecmp(argv[i], "before")) {
discrim->max_issued = now - ParseInterval(argv[++i]);
} else {
***************
*** 352,356 ****
&& !match_ircglobs(discrim->target_mask, gline->target))
|| ((discrim->target_mask_type == EXACT)
! && strcasecmp(discrim->target_mask, gline->target))
|| ((discrim->target_mask_type == SUPERSET)
&& !match_ircglobs(gline->target, discrim->target_mask))))
--- 352,356 ----
&& !match_ircglobs(discrim->target_mask, gline->target))
|| ((discrim->target_mask_type == EXACT)
! && irccasecmp(discrim->target_mask, gline->target))
|| ((discrim->target_mask_type == SUPERSET)
&& !match_ircglobs(gline->target, discrim->target_mask))))
Index: global.c
===================================================================
RCS file: /cvsroot/srvx/services/src/global.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -r1.44 -r1.45
*** global.c 4 Jul 2002 02:47:30 -0000 1.44
--- global.c 8 Jul 2002 15:45:32 -0000 1.45
***************
*** 258,262 ****
}
! if(!strcasecmp(argv[i], "text"))
{
i++;
--- 258,262 ----
}
! if(!irccasecmp(argv[i], "text"))
{
i++;
***************
*** 264,286 ****
text = argv[i];
break;
! } else if (!strcasecmp(argv[i], "sourceless")) {
i++;
flags |= MESSAGE_OPTION_SOURCELESS;
! } else if (!strcasecmp(argv[i], "target")) {
i++;
! if(!strcasecmp(argv[i], "all")) {
flags |= MESSAGE_RECIPIENT_ALL;
! } else if(!strcasecmp(argv[i], "users")) {
flags |= MESSAGE_RECIPIENT_LUSERS;
! } else if(!strcasecmp(argv[i], "helpers")) {
flags |= MESSAGE_RECIPIENT_HELPERS;
! } else if(!strcasecmp(argv[i], "opers")) {
flags |= MESSAGE_RECIPIENT_OPERS;
! } else if(!strcasecmp(argv[i], "staff") || !strcasecmp(argv[i], "privileged")) {
flags |= MESSAGE_RECIPIENT_STAFF;
! } else if(!strcasecmp(argv[i], "channels")) {
flags |= MESSAGE_RECIPIENT_CHANNELS;
! } else if(!strcasecmp(argv[i], "announcement") || !strcasecmp(argv[i], "announce")) {
flags |= MESSAGE_RECIPIENT_ANNOUNCE;
} else {
--- 264,286 ----
text = argv[i];
break;
! } else if (!irccasecmp(argv[i], "sourceless")) {
i++;
flags |= MESSAGE_OPTION_SOURCELESS;
! } else if (!irccasecmp(argv[i], "target")) {
i++;
! if(!irccasecmp(argv[i], "all")) {
flags |= MESSAGE_RECIPIENT_ALL;
! } else if(!irccasecmp(argv[i], "users")) {
flags |= MESSAGE_RECIPIENT_LUSERS;
! } else if(!irccasecmp(argv[i], "helpers")) {
flags |= MESSAGE_RECIPIENT_HELPERS;
! } else if(!irccasecmp(argv[i], "opers")) {
flags |= MESSAGE_RECIPIENT_OPERS;
! } else if(!irccasecmp(argv[i], "staff") || !irccasecmp(argv[i], "privileged")) {
flags |= MESSAGE_RECIPIENT_STAFF;
! } else if(!irccasecmp(argv[i], "channels")) {
flags |= MESSAGE_RECIPIENT_CHANNELS;
! } else if(!irccasecmp(argv[i], "announcement") || !irccasecmp(argv[i], "announce")) {
flags |= MESSAGE_RECIPIENT_ANNOUNCE;
} else {
***************
*** 288,292 ****
return NULL;
}
! } else if (strcasecmp(argv[i], "duration") == 0) {
duration = ParseInterval(argv[++i]);
} else {
--- 288,292 ----
return NULL;
}
! } else if (irccasecmp(argv[i], "duration") == 0) {
duration = ParseInterval(argv[++i]);
} else {
***************
*** 490,506 ****
}
! if(!strcasecmp(argv[1], "all")) {
target = MESSAGE_RECIPIENT_ALL;
! } else if(!strcasecmp(argv[1], "users")) {
target = MESSAGE_RECIPIENT_LUSERS;
! } else if(!strcasecmp(argv[1], "helpers")) {
target = MESSAGE_RECIPIENT_HELPERS;
! } else if(!strcasecmp(argv[1], "opers")) {
target = MESSAGE_RECIPIENT_OPERS;
! } else if(!strcasecmp(argv[1], "staff") || !strcasecmp(argv[1], "privileged")) {
target |= MESSAGE_RECIPIENT_HELPERS | MESSAGE_RECIPIENT_OPERS;
! } else if(!strcasecmp(argv[1], "announcement") || !strcasecmp(argv[1], "announce")) {
target |= MESSAGE_RECIPIENT_ANNOUNCE;
! } else if(!strcasecmp(argv[1], "channels")) {
target = MESSAGE_RECIPIENT_CHANNELS;
} else {
--- 490,506 ----
}
! if(!irccasecmp(argv[1], "all")) {
target = MESSAGE_RECIPIENT_ALL;
! } else if(!irccasecmp(argv[1], "users")) {
target = MESSAGE_RECIPIENT_LUSERS;
! } else if(!irccasecmp(argv[1], "helpers")) {
target = MESSAGE_RECIPIENT_HELPERS;
! } else if(!irccasecmp(argv[1], "opers")) {
target = MESSAGE_RECIPIENT_OPERS;
! } else if(!irccasecmp(argv[1], "staff") || !irccasecmp(argv[1], "privileged")) {
target |= MESSAGE_RECIPIENT_HELPERS | MESSAGE_RECIPIENT_OPERS;
! } else if(!irccasecmp(argv[1], "announcement") || !irccasecmp(argv[1], "announce")) {
target |= MESSAGE_RECIPIENT_ANNOUNCE;
! } else if(!irccasecmp(argv[1], "channels")) {
target = MESSAGE_RECIPIENT_CHANNELS;
} else {
Index: helpserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpserv.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** helpserv.c 3 Jul 2002 23:19:18 -0000 1.18
--- helpserv.c 8 Jul 2002 15:45:32 -0000 1.19
***************
*** 560,564 ****
enum helpserv_level nn;
for (nn=HlNone; nn<=HlOper; nn++) {
! if (!strcasecmp(msg, helpserv_level_names[nn])) return nn;
}
log(HS_LOG, LOG_ERROR, "helpserv_str2level received invalid level %s\n", msg);
--- 560,564 ----
enum helpserv_level nn;
for (nn=HlNone; nn<=HlOper; nn++) {
! if (!irccasecmp(msg, helpserv_level_names[nn])) return nn;
}
log(HS_LOG, LOG_ERROR, "helpserv_str2level received invalid level %s\n", msg);
***************
*** 857,861 ****
helpserv_notice(user, MSG_VERSION);
! if ((argc > 1 && !strcasecmp(argv[1], "cvs")) || from_opserv) {
helpserv_notice(user, "%s", HSMSG_VERSION_ID);
}
--- 857,861 ----
helpserv_notice(user, MSG_VERSION);
! if ((argc > 1 && !irccasecmp(argv[1], "cvs")) || from_opserv) {
helpserv_notice(user, "%s", HSMSG_VERSION_ID);
}
***************
*** 894,898 ****
struct helpfile_expansion exp;
! if (!strcasecmp(variable, "index")) {
exp.type = HF_TABLE;
exp.value.table.length = 1;
--- 894,898 ----
struct helpfile_expansion exp;
! if (!irccasecmp(variable, "index")) {
exp.type = HF_TABLE;
exp.value.table.length = 1;
***************
*** 1311,1323 ****
struct helpserv_request *req;
! if ((argc < 2) || !strcasecmp(argv[1], "unassigned")) {
helpserv_notice(user, HSMSG_REQ_LIST_TOP, "all unassigned");
for (req = hs->unhandled, total=0; req; req = req->next_unhandled, total++);
searchtype = 1; /* Unassigned */
! } else if (!strcasecmp(argv[1], "assigned")) {
helpserv_notice(user, HSMSG_REQ_LIST_TOP, "all assigned");
for (req = hs->unhandled, total=dict_size(hs->requests); req; req = req->next_unhandled, total--);
searchtype = 2; /* Assigned */
! } else if (!strcasecmp(argv[1], "me")) {
helpserv_notice(user, HSMSG_REQ_LIST_TOP, "your");
for (total = 0, it = dict_first(hs->requests); it; it = iter_next(it)) {
--- 1311,1323 ----
struct helpserv_request *req;
! if ((argc < 2) || !irccasecmp(argv[1], "unassigned")) {
helpserv_notice(user, HSMSG_REQ_LIST_TOP, "all unassigned");
for (req = hs->unhandled, total=0; req; req = req->next_unhandled, total++);
searchtype = 1; /* Unassigned */
! } else if (!irccasecmp(argv[1], "assigned")) {
helpserv_notice(user, HSMSG_REQ_LIST_TOP, "all assigned");
for (req = hs->unhandled, total=dict_size(hs->requests); req; req = req->next_unhandled, total--);
searchtype = 2; /* Assigned */
! } else if (!irccasecmp(argv[1], "me")) {
helpserv_notice(user, HSMSG_REQ_LIST_TOP, "your");
for (total = 0, it = dict_first(hs->requests); it; it = iter_next(it)) {
***************
*** 1326,1330 ****
}
searchtype = 4;
! } else if (!strcasecmp(argv[1], "all")) {
helpserv_notice(user, HSMSG_REQ_LIST_TOP, "all");
total = dict_size(hs->requests);
--- 1326,1330 ----
}
searchtype = 4;
! } else if (!irccasecmp(argv[1], "all")) {
helpserv_notice(user, HSMSG_REQ_LIST_TOP, "all");
total = dict_size(hs->requests);
***************
*** 1717,1721 ****
if (argc > 1) {
! if (!strcasecmp(argv[1], "NOTICE")) {
use_privmsg = 0;
}
--- 1717,1721 ----
if (argc > 1) {
! if (!irccasecmp(argv[1], "NOTICE")) {
use_privmsg = 0;
}
***************
*** 1810,1814 ****
strcpy(oldchan, hs->helpchan->name);
! if (!strcasecmp(oldchan, newchan)) {
helpserv_notice(user, HSMSG_MOVE_SAME_CHANNEL, hs->helpserv->nick);
return 0;
--- 1810,1814 ----
strcpy(oldchan, hs->helpchan->name);
! if (!irccasecmp(oldchan, newchan)) {
helpserv_notice(user, HSMSG_MOVE_SAME_CHANNEL, hs->helpserv->nick);
return 0;
***************
*** 2333,2337 ****
enum page_type type;
for (type=0; type<PAGE_COUNT; type++) {
! if (!strcasecmp(page_type_names[type], name)) return type;
}
return PAGE_COUNT;
--- 2333,2337 ----
enum page_type type;
for (type=0; type<PAGE_COUNT; type++) {
! if (!irccasecmp(page_type_names[type], name)) return type;
}
return PAGE_COUNT;
***************
*** 2464,2468 ****
enum persistence_length pers;
for (pers=0; pers<PERSIST_COUNT; pers++) {
! if (!strcasecmp(name, persistence_length_names[pers])) return pers;
}
return PERSIST_COUNT;
--- 2464,2468 ----
enum persistence_length pers;
for (pers=0; pers<PERSIST_COUNT; pers++) {
! if (!irccasecmp(name, persistence_length_names[pers])) return pers;
}
return PERSIST_COUNT;
***************
*** 2496,2500 ****
enum notification_type notify;
for (notify=0; notify<NOTIFY_COUNT; notify++) {
! if (!strcasecmp(name, notification_type_names[notify])) return notify;
}
return NOTIFY_COUNT;
--- 2496,2500 ----
enum notification_type notify;
for (notify=0; notify<NOTIFY_COUNT; notify++) {
! if (!irccasecmp(name, notification_type_names[notify])) return notify;
}
return NOTIFY_COUNT;
Index: log.c
===================================================================
RCS file: /cvsroot/srvx/services/src/log.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -r1.39 -r1.40
*** log.c 6 May 2002 23:33:12 -0000 1.39
--- log.c 8 Jul 2002 15:45:32 -0000 1.40
***************
*** 162,184 ****
find_log_type(const char *logname)
{
! if (!strcasecmp(logname, "main")) {
! return MAIN_LOG;
! } else if (!strcasecmp(logname, "debug")) {
! return DEBUG_LOG;
! } else if (!strcasecmp(logname, "chanserv")) {
! return CS_LOG;
! } else if (!strcasecmp(logname, "opserv")) {
! return OS_LOG;
! } else if (!strcasecmp(logname, "nickserv")) {
! return NS_LOG;
! } else if (!strcasecmp(logname, "global")) {
! return G_LOG;
! } else if (!strcasecmp(logname, "proxycheck")) {
! return PC_LOG;
! } else if (!strcasecmp(logname, "helpserv")) {
! return HS_LOG;
! } else {
! return NUM_LOGS;
! }
}
--- 162,174 ----
find_log_type(const char *logname)
{
! if (!irccasecmp(logname, "main")) return MAIN_LOG;
! else if (!irccasecmp(logname, "debug")) return DEBUG_LOG;
! else if (!irccasecmp(logname, "chanserv")) return CS_LOG;
! else if (!irccasecmp(logname, "opserv")) return OS_LOG;
! else if (!irccasecmp(logname, "nickserv")) return NS_LOG;
! else if (!irccasecmp(logname, "global")) return G_LOG;
! else if (!irccasecmp(logname, "proxycheck")) return PC_LOG;
! else if (!irccasecmp(logname, "helpserv")) return HS_LOG;
! else return NUM_LOGS;
}
***************
*** 217,221 ****
for (i=1; i<argc-1; i++) {
! if (!strcasecmp(argv[i], "severity")) {
i++;
discrim->severity = find_severity(argv[i], strlen(argv[i]));
--- 207,211 ----
for (i=1; i<argc-1; i++) {
! if (!irccasecmp(argv[i], "severity")) {
i++;
discrim->severity = find_severity(argv[i], strlen(argv[i]));
***************
*** 224,228 ****
goto fail;
}
! } else if (strcasecmp(argv[i], "type") == 0) {
discrim->type = find_log_type(argv[++i]);
if (discrim->type == NUM_LOGS) {
--- 214,218 ----
goto fail;
}
! } else if (irccasecmp(argv[i], "type") == 0) {
discrim->type = find_log_type(argv[++i]);
if (discrim->type == NUM_LOGS) {
***************
*** 230,236 ****
goto fail;
}
! } else if (strcasecmp(argv[i], "text") == 0) {
discrim->glob = argv[++i];
! } else if (strcasecmp(argv[i], "limit") == 0) {
discrim->limit = strtoul(argv[++i], NULL, 10);
} else {
--- 220,226 ----
goto fail;
}
! } else if (irccasecmp(argv[i], "text") == 0) {
discrim->glob = argv[++i];
! } else if (irccasecmp(argv[i], "limit") == 0) {
discrim->limit = strtoul(argv[++i], NULL, 10);
} else {
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.178
retrieving revision 1.179
diff -C2 -r1.178 -r1.179
*** nickserv.c 7 Jul 2002 21:25:40 -0000 1.178
--- nickserv.c 8 Jul 2002 15:45:32 -0000 1.179
***************
*** 664,668 ****
return 0;
}
! if (!strcasecmp(pass, handle)) {
if (user) nickserv_notice(user, NSMSG_PASSWORD_ACCOUNT);
return 0;
--- 664,668 ----
return 0;
}
! if (!irccasecmp(pass, handle)) {
if (user) nickserv_notice(user, NSMSG_PASSWORD_ACCOUNT);
return 0;
***************
*** 1631,1635 ****
char *new_mask = canonicalize_hostmask(strdup(mask));
for (i=0; i<hi->masks->used; i++) {
! if (!strcasecmp(new_mask, hi->masks->list[i])) {
nickserv_notice(user, NSMSG_ADDMASK_ALREADY, new_mask);
free(new_mask);
--- 1631,1635 ----
char *new_mask = canonicalize_hostmask(strdup(mask));
for (i=0; i<hi->masks->used; i++) {
! if (!irccasecmp(new_mask, hi->masks->list[i])) {
nickserv_notice(user, NSMSG_ADDMASK_ALREADY, new_mask);
free(new_mask);
***************
*** 1917,1923 ****
if (argc > 1) {
! if (!strcasecmp(argv[1], "Zoot")) {
hi->userlist_style = HI_STYLE_ZOOT;
! } else if (!strcasecmp(argv[1], "def")) {
hi->userlist_style = HI_STYLE_DEF;
}
--- 1917,1923 ----
if (argc > 1) {
! if (!irccasecmp(argv[1], "Zoot")) {
hi->userlist_style = HI_STYLE_ZOOT;
! } else if (!irccasecmp(argv[1], "def")) {
hi->userlist_style = HI_STYLE_DEF;
}
***************
*** 1947,1951 ****
} else if (disabled_string(argv[1])) {
hi->announcements = 'n';
! } else if (!strcmp(argv[1], "?") || !strcasecmp(argv[1], "default")) {
hi->announcements = '?';
} else {
--- 1947,1951 ----
} else if (disabled_string(argv[1])) {
hi->announcements = 'n';
! } else if (!strcmp(argv[1], "?") || !irccasecmp(argv[1], "default")) {
hi->announcements = '?';
} else {
***************
*** 2021,2025 ****
return 0;
}
! if (!hi->email_addr || strcasecmp(hi->email_addr, argv[1])) {
if (override) {
nickserv_set_email_addr(hi, argv[1]);
--- 2021,2025 ----
return 0;
}
! if (!hi->email_addr || irccasecmp(hi->email_addr, argv[1])) {
if (override) {
nickserv_set_email_addr(hi, argv[1]);
***************
*** 2441,2445 ****
const char *cmdname;
! if (!strcasecmp(variable, "index")) {
exp.type = HF_TABLE;
exp.value.table.length = 1;
--- 2441,2445 ----
const char *cmdname;
! if (!irccasecmp(variable, "index")) {
exp.type = HF_TABLE;
exp.value.table.length = 1;
***************
*** 2654,2660 ****
goto fail;
}
! if (!strcasecmp(argv[i], "limit")) {
discrim->limit = atoi(argv[++i]);
! } else if (!strcasecmp(argv[i], "flags")) {
int is_on = 1, pos;
i++;
--- 2654,2660 ----
goto fail;
}
! if (!irccasecmp(argv[i], "limit")) {
discrim->limit = atoi(argv[++i]);
! } else if (!irccasecmp(argv[i], "flags")) {
int is_on = 1, pos;
i++;
***************
*** 2673,2685 ****
}
}
! } else if (!strcasecmp(argv[i], "registered")) {
discrim->registered = now - ParseInterval(argv[++i]);
! } else if (!strcasecmp(argv[i], "seen")) {
discrim->lastseen = now - ParseInterval(argv[++i]);
! } else if (!nickserv_conf.disable_nicks && !strcasecmp(argv[i], "nickmask")) {
discrim->nickmask = argv[++i];
! } else if (!strcasecmp(argv[i], "hostmask")) {
i++;
! if (!strcasecmp(argv[i], "exact")) {
if (i == argc - 1) {
nickserv_notice(user, MSG_MISSING_PARAMS, argv[i]);
--- 2673,2685 ----
}
}
! } else if (!irccasecmp(argv[i], "registered")) {
discrim->registered = now - ParseInterval(argv[++i]);
! } else if (!irccasecmp(argv[i], "seen")) {
discrim->lastseen = now - ParseInterval(argv[++i]);
! } else if (!nickserv_conf.disable_nicks && !irccasecmp(argv[i], "nickmask")) {
discrim->nickmask = argv[++i];
! } else if (!irccasecmp(argv[i], "hostmask")) {
i++;
! if (!irccasecmp(argv[i], "exact")) {
if (i == argc - 1) {
nickserv_notice(user, MSG_MISSING_PARAMS, argv[i]);
***************
*** 2687,2691 ****
}
discrim->hostmask_type = EXACT;
! } else if (!strcasecmp(argv[i], "subset")) {
if (i == argc - 1) {
nickserv_notice(user, MSG_MISSING_PARAMS, argv[i]);
--- 2687,2691 ----
}
discrim->hostmask_type = EXACT;
! } else if (!irccasecmp(argv[i], "subset")) {
if (i == argc - 1) {
nickserv_notice(user, MSG_MISSING_PARAMS, argv[i]);
***************
*** 2693,2697 ****
}
discrim->hostmask_type = SUBSET;
! } else if (!strcasecmp(argv[i], "superset")) {
if (i == argc - 1) {
nickserv_notice(user, MSG_MISSING_PARAMS, argv[i]);
--- 2693,2697 ----
}
discrim->hostmask_type = SUBSET;
! } else if (!irccasecmp(argv[i], "superset")) {
if (i == argc - 1) {
nickserv_notice(user, MSG_MISSING_PARAMS, argv[i]);
***************
*** 2704,2710 ****
}
discrim->hostmask = argv[++i];
! } else if (!strcasecmp(argv[i], "handlemask") || !strcasecmp(argv[i], "accountmask")) {
discrim->handlemask = argv[++i];
! } else if (!strcasecmp(argv[i], "access")) {
const unsigned char *cmp = argv[++i];
if (cmp[0] == '<') {
--- 2704,2710 ----
}
discrim->hostmask = argv[++i];
! } else if (!irccasecmp(argv[i], "handlemask") || !irccasecmp(argv[i], "accountmask")) {
discrim->handlemask = argv[++i];
! } else if (!irccasecmp(argv[i], "access")) {
const unsigned char *cmp = argv[++i];
if (cmp[0] == '<') {
***************
*** 2756,2760 ****
&& (match_ircglobs(discrim->hostmask, mask))) break;
else if ((discrim->hostmask_type == EXACT)
! && !strcasecmp(discrim->hostmask, mask)) break;
else if ((discrim->hostmask_type == SUPERSET)
&& (match_ircglobs(mask, discrim->hostmask))) break;
--- 2756,2760 ----
&& (match_ircglobs(discrim->hostmask, mask))) break;
else if ((discrim->hostmask_type == EXACT)
! && !irccasecmp(discrim->hostmask, mask)) break;
else if ((discrim->hostmask_type == SUPERSET)
&& (match_ircglobs(mask, discrim->hostmask))) break;
***************
*** 2817,2827 ****
NICKSERV_MIN_PARMS(3);
! if (!strcasecmp(argv[1], "print")) {
action = search_print_func;
subcmd = dict_find(nickserv_func_dict, "search print", NULL);
! } else if (!strcasecmp(argv[1], "count")) {
action = search_count_func;
subcmd = dict_find(nickserv_func_dict, "search count", NULL);
! } else if (!strcasecmp(argv[1], "unregister")) {
action = search_unregister_func;
subcmd = dict_find(nickserv_func_dict, "search unregister", NULL);
--- 2817,2827 ----
NICKSERV_MIN_PARMS(3);
! if (!irccasecmp(argv[1], "print")) {
action = search_print_func;
subcmd = dict_find(nickserv_func_dict, "search print", NULL);
! } else if (!irccasecmp(argv[1], "count")) {
action = search_count_func;
subcmd = dict_find(nickserv_func_dict, "search count", NULL);
! } else if (!irccasecmp(argv[1], "unregister")) {
action = search_unregister_func;
subcmd = dict_find(nickserv_func_dict, "search unregister", NULL);
***************
*** 2941,2948 ****
goto cookie_out;
}
! if (!strcasecmp(type, KEY_ACTIVATION)) cookie->type = ACTIVATION;
! else if (!strcasecmp(type, KEY_PASSWORD_CHANGE)) cookie->type = PASSWORD_CHANGE;
! else if (!strcasecmp(type, KEY_EMAIL_CHANGE)) cookie->type = EMAIL_CHANGE;
! else if (!strcasecmp(type, KEY_ALLOWAUTH)) cookie->type = ALLOWAUTH;
else {
log(NS_LOG, LOG_ERROR, "Invalid cookie type %s for account %s; dropping cookie.\n", type, cookie);
--- 2941,2948 ----
goto cookie_out;
}
! if (!irccasecmp(type, KEY_ACTIVATION)) cookie->type = ACTIVATION;
! else if (!irccasecmp(type, KEY_PASSWORD_CHANGE)) cookie->type = PASSWORD_CHANGE;
! else if (!irccasecmp(type, KEY_EMAIL_CHANGE)) cookie->type = EMAIL_CHANGE;
! else if (!irccasecmp(type, KEY_ALLOWAUTH)) cookie->type = ALLOWAUTH;
else {
log(NS_LOG, LOG_ERROR, "Invalid cookie type %s for account %s; dropping cookie.\n", type, cookie);
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.243
retrieving revision 1.244
diff -C2 -r1.243 -r1.244
*** opserv.c 8 Jul 2002 14:43:59 -0000 1.243
--- opserv.c 8 Jul 2002 15:45:32 -0000 1.244
***************
*** 1946,1966 ****
{
OPSERV_MIN_PARMS(2, false);
! if (!strcasecmp(argv[1], "alerts")) cmd_stats_alerts(user);
! else if (!strcasecmp(argv[1], "aliases")) cmd_stats_aliases(user, (argc > 2) ? argv[2] : NULL);
! else if (!strcasecmp(argv[1], "bad")) cmd_stats_bad(user);
! else if (!strcasecmp(argv[1], "email")) cmd_stats_email(user);
! else if (!strcasecmp(argv[1], "gags")) cmd_stats_gags(user);
! else if (!strcasecmp(argv[1], "glines")) cmd_stats_glines(user);
! else if (!strcasecmp(argv[1], "links")) trace_links(user, self, 1);
! else if (!strcasecmp(argv[1], "max")) cmd_stats_max(user);
! else if (!strcasecmp(argv[1], "network")) cmd_stats_network(user);
! else if (!strcasecmp(argv[1], "network2")) cmd_stats_network_2(user);
! else if (!strcasecmp(argv[1], "opers")) cmd_stats_opers(user);
! else if (!strcasecmp(argv[1], "reserved")) cmd_stats_reserved(user);
! else if (!strcasecmp(argv[1], "timeq")) cmd_stats_timeq(user);
! else if (!strcasecmp(argv[1], "trusted")) cmd_stats_trusted(user);
! else if (!strcasecmp(argv[1], "uptime")) cmd_stats_uptime(user);
! else if (!strcasecmp(argv[1], "warn")) cmd_stats_warn(user);
! else if (!strcasecmp(argv[1], "proxycheck")) cmd_stats_proxycheck(user);
else {
opserv_notice(user, OSMSG_UNKNOWN_STATS, argv[1]);
--- 1946,1966 ----
{
OPSERV_MIN_PARMS(2, false);
! if (!irccasecmp(argv[1], "alerts")) cmd_stats_alerts(user);
! else if (!irccasecmp(argv[1], "aliases")) cmd_stats_aliases(user, (argc > 2) ? argv[2] : NULL);
! else if (!irccasecmp(argv[1], "bad")) cmd_stats_bad(user);
! else if (!irccasecmp(argv[1], "email")) cmd_stats_email(user);
! else if (!irccasecmp(argv[1], "gags")) cmd_stats_gags(user);
! else if (!irccasecmp(argv[1], "glines")) cmd_stats_glines(user);
! else if (!irccasecmp(argv[1], "links")) trace_links(user, self, 1);
! else if (!irccasecmp(argv[1], "max")) cmd_stats_max(user);
! else if (!irccasecmp(argv[1], "network")) cmd_stats_network(user);
! else if (!irccasecmp(argv[1], "network2")) cmd_stats_network_2(user);
! else if (!irccasecmp(argv[1], "opers")) cmd_stats_opers(user);
! else if (!irccasecmp(argv[1], "reserved")) cmd_stats_reserved(user);
! else if (!irccasecmp(argv[1], "timeq")) cmd_stats_timeq(user);
! else if (!irccasecmp(argv[1], "trusted")) cmd_stats_trusted(user);
! else if (!irccasecmp(argv[1], "uptime")) cmd_stats_uptime(user);
! else if (!irccasecmp(argv[1], "warn")) cmd_stats_warn(user);
! else if (!irccasecmp(argv[1], "proxycheck")) cmd_stats_proxycheck(user);
else {
opserv_notice(user, OSMSG_UNKNOWN_STATS, argv[1]);
***************
*** 2387,2391 ****
/* Look for exception modifiers. */
for (arg=2; arg<argc; arg++) {
! if (!strcasecmp(argv[arg], "except")) {
opserv_notice(user, MSG_DEPRECATED_COMMAND, "addbad ... except", "addexempt");
if (++arg > argc) {
--- 2387,2391 ----
/* Look for exception modifiers. */
for (arg=2; arg<argc; arg++) {
! if (!irccasecmp(argv[arg], "except")) {
opserv_notice(user, MSG_DEPRECATED_COMMAND, "addbad ... except", "addexempt");
if (++arg > argc) {
***************
*** 2435,2439 ****
for (nn=0; nn<opserv_bad_words->used; nn++) {
! if (!strcasecmp(opserv_bad_words->list[nn], argv[1])) {
string_list_delete(opserv_bad_words, nn);
opserv_notice(user, OSMSG_REMOVED_BAD, argv[1]);
--- 2435,2439 ----
for (nn=0; nn<opserv_bad_words->used; nn++) {
! if (!irccasecmp(opserv_bad_words->list[nn], argv[1])) {
string_list_delete(opserv_bad_words, nn);
opserv_notice(user, OSMSG_REMOVED_BAD, argv[1]);
***************
*** 2559,2563 ****
clone = GetUserH(argv[2]);
! if (!strcasecmp(argv[1], "ADD")) {
if (argc < 5) {
opserv_notice(user, MSG_MISSING_PARAMS, argv[1]);
--- 2559,2563 ----
clone = GetUserH(argv[2]);
! if (!irccasecmp(argv[1], "ADD")) {
if (argc < 5) {
opserv_notice(user, MSG_MISSING_PARAMS, argv[1]);
***************
*** 2596,2600 ****
return 0;
}
! if (!strcasecmp(argv[1], "REMOVE")) {
const char *reason;
if (argc > 3) {
--- 2596,2600 ----
return 0;
}
! if (!irccasecmp(argv[1], "REMOVE")) {
const char *reason;
if (argc > 3) {
***************
*** 2617,2621 ****
}
channel = GetChannel(argv[3]);
! if (!strcasecmp(argv[1], "JOIN")) {
if (!channel
&& !(channel = AddChannel(argv[3], now, "", "", 0, NULL))) {
--- 2617,2621 ----
}
channel = GetChannel(argv[3]);
! if (!irccasecmp(argv[1], "JOIN")) {
if (!channel
&& !(channel = AddChannel(argv[3], now, "", "", 0, NULL))) {
***************
*** 2627,2631 ****
return 1;
}
! if (!strcasecmp(argv[1], "PART")) {
if (!channel) {
opserv_notice(user, MSG_CHANNEL_UNKNOWN, argv[3]);
--- 2627,2631 ----
return 1;
}
! if (!irccasecmp(argv[1], "PART")) {
if (!channel) {
opserv_notice(user, MSG_CHANNEL_UNKNOWN, argv[3]);
***************
*** 2640,2644 ****
return 1;
}
! if (!strcasecmp(argv[1], "OP")) {
if (!channel) {
opserv_notice(user, MSG_CHANNEL_UNKNOWN, argv[3]);
--- 2640,2644 ----
return 1;
}
! if (!irccasecmp(argv[1], "OP")) {
if (!channel) {
opserv_notice(user, MSG_CHANNEL_UNKNOWN, argv[3]);
***************
*** 2658,2662 ****
return 0;
}
! if (!strcasecmp(argv[1], "SAY")) {
unsplit_string(argv+4, argc-4);
irc_privmsg(clone, argv[3], argv[4]);
--- 2658,2662 ----
return 0;
}
! if (!irccasecmp(argv[1], "SAY")) {
unsplit_string(argv+4, argc-4);
irc_privmsg(clone, argv[3], argv[4]);
***************
*** 2694,2698 ****
int row;
! if (!strcasecmp(variable, "index")) {
exp.type = HF_TABLE;
exp.value.table.length = 1;
--- 2694,2698 ----
int row;
! if (!irccasecmp(variable, "index")) {
exp.type = HF_TABLE;
exp.value.table.length = 1;
***************
*** 3069,3075 ****
discrim = database_get_data(alert_dict, KEY_DISCRIM, RECDB_QSTRING);
react = database_get_data(alert_dict, KEY_REACTION, RECDB_QSTRING);
! if (!react || !strcasecmp(react, "notice")) {
reaction = REACT_NOTICE;
! } else if (!strcasecmp(react, "gline")) {
reaction = REACT_GLINE;
} else {
--- 3069,3075 ----
discrim = database_get_data(alert_dict, KEY_DISCRIM, RECDB_QSTRING);
react = database_get_data(alert_dict, KEY_REACTION, RECDB_QSTRING);
! if (!react || !irccasecmp(react, "notice")) {
reaction = REACT_NOTICE;
! } else if (!irccasecmp(react, "gline")) {
reaction = REACT_GLINE;
} else {
***************
*** 3557,3561 ****
return NULL;
}
! if (!strcasecmp(argv[i], "mask")) {
if (!is_ircmask(argv[++i])) {
opserv_notice(user, OSMSG_INVALID_IRCMASK, argv[i]);
--- 3557,3561 ----
return NULL;
}
! if (!irccasecmp(argv[i], "mask")) {
if (!is_ircmask(argv[++i])) {
opserv_notice(user, OSMSG_INVALID_IRCMASK, argv[i]);
***************
*** 3569,3588 ****
goto fail;
}
! } else if (strcasecmp(argv[i], "nick") == 0) {
discrim->mask_nick = argv[++i];
! } else if (strcasecmp(argv[i], "ident") == 0) {
discrim->mask_ident = argv[++i];
! } else if (strcasecmp(argv[i], "host") == 0) {
discrim->mask_host = argv[++i];
! } else if (strcasecmp(argv[i], "info") == 0) {
discrim->mask_info = argv[++i];
! } else if (strcasecmp(argv[i], "server") == 0) {
discrim->server = argv[++i];
! } else if (strcasecmp(argv[i], "ip") == 0) {
j = parse_ipmask(argv[++i], &discrim->ip_addr, &discrim->ip_mask);
if (!j) discrim->ip_mask_str = argv[i];
! } else if (strcasecmp(argv[i], "duration") == 0) {
discrim->duration = ParseInterval(argv[++i]);
! } else if (strcasecmp(argv[i], "channel") == 0) {
i++;
for (j=0; ; j++) {
--- 3569,3588 ----
goto fail;
}
! } else if (irccasecmp(argv[i], "nick") == 0) {
discrim->mask_nick = argv[++i];
! } else if (irccasecmp(argv[i], "ident") == 0) {
discrim->mask_ident = argv[++i];
! } else if (irccasecmp(argv[i], "host") == 0) {
discrim->mask_host = argv[++i];
! } else if (irccasecmp(argv[i], "info") == 0) {
discrim->mask_info = argv[++i];
! } else if (irccasecmp(argv[i], "server") == 0) {
discrim->server = argv[++i];
! } else if (irccasecmp(argv[i], "ip") == 0) {
j = parse_ipmask(argv[++i], &discrim->ip_addr, &discrim->ip_mask);
if (!j) discrim->ip_mask_str = argv[i];
! } else if (irccasecmp(argv[i], "duration") == 0) {
discrim->duration = ParseInterval(argv[++i]);
! } else if (irccasecmp(argv[i], "channel") == 0) {
i++;
for (j=0; ; j++) {
***************
*** 3611,3623 ****
goto fail;
}
! } else if (strcasecmp(argv[i], "limit") == 0) {
discrim->limit = strtoul(argv[++i], NULL, 10);
! } else if (strcasecmp(argv[i], "reason") == 0) {
unsplit_string(argv+i+1, argc-i-1);
discrim->reason = argv[++i];
i = argc;
! } else if (strcasecmp(argv[i], "last") == 0) {
discrim->min_ts = now - ParseInterval(argv[++i]);
! } else if (strcasecmp(argv[i], "linked") == 0) {
const unsigned char *cmp = argv[++i];
if (cmp[0] == '<') {
--- 3611,3623 ----
goto fail;
}
! } else if (irccasecmp(argv[i], "limit") == 0) {
discrim->limit = strtoul(argv[++i], NULL, 10);
! } else if (irccasecmp(argv[i], "reason") == 0) {
unsplit_string(argv+i+1, argc-i-1);
discrim->reason = argv[++i];
i = argc;
! } else if (irccasecmp(argv[i], "last") == 0) {
discrim->min_ts = now - ParseInterval(argv[++i]);
! } else if (irccasecmp(argv[i], "linked") == 0) {
const unsigned char *cmp = argv[++i];
if (cmp[0] == '<') {
***************
*** 3636,3640 ****
discrim->min_ts = now - ParseInterval(cmp+2);
}
! } else if (strcasecmp(argv[i], "access") == 0) {
const unsigned char *cmp = argv[++i];
if (cmp[0] == '<') {
--- 3636,3640 ----
discrim->min_ts = now - ParseInterval(cmp+2);
}
! } else if (irccasecmp(argv[i], "access") == 0) {
const unsigned char *cmp = argv[++i];
if (cmp[0] == '<') {
***************
*** 3656,3665 ****
discrim->min_level = strtoul(cmp+2, NULL, 0);
}
! } else if ((strcasecmp(argv[i], "abuse") == 0)
! && (strcasecmp(argv[++i], "opers") == 0)) {
discrim->match_opers = 1;
! } else if (strcasecmp(argv[i], "depth") == 0) {
discrim->domain_depth = strtoul(argv[++i], NULL, 0);
! } else if (strcasecmp(argv[i], "clones") == 0) {
discrim->min_clones = strtoul(argv[++i], NULL, 0);
} else {
--- 3656,3665 ----
discrim->min_level = strtoul(cmp+2, NULL, 0);
}
! } else if ((irccasecmp(argv[i], "abuse") == 0)
! && (irccasecmp(argv[++i], "opers") == 0)) {
discrim->match_opers = 1;
! } else if (irccasecmp(argv[i], "depth") == 0) {
discrim->domain_depth = strtoul(argv[++i], NULL, 0);
! } else if (irccasecmp(argv[i], "clones") == 0) {
discrim->min_clones = strtoul(argv[++i], NULL, 0);
} else {
***************
*** 3939,3961 ****
OPSERV_MIN_PARMS(3, false);
! if (!strcasecmp(argv[1], "print")) {
action = trace_print_func;
subcmd = dict_find(opserv_func_dict, "trace print", NULL);
! } else if (!strcasecmp(argv[1], "count")) {
action = trace_count_func;
subcmd = dict_find(opserv_func_dict, "trace count", NULL);
! } else if (!strcasecmp(argv[1], "scan")) {
action = trace_scan_func;
subcmd = dict_find(opserv_func_dict, "trace scan", NULL);
! } else if (!strcasecmp(argv[1], "domains")) {
action = trace_domains_func;
subcmd = dict_find(opserv_func_dict, "trace domains", NULL);
! } else if (!strcasecmp(argv[1], "gline")) {
action = trace_gline_func;
subcmd = dict_find(opserv_func_dict, "trace gline", NULL);
! } else if (!strcasecmp(argv[1], "kill")) {
action = trace_kill_func;
subcmd = dict_find(opserv_func_dict, "trace kill", NULL);
! } else if (!strcasecmp(argv[1], "gag")) {
action = trace_gag_func;
subcmd = dict_find(opserv_func_dict, "trace gag", NULL);
--- 3939,3961 ----
OPSERV_MIN_PARMS(3, false);
! if (!irccasecmp(argv[1], "print")) {
action = trace_print_func;
subcmd = dict_find(opserv_func_dict, "trace print", NULL);
! } else if (!irccasecmp(argv[1], "count")) {
action = trace_count_func;
subcmd = dict_find(opserv_func_dict, "trace count", NULL);
! } else if (!irccasecmp(argv[1], "scan")) {
action = trace_scan_func;
subcmd = dict_find(opserv_func_dict, "trace scan", NULL);
! } else if (!irccasecmp(argv[1], "domains")) {
action = trace_domains_func;
subcmd = dict_find(opserv_func_dict, "trace domains", NULL);
! } else if (!irccasecmp(argv[1], "gline")) {
action = trace_gline_func;
subcmd = dict_find(opserv_func_dict, "trace gline", NULL);
! } else if (!irccasecmp(argv[1], "kill")) {
action = trace_kill_func;
subcmd = dict_find(opserv_func_dict, "trace kill", NULL);
! } else if (!irccasecmp(argv[1], "gag")) {
action = trace_gag_func;
subcmd = dict_find(opserv_func_dict, "trace gag", NULL);
***************
*** 4039,4047 ****
}
! if(!strcasecmp(argv[i], "name")) {
discrim->name = argv[++i];
! } else if(!strcasecmp(argv[i], "topic")) {
discrim->topic = argv[++i];
! } else if(!strcasecmp(argv[i], "users")) {
const char *cmp = argv[++i];
if (cmp[0] == '<') {
--- 4039,4047 ----
}
! if(!irccasecmp(argv[i], "name")) {
discrim->name = argv[++i];
! } else if(!irccasecmp(argv[i], "topic")) {
discrim->topic = argv[++i];
! } else if(!irccasecmp(argv[i], "users")) {
const char *cmp = argv[++i];
if (cmp[0] == '<') {
***************
*** 4062,4066 ****
discrim->min_users = strtoul(cmp+2, NULL, 0);
}
! } else if(!strcasecmp(argv[i], "timestamp")) {
const char *cmp = argv[++i];
if (cmp[0] == '<') {
--- 4062,4066 ----
discrim->min_users = strtoul(cmp+2, NULL, 0);
}
! } else if(!irccasecmp(argv[i], "timestamp")) {
const char *cmp = argv[++i];
if (cmp[0] == '<') {
***************
*** 4081,4085 ****
discrim->min_ts = smart_parse_time(cmp);
}
! } else if(!strcasecmp(argv[i], "limit")) {
discrim->limit = strtoul(argv[++i], NULL, 10);
} else {
--- 4081,4085 ----
discrim->min_ts = smart_parse_time(cmp);
}
! } else if(!irccasecmp(argv[i], "limit")) {
discrim->limit = strtoul(argv[++i], NULL, 10);
} else {
***************
*** 4154,4160 ****
OPSERV_MIN_PARMS(3, false);
! if(!strcasecmp(argv[1], "count")) {
action = channel_count;
! } else if(!strcasecmp(argv[1], "print")) {
action = channel_print;
} else {
--- 4154,4160 ----
OPSERV_MIN_PARMS(3, false);
! if(!irccasecmp(argv[1], "count")) {
action = channel_count;
! } else if(!irccasecmp(argv[1], "print")) {
action = channel_print;
} else {
***************
*** 4241,4249 ****
extra.user = user;
extra.glines = alloc_string_list(4);
! if (!strcasecmp(argv[1], "print")) {
action = gtrace_print_func;
! } else if (!strcasecmp(argv[1], "count")) {
action = gtrace_count_func;
! } else if (!strcasecmp(argv[1], "ungline")) {
action = gtrace_ungline_func;
} else {
--- 4241,4249 ----
extra.user = user;
extra.glines = alloc_string_list(4);
! if (!irccasecmp(argv[1], "print")) {
action = gtrace_print_func;
! } else if (!irccasecmp(argv[1], "count")) {
action = gtrace_count_func;
! } else if (!irccasecmp(argv[1], "ungline")) {
action = gtrace_ungline_func;
} else {
***************
*** 4398,4411 ****
ntype = chanserv_create_note_type(argv[arg]);
}
! if (!strcasecmp(argv[++arg], "privileged")) {
arg++;
ntype->set_access_type = NOTE_SET_PRIVILEGED;
ntype->set_access.min_opserv = strtoul(argv[arg], NULL, 0);
! } else if (!strcasecmp(argv[arg], "channel")) {
enum userLevel ulvl;
arg++;
ntype->set_access_type = NOTE_SET_CHANNEL_ACCESS;
for (ulvl = ulPeon; ulvl < ulHelper; ulvl++) {
! if (!(strcasecmp(argv[arg], accessNames[ulvl]))) break;
}
if (ulvl == ulHelper) {
--- 4398,4411 ----
ntype = chanserv_create_note_type(argv[arg]);
}
! if (!irccasecmp(argv[++arg], "privileged")) {
arg++;
ntype->set_access_type = NOTE_SET_PRIVILEGED;
ntype->set_access.min_opserv = strtoul(argv[arg], NULL, 0);
! } else if (!irccasecmp(argv[arg], "channel")) {
enum userLevel ulvl;
arg++;
ntype->set_access_type = NOTE_SET_CHANNEL_ACCESS;
for (ulvl = ulPeon; ulvl < ulHelper; ulvl++) {
! if (!(irccasecmp(argv[arg], accessNames[ulvl]))) break;
}
if (ulvl == ulHelper) {
**...
[truncated message content] |
|
From: Entrope <en...@us...> - 2002-07-08 15:44:03
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv25350/src
Modified Files:
Makefile.am checkdb.c expnhelp.c main.c
Added Files:
mini-tools.c
Log Message:
hoist tools_init() before ever reading config file
add new mini-tools.c so checkdb, expnhelp can link more easily
start replacing strcase* with irccase*
--- NEW FILE ---
static unsigned char irc_tolower[256];
int
irccasecmp(const unsigned char *stra, const unsigned char *strb) {
while (*stra && (irc_tolower[*stra] == irc_tolower[*strb])) stra++, strb++;
return irc_tolower[*stra] - irc_tolower[*strb];
}
int
ircncasecmp(const unsigned char *stra, const unsigned char *strb, unsigned int len) {
while (*stra && (irc_tolower[*stra] == irc_tolower[*strb]) && len) stra++, strb++, len--;
return irc_tolower[*stra] - irc_tolower[*strb];
}
const unsigned char *
irccasestr(const unsigned char *haystack, const unsigned char *needle) {
unsigned int hay_len = strlen(haystack), needle_len = strlen(needle), pos;
if (hay_len < needle_len) return 0;
for (pos=0; pos<hay_len+1-needle_len; ++pos) {
if ((irc_tolower[haystack[pos]] == irc_tolower[*needle])
&& !ircncasecmp(haystack+pos, needle, needle_len)) return haystack+pos;
}
return 0;
}
void
tools_init(void)
{
unsigned int upr, lwr;
for (lwr=0; lwr<256; ++lwr) irc_tolower[lwr] = lwr;
for (upr='A', lwr='a'; lwr <= 'z'; ++upr, ++lwr) irc_tolower[upr] = lwr;
#ifdef WITH_PROTOCOL_P10
for (upr='[', lwr='{'; lwr <= '~'; ++upr, ++lwr) irc_tolower[upr] = lwr;
for (upr=0xc0, lwr=0xe0; lwr <= 0xf6; ++upr, ++lwr) irc_tolower[upr] = lwr;
for (upr=0xd8, lwr=0xf8; lwr <= 0xfe; ++upr, ++lwr) irc_tolower[upr] = lwr;
#endif
}
Index: Makefile.am
===================================================================
RCS file: /cvsroot/srvx/services/src/Makefile.am,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -r1.49 -r1.50
*** Makefile.am 26 Jun 2002 11:45:28 -0000 1.49
--- Makefile.am 8 Jul 2002 15:43:57 -0000 1.50
***************
*** 40,46 ****
tools.c
! expnhelp_SOURCES = expnhelp.c compat.c compat.h common.h dict-splay.c dict.h recdb.c recdb.h log.c log.h
! checkdb_SOURCES = checkdb.c recdb.c recdb.h dict-splay.c dict.h log.h
! globtest_SOURCES = tools.c globtest.c common.h dict-splay.c
globtest_CFLAGS = -DGLOBTEST
--- 40,46 ----
tools.c
! expnhelp_SOURCES = expnhelp.c compat.c compat.h common.h dict-splay.c dict.h recdb.c recdb.h log.c log.h mini-tools.c
! checkdb_SOURCES = checkdb.c recdb.c recdb.h dict-splay.c dict.h log.h mini-tools.c
! globtest_SOURCES = tools.c globtest.c common.h dict-splay.c mini-tools.c
globtest_CFLAGS = -DGLOBTEST
Index: checkdb.c
===================================================================
RCS file: /cvsroot/srvx/services/src/checkdb.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** checkdb.c 8 Jul 2002 01:36:09 -0000 1.5
--- checkdb.c 8 Jul 2002 15:43:59 -0000 1.6
***************
*** 48,51 ****
--- 48,52 ----
}
+ tools_init();
if (!strcmp(argv[1], "-")) {
infile = "/dev/stdin";
Index: expnhelp.c
===================================================================
RCS file: /cvsroot/srvx/services/src/expnhelp.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** expnhelp.c 6 May 2002 23:33:12 -0000 1.2
--- expnhelp.c 8 Jul 2002 15:43:59 -0000 1.3
***************
*** 46,52 ****
switch (rd->type) {
case RECDB_QSTRING:
! if ((strcasestr(key, "enable")
! || (strcasestr(key, "disable"))
! || (strcasestr(key, "require")))
&& enabled_string(rd->d.qstring)) {
char *new_arg;
--- 46,52 ----
switch (rd->type) {
case RECDB_QSTRING:
! if ((irccasestr(key, "enable")
! || (irccasestr(key, "disable"))
! || (irccasestr(key, "require")))
&& enabled_string(rd->d.qstring)) {
char *new_arg;
***************
*** 74,77 ****
--- 74,78 ----
dict_t cfg_db;
+ tools_init();
init_logs();
time(&now);
Index: main.c
===================================================================
RCS file: /cvsroot/srvx/services/src/main.c,v
retrieving revision 1.127
retrieving revision 1.128
diff -C2 -r1.127 -r1.128
*** main.c 8 Jul 2002 15:21:17 -0000 1.127
--- main.c 8 Jul 2002 15:43:59 -0000 1.128
***************
*** 169,173 ****
XXX: May want to include the bind_address in the equivalence test. */
! if(cManager.uplink && enabled && !strcasecmp(uplink->host, cManager.uplink->host) && uplink->port == cManager.uplink->port)
{
uplink->state = cManager.uplink->state;
--- 169,176 ----
XXX: May want to include the bind_address in the equivalence test. */
! if(cManager.uplink
! && enabled
! && !irccasecmp(uplink->host, cManager.uplink->host)
! && uplink->port == cManager.uplink->port)
{
uplink->state = cManager.uplink->state;
***************
*** 307,311 ****
}
! if(name && strcasecmp(uplink->name, name))
{
/* If we were told to connect to a specific uplink, don't stop
--- 310,314 ----
}
! if(name && irccasecmp(uplink->name, name))
{
/* If we were told to connect to a specific uplink, don't stop
***************
*** 666,669 ****
--- 669,673 ----
daemon = 1;
silent = 1;
+ tools_init();
/* set up some signal handlers */
***************
*** 808,812 ****
tmp = conf_server_ping_timeout();
if (tmp != -1) ping_timeout = tmp;
- tools_init();
timeq_init();
sendmail_init();
--- 812,815 ----
|
|
From: Entrope <en...@us...> - 2002-07-08 15:21:21
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv18580/src
Modified Files:
main.c
Log Message:
whoops, actually call tools_init() to initialize the case conversion table
Index: main.c
===================================================================
RCS file: /cvsroot/srvx/services/src/main.c,v
retrieving revision 1.126
retrieving revision 1.127
diff -C2 -r1.126 -r1.127
*** main.c 6 Jul 2002 05:08:51 -0000 1.126
--- main.c 8 Jul 2002 15:21:17 -0000 1.127
***************
*** 808,811 ****
--- 808,812 ----
tmp = conf_server_ping_timeout();
if (tmp != -1) ping_timeout = tmp;
+ tools_init();
timeq_init();
sendmail_init();
|
|
From: Entrope <en...@us...> - 2002-07-08 15:19:33
|
Update of /cvsroot/srvx/services
In directory usw-pr-cvs1:/tmp/cvs-serv17948
Modified Files:
configure.in
Log Message:
remove checks and compatibility code for strcasecmp, strncasecmp,
stricmp, strcasestr and strstr functions
add declarations for irccasecmp, ircncasecmp, irccasestr functions
correct use of strstr() in parse_foreach() to be strchr() instead
Index: configure.in
===================================================================
RCS file: /cvsroot/srvx/services/configure.in,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -r1.50 -r1.51
*** configure.in 4 Jul 2002 03:46:26 -0000 1.50
--- configure.in 8 Jul 2002 15:19:30 -0000 1.51
***************
*** 42,46 ****
;;
*-linux*)
! dnl -D_GNU_SOURCE needed for strsignal() and strcasecmp()
EXTRA_DEFINE="-D_GNU_SOURCE"
;;
--- 42,46 ----
;;
*-linux*)
! dnl -D_GNU_SOURCE needed for strsignal()
EXTRA_DEFINE="-D_GNU_SOURCE"
;;
***************
*** 89,93 ****
dnl We have fallbacks in case these are missing, so just check for them.
! AC_CHECK_FUNCS(bcopy memcpy memset stricmp strcasestr strcasecmp strncasecmp strdup strerror strstr strsignal localtime_r setrlimit inet_ntoa getopt getopt_long regcomp regexec regfree,,)
dnl Check for absolutely required library functions.
--- 89,93 ----
dnl We have fallbacks in case these are missing, so just check for them.
! AC_CHECK_FUNCS(bcopy memcpy memset strdup strerror strsignal localtime_r setrlimit inet_ntoa getopt getopt_long regcomp regexec regfree,,)
dnl Check for absolutely required library functions.
|
|
From: Entrope <en...@us...> - 2002-07-08 15:19:33
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv17948/src
Modified Files:
common.h compat.c compat.h proto-bahamut.c proto-p10.c tools.c
Log Message:
remove checks and compatibility code for strcasecmp, strncasecmp,
stricmp, strcasestr and strstr functions
add declarations for irccasecmp, ircncasecmp, irccasestr functions
correct use of strstr() in parse_foreach() to be strchr() instead
Index: common.h
===================================================================
RCS file: /cvsroot/srvx/services/src/common.h,v
retrieving revision 1.73
retrieving revision 1.74
diff -C2 -r1.73 -r1.74
*** common.h 7 Jul 2002 03:23:37 -0000 1.73
--- common.h 8 Jul 2002 15:19:30 -0000 1.74
***************
*** 198,202 ****
--- 198,208 ----
const char *preposition(const char *word);
int set_policer_param(const char *param, void *data, void *extra);
+
+ void tools_init(void);
void tools_cleanup(void);
+
+ int irccasecmp(const unsigned char *stra, const unsigned char *strb);
+ int ircncasecmp(const unsigned char *stra, const unsigned char *strb, unsigned int len);
+ const unsigned char *irccasestr(const unsigned char *haystack, const unsigned char *needle);
DECLARE_LIST(string_buffer, char);
Index: compat.c
===================================================================
RCS file: /cvsroot/srvx/services/src/compat.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** compat.c 6 May 2002 23:33:12 -0000 1.9
--- compat.c 8 Jul 2002 15:19:30 -0000 1.10
***************
*** 113,149 ****
#endif
- #if !defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP)
- extern int strcasecmp(char const * str1, char const * str2)
- {
- unsigned int i;
- int a;
- int b;
-
- if (!str1 || !str2)
- return -1;
-
- /* some versions of tolower() break when given already lowercase characters */
- for (i=0; str1[i]!='\0' && str2[i]!='\0'; i++)
- {
- if (isupper((int)str1[i]))
- a = (int)tolower((int)str1[i]);
- else
- a = (int)str1[i];
-
- if (isupper((int)str2[i]))
- b = (int)tolower((int)str2[i]);
- else
- b = (int)str2[i];
-
- if (a<b)
- return -1;
- if (a>b)
- return +1;
- }
-
- return 0;
- }
- #endif
-
#ifndef HAVE_STRDUP
extern char * strdup(char const * str)
--- 113,116 ----
***************
*** 422,491 ****
#endif
return "Unknown error";
- }
- #endif
-
- #ifndef HAVE_STRNCASECMP
- extern int strncasecmp(char const * str1, char const * str2, unsigned int cnt)
- {
- unsigned int i;
- int a;
- int b;
-
- if (!str1 || !str2)
- return -1;
-
- /* some versions of tolower() break when given already lowercase characters */
- for (i=0; i<cnt && str1[i]!='\0' && str2[i]!='\0'; i++)
- {
- if (isupper((int)str1[i]))
- a = (int)tolower((int)str1[i]);
- else
- a = (int)str1[i];
-
- if (isupper((int)str2[i]))
- b = (int)tolower((int)str2[i]);
- else
- b = (int)str2[i];
-
- if (a<b)
- return -1;
- if (a>b)
- return +1;
- }
-
- return 0;
- }
- #endif
-
- #ifndef HAVE_STRSTR
- char *
- strstr(const char *string, const char *pattern)
- {
- char *cp;
- int len;
-
- len = strlen (pattern);
-
- for (cp = string;cp = strchr (cp, *pattern);) {
- if (strncmp (cp, pattern, len) == 0)
- return cp;
-
- cp++;
- }
- return 0;
- }
- #endif
-
- #ifndef HAVE_STRCASESTR
- const unsigned char *
- strcasestr(const unsigned char *haystack, const unsigned char *needle)
- {
- unsigned int hay_len = strlen(haystack), needle_len = strlen(needle), pos;
- if (hay_len < needle_len) return NULL;
- for (pos=0; pos<(hay_len+1-needle_len); pos++) {
- if (tolower(haystack[pos]) != tolower(*needle)) continue;
- if (!strncasecmp(haystack+pos, needle, needle_len)) return haystack+pos;
- }
- return NULL;
}
#endif
--- 389,392 ----
Index: compat.h
===================================================================
RCS file: /cvsroot/srvx/services/src/compat.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** compat.h 6 May 2002 23:33:12 -0000 1.6
--- compat.h 8 Jul 2002 15:19:30 -0000 1.7
***************
*** 29,41 ****
#endif
- #ifndef HAVE_STRCASECMP
- # ifdef HAVE_STRICMP
- # define strcasecmp(s1, s2) stricmp(s1, s2)
- # else
- extern int strcasecmp(char const * str1, char const * str2);
- # define stricmp(s1, s2) strcasecmp(s1, s2)
- # endif
- #endif
-
#ifndef HAVE_STRDUP
extern char * strdup(char const * str);
--- 29,32 ----
***************
*** 44,59 ****
#ifndef HAVE_STRERROR
extern char const * strerror(int errornum);
- #endif
-
- #ifndef HAVE_STRNCASECMP
- extern int strncasecmp(char const * str1, char const * str2, unsigned int cnt);
- #endif
-
- #ifndef HAVE_STRSTR
- extern char *strstr(const char *string, const char *pattern);
- #endif
-
- #ifndef HAVE_STRCASESTR
- extern const unsigned char *strcasestr(const unsigned char *haystack, const unsigned char *needle);
#endif
--- 35,38 ----
Index: proto-bahamut.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-bahamut.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** proto-bahamut.c 8 Jul 2002 14:43:59 -0000 1.5
--- proto-bahamut.c 8 Jul 2002 15:19:30 -0000 1.6
***************
*** 483,487 ****
if (*target_list == '@') {
user = NULL;
! } else if (strstr(target_list, "@")) {
struct server *server;
--- 483,487 ----
if (*target_list == '@') {
user = NULL;
! } else if (strchr(target_list, '@')) {
struct server *server;
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** proto-p10.c 8 Jul 2002 14:43:59 -0000 1.5
--- proto-p10.c 8 Jul 2002 15:19:30 -0000 1.6
***************
*** 1312,1316 ****
if (*target_list == '@') {
user = NULL;
! } else if (strstr(target_list, "@")) {
struct server *server;
--- 1312,1316 ----
if (*target_list == '@') {
user = NULL;
! } else if (strchr(target_list, '@')) {
struct server *server;
Index: tools.c
===================================================================
RCS file: /cvsroot/srvx/services/src/tools.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -C2 -r1.106 -r1.107
*** tools.c 26 Jun 2002 11:45:28 -0000 1.106
--- tools.c 8 Jul 2002 15:19:30 -0000 1.107
***************
*** 41,45 ****
#endif
-
#include "common.h"
#include "hash.h"
--- 41,44 ----
***************
*** 81,86 ****
};
- extern struct policer_params *oper_policer_params, *luser_policer_params;
-
unsigned long int
base64toint(const unsigned char* s, int count)
--- 80,83 ----
***************
*** 104,107 ****
--- 101,129 ----
}
+ static unsigned char irc_tolower[256];
+
+ int
+ irccasecmp(const unsigned char *stra, const unsigned char *strb) {
+ while (*stra && (irc_tolower[*stra] == irc_tolower[*strb])) stra++, strb++;
+ return irc_tolower[*stra] - irc_tolower[*strb];
+ }
+
+ int
+ ircncasecmp(const unsigned char *stra, const unsigned char *strb, unsigned int len) {
+ while (*stra && (irc_tolower[*stra] == irc_tolower[*strb]) && len) stra++, strb++, len--;
+ return irc_tolower[*stra] - irc_tolower[*strb];
+ }
+
+ const unsigned char *
+ irccasestr(const unsigned char *haystack, const unsigned char *needle) {
+ unsigned int hay_len = strlen(haystack), needle_len = strlen(needle), pos;
+ if (hay_len < needle_len) return NULL;
+ for (pos=0; pos<hay_len+1-needle_len; ++pos) {
+ if ((irc_tolower[haystack[pos]] == irc_tolower[*needle])
+ && !ircncasecmp(haystack+pos, needle, needle_len)) return haystack+pos;
+ }
+ return NULL;
+ }
+
static oper_func_t *of_list;
static unsigned int of_size = 0, of_used = 0;
***************
*** 134,138 ****
--- 156,162 ----
void mod_usermode(struct userNode *user, const char *mode_change) {
+ extern struct policer_params *oper_policer_params, *luser_policer_params;
int add = 1;
+
if (!user || !mode_change || !*mode_change) return;
while (1) {
***************
*** 991,994 ****
--- 1015,1031 ----
memmove(buf->list+from+repl_len, buf->list+from+len, strlen(buf->list+from+len));
strcpy(buf->list+from, repl);
+ }
+
+ void
+ tools_init(void)
+ {
+ unsigned int upr, lwr;
+ for (lwr=0; lwr<256; ++lwr) irc_tolower[lwr] = lwr;
+ for (upr='A', lwr='a'; lwr <= 'z'; ++upr, ++lwr) irc_tolower[upr] = lwr;
+ #ifdef WITH_PROTOCOL_P10
+ for (upr='[', lwr='{'; lwr <= '~'; ++upr, ++lwr) irc_tolower[upr] = lwr;
+ for (upr=0xc0, lwr=0xe0; lwr <= 0xf6; ++upr, ++lwr) irc_tolower[upr] = lwr;
+ for (upr=0xd8, lwr=0xf8; lwr <= 0xfe; ++upr, ++lwr) irc_tolower[upr] = lwr;
+ #endif
}
|
|
From: Entrope <en...@us...> - 2002-07-08 14:44:02
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv6894/src
Modified Files:
opserv.c proto-bahamut.c proto-common.c proto-p10.c
Log Message:
do not try to add users with invalid nicks
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.242
retrieving revision 1.243
diff -C2 -r1.242 -r1.243
*** opserv.c 7 Jul 2002 22:47:32 -0000 1.242
--- opserv.c 8 Jul 2002 14:43:59 -0000 1.243
***************
*** 218,221 ****
--- 218,222 ----
#define OSMSG_TOO_MANY_CLONES "Excessive connections from a single host."
#define OSMSG_CLONE_ADDED "Added clone $b%s$b."
+ #define OSMSG_CLONE_FAILED "Unable to add user $b%s$b."
#define OSMSG_NOT_A_CLONE "Har har. $b%s$b isn't a clone."
#define OSMSG_PART_REASON "%s has no reason."
***************
*** 2067,2072 ****
}
}
! resv = AddClone(nick, ident, host, desc);
! dict_insert(opserv_reserved_nick_dict, resv->nick, resv);
return resv;
}
--- 2068,2074 ----
}
}
! if ((resv = AddClone(nick, ident, host, desc))) {
! dict_insert(opserv_reserved_nick_dict, resv->nick, resv);
! }
return resv;
}
***************
*** 2084,2087 ****
--- 2086,2090 ----
return 1;
} else {
+ opserv_notice(user, OSMSG_CLONE_FAILED, argv[1]);
return 0;
}
***************
*** 2101,2104 ****
--- 2104,2108 ----
return 1;
} else {
+ opserv_notice(user, OSMSG_CLONE_FAILED, argv[1]);
return 0;
}
***************
*** 2577,2582 ****
return 0;
}
! clone = AddClone(argv[2], argv[3], argv[3]+i, argv[4]);
! opserv_notice(user, OSMSG_CLONE_ADDED, clone->nick);
return 1;
}
--- 2581,2589 ----
return 0;
}
! if (!(clone = AddClone(argv[2], argv[3], argv[3]+i, argv[4]))) {
! opserv_notice(user, OSMSG_CLONE_FAILED, argv[2]);
! return 0;
! }
! opserv_notice(user, OSMSG_CLONE_ADDED, clone->nick);
return 1;
}
***************
*** 2889,2897 ****
return 0;
}
! reserve = AddClone(key, ident, hostname, desc);
! if (database_get_data(rd->d.object, KEY_PERSISTENT, RECDB_QSTRING)) {
! reserve->modes |= FLAGS_PERSISTENT;
}
- dict_insert(extra, reserve->nick, reserve);
return 0;
}
--- 2896,2905 ----
return 0;
}
! if ((reserve = AddClone(key, ident, hostname, desc))) {
! if (database_get_data(rd->d.object, KEY_PERSISTENT, RECDB_QSTRING)) {
! reserve->modes |= FLAGS_PERSISTENT;
! }
! dict_insert(extra, reserve->nick, reserve);
}
return 0;
}
Index: proto-bahamut.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-bahamut.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** proto-bahamut.c 7 Jul 2002 03:23:37 -0000 1.4
--- proto-bahamut.c 8 Jul 2002 14:43:59 -0000 1.5
***************
*** 94,97 ****
--- 94,112 ----
}
+ static int
+ is_valid_nick(const unsigned char *nick) {
+ /* IRC has some of The Most Fucked-Up ideas about character sets
+ * in the world.. */
+ if ((*nick < 'A') || (*nick >= '~')) return 0;
+ for (++nick; *nick; ++nick) {
+ if (!((*nick >= 'A') && (*nick < '~'))
+ && !isdigit(*nick)
+ && (*nick != '-')) {
+ return 0;
+ }
+ }
+ return 1;
+ }
+
struct userNode *
AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *userinfo, time_t timestamp, unsigned int realip) {
Index: proto-common.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-common.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** proto-common.c 2 Jul 2002 00:25:16 -0000 1.3
--- proto-common.c 8 Jul 2002 14:43:59 -0000 1.4
***************
*** 21,24 ****
--- 21,25 ----
#include "config.h"
+ #include <ctype.h>
#include <errno.h>
#include <stdarg.h>
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** proto-p10.c 4 Jul 2002 02:46:29 -0000 1.4
--- proto-p10.c 8 Jul 2002 14:43:59 -0000 1.5
***************
*** 768,780 ****
if (argv[6][0] == '+') {
if (argc < 10) return 0;
! if (!AddUser(serv, argv[1], argv[4], argv[5], argv[6], argv[8], argv[9], (time_t)atoi(argv[3]), argv[7])) {
! log(DEBUG_LOG, LOG_ERROR, "could not add user: %s\n", argv[1]);
! return 0;
! }
} else {
! if (!AddUser(serv, argv[1], argv[4], argv[5], "+", argv[7], argv[8], (time_t)atoi(argv[3]), argv[6])) {
! log(DEBUG_LOG, LOG_ERROR, "could not add user: %s\n", argv[1]);
! return 0;
! }
}
}
--- 768,774 ----
if (argv[6][0] == '+') {
if (argc < 10) return 0;
! AddUser(serv, argv[1], argv[4], argv[5], argv[6], argv[8], argv[9], (time_t)atoi(argv[3]), argv[7]);
} else {
! AddUser(serv, argv[1], argv[4], argv[5], "+", argv[7], argv[8], (time_t)atoi(argv[3]), argv[6]);
}
}
***************
*** 1493,1496 ****
--- 1487,1501 ----
}
+ static int
+ is_valid_nick(const unsigned char *nick) {
+ /* IRC has some of The Most Fucked-Up ideas about character sets
+ * in the world.. */
+ if (!isalpha(*nick) && !strchr("{|}~[\\]^_`", *nick)) return 0;
+ for (++nick; *nick; ++nick) {
+ if (!isalnum(*nick) && !strchr("{|}~[\\]^-_`", *nick)) return 0;
+ }
+ return 1;
+ }
+
static struct userNode*
AddUser(struct server* uplink, const char *nick, const char *ident, const char *hostname, const char *modes, const char *numeric, const char *userinfo, time_t timestamp, const char *realip)
***************
*** 1512,1515 ****
--- 1517,1525 ----
if (uplink != GetServerN(numeric)) {
log(MAIN_LOG, LOG_WARNING, "AddUser(%p, %s, ...): server for numeric %s differs from nominal uplink %s.\n", uplink, nick, numeric, uplink->name);
+ return NULL;
+ }
+
+ if (!is_valid_nick(nick)) {
+ log(MAIN_LOG, LOG_WARNING, "AddUser(%p, %s, ...): invalid nickname detected.\n", uplink, nick);
return NULL;
}
|
|
From: Entrope <en...@us...> - 2002-07-08 14:42:59
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv6475/src
Modified Files:
chanserv.c
Log Message:
make !move always check the DNR list
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.245
retrieving revision 1.246
diff -C2 -r1.245 -r1.246
*** chanserv.c 7 Jul 2002 23:04:50 -0000 1.245
--- chanserv.c 8 Jul 2002 14:42:55 -0000 1.246
***************
*** 2245,2249 ****
struct modeNode *mn;
struct userData *uData;
! int new_channel = 0;
char reason[MAXLEN];
--- 2245,2249 ----
struct modeNode *mn;
struct userData *uData;
! int new_channel = 0, force = 0;
char reason[MAXLEN];
***************
*** 2256,2260 ****
}
! if(!(target = GetChannel(argv[1])))
{
if(!IsCSChannelName(argv[1]))
--- 2256,2270 ----
}
! force = (argc > 2) && !strcasecmp(argv[2], "force") && IsPrivileged(user);
! if((target = GetChannel(argv[1])))
! {
!
! if(!force && chanserv_is_dnr(target->name, NULL))
! {
! chanserv_notice(user, CSMSG_DNR_CHANNEL_MOVE, argv[1]);
! return 0;
! }
! }
! else
{
if(!IsCSChannelName(argv[1]))
***************
*** 2279,2283 ****
}
! if(chanserv_is_dnr(argv[1], NULL))
{
chanserv_notice(user, CSMSG_DNR_CHANNEL_MOVE, argv[1]);
--- 2289,2293 ----
}
! if(!force && chanserv_is_dnr(argv[1], NULL))
{
chanserv_notice(user, CSMSG_DNR_CHANNEL_MOVE, argv[1]);
|
|
From: Adrian D. <sai...@us...> - 2002-07-08 01:36:42
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv7791
Modified Files:
checkdb.c
Log Message:
Make checkdb able to write out a copy of the db after checking it (good for reformatting old databases, and testing of recdb.c)
Index: checkdb.c
===================================================================
RCS file: /cvsroot/srvx/services/src/checkdb.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** checkdb.c 6 May 2002 23:33:13 -0000 1.4
--- checkdb.c 8 Jul 2002 01:36:09 -0000 1.5
***************
*** 2,5 ****
--- 2,6 ----
#include <stdarg.h>
#include <stdio.h>
+ #include <errno.h>
#include "log.h"
#include "recdb.h"
***************
*** 38,49 ****
{
dict_t db;
! if (argc < 2) {
! fprintf(stderr, "%s usage: %s <dbfile>\n", argv[0], argv[0]);
! return 1;
}
! if (!(db = parse_database(argv[1]))) return 2;
if (dict_foreach(db, check_record, 0)) return 3;
! if (!bad) fprintf(stdout, "Database checked okay.\n");
return 0;
}
--- 39,83 ----
{
dict_t db;
+ char *infile;
! if (argc < 2 || argc > 3) {
! fprintf(stderr, "%s usage: %s <dbfile> [outputfile]\n\n", argv[0], argv[0]);
! fprintf(stderr, "If [outputfile] is specified, dbfile is rewritten into outputfile after being\nparsed.\n\n");
! fprintf(stderr, "<dbfile> and/or [outputfile] may be given as '-' to use stdin and stdout,\nrespectively.\n");
! return 1;
! }
!
! if (!strcmp(argv[1], "-")) {
! infile = "/dev/stdin";
! } else {
! infile = argv[1];
}
! if (!(db = parse_database(infile))) return 2;
! fprintf(stdout, "Database read okay.\n");
! fflush(stdout);
if (dict_foreach(db, check_record, 0)) return 3;
! if (!bad) {
! fprintf(stdout, "Database checked okay.\n");
! fflush(stdout);
! }
!
! if (argc == 3) {
! FILE *f;
!
! if (!strcmp(argv[2], "-")) {
! f = stdout;
! } else {
! if (!(f = fopen(argv[2], "w"))) {
! fprintf(stderr, "fopen: %s\n", strerror(errno));
! return 4;
! }
! }
!
! write_database(f, db);
! fclose(f);
! fprintf(stdout, "Database written okay.\n");
! fflush(stdout);
! }
!
return 0;
}
|
|
From: Adrian D. <sai...@us...> - 2002-07-08 01:35:54
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv7491
Modified Files:
recdb.c
Log Message:
Make db output format more readable (especially with --enable-debug) by tab-indenting it
Escape non-printable characters in \x?? format.
Index: recdb.c
===================================================================
RCS file: /cvsroot/srvx/services/src/recdb.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -r1.37 -r1.38
*** recdb.c 3 Jul 2002 02:57:53 -0000 1.37
--- recdb.c 8 Jul 2002 01:35:20 -0000 1.38
***************
*** 33,51 ****
#include "common.h"
- #if HAVE_GETC_UNLOCKED
- #undef fgetc
- #define fgetc(STR) getc_unlocked(STR)
- #endif
-
- #if HAVE_PUTC_UNLOCKED
- #undef fputc
- #define fputc(CHR,STR) putc_unlocked(CHR,STR)
- #endif
-
- #if HAVE_FEOF_UNLOCKED
- #undef feof
- #define feof(STR) feof_unlocked(STR)
- #endif
-
/* file format (grammar in Backus-Naur Form):
*
--- 33,36 ----
***************
*** 79,82 ****
--- 64,75 ----
} RECDB;
+ typedef struct recdb_outfile {
+ FILE *f;
+ int tablvl;
+ #ifdef NDEBUG
+ int need_tab;
+ #endif
+ } RECDB_OUT;
+
#define EOL '\n'
***************
*** 272,275 ****
--- 265,270 ----
*(--recdb->s.s) = c;
}
+ if (c == EOL) recdb->ctx.line--, recdb->ctx.col=-1;
+ else recdb->ctx.col--;
}
***************
*** 312,315 ****
--- 307,312 ----
int used=0, size=8, c;
struct recdb_context start_ctx;
+ unsigned int i;
+
if ((c = parse_skip_ws(recdb)) == EOF) return NULL;
start_ctx = recdb->ctx;
***************
*** 317,337 ****
buff = malloc(size);
while (!dbeof(recdb) && (c = dbgetc(recdb)) != '"') {
! if (c != '\\') {
! buff[used++] = c;
! } else {
! switch (c = dbgetc(recdb)) {
! case 'n': buff[used++] = EOL; break;
! default: buff[used++] = c; break;
! }
! }
! if (used == size) {
! size <<= 1;
! buff = realloc(buff, size);
! }
}
if (c != '"' && dbeof(recdb)) {
! free(buff);
! recdb->ctx = start_ctx;
! ABORT(recdb, UNTERMINATED_STRING, EOF);
}
buff[used] = 0;
--- 314,394 ----
buff = malloc(size);
while (!dbeof(recdb) && (c = dbgetc(recdb)) != '"') {
! if (c != '\\') {
! /* There should never be a literal newline, as it is saved as a \n */
! if (c == EOL) {
! dbungetc(c, recdb);
! ABORT(recdb, UNTERMINATED_STRING, ' ');
! }
! buff[used++] = c;
! } else {
! switch (c = dbgetc(recdb)) {
! case '0': /* either \0 or \0<octal> */
! {
! char digits[4] = { '\0', '\0', '\0', '\0' };
! for (i=0; i < 3; i++) {
! /* \0177 is the highest possible, so \0200 would be invalid */
! if ((i == 3) && (digits[0] != '1')) {
! break;
! }
! if ((c = dbgetc(recdb)) == EOF) {
! break;
! }
! if ((c < '0') || (c > '7')) {
! dbungetc(c, recdb);
! break;
! }
! digits[i] = (char)c;
! }
! if (i) {
! c = (int)strtol(digits, NULL, 8);
! buff[used++] = c;
! } else {
! buff[used++] = '\0';
! }
! }
! break;
! case 'x': /* Hex */
! {
! char digits[3] = { '\0', '\0', '\0' };
! for (i=0; i < 2; i++) {
! if ((c = dbgetc(recdb)) == EOF) {
! break;
! }
! if (!isxdigit(c)) {
! dbungetc(c, recdb);
! break;
! }
! digits[i] = (char)c;
! }
! if (i) {
! c = (int)strtol(digits, NULL, 16);
! buff[used++] = c;
! } else {
! buff[used++] = '\\';
! buff[used++] = 'x';
! }
! }
! break;
! case 'a': buff[used++] = '\a'; break;
! case 'b': buff[used++] = '\b'; break;
! case 't': buff[used++] = '\t'; break;
! case 'n': buff[used++] = EOL; break;
! case 'v': buff[used++] = '\v'; break;
! case 'f': buff[used++] = '\f'; break;
! case 'r': buff[used++] = '\r'; break;
! case '\\': buff[used++] = '\\'; break;
! case '"': buff[used++] = '"'; break;
! default: buff[used++] = '\\'; buff[used++] = c; break;
! }
! }
! if (used == size) {
! size <<= 1;
! buff = realloc(buff, size);
! }
}
if (c != '"' && dbeof(recdb)) {
! free(buff);
! recdb->ctx = start_ctx;
! ABORT(recdb, UNTERMINATED_STRING, EOF);
}
buff[used] = 0;
***************
*** 496,546 ****
void
! write_qstring(FILE *file, const char *str)
{
! fputc('"', file);
while (*str) {
! switch (*str) {
! case EOL: fputs("\\n", file); break;
! case '\\': fputs("\\\\", file); break;
! case '"': fputs("\\\"", file); break;
! default: fputc(*str, file); break;
! }
! str++;
}
! fputc('"', file);
}
static int
write_object_helper(const char *key, void *data, void *extra)
{
! write_record(extra, key, data);
return 0;
}
void
! write_object(FILE *file, dict_t obj)
{
! fputs("{ ", file);
dict_foreach(obj, write_object_helper, file);
! fputs("}", file);
}
void
! write_string_list(FILE *file, struct string_list *slist)
{
unsigned int i;
! fputc('(', file);
if (slist->used) {
write_qstring(file, slist->list[0]);
for (i=1; i<slist->used; i++) {
! fputs(", ", file);
write_qstring(file, slist->list[i]);
}
}
! fputc(')', file);
}
void
! write_record_data(FILE *file, struct record_data *rd)
{
switch (rd->type) {
--- 553,633 ----
void
! write_qstring(RECDB_OUT *file, const char *str)
{
! fputc('"', file->f);
while (*str) {
! switch (*str) {
! case '\a': fputs("\\a", file->f); break;
! case '\b': fputs("\\b", file->f); break;
! case '\t': fputs("\\t", file->f); break;
! case EOL: fputs("\\n", file->f); break;
! case '\v': fputs("\\v", file->f); break;
! case '\f': fputs("\\f", file->f); break;
! case '\r': fputs("\\r", file->f); break;
! case '\\': fputs("\\\\", file->f); break;
! case '"': fputs("\\\"", file->f); break;
! default:
! if (!isprint(*str)) {
! unsigned int chr = (unsigned char)(*str);
! fprintf(file->f, "\\x%.2x", chr);
! } else {
! fputc(*str, file->f);
! }
! break;
! }
! str++;
}
! fputc('"', file->f);
}
+ void write_record2(RECDB_OUT *file, const char *name, struct record_data *rd);
+
static int
write_object_helper(const char *key, void *data, void *extra)
{
! write_record2(extra, key, data);
return 0;
}
void
! write_object(RECDB_OUT *file, dict_t obj)
{
! int i;
!
! fputs("{\n", file->f);
! #ifdef NDEBUG
! file->need_tab = 1;
! #endif
!
! file->tablvl++;
dict_foreach(obj, write_object_helper, file);
! file->tablvl--;
!
! #ifdef NDEBUG
! fputc('\n', file->f);
! #endif
! for (i=0; i < file->tablvl; i++) {
! fputc('\t', file->f);
! }
! fputc('}', file->f);
}
void
! write_string_list(RECDB_OUT *file, struct string_list *slist)
{
unsigned int i;
! fputc('(', file->f);
if (slist->used) {
write_qstring(file, slist->list[0]);
for (i=1; i<slist->used; i++) {
! fputs(", ", file->f);
write_qstring(file, slist->list[i]);
}
}
! fputc(')', file->f);
}
void
! write_record_data(RECDB_OUT *file, struct record_data *rd)
{
switch (rd->type) {
***************
*** 555,563 ****
write_record(FILE *file, const char *name, struct record_data *rd)
{
write_qstring(file, name);
! fputc(' ', file);
write_record_data(file, rd);
! fputc(';', file);
! fputc((rd->type == RECDB_OBJECT) ? EOL : ' ', file);
}
--- 642,689 ----
write_record(FILE *file, const char *name, struct record_data *rd)
{
+ RECDB_OUT fileinfo;
+
+ fileinfo.f = file;
+ fileinfo.tablvl = 0;
+ #ifdef NDEBUG
+ fileinfo.need_tab = 0;
+ #endif
+
+ write_record2(&fileinfo, name, rd);
+ }
+
+ void
+ write_record2(RECDB_OUT *file, const char *name, struct record_data *rd)
+ {
+ int i;
+ #ifdef NDEBUG
+ if (rd->type == RECDB_OBJECT && !file->need_tab) {
+ fputc('\n', file->f);
+ file->need_tab = 1;
+ }
+
+ if (file->need_tab) {
+ #endif
+ for (i=0; i < file->tablvl; i++) {
+ fputc('\t', file->f);
+ }
+ #ifdef NDEBUG
+ file->need_tab = 0;
+ }
+ #endif
write_qstring(file, name);
! fputc(' ', file->f);
write_record_data(file, rd);
! fputc(';', file->f);
! #ifdef NDEBUG
! if (rd->type == RECDB_OBJECT) {
! fputc('\n', file->f);
! file->need_tab = 1;
! } else {
! fputc(' ', file->f);
! }
! #else
! fputc('\n', file->f);
! #endif
}
***************
*** 565,570 ****
write_database_helper(const char *key, void *data, void *extra)
{
! write_record(extra, key, data);
! fputc(EOL, (FILE*)extra);
return 0;
}
--- 691,697 ----
write_database_helper(const char *key, void *data, void *extra)
{
! RECDB_OUT *file = extra;
! write_record2(file, key, data);
! fputc(EOL, file->f);
return 0;
}
***************
*** 573,576 ****
write_database(FILE *file, dict_t db)
{
! dict_foreach(db, write_database_helper, file);
}
--- 700,709 ----
write_database(FILE *file, dict_t db)
{
! RECDB_OUT fileinfo;
! fileinfo.f = file;
! fileinfo.tablvl = 0;
! #ifdef NDEBUG
! fileinfo.need_tab = 0;
! #endif
! dict_foreach(db, write_database_helper, &fileinfo);
}
|
|
From: Entrope <en...@us...> - 2002-07-07 23:04:53
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv15026/src
Modified Files:
chanserv.c
Log Message:
fix some ?: signedness warnings from gcc-3.1
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.244
retrieving revision 1.245
diff -C2 -r1.244 -r1.245
*** chanserv.c 7 Jul 2002 04:27:44 -0000 1.244
--- chanserv.c 7 Jul 2002 23:04:50 -0000 1.245
***************
*** 7113,7119 ****
if ((cData->suspended = suspended)) suspended->cData = cData;
str = database_get_data(channel, KEY_REGISTERED, RECDB_QSTRING);
! cData->registered = str ? strtoul(str, NULL, 0) : now;
str = database_get_data(channel, KEY_VISITED, RECDB_QSTRING);
! cData->visited = str ? strtoul(str, NULL, 0) : now;
str = database_get_data(channel, KEY_MAX, RECDB_QSTRING);
cData->max = str ? strtoul(str, NULL, 0) : 0;
--- 7113,7119 ----
if ((cData->suspended = suspended)) suspended->cData = cData;
str = database_get_data(channel, KEY_REGISTERED, RECDB_QSTRING);
! cData->registered = str ? (time_t)strtoul(str, NULL, 0) : now;
str = database_get_data(channel, KEY_VISITED, RECDB_QSTRING);
! cData->visited = str ? (time_t)strtoul(str, NULL, 0) : now;
str = database_get_data(channel, KEY_MAX, RECDB_QSTRING);
cData->max = str ? strtoul(str, NULL, 0) : 0;
|
|
From: Entrope <en...@us...> - 2002-07-07 22:47:36
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv11489/src
Modified Files:
opserv.c
Log Message:
pull out "smart" time parsing logic for channel timestamps
don't skip the first two characters of a non-prefixed timestamp (e.g. "timestamp 0")
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.241
retrieving revision 1.242
diff -C2 -r1.241 -r1.242
*** opserv.c 4 Jul 2002 02:45:55 -0000 1.241
--- opserv.c 7 Jul 2002 22:47:32 -0000 1.242
***************
*** 4008,4011 ****
--- 4008,4018 ----
static unsigned int opserv_cdiscrim_search(cdiscrim_t discrim, cdiscrim_search_func dsf, void *data);
+ static time_t
+ smart_parse_time(const unsigned char *str) {
+ /* If an interval-style string is given, treat as time before now.
+ * If it's all digits, treat directly as a Unix timestamp. */
+ return str[strspn(str, "0123456789")] ? (now - ParseInterval(str)) : atoi(str);
+ }
+
static cdiscrim_t
opserv_cdiscrim_create(struct userNode *user, unsigned int argc, unsigned char *argv[])
***************
*** 4051,4068 ****
if (cmp[0] == '<') {
if (cmp[1] == '=') {
! discrim->max_ts = (!cmp[strspn(cmp+2, "0123456789")]) ? atoi(cmp+2) : (now - ParseInterval(cmp+2));
} else {
! discrim->max_ts = ((!cmp[strspn(cmp+1, "0123456789")]) ? atoi(cmp+1) : (now - ParseInterval(cmp+1))) - 1;
}
} else if (cmp[0] == '=') {
! discrim->min_ts = discrim->max_ts = (!cmp[strspn(cmp+1, "0123456789")]) ? atoi(cmp+1) : (now - ParseInterval(cmp+1));
} else if (cmp[0] == '>') {
if (cmp[1] == '=') {
! discrim->min_ts = (!cmp[strspn(cmp+2, "0123456789")]) ? atoi(cmp+2) : (now - ParseInterval(cmp+2));
} else {
! discrim->min_ts = ((!cmp[strspn(cmp+1, "0123456789")]) ? atoi(cmp+1) : (now - ParseInterval(cmp+1))) + 1;
}
} else {
! discrim->min_ts = (!cmp[strspn(cmp+2, "0123456789")]) ? atoi(cmp+2) : (now - ParseInterval(cmp+2));
}
} else if(!strcasecmp(argv[i], "limit")) {
--- 4058,4075 ----
if (cmp[0] == '<') {
if (cmp[1] == '=') {
! discrim->max_ts = smart_parse_time(cmp+2);
} else {
! discrim->max_ts = smart_parse_time(cmp+1)-1;
}
} else if (cmp[0] == '=') {
! discrim->min_ts = discrim->max_ts = smart_parse_time(cmp+1);
} else if (cmp[0] == '>') {
if (cmp[1] == '=') {
! discrim->min_ts = smart_parse_time(cmp+2);
} else {
! discrim->min_ts = smart_parse_time(cmp+1)+1;
}
} else {
! discrim->min_ts = smart_parse_time(cmp);
}
} else if(!strcasecmp(argv[i], "limit")) {
|
|
From: Entrope <en...@us...> - 2002-07-07 21:25:42
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv27807/src
Modified Files:
nickserv.c
Log Message:
use Global to announce account merges
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.177
retrieving revision 1.178
diff -C2 -r1.177 -r1.178
*** nickserv.c 4 Jul 2002 03:46:26 -0000 1.177
--- nickserv.c 7 Jul 2002 21:25:40 -0000 1.178
***************
*** 40,43 ****
--- 40,44 ----
#include "conf.h"
#include "dict.h"
+ #include "global.h"
#include "hash.h"
#include "helpfile.h"
***************
*** 236,239 ****
--- 237,241 ----
#define NSMSG_CANNOT_MERGE_SELF "You cannot merge account $b%s$b with itself."
#define NSMSG_HANDLES_MERGED "Merged account $b%s$b into $b%s$b."
+ #define NSMSG_HANDLES_MERGED_G "%s (%s) merged account %s into %s."
#define NSMSG_NICK_OWNED "%s is a registered nick - you must auth to account %s or change your nick, or the owner may disconnect you."
***************
*** 2511,2514 ****
--- 2513,2517 ----
struct chanList *cList, *cListNext;
unsigned int ii, jj;
+ char buffer[MAXLEN];
NICKSERV_MIN_PARMS(3);
***************
*** 2603,2607 ****
--- 2606,2612 ----
/* Notify of success. */
+ sprintf(buffer, NSMSG_HANDLES_MERGED_G, user->nick, user->handle_info->handle, hi_from->handle, hi_to->handle);
nickserv_notice(user, NSMSG_HANDLES_MERGED, hi_from->handle, hi_to->handle);
+ global_message(MESSAGE_RECIPIENT_STAFF, buffer);
/* Unregister the "from" handle. */
|
|
From: Entrope <en...@us...> - 2002-07-07 21:16:44
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv26039/src
Modified Files:
nickserv.help.m4
Log Message:
replace "handle" with "account"
Index: nickserv.help.m4
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.help.m4,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** nickserv.help.m4 4 Jul 2002 03:33:03 -0000 1.9
--- nickserv.help.m4 7 Jul 2002 21:16:40 -0000 1.10
***************
*** 134,139 ****
" VERSION $b$N$b version information.",
" STATUS $b$N$b status.",
! " SEARCH Search for handles by various criteria.",
! " MERGE Merge one handle into another.",
" MERGEDB Load a database into memory.",
" HELP Get help on $b$N$b.");
--- 134,139 ----
" VERSION $b$N$b version information.",
" STATUS $b$N$b status.",
! " SEARCH Search for accounts by various criteria.",
! " MERGE Merge one account into another.",
" MERGEDB Load a database into memory.",
" HELP Get help on $b$N$b.");
|
|
From: Zoot <zo...@us...> - 2002-07-07 19:32:25
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv32637/src
Modified Files:
chanserv.help
Log Message:
Yet another spelling error fix thanks to Byte.
Index: chanserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.help,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -r1.32 -r1.33
*** chanserv.help 7 Jul 2002 19:31:38 -0000 1.32
--- chanserv.help 7 Jul 2002 19:32:21 -0000 1.33
***************
*** 334,338 ****
"/msg $C INFO <#channel> ",
"${command/INFO/access}",
! "This command responds vith various pieces of information about a channel's users, status, and registration.");
"INVITE" ("$bINVITE$b",
"/msg $C INVITE <#channel> [nick [reason]]",
--- 334,338 ----
"/msg $C INFO <#channel> ",
"${command/INFO/access}",
! "This command responds with various pieces of information about a channel's users, status, and registration.");
"INVITE" ("$bINVITE$b",
"/msg $C INVITE <#channel> [nick [reason]]",
|
|
From: Zoot <zo...@us...> - 2002-07-07 19:31:40
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv32428/src
Modified Files:
chanserv.help
Log Message:
Fix another spelling error (thanks, Byte).
Index: chanserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.help,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -r1.31 -r1.32
*** chanserv.help 7 Jul 2002 19:20:02 -0000 1.31
--- chanserv.help 7 Jul 2002 19:31:38 -0000 1.32
***************
*** 31,35 ****
" OP Give ops to the specified user.",
" DEOP Remove ops from the specified user.",
! " VOICE Give voice to the speicifed user.",
" DEVOICE Remove voice from the specified user.",
" SUSPEND Suspend a user's access to a channel.",
--- 31,35 ----
" OP Give ops to the specified user.",
" DEOP Remove ops from the specified user.",
! " VOICE Give voice to the specified user.",
" DEVOICE Remove voice from the specified user.",
" SUSPEND Suspend a user's access to a channel.",
|
|
From: Zoot <zo...@us...> - 2002-07-07 19:20:07
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv29455/src
Modified Files:
chanserv.help opserv.help
Log Message:
Fix the spelling of "omitted" in the help files.
Index: chanserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.help,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -r1.30 -r1.31
*** chanserv.help 7 Jul 2002 03:22:21 -0000 1.30
--- chanserv.help 7 Jul 2002 19:20:02 -0000 1.31
***************
*** 678,682 ****
"/msg $C UNBANALL <#channel> ",
"${command/UNBANALL/access}",
! "Clears the specified channel's banlist. If the channel is omited, then $bunbanall$b will be done in the channel where the command was given.",
"$bSee Also:$b ban, unban, unbanme");
"UNBANME" ("$bUNBANME$b",
--- 678,682 ----
"/msg $C UNBANALL <#channel> ",
"${command/UNBANALL/access}",
! "Clears the specified channel's banlist. If the channel is omitted, then $bunbanall$b will be done in the channel where the command was given.",
"$bSee Also:$b ban, unban, unbanme");
"UNBANME" ("$bUNBANME$b",
***************
*** 722,726 ****
"/msg $C VOICE <#channel> <nick> [nick]...",
"${command/VOICE/access}",
! "Voices the specified nick in the specified channel. If the channel is omited, then $bvoice$b will be done in the channel where the command was given.",
"$uSee Also:$u devoice");
"WLIST" ("$bWLIST$b",
--- 722,726 ----
"/msg $C VOICE <#channel> <nick> [nick]...",
"${command/VOICE/access}",
! "Voices the specified nick in the specified channel. If the channel is omitted, then $bvoice$b will be done in the channel where the command was given.",
"$uSee Also:$u devoice");
"WLIST" ("$bWLIST$b",
Index: opserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.help,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -r1.42 -r1.43
*** opserv.help 3 Jul 2002 03:01:17 -0000 1.42
--- opserv.help 7 Jul 2002 19:20:02 -0000 1.43
***************
*** 105,109 ****
"CHANINFO" ("$bCHANINFO$b",
"/msg $O CHANINFO <#channel> [users]",
! "Displays very detailed information on the specified channel. If the channel is omited, then $bchaninfo$b will be done on the channel where the command was given. You must give a second parameter ($busers$b) to list users in the channel.",
"$uSee Also:$u whois");
"CSEARCH"("$bCSEARCH$b",
--- 105,109 ----
"CHANINFO" ("$bCHANINFO$b",
"/msg $O CHANINFO <#channel> [users]",
! "Displays very detailed information on the specified channel. If the channel is omitted, then $bchaninfo$b will be done on the channel where the command was given. You must give a second parameter ($busers$b) to list users in the channel.",
"$uSee Also:$u whois");
"CSEARCH"("$bCSEARCH$b",
***************
*** 128,132 ****
"PART" ("$bPART$b",
"/msg $O PART <#channel> ",
! "Makes $b$O$b leave the specified channel. If the channel is omited, then $bpart$b will be done in the channel where the command was given.",
"$uSee Also:$u join");
--- 128,132 ----
"PART" ("$bPART$b",
"/msg $O PART <#channel> ",
! "Makes $b$O$b leave the specified channel. If the channel is omitted, then $bpart$b will be done in the channel where the command was given.",
"$uSee Also:$u join");
***************
*** 187,231 ****
"/msg $O BAN <#channel> <hostmask>",
"Bans the specified hostmask from the specified channel.",
! "If the channel is omited, the $bban$b will be done in the channel where the command was given.",
"$uSee Also:$u kickban, kickbanall, nickban, unban");
"UNBAN" ("$bUNBAN$b",
"/msg $O UNBAN <#channel> <hostmask>",
"Unbans the specified hostmask from the specified channel.",
! "If the channel is omited, the $bunban$b will be done in the channel where the command was given.",
"$uSee Also:$u kickban, kickbanall, nickban, ban");
"CLEARBANS" ("$bCLEARBANS$b",
"/msg $O CLEARBANS <#channel> ",
"Clears all bans in the specified channel.",
! "If the channel is omited, then $bclearbans$b will be done in the channel where the command was given.",
"$uSee Also:$u ban, unban");
"CLEARMODES" ("$bCLEARMODES$b",
"/msg $O CLEARMODES <#channel> ",
"Clears the specified channel of all modes.",
! "If the channel is omited, then $bclearmodes$b will be done in the channel where the command was given.",
"$uSee Also:$u mode");
"DEOP" ("$bDEOP$b",
"/msg $O DEOP <#channel> <nick> [nick]...",
"Deops the specified user from the specified channel.",
! "If the channel is omited, then $bdeop$b will be done in the channel where the command was given.",
"$uSee Also:$u deopall, devoiceall, op, opall");
"DEOPALL" ("$bDEOPALL$b",
"/msg $O DEOPALL <#channel>",
"Deops all members of the specified channel.",
! "If the channel is omited, then $bdeopall$b will be done in the channel where the command was given.",
"$uSee Also:$u deop, devoiceall, op, opall");
"DEVOICEALL" ("$bDEVOICEALL$b",
"/msg $O DEVOICEALL <#channel>",
"Devoice all members of the specified channel who do not have channel ops.",
! "If the channel is omited, then $bdevoiceall$b will be done in the channel where the command was given.",
"$uSee Also:$u deop, deopall, op, opall");
"KICK" ("$bKICK$b",
"/msg $O KICK <#channel> <nick> [reason]",
"Kicks the specified user from the specified channel.",
! "If the channel is omited, then $bkick$b will be done in the channel where the command was given.",
"$uSee Also:$u ban, kickall, kickban, kickbanall");
"KICKALL" ("$bKICKALL$b",
"/msg $O KICKALL <#channel> [reason]",
"Kicks all users in the specified channel except for the user issuing the command.",
! "If the channel is omited, then $bkickall$b will be done in the channel where the command was given.",
"$uSee Also:$u ban, kick, kickbanall");
"KICKBAN" ("$bKICKBAN$b",
--- 187,231 ----
"/msg $O BAN <#channel> <hostmask>",
"Bans the specified hostmask from the specified channel.",
! "If the channel is omitted, the $bban$b will be done in the channel where the command was given.",
"$uSee Also:$u kickban, kickbanall, nickban, unban");
"UNBAN" ("$bUNBAN$b",
"/msg $O UNBAN <#channel> <hostmask>",
"Unbans the specified hostmask from the specified channel.",
! "If the channel is omitted, the $bunban$b will be done in the channel where the command was given.",
"$uSee Also:$u kickban, kickbanall, nickban, ban");
"CLEARBANS" ("$bCLEARBANS$b",
"/msg $O CLEARBANS <#channel> ",
"Clears all bans in the specified channel.",
! "If the channel is omitted, then $bclearbans$b will be done in the channel where the command was given.",
"$uSee Also:$u ban, unban");
"CLEARMODES" ("$bCLEARMODES$b",
"/msg $O CLEARMODES <#channel> ",
"Clears the specified channel of all modes.",
! "If the channel is omitted, then $bclearmodes$b will be done in the channel where the command was given.",
"$uSee Also:$u mode");
"DEOP" ("$bDEOP$b",
"/msg $O DEOP <#channel> <nick> [nick]...",
"Deops the specified user from the specified channel.",
! "If the channel is omitted, then $bdeop$b will be done in the channel where the command was given.",
"$uSee Also:$u deopall, devoiceall, op, opall");
"DEOPALL" ("$bDEOPALL$b",
"/msg $O DEOPALL <#channel>",
"Deops all members of the specified channel.",
! "If the channel is omitted, then $bdeopall$b will be done in the channel where the command was given.",
"$uSee Also:$u deop, devoiceall, op, opall");
"DEVOICEALL" ("$bDEVOICEALL$b",
"/msg $O DEVOICEALL <#channel>",
"Devoice all members of the specified channel who do not have channel ops.",
! "If the channel is omitted, then $bdevoiceall$b will be done in the channel where the command was given.",
"$uSee Also:$u deop, deopall, op, opall");
"KICK" ("$bKICK$b",
"/msg $O KICK <#channel> <nick> [reason]",
"Kicks the specified user from the specified channel.",
! "If the channel is omitted, then $bkick$b will be done in the channel where the command was given.",
"$uSee Also:$u ban, kickall, kickban, kickbanall");
"KICKALL" ("$bKICKALL$b",
"/msg $O KICKALL <#channel> [reason]",
"Kicks all users in the specified channel except for the user issuing the command.",
! "If the channel is omitted, then $bkickall$b will be done in the channel where the command was given.",
"$uSee Also:$u ban, kick, kickbanall");
"KICKBAN" ("$bKICKBAN$b",
***************
*** 237,266 ****
"/msg $O KICKBANALL <#channel> [reason]",
"Kick and bans all members of the specified channel except for the user issuing the command.",
! "If the channel is omited, then $bkickbanall$b will be done in the channel where the command was given.",
"$uSee Also:$u ban, kick, kickban");
"MODE" ("$bMODE$b",
"/msg $O MODE <#channel> <+/- mode>",
"Sets the specified modes (but cannot include voice, ban or op changes) on a channel.",
! "If the channel is omited, then $bmode$b will be done in the channel where the command was given.",
"$uSee Also:$u ban, deop, kickban, nickban, op");
"NICKBAN" ("$bNICKBAN$b",
"/msg $O NICKBAN <#channel> <nick>",
"Bans the specified user. $b$O$b will find the hostmask of the specified nick and ban it in the specified channel.",
! "If the channel is omited, then $bnickban$b will be done in the channel where the command was given.",
"$uSee Also:$u ban, kickban");
"OP" ("$bOP$b",
"/msg $O OP <#channel> <nick> [nick]...",
"Ops specified nicknames the specified channel.",
! "If the channel is omited, then $bop$b will be done in the channel where the command was given.",
"$uSee Also:$u deop, deopall, opall");
"OPALL" ("$bOPALL$b",
"/msg $O OPALL <#channel>",
"Ops all members of the specified channel.",
! "If the channel is omited, then $bopall$b will be done in the channel where the command was given.",
"$uSee Also:$u deopall");
"VOICEALL" ("$bVOICEALL$b",
"/msg $O VOICEALL <#channel>",
"Voices all members of the specified channel who do not have channel ops.",
! "If the channel is omited, then $bvoiceall$b will be done in the channel where the command was given.",
"$uSee Also:$u opall, deopall, devoiceall");
--- 237,266 ----
"/msg $O KICKBANALL <#channel> [reason]",
"Kick and bans all members of the specified channel except for the user issuing the command.",
! "If the channel is omitted, then $bkickbanall$b will be done in the channel where the command was given.",
"$uSee Also:$u ban, kick, kickban");
"MODE" ("$bMODE$b",
"/msg $O MODE <#channel> <+/- mode>",
"Sets the specified modes (but cannot include voice, ban or op changes) on a channel.",
! "If the channel is omitted, then $bmode$b will be done in the channel where the command was given.",
"$uSee Also:$u ban, deop, kickban, nickban, op");
"NICKBAN" ("$bNICKBAN$b",
"/msg $O NICKBAN <#channel> <nick>",
"Bans the specified user. $b$O$b will find the hostmask of the specified nick and ban it in the specified channel.",
! "If the channel is omitted, then $bnickban$b will be done in the channel where the command was given.",
"$uSee Also:$u ban, kickban");
"OP" ("$bOP$b",
"/msg $O OP <#channel> <nick> [nick]...",
"Ops specified nicknames the specified channel.",
! "If the channel is omitted, then $bop$b will be done in the channel where the command was given.",
"$uSee Also:$u deop, deopall, opall");
"OPALL" ("$bOPALL$b",
"/msg $O OPALL <#channel>",
"Ops all members of the specified channel.",
! "If the channel is omitted, then $bopall$b will be done in the channel where the command was given.",
"$uSee Also:$u deopall");
"VOICEALL" ("$bVOICEALL$b",
"/msg $O VOICEALL <#channel>",
"Voices all members of the specified channel who do not have channel ops.",
! "If the channel is omitted, then $bvoiceall$b will be done in the channel where the command was given.",
"$uSee Also:$u opall, deopall, devoiceall");
|
|
From: Zoot <zo...@us...> - 2002-07-07 04:27:47
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv19434/src Modified Files: chanserv.c Log Message: Yet another frivolous commit fixing yet another stupid typo. Index: chanserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/chanserv.c,v retrieving revision 1.243 retrieving revision 1.244 diff -C2 -r1.243 -r1.244 *** chanserv.c 7 Jul 2002 03:21:51 -0000 1.243 --- chanserv.c 7 Jul 2002 04:27:44 -0000 1.244 *************** *** 277,281 **** #define CSMSG_KICK_DONE "Kicked $b%s$b from %s." ! #define CSMSG_NO_BANS "No channel bans found om $b%s$b." #define CSMSG_BANS_REMOVED "Removed all channel bans from $b%s$b." --- 277,281 ---- #define CSMSG_KICK_DONE "Kicked $b%s$b from %s." ! #define CSMSG_NO_BANS "No channel bans found on $b%s$b." #define CSMSG_BANS_REMOVED "Removed all channel bans from $b%s$b." |
|
From: Zoot <zo...@us...> - 2002-07-07 04:20:35
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv17690/src
Modified Files:
md5.c
Log Message:
Frivolous commit (fixing a typo in md5.c) to piss Commander (Hi!) off.
Index: md5.c
===================================================================
RCS file: /cvsroot/srvx/services/src/md5.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** md5.c 6 May 2002 23:33:12 -0000 1.12
--- md5.c 7 Jul 2002 04:20:33 -0000 1.13
***************
*** 371,375 ****
seed = strtoul(hseed, NULL, 16);
} else {
! /* old-stype crypt, use "seed" of 0 */
seed = 0;
}
--- 371,375 ----
seed = strtoul(hseed, NULL, 16);
} else {
! /* old-style crypt, use "seed" of 0 */
seed = 0;
}
|
|
From: Entrope <en...@us...> - 2002-07-07 04:11:08
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv15831/src Modified Files: helpfile.c Log Message: support reverse video with $r Index: helpfile.c =================================================================== RCS file: /cvsroot/srvx/services/src/helpfile.c,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -r1.49 -r1.50 *** helpfile.c 2 Jul 2002 00:25:16 -0000 1.49 --- helpfile.c 7 Jul 2002 04:11:06 -0000 1.50 *************** *** 284,287 **** --- 284,290 ---- value = use_color ? "\017" : ""; break; + case 'r': + value = use_color ? "\026" : ""; + break; case 'u': value = use_color ? "\037" : ""; |
|
From: Entrope <en...@us...> - 2002-07-07 03:23:40
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv4157/src
Modified Files:
common.h hash.h proto-bahamut.c proto.h
Log Message:
move declarations of AddService(), AddClone(), AddServer(),
DelServer(), and DelUser() to proto.h to indicate they must
be defined by the selected proto-*.c file
Index: common.h
===================================================================
RCS file: /cvsroot/srvx/services/src/common.h,v
retrieving revision 1.72
retrieving revision 1.73
diff -C2 -r1.72 -r1.73
*** common.h 11 May 2002 02:52:30 -0000 1.72
--- common.h 7 Jul 2002 03:23:37 -0000 1.73
***************
*** 95,101 ****
extern int quit_services;
- struct userNode *AddService(const char *nick, const char *desc);
- struct userNode *AddClone(const char *nick, const char *ident, const char *hostname, const char *desc);
-
int create_socket_client(struct uplinkNode *target);
void close_socket(void);
--- 95,98 ----
Index: hash.h
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.h,v
retrieving revision 1.82
retrieving revision 1.83
diff -C2 -r1.82 -r1.83
*** hash.h 26 Jun 2002 11:45:28 -0000 1.82
--- hash.h 7 Jul 2002 03:23:37 -0000 1.83
***************
*** 188,194 ****
void reg_server_link_func(server_link_func_t handler);
- struct server* AddServer(struct server* uplink, const char *name, int hops, time_t boot, time_t link, const char *numeric, const char *description);
- void DelServer(struct server* serv, int announce, const char *message);
-
#define IsNickName(x) ( \
(isalpha(*(x)) || \
--- 188,191 ----
***************
*** 201,205 ****
void reg_del_user_func(del_user_func_t handler);
void unreg_del_user_func(del_user_func_t handler);
- void DelUser(struct userNode* user, struct userNode *killer, int announce, const char *why);
void ReintroduceUser(struct userNode* user);
typedef void (*nick_change_func_t)(struct userNode *user, const char *new_nick);
--- 198,201 ----
Index: proto-bahamut.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-bahamut.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** proto-bahamut.c 2 Jul 2002 18:19:41 -0000 1.3
--- proto-bahamut.c 7 Jul 2002 03:23:37 -0000 1.4
***************
*** 21,30 ****
#include "proto-common.c"
- /* Things that MUST be defined in a proto-${dialect}.c file, in
- * addition to the things defined in proto.h:
- * AddServer(), AddService(), AddClone(), DelUser()
- * Most protocols will want an internal AddUser() helper function, too.
- */
-
#define CAPAB_TS3 0x01
#define CAPAB_NOQUIT 0x02
--- 21,24 ----
Index: proto.h
===================================================================
RCS file: /cvsroot/srvx/services/src/proto.h,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -r1.53 -r1.54
*** proto.h 27 Jun 2002 01:28:33 -0000 1.53
--- proto.h 7 Jul 2002 03:23:37 -0000 1.54
***************
*** 160,162 ****
--- 160,170 ----
#define ERR_NOSUCHNICK 401
+ /* stuff originally from other headers that is really protocol-specific */
+ struct userNode *AddService(const char *nick, const char *desc);
+ struct userNode *AddClone(const char *nick, const char *ident, const char *hostname, const char *desc);
+ struct server* AddServer(struct server* uplink, const char *name, int hops, time_t boot, time_t link, const char *numeric, const char *description);
+ void DelServer(struct server* serv, int announce, const char *message);
+ void DelUser(struct userNode* user, struct userNode *killer, int announce, const char *why);
+ /* (most protocols will want to make an AddUser helper function) */
+
#endif /* !defined(PROTO_H) */
|
|
From: Entrope <en...@us...> - 2002-07-07 03:22:23
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv3889/src
Modified Files:
chanserv.help
Log Message:
clarify documentation for greeting and usergreeting settings
Index: chanserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.help,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** chanserv.help 6 Jul 2002 05:09:11 -0000 1.29
--- chanserv.help 7 Jul 2002 03:22:21 -0000 1.30
***************
*** 500,505 ****
"DEFAULTTOPIC: The channel's default topic.",
"TOPICMASK: A pattern that topics must match.",
! "GREETING: A greeting message for the channel's regular users.",
! "USERGREETING: A greeting message for the channel's $b$C$b users.",
"MODES: The channel's default modes.",
"PUBCMD: Restrictions to use commands in public.",
--- 500,505 ----
"DEFAULTTOPIC: The channel's default topic.",
"TOPICMASK: A pattern that topics must match.",
! "GREETING: A greeting message for visitors to the channel.",
! "USERGREETING: A greeting message for users on the channel's userlist.",
"MODES: The channel's default modes.",
"PUBCMD: Restrictions to use commands in public.",
|
|
From: Entrope <en...@us...> - 2002-07-07 03:21:54
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv3740/src
Modified Files:
chanserv.c
Log Message:
fix a bug where "/msg chanserv ping" went to wrong target
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.242
retrieving revision 1.243
diff -C2 -r1.242 -r1.243
*** chanserv.c 6 Jul 2002 05:10:31 -0000 1.242
--- chanserv.c 7 Jul 2002 03:21:51 -0000 1.243
***************
*** 6138,6142 ****
else
{
! irc_privmsg(chanserv, channel->name, CSMSG_PING_RESPONSE);
}
return 1;
--- 6138,6142 ----
else
{
! chanserv_notice(user, CSMSG_PING_RESPONSE);
}
return 1;
***************
*** 6222,6225 ****
--- 6222,6226 ----
else
{
+ /* CTCP must be via PRIVMSG, never notice */
irc_privmsg(chanserv, user->nick, "\001ACTION huggles you\001");
}
|
|
From: Entrope <en...@us...> - 2002-07-06 05:10:35
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv22950/src
Modified Files:
chanserv.h chanserv.c
Log Message:
add history of channel suspensions (kept until the channel is unregged)
Index: chanserv.h
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -r1.40 -r1.41
*** chanserv.h 6 Jul 2002 00:32:09 -0000 1.40
--- chanserv.h 6 Jul 2002 05:10:31 -0000 1.41
***************
*** 122,125 ****
--- 122,128 ----
#define USER_FLAGS_SIZE 7
+ #define IsUserAutoOp(USER) (!((USER)->flags & USER_AUTO_OP))
+ #define IsUserSuspended(USER) ((USER)->flags & USER_SUSPENDED)
+
struct userData
{
***************
*** 164,172 ****
{
struct chanData *cData;
-
char *name;
char *suspender;
char *reason;
! time_t expires;
};
--- 167,175 ----
{
struct chanData *cData;
char *name;
char *suspender;
char *reason;
! time_t issued, expires, revoked;
! struct suspended *previous;
};
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.241
retrieving revision 1.242
diff -C2 -r1.241 -r1.242
*** chanserv.c 6 Jul 2002 00:32:09 -0000 1.241
--- chanserv.c 6 Jul 2002 05:10:31 -0000 1.242
***************
*** 113,117 ****
--- 113,121 ----
#define KEY_REGISTERED "registered"
#define KEY_REGISTRAR "registrar"
+ #define KEY_SUSPENDED "suspended"
+ #define KEY_PREVIOUS "previous"
#define KEY_SUSPENDER "suspender"
+ #define KEY_ISSUED "issued"
+ #define KEY_REVOKED "revoked"
#define KEY_SUSPEND_EXPIRES "suspend_expires"
#define KEY_SUSPEND_REASON "suspend_reason"
***************
*** 338,343 ****
#define CSMSG_CHANNEL_USERS "$b%s Count:%*s$b%i"
#define CSMSG_CHANNEL_REGISTRAR "$bRegistrar: $b%s"
! #define CSMSG_CHANNEL_SUSPENDED "$bSuspended: $bBy %s (%s)"
! #define CSMSG_CHANNEL_SUSPENDED2 "$bSuspended: $bBy %s (%s; %s remaining)"
#define CSMSG_CHANNEL_REGISTERED "$bRegistered: $b%s ago."
#define CSMSG_CHANNEL_VISITED "$bVisited: $b%s ago."
--- 342,355 ----
#define CSMSG_CHANNEL_USERS "$b%s Count:%*s$b%i"
#define CSMSG_CHANNEL_REGISTRAR "$bRegistrar: $b%s"
! #define CSMSG_CHANNEL_SUSPENDED "$b%s$b is suspended:"
! #define CSMSG_CHANNEL_HISTORY "Suspension history for $b%s$b:"
! #define CSMSG_CHANNEL_SUSPENDED_0 " by %s: %s"
! #define CSMSG_CHANNEL_SUSPENDED_1 " by %s; expires in %s: %s"
! #define CSMSG_CHANNEL_SUSPENDED_2 " by %s; expired %s ago: %s"
! #define CSMSG_CHANNEL_SUSPENDED_3 " by %s; revoked %s ago: %s"
! #define CSMSG_CHANNEL_SUSPENDED_4 " %s ago by %s: %s"
! #define CSMSG_CHANNEL_SUSPENDED_5 " %s ago by %s; expires in %s: %s"
! #define CSMSG_CHANNEL_SUSPENDED_6 " %s ago by %s; expired %s ago: %s"
! #define CSMSG_CHANNEL_SUSPENDED_7 " %s ago by %s; revoked %s ago: %s"
#define CSMSG_CHANNEL_REGISTERED "$bRegistered: $b%s ago."
#define CSMSG_CHANNEL_VISITED "$bVisited: $b%s ago."
***************
*** 666,670 ****
for(uData = channel->users; uData; uData = uData->next)
{
! if((uData->handle == handle) && (allow_suspended || !(uData->flags & USER_SUSPENDED))) break;
}
--- 678,682 ----
for(uData = channel->users; uData; uData = uData->next)
{
! if((uData->handle == handle) && (allow_suspended || !IsUserSuspended(uData))) break;
}
***************
*** 1734,1744 ****
{
struct chanNode *cNode = dict_find(channels, channel->suspended->name, NULL);
! struct suspended *suspended = channel->suspended;
! free(suspended->name);
! free(suspended->suspender);
! if(suspended->reason) free(suspended->reason);
! if(suspended->expires) timeq_del(suspended->expires, chanserv_expire_suspension, suspended, 0);
! free(suspended);
if(cNode)
--- 1746,1760 ----
{
struct chanNode *cNode = dict_find(channels, channel->suspended->name, NULL);
! struct suspended *suspended, *next_suspended;
! for(suspended = channel->suspended; suspended; suspended = next_suspended)
! {
! next_suspended = suspended->previous;
! free(suspended->name);
! free(suspended->suspender);
! free(suspended->reason);
! if(suspended->expires) timeq_del(suspended->expires, chanserv_expire_suspension, suspended, 0);
! free(suspended);
! }
if(cNode)
***************
*** 1855,1859 ****
if(!check_user_level(user, channel, channel->channel_info->options[optAutoOp], 0, 0)) return 0;
uData = GetChannelAccess(channel->channel_info, user->handle_info);
! return !uData || !(uData->flags & USER_AUTO_OP);
}
--- 1871,1876 ----
if(!check_user_level(user, channel, channel->channel_info->options[optAutoOp], 0, 0)) return 0;
uData = GetChannelAccess(channel->channel_info, user->handle_info);
! /* uData may be NULL if optAutoOp is "all" */
! return !uData || IsUserAutoOp(uData);
}
***************
*** 2096,2101 ****
if((suspended = dict_find(sChannels, argv[1], NULL)))
{
! char *reason = suspended->reason ? suspended->reason : "no reason";
! chanserv_notice(user, CSMSG_SUSPENDED_REASON, argv[1], reason);
return 0;
}
--- 2113,2117 ----
if((suspended = dict_find(sChannels, argv[1], NULL)))
{
! chanserv_notice(user, CSMSG_SUSPENDED_REASON, argv[1], suspended->reason);
return 0;
}
***************
*** 2144,2148 ****
if(new_channel)
{
! channel = AddChannel(argv[1], now, "", "", 0, NULL);
AddChannelUser(chanserv, channel);
}
--- 2160,2164 ----
if(new_channel)
{
! channel = AddChannel(argv[1], now, NULL, NULL, 0, NULL);
AddChannelUser(chanserv, channel);
}
***************
*** 2269,2273 ****
}
! target = AddChannel(argv[1], now, "", "", 0, NULL);
AddChannelUser(chanserv, target);
new_channel = 1;
--- 2285,2289 ----
}
! target = AddChannel(argv[1], now, NULL, NULL, 0, NULL);
AddChannelUser(chanserv, target);
new_channel = 1;
***************
*** 3074,3078 ****
|| IsSuspended(cList->channel)
|| !GetUserMode(cList->channel->channel, user)
! || (cList->user->flags & USER_SUSPENDED))
{
continue;
--- 3090,3094 ----
|| IsSuspended(cList->channel)
|| !GetUserMode(cList->channel->channel, user)
! || IsUserSuspended(cList->user))
{
continue;
***************
*** 3695,3702 ****
}
! if (uData->flags & USER_AUTO_OP) {
! chanserv_notice(user, ((uData->access > ulPeon) ? CSMSG_AUTOOP_OFF : CSMSG_AUTOVOICE_OFF), channel->name);
! } else {
chanserv_notice(user, ((uData->access > ulPeon) ? CSMSG_AUTOOP_ON : CSMSG_AUTOVOICE_ON), channel->name);
}
return 1;
--- 3711,3718 ----
}
! if (IsUserAutoOp(uData)) {
chanserv_notice(user, ((uData->access > ulPeon) ? CSMSG_AUTOOP_ON : CSMSG_AUTOVOICE_ON), channel->name);
+ } else {
+ chanserv_notice(user, ((uData->access > ulPeon) ? CSMSG_AUTOOP_OFF : CSMSG_AUTOVOICE_OFF), channel->name);
}
return 1;
***************
*** 3833,3837 ****
/* Likewise, only say it's suspended if the user has active
* access in that channel or it's their own entry. */
! if((uData->flags & USER_SUSPENDED)
&& (GetChannelUser(channel->channel_info, user->handle_info)
|| (user->handle_info == uData->handle)))
--- 3849,3853 ----
/* Likewise, only say it's suspended if the user has active
* access in that channel or it's their own entry. */
! if(IsUserSuspended(uData)
&& (GetChannelUser(channel->channel_info, user->handle_info)
|| (user->handle_info == uData->handle)))
***************
*** 4352,4355 ****
--- 4368,4425 ----
}
+ static void
+ show_suspension_info(struct userNode *user, struct suspended *suspended)
+ {
+ unsigned int combo;
+ char buf1[INTERVALLEN], buf2[INTERVALLEN];
+
+ /* We display things based on two dimensions:
+ * - Issue time: present or absent
+ * - Expiration: revoked, expired, expires in future, or indefinite expiration
+ * (in order of precedence, so something both expired and revoked
+ * only counts as revoked)
+ */
+ combo = (suspended->issued ? 4 : 0)
+ + (suspended->revoked ? 3 : suspended->expires ? ((suspended->expires < now) ? 2 : 1) : 0);
+ switch(combo) {
+ case 0: /* no issue time, indefinite expiration */
+ chanserv_notice(user, CSMSG_CHANNEL_SUSPENDED_0, suspended->suspender, suspended->reason);
+ break;
+ case 1: /* no issue time, expires in future */
+ intervalString(buf1, suspended->expires-now);
+ chanserv_notice(user, CSMSG_CHANNEL_SUSPENDED_1, suspended->suspender, buf1, suspended->reason);
+ break;
+ case 2: /* no issue time, expired */
+ intervalString(buf1, now-suspended->expires);
+ chanserv_notice(user, CSMSG_CHANNEL_SUSPENDED_2, suspended->suspender, buf1, suspended->reason);
+ break;
+ case 3: /* no issue time, revoked */
+ intervalString(buf1, now-suspended->revoked);
+ chanserv_notice(user, CSMSG_CHANNEL_SUSPENDED_3, suspended->suspender, buf1, suspended->reason);
+ break;
+ case 4: /* issue time set, indefinite expiration */
+ intervalString(buf1, now-suspended->issued);
+ chanserv_notice(user, CSMSG_CHANNEL_SUSPENDED_4, buf1, suspended->suspender, suspended->reason);
+ break;
+ case 5: /* issue time set, expires in future */
+ intervalString(buf1, now-suspended->issued);
+ intervalString(buf1, suspended->expires-now);
+ chanserv_notice(user, CSMSG_CHANNEL_SUSPENDED_5, buf1, suspended->suspender, buf2, suspended->reason);
+ break;
+ case 6: /* issue time set, expired */
+ intervalString(buf1, now-suspended->issued);
+ intervalString(buf2, now-suspended->expires);
+ chanserv_notice(user, CSMSG_CHANNEL_SUSPENDED_6, buf1, suspended->suspender, buf2, suspended->reason);
+ break;
+ case 7: /* issue time set, revoked */
+ intervalString(buf1, now-suspended->issued);
+ intervalString(buf2, now-suspended->revoked);
+ chanserv_notice(user, CSMSG_CHANNEL_SUSPENDED_7, buf1, suspended->suspender, buf2, suspended->reason);
+ default:
+ log(CS_LOG, LOG_ERROR, "Invalid combo value %d in show_suspension_info()\n", combo);
+ return;
+ }
+ }
+
static CHANSERV_FUNC(cmd_info)
{
***************
*** 4357,4369 ****
struct userData *uData;
struct chanData *cData;
! struct suspended *sChan = NULL;
struct do_not_register *dnr;
enum userLevel access;
- int i;
- (void)argc;(void)argv;
if(channel)
{
cData = channel->channel_info;
}
else if(argc > 1)
--- 4427,4439 ----
struct userData *uData;
struct chanData *cData;
! struct suspended *sChan;
struct do_not_register *dnr;
+ const char *chan_name;
enum userLevel access;
if(channel)
{
cData = channel->channel_info;
+ sChan = NULL;
}
else if(argc > 1)
***************
*** 4389,4393 ****
}
! chanserv_notice(user, CSMSG_CHANNEL_INFO, channel ? channel->name : sChan->name);
uData = GetChannelUser(cData, user->handle_info);
--- 4459,4464 ----
}
! chan_name = channel ? channel->name : sChan->name;
! chanserv_notice(user, CSMSG_CHANNEL_INFO, chan_name);
uData = GetChannelUser(cData, user->handle_info);
***************
*** 4402,4427 ****
for(access = USER_LEVEL_HIGHEST; access >= USER_LEVEL_LOWEST; access--)
{
! i = PADLEN - strlen(accessTitles[access]);
! chanserv_notice(user, CSMSG_CHANNEL_USERS, accessTitles[access], i, "", cData->userCount[access]);
}
chanserv_notice(user, CSMSG_CHANNEL_USERS, "Total User", PADLEN - 10, "", cData->userCount[0]);
chanserv_notice(user, CSMSG_CHANNEL_BANS, cData->banCount);
- if(IsSuspended(cData))
- {
- struct suspended *suspended = cData->suspended;
- char *reason = suspended->reason ? suspended->reason : "No reason";
- if(suspended->expires)
- {
- intervalString(buffer, suspended->expires - now);
- chanserv_notice(user, CSMSG_CHANNEL_SUSPENDED2, cData->suspended->suspender, reason, buffer);
- }
- else
- {
- chanserv_notice(user, CSMSG_CHANNEL_SUSPENDED, cData->suspended->suspender, reason);
- }
- }
-
intervalString(buffer, now - cData->visited);
chanserv_notice(user, CSMSG_CHANNEL_VISITED, buffer);
--- 4473,4483 ----
for(access = USER_LEVEL_HIGHEST; access >= USER_LEVEL_LOWEST; access--)
{
! int ii = PADLEN - strlen(accessTitles[access]);
! chanserv_notice(user, CSMSG_CHANNEL_USERS, accessTitles[access], ii, "", cData->userCount[access]);
}
chanserv_notice(user, CSMSG_CHANNEL_USERS, "Total User", PADLEN - 10, "", cData->userCount[0]);
chanserv_notice(user, CSMSG_CHANNEL_BANS, cData->banCount);
intervalString(buffer, now - cData->visited);
chanserv_notice(user, CSMSG_CHANNEL_VISITED, buffer);
***************
*** 4437,4441 ****
}
! if((dnr = chanserv_is_dnr(channel ? channel->name : sChan->name, NULL)))
{
chanserv_notice(user, CSMSG_DNR_INFO, dnr->chan_name, dnr->setter, dnr->reason);
--- 4493,4497 ----
}
! if((dnr = chanserv_is_dnr(chan_name, NULL)))
{
chanserv_notice(user, CSMSG_DNR_INFO, dnr->chan_name, dnr->setter, dnr->reason);
***************
*** 4443,4446 ****
--- 4499,4516 ----
}
+ if(IsSuspended(cData)) chanserv_notice(user, CSMSG_CHANNEL_SUSPENDED, chan_name);
+ if((cData->suspended) && (uData || IsPrivileged(user)))
+ {
+ struct suspended *suspended;
+ if(!IsSuspended(cData)) chanserv_notice(user, CSMSG_CHANNEL_HISTORY, chan_name);
+ for(suspended = cData->suspended; suspended; suspended = suspended->previous)
+ {
+ show_suspension_info(user, suspended);
+ }
+ }
+ else if(IsSuspended(cData))
+ {
+ show_suspension_info(user, sChan);
+ }
return 1;
}
***************
*** 4980,4983 ****
--- 5050,5054 ----
struct chanNode *channel;
+ if(!suspended->expires || (now < suspended->expires)) suspended->revoked = now;
dict_remove(sChannels, suspended->name);
channel = AddChannel(suspended->name, now, NULL, NULL, 0, NULL);
***************
*** 4987,4995 ****
suspended->cData->channel = channel;
suspended->cData->flags &= ~CHANNEL_SUSPENDED;
- suspended->cData->suspended = NULL;
- free(suspended->name);
- free(suspended->suspender);
- free(suspended->reason);
- free(suspended);
}
--- 5058,5061 ----
***************
*** 5031,5036 ****
unsplit_string(argv + 2, argc - 2);
! suspended = malloc(sizeof(struct suspended));
!
suspended->name = strdup(channel->name);
suspended->suspender = strdup(user->handle_info->handle);
--- 5097,5103 ----
unsplit_string(argv + 2, argc - 2);
! suspended = calloc(1, sizeof(*suspended));
! suspended->revoked = 0;
! suspended->issued = now;
suspended->name = strdup(channel->name);
suspended->suspender = strdup(user->handle_info->handle);
***************
*** 5042,5045 ****
--- 5109,5113 ----
suspended->reason = strdup(argv[2]);
suspended->cData = channel->channel_info;
+ suspended->previous = suspended->cData->suspended;
suspended->cData->suspended = suspended;
suspended->cData->channel = NULL;
***************
*** 5069,5073 ****
if(channel)
{
! if(!channel->channel_info || !IsSuspended(channel->channel_info) || !channel->channel_info->suspended)
{
chanserv_notice(user, CSMSG_NOT_SUSPENDED, channel->name);
--- 5137,5141 ----
if(channel)
{
! if(!channel->channel_info || !IsSuspended(channel->channel_info))
{
chanserv_notice(user, CSMSG_NOT_SUSPENDED, channel->name);
***************
*** 5084,5092 ****
timeq_del(suspended->expires, chanserv_expire_suspension, suspended, 0);
chanserv_expire_suspension(suspended);
! if(!channel)
! {
! channel = GetChannel(argv[1]);
! }
!
chanserv_notice(user, CSMSG_UNSUSPENDED, channel->name);
sprintf(message, "%s unsuspended by %s.", channel->name, user->handle_info->handle);
--- 5152,5156 ----
timeq_del(suspended->expires, chanserv_expire_suspension, suspended, 0);
chanserv_expire_suspension(suspended);
! if(!channel) channel = GetChannel(argv[1]);
chanserv_notice(user, CSMSG_UNSUSPENDED, channel->name);
sprintf(message, "%s unsuspended by %s.", channel->name, user->handle_info->handle);
***************
*** 6172,6179 ****
char change[10];
! if(IsSuspended(cData))
! {
! return;
! }
channel = cData->channel;
--- 6236,6240 ----
char change[10];
! if(IsSuspended(cData)) return;
channel = cData->channel;
***************
*** 6231,6253 ****
unsigned int ii;
! if(!channel->channel_info)
{
! if(channel->members.used < 3)
! {
! struct suspended *suspended = dict_find(sChannels, channel->name, NULL);
!
! if(!suspended)
! {
! return;
! }
!
! channel->channel_info = suspended->cData;
! suspended->cData->channel = channel;
! }
!
! return;
}
! if(IsLocal(user) || IsSuspended(channel->channel_info)) return;
cData = channel->channel_info;
--- 6292,6304 ----
unsigned int ii;
! if(!channel->channel_info && (channel->members.used < 3))
{
! struct suspended *suspended = dict_find(sChannels, channel->name, NULL);
! if(!suspended) return;
! channel->channel_info = suspended->cData;
! suspended->cData->channel = channel;
}
! if(IsLocal(user) || !channel->channel_info || IsSuspended(channel->channel_info)) return;
cData = channel->channel_info;
***************
*** 6352,6384 ****
handle = user->handle_info;
! if(handle && (uData = GetTrueChannelAccess(cData, handle)))
{
! /* Ops and above were handled by the above case. */
! if((uData->access == ulPeon)
! && !(uData->flags & USER_SUSPENDED)
! && !(cData->flags & CHANNEL_VOICE_ALL)
! && !(uData->flags & USER_AUTO_OP))
! {
! AddChannelVoice(1, &user, channel, chanserv, 1);
! }
! if((uData->access >= ulMaster) && !(uData->flags & USER_SUSPENDED))
! {
! cData->visited = now;
! }
! if(uData->info
! && !(uData->flags & USER_SUSPENDED)
&& (cData->flags & CHANNEL_INFO_LINES)
&& ((now - uData->seen) >= chanserv_conf.info_delay)
&& !uData->present)
! {
! char info[MAXLEN];
! sprintf(info, "[%s] %s", user->nick, uData->info);
! irc_privmsg(chanserv, channel->name, info);
! }
!
! uData->seen = now;
! uData->present = 1;
if(cData->user_greeting)
--- 6403,6431 ----
handle = user->handle_info;
! uData = handle ? GetTrueChannelAccess(cData, handle) : NULL;
! if(uData && !IsUserSuspended(uData))
{
! /* Ops and above were handled by the above case. */
! if((uData->access == ulPeon)
! && IsUserAutoOp(uData)
! && !(cData->flags & CHANNEL_VOICE_ALL))
! {
! AddChannelVoice(1, &user, channel, chanserv, 1);
! }
! if(uData->access >= ulMaster)
! {
! cData->visited = now;
! }
! if(uData->info
&& (cData->flags & CHANNEL_INFO_LINES)
&& ((now - uData->seen) >= chanserv_conf.info_delay)
&& !uData->present)
! {
! char info[MAXLEN];
! sprintf(info, "[%s] %s", user->nick, uData->info);
! irc_privmsg(chanserv, channel->name, info);
! }
if(cData->user_greeting)
***************
*** 6387,6393 ****
}
}
! else if(cData->greeting)
{
! chanserv_notice(user, "(%s) %s", channel->name, cData->greeting);
}
}
--- 6434,6449 ----
}
}
! else
! {
! /* Not a user, or a suspended user. */
! if(cData->greeting)
! {
! chanserv_notice(user, "(%s) %s", channel->name, cData->greeting);
! }
! }
! if(uData)
{
! uData->seen = now;
! uData->present = 1;
}
}
***************
*** 6419,6423 ****
}
else if((channel->user->access == ulPeon)
! && !(channel->user->flags & USER_AUTO_OP))
{
AddChannelVoice(1, &user, cn, chanserv, 1);
--- 6475,6479 ----
}
else if((channel->user->access == ulPeon)
! && IsUserAutoOp(channel->user))
{
AddChannelVoice(1, &user, cn, chanserv, 1);
***************
*** 6606,6613 ****
for(cData = channelList; cData; cData = cData->next)
{
! if(!IsSuspended(cData))
! {
! cData->may_opchan = 1;
! }
}
}
--- 6662,6666 ----
for(cData = channelList; cData; cData = cData->next)
{
! if(!IsSuspended(cData)) cData->may_opchan = 1;
}
}
***************
*** 6958,7006 ****
}
static int
chanserv_channel_read(const char *key, struct record_data *hir)
{
! struct chanNode *cNode = NULL;
! struct chanData *cData = NULL;
! dict_t channel, users, bans, notes;
dict_iterator_t it;
! char *flags, *topic, *topic_mask, *modes, *data;
! char *greeting, *user_greeting, *registrar, *suspender;
! char *options;
unsigned long num_flags;
! unsigned int max;
! time_t registered, visited, expires = 0;
! channel = hir->d.object;
! users = database_get_data(channel, KEY_USERS, RECDB_OBJECT);
!
! if(!users)
! {
! log(CS_LOG, LOG_ERROR, "%s has no users.\n", key);
! return 0;
! }
!
! bans = database_get_data(channel, KEY_BANS, RECDB_OBJECT);
! notes = database_get_data(channel, KEY_NOTES, RECDB_OBJECT);
! flags = database_get_data(channel, KEY_FLAGS, RECDB_QSTRING);
! topic = database_get_data(channel, KEY_TOPIC, RECDB_QSTRING);
! topic_mask = database_get_data(channel, KEY_TOPIC_MASK, RECDB_QSTRING);
! registrar = database_get_data(channel, KEY_REGISTRAR, RECDB_QSTRING);
! greeting = database_get_data(channel, KEY_GREETING, RECDB_QSTRING);
! user_greeting = database_get_data(channel, KEY_USER_GREETING, RECDB_QSTRING);
! modes = database_get_data(channel, KEY_MODES, RECDB_QSTRING);
!
! data = database_get_data(channel, KEY_REGISTERED, RECDB_QSTRING);
! registered = data ? (signed)strtoul(data, NULL, 0) : now;
!
! data = database_get_data(channel, KEY_VISITED, RECDB_QSTRING);
! visited = data ? (signed)strtoul(data, NULL, 0) : now;
! data = database_get_data(channel, KEY_MAX, RECDB_QSTRING);
! max = data ? strtoul(data, NULL, 0) : 0;
! if(flags)
{
! num_flags = base64toint(flags, FLAGS_STRING_LENGTH);
! options = flags + FLAGS_STRING_LENGTH;
}
else
--- 7011,7051 ----
}
+ static struct suspended *
+ chanserv_read_suspended(dict_t obj)
+ {
+ struct suspended *suspended = calloc(1, sizeof(*suspended));
+ char *str;
+ dict_t previous;
+
+ str = database_get_data(obj, KEY_EXPIRES, RECDB_QSTRING);
+ suspended->expires = str ? strtoul(str, NULL, 0) : 0;
+ str = database_get_data(obj, KEY_REVOKED, RECDB_QSTRING);
+ suspended->revoked = str ? strtoul(str, NULL, 0) : 0;
+ str = database_get_data(obj, KEY_ISSUED, RECDB_QSTRING);
+ suspended->issued = str ? strtoul(str, NULL, 0) : 0;
+ suspended->suspender = strdup(database_get_data(obj, KEY_SUSPENDER, RECDB_QSTRING));
+ suspended->reason = strdup(database_get_data(obj, KEY_REASON, RECDB_QSTRING));
+ previous = database_get_data(obj, KEY_PREVIOUS, RECDB_OBJECT);
+ suspended->previous = previous ? chanserv_read_suspended(previous) : NULL;
+ return suspended;
+ }
+
static int
chanserv_channel_read(const char *key, struct record_data *hir)
{
! struct chanNode *cNode;
! struct chanData *cData;
! dict_t channel, obj;
dict_iterator_t it;
! char *str, *registrar, *options;
unsigned long num_flags;
! struct suspended *suspended;
! channel = hir->d.object;
! if((str = database_get_data(channel, KEY_FLAGS, RECDB_QSTRING)))
{
! num_flags = base64toint(str, FLAGS_STRING_LENGTH);
! options = str + FLAGS_STRING_LENGTH;
}
else
***************
*** 7009,7028 ****
options = CHANNEL_DEFAULT_OPTIONS;
}
if(num_flags & CHANNEL_SUSPENDED)
{
! char *exp_text;
! exp_text = database_get_data(channel, KEY_SUSPEND_EXPIRES, RECDB_QSTRING);
! if(exp_text)
! {
! expires = strtoul(exp_text, NULL, 0);
! if(expires <= now)
! {
! num_flags &= ~CHANNEL_SUSPENDED;
! }
! }
}
!
! if(!(num_flags & CHANNEL_SUSPENDED))
{
cNode = AddChannel(key, now, NULL, NULL, 0, NULL);
--- 7054,7099 ----
options = CHANNEL_DEFAULT_OPTIONS;
}
+
+ if((obj = database_get_data(hir->d.object, KEY_SUSPENDED, RECDB_OBJECT)))
+ {
+ suspended = chanserv_read_suspended(obj);
+ /* We could use suspended->expires and suspended->revoked to
+ * set the CHANNEL_SUSPENDED flag, but we don't. */
+ }
+ else if(num_flags & CHANNEL_SUSPENDED)
+ {
+ suspended = calloc(1, sizeof(*suspended));
+ suspended->issued = 0;
+ suspended->revoked = 0;
+ str = database_get_data(hir->d.object, KEY_SUSPEND_EXPIRES, RECDB_QSTRING);
+ suspended->expires = str ? strtoul(str, NULL, 0) : 0;
+ suspended->suspender = strdup(database_get_data(hir->d.object, KEY_SUSPENDER, RECDB_QSTRING));
+ str = database_get_data(hir->d.object, KEY_SUSPEND_REASON, RECDB_QSTRING);
+ suspended->reason = strdup(str ? str : "No reason");
+ suspended->previous = NULL;
+ }
+ else
+ {
+ suspended = NULL;
+ }
+
+ if((num_flags & CHANNEL_SUSPENDED)
+ && suspended->expires
+ && (suspended->expires < now))
+ {
+ num_flags &= ~CHANNEL_SUSPENDED;
+ }
if(num_flags & CHANNEL_SUSPENDED)
{
! suspended->name = strdup(key);
! dict_insert(sChannels, suspended->name, suspended);
! if(suspended->expires > now)
! {
! timeq_add(suspended->expires, chanserv_expire_suspension, suspended);
! }
! cNode = NULL;
}
! else
{
cNode = AddChannel(key, now, NULL, NULL, 0, NULL);
***************
*** 7031,7034 ****
--- 7102,7106 ----
}
+ registrar = database_get_data(channel, KEY_REGISTRAR, RECDB_QSTRING);
cData = register_channel(cNode, registrar, options, num_flags);
if(!cData)
***************
*** 7038,7082 ****
}
! if(num_flags & CHANNEL_SUSPENDED)
! {
! struct suspended *suspended;
! char *reason;
! suspended = malloc(sizeof(struct suspended));
! if((suspended->expires = expires))
! {
! timeq_add(suspended->expires, chanserv_expire_suspension, suspended);
! }
! suspended->name = strdup(key);
! suspender = database_get_data(channel, KEY_SUSPENDER, RECDB_QSTRING);
! suspended->suspender = strdup(suspender);
! reason = database_get_data(channel, KEY_SUSPEND_REASON, RECDB_QSTRING);
! suspended->reason = reason ? strdup(reason) : NULL;
!
! suspended->cData = cData;
! cData->suspended = suspended;
!
! dict_insert(sChannels, suspended->name, suspended);
! }
!
! cData->registered = registered;
! cData->visited = visited;
! cData->max = max;
!
! if(greeting) cData->greeting = strdup(greeting);
! if(user_greeting) cData->user_greeting = strdup(user_greeting);
! if(topic_mask) cData->topic_mask = strdup(topic_mask);
! if(topic) safestrncpy(cData->topic, topic, sizeof(cData->topic));
!
! if(modes)
{
unsigned char *split_modes[3];
int count;
! count = split_line(modes, 0, 3, split_modes);
parse_mode_lock(split_modes, count, cData);
}
! for(it = dict_first(users); it; it = iter_next(it))
{
user_read_helper(iter_key(it), iter_data(it), cData);
--- 7110,7140 ----
}
! if ((cData->suspended = suspended)) suspended->cData = cData;
! str = database_get_data(channel, KEY_REGISTERED, RECDB_QSTRING);
! cData->registered = str ? strtoul(str, NULL, 0) : now;
! str = database_get_data(channel, KEY_VISITED, RECDB_QSTRING);
! cData->visited = str ? strtoul(str, NULL, 0) : now;
! str = database_get_data(channel, KEY_MAX, RECDB_QSTRING);
! cData->max = str ? strtoul(str, NULL, 0) : 0;
! str = database_get_data(channel, KEY_GREETING, RECDB_QSTRING);
! cData->greeting = str ? strdup(str) : NULL;
! str = database_get_data(channel, KEY_USER_GREETING, RECDB_QSTRING);
! cData->user_greeting = str ? strdup(str) : NULL;
! str = database_get_data(channel, KEY_TOPIC_MASK, RECDB_QSTRING);
! cData->topic_mask = str ? strdup(str) : NULL;
! str = database_get_data(channel, KEY_TOPIC, RECDB_QSTRING);
! if (str) safestrncpy(cData->topic, str, sizeof(cData->topic));
! if((str = database_get_data(channel, KEY_MODES, RECDB_QSTRING)))
{
unsigned char *split_modes[3];
int count;
! count = split_line(str, 0, ArrayLength(split_modes), split_modes);
parse_mode_lock(split_modes, count, cData);
}
! obj = database_get_data(channel, KEY_USERS, RECDB_OBJECT);
! for(it = dict_first(obj); it; it = iter_next(it))
{
user_read_helper(iter_key(it), iter_data(it), cData);
***************
*** 7094,7103 ****
}
! for(it = dict_first(bans); it; it = iter_next(it))
{
ban_read_helper(iter_key(it), iter_data(it), cData);
}
! for(it = dict_first(notes); it; it = iter_next(it))
{
struct note_type *ntype = dict_find(note_types, iter_key(it), NULL);
--- 7152,7163 ----
}
! obj = database_get_data(channel, KEY_BANS, RECDB_OBJECT);
! for(it = dict_first(obj); it; it = iter_next(it))
{
ban_read_helper(iter_key(it), iter_data(it), cData);
}
! obj = database_get_data(channel, KEY_NOTES, RECDB_OBJECT);
! for(it = dict_first(obj); it; it = iter_next(it))
{
struct note_type *ntype = dict_find(note_types, iter_key(it), NULL);
***************
*** 7291,7294 ****
--- 7351,7384 ----
}
+ static dict_t
+ chanserv_write_suspended(struct suspended *susp)
+ {
+ dict_t obj = alloc_object();
+ char buf[16];
+
+ dict_insert(obj, KEY_SUSPENDER, alloc_record_data_qstring(susp->suspender));
+ dict_insert(obj, KEY_REASON, alloc_record_data_qstring(susp->reason));
+ if(susp->issued)
+ {
+ sprintf(buf, FMT_TIME_T, susp->issued);
+ dict_insert(obj, KEY_ISSUED, alloc_record_data_qstring(buf));
+ }
+ if(susp->expires)
+ {
+ sprintf(buf, FMT_TIME_T, susp->expires);
+ dict_insert(obj, KEY_EXPIRES, alloc_record_data_qstring(buf));
+ }
+ if(susp->revoked)
+ {
+ sprintf(buf, FMT_TIME_T, susp->revoked);
+ dict_insert(obj, KEY_REVOKED, alloc_record_data_qstring(buf));
+ }
+ if (susp->previous)
+ {
+ dict_insert(obj, KEY_PREVIOUS, alloc_record_data_object(chanserv_write_suspended(susp->previous)));
+ }
+ return obj;
+ }
+
static void
chanserv_write_channel(dict_t db, struct chanData *channel)
***************
*** 7331,7346 ****
}
! if(IsSuspended(channel))
{
! dict_insert(obj, KEY_SUSPENDER, alloc_record_data_qstring(channel->suspended->suspender));
! if(channel->suspended->expires)
! {
! snprintf(str, sizeof(str), FMT_TIME_T, channel->suspended->expires);
! dict_insert(obj, KEY_SUSPEND_EXPIRES, alloc_record_data_qstring(str));
! }
! if(channel->suspended->reason)
! {
! dict_insert(obj, KEY_SUSPEND_REASON, alloc_record_data_qstring(channel->suspended->reason));
! }
}
--- 7421,7427 ----
}
! if(channel->suspended)
{
! dict_insert(obj, KEY_SUSPENDED, alloc_record_data_object(chanserv_write_suspended(channel->suspended)));
}
|
|
From: Entrope <en...@us...> - 2002-07-06 05:09:14
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv22751/src
Modified Files:
chanserv.help
Log Message:
fix typos in !*list commands
Index: chanserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.help,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** chanserv.help 6 Jul 2002 00:32:09 -0000 1.28
--- chanserv.help 6 Jul 2002 05:09:11 -0000 1.29
***************
*** 171,175 ****
"/msg $C CLIST <#channel> ",
"${command/CLIST/access}",
! "This command lists all users of level $bCoowner$b in on a channel's userlist.",
"$uSee Also:$u addcoowner, delcoowner, mdelcoowner, users");
"CLVL" ("$bCLVL$b",
--- 171,175 ----
"/msg $C CLIST <#channel> ",
"${command/CLIST/access}",
! "This command lists all users of level $bCoowner$b on a channel's userlist.",
"$uSee Also:$u addcoowner, delcoowner, mdelcoowner, users");
"CLVL" ("$bCLVL$b",
***************
*** 392,396 ****
"/msg $C MLIST <#channel> ",
"${command/MLIST/access}",
! "This command lists all users of level $bMaster$b in on a channel's userlist.",
"$uSee Also:$u addmaster, delmaster, mdelmaster, users");
"MODE" ("$bMODE$b",
--- 392,396 ----
"/msg $C MLIST <#channel> ",
"${command/MLIST/access}",
! "This command lists all users of level $bMaster$b on a channel's userlist.",
"$uSee Also:$u addmaster, delmaster, mdelmaster, users");
"MODE" ("$bMODE$b",
***************
*** 428,432 ****
"/msg $C OLIST <#channel> ",
"${command/OLIST/access}",
! "This command lists all users of level $bOp$b in on a channel's userlist.",
"$uSee Also:$u addop, delop, mdelop, users");
"OP" ("$bOP$b",
--- 428,432 ----
"/msg $C OLIST <#channel> ",
"${command/OLIST/access}",
! "This command lists all users of level $bOp$b on a channel's userlist.",
"$uSee Also:$u addop, delop, mdelop, users");
"OP" ("$bOP$b",
***************
*** 452,456 ****
"/msg $C PLIST <#channel> ",
"${command/PLIST/access}",
! "This command lists all users of level $bPeon$b in on a channel's userlist.",
"$uSee Also:$u addpeon, delpeon, mdelpeon, users");
"READHELP" ("$bREADHELP$b",
--- 452,456 ----
"/msg $C PLIST <#channel> ",
"${command/PLIST/access}",
! "This command lists all users of level $bPeon$b on a channel's userlist.",
"$uSee Also:$u addpeon, delpeon, mdelpeon, users");
"READHELP" ("$bREADHELP$b",
***************
*** 727,731 ****
"/msg $C WLIST <#channel> ",
"${command/WLIST/access}",
! "This command lists all users of level $bOwner$b in on a channel's userlist.",
"$uSee Also:$u addcoowner, delcoowner, mdelcoowner, users");
"WRITE" ("$bWRITE$b",
--- 727,731 ----
"/msg $C WLIST <#channel> ",
"${command/WLIST/access}",
! "This command lists all users of level $bOwner$b on a channel's userlist.",
"$uSee Also:$u addcoowner, delcoowner, mdelcoowner, users");
"WRITE" ("$bWRITE$b",
|