srvx-commits Mailing List for srvx IRC Services (Page 25)
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: Zoot <zo...@us...> - 2002-10-29 21:07:41
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv9397/src
Modified Files:
proto-p10.c
Log Message:
Fix an off-by-one error in the burst output code that truncated modes by 1 character and could cause services to fail to burst into channels properly.
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -r1.41 -r1.42
*** proto-p10.c 29 Oct 2002 01:55:28 -0000 1.41
--- proto-p10.c 29 Oct 2002 21:07:37 -0000 1.42
***************
*** 542,547 ****
self->numeric, chan->name, chan->timestamp);
len = irc_make_chanmode(chan, burst_line+base_len);
! pos = base_len + len - 1;
! burst_line[pos++] = ' ';
/* dump the users */
--- 542,549 ----
self->numeric, chan->name, chan->timestamp);
len = irc_make_chanmode(chan, burst_line+base_len);
! pos = base_len + len;
! if(len) {
! burst_line[pos++] = ' ';
! }
/* dump the users */
|
|
From: Zoot <zo...@us...> - 2002-10-29 20:52:22
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv3613/src
Modified Files:
Tag: rel-1_1-branch
hash.c
Log Message:
Backport a crash bug fix from the 1.2.x branch.
Index: hash.c
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.c,v
retrieving revision 1.159.2.2
retrieving revision 1.159.2.3
diff -C2 -r1.159.2.2 -r1.159.2.3
*** hash.c 23 Oct 2002 16:22:48 -0000 1.159.2.2
--- hash.c 29 Oct 2002 20:52:16 -0000 1.159.2.3
***************
*** 738,741 ****
--- 738,743 ----
for (user = members, sep = *members, mode = 0; sep; user = end) {
+ struct modeNode *mn;
+
for (end = user + 3; (*end != ':') && (*end != ',') && *end; end++) ;
sep = *end++; end[-1] = 0;
***************
*** 749,753 ****
}
if (!(un = GetUserN(user))) continue;
! AddChannelUser(un, cNode)->modes = mode;
}
}
--- 751,757 ----
}
if (!(un = GetUserN(user))) continue;
! if((mn = AddChannelUser(un, cNode))) {
! mn->modes = mode;
! }
}
}
|
|
From: Zoot <zo...@us...> - 2002-10-29 07:51:44
|
Update of /cvsroot/srvx/services In directory usw-pr-cvs1:/tmp/cvs-serv27288 Modified Files: README srvx.conf.example Log Message: Make a small documentation update and remember to add the new join_flood_moderate_threshold setting to srvx.conf.example. Index: README =================================================================== RCS file: /cvsroot/srvx/services/README,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** README 21 Oct 2002 02:26:07 -0000 1.8 --- README 29 Oct 2002 07:51:41 -0000 1.9 *************** *** 28,39 **** - Use under Windows. srvx can work to some extent under the Cygwin ! (http://www.cygwin.com/) environment, but Windows as a whole departs significantly from standard APIs and is difficult to support. - Alteration of credits. If you change the credits in your version of ! the code so as to obscure the original authorship of the program, we ! will not support you. If you want to use our code -- especially if ! you want us to answer your questions about it -- do the decent thing ! and preserve the credits that are in the code we distribute. Contacts: --- 28,45 ---- - Use under Windows. srvx can work to some extent under the Cygwin ! (http://www.cygwin.com/) environment, but Windows as a whole departs significantly from standard APIs and is difficult to support. - Alteration of credits. If you change the credits in your version of ! the code so as to obscure the original authorship of the program, we ! will not support you. If you want to use our code -- especially if ! you want us to answer your questions about it -- do the decent thing ! and preserve the credits that are in the code we distribute. ! ! In addition, please read the documentation included in the srvx ! distribution before you ask us for support. The answers to many common ! questions related to installation are in the INSTALL file, for ! example. It saves both our time and your time, so please read the ! documentation. Contacts: Index: srvx.conf.example =================================================================== RCS file: /cvsroot/srvx/services/srvx.conf.example,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** srvx.conf.example 24 Sep 2002 02:17:33 -0000 1.30 --- srvx.conf.example 29 Oct 2002 07:51:41 -0000 1.31 *************** *** 135,138 **** --- 135,142 ---- // automatically moderate join flooded channels? "join_flood_moderate" "1"; + // Don't moderate and warn channels unless there are more than + // join_flood_moderate_threshold users in the channel. the + // value 0 will disable the threshold. + "join_flood_moderate_threshold" "50"; // new user flood policer params "new_user_policer" { |
|
From: Entrope <en...@us...> - 2002-10-29 04:31:32
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv6215/src
Modified Files:
modcmd.c modcmd.h modcmd.help
Log Message:
fix the tendency to use the wrong helpfile for non-command help requests
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -r1.35 -r1.36
*** modcmd.c 29 Oct 2002 01:57:10 -0000 1.35
--- modcmd.c 29 Oct 2002 04:31:29 -0000 1.36
***************
*** 59,62 ****
--- 59,63 ----
#define MCMSG_UNBIND_PROHIBITED "It wouldn't be very much fun to unbind the last %s command, now would it?"
#define MCMSG_COMMAND_UNBOUND "Unbound command %s from %s."
+ #define MCMSG_HELPFILE_UNBOUND "Since that was the last command from module %s on the service, the helpfile for %s was removed."
#define MCMSG_NO_HELPFILE "Module %s does not have a help file."
#define MCMSG_HELPFILE_ERROR "Syntax error reading %s; help contents not changed."
***************
*** 86,89 ****
--- 87,92 ----
#define MCMSG_RESOLVE_LOOP "Invalid template loop detected: %s"
#define MCMSG_RESOLVE_TOO_DEEP "Takes more than %d steps to resolve command templates; giving up."
+ #define MCMSG_HELPFILE_SEQUENCE "Help priority %d: %s"
+ #define MCMSG_HELPFILE_SEQUENCE_SET "Set helpfile priority sequence for %s."
struct pending_template {
***************
*** 145,148 ****
--- 148,152 ----
DEFINE_LIST(svccmd_list, struct svccmd*);
+ DEFINE_LIST(module_list, struct module*);
static void
***************
*** 164,168 ****
struct service *service = data;
dict_delete(service->commands);
! dict_delete(service->modules);
free(service);
}
--- 168,172 ----
struct service *service = data;
dict_delete(service->commands);
! module_list_clean(&service->modules);
free(service);
}
***************
*** 703,711 ****
return svccmd_send_help(user, service->bot, cmd);
} else {
! dict_iterator_t it;
struct module *module;
if (!topic) topic = "<index>";
! for (it = dict_first(service->modules); it; it = iter_next(it)) {
! module = iter_data(it);
if (!module->helpfile) continue;
if (dict_find(module->helpfile->db, topic, NULL)) {
--- 707,715 ----
return svccmd_send_help(user, service->bot, cmd);
} else {
! unsigned int ii;
struct module *module;
if (!topic) topic = "<index>";
! for (ii = 0; ii < service->modules.used; ++ii) {
! module = service->modules.list[ii];
if (!module->helpfile) continue;
if (dict_find(module->helpfile->db, topic, NULL)) {
***************
*** 765,769 ****
service_register(struct userNode *bot, unsigned char trigger) {
struct service *service = calloc(1, sizeof(*service));
! service->modules = dict_new();
service->commands = dict_new();
service->bot = bot;
--- 769,773 ----
service_register(struct userNode *bot, unsigned char trigger) {
struct service *service = calloc(1, sizeof(*service));
! module_list_init(&service->modules);
service->commands = dict_new();
service->bot = bot;
***************
*** 783,786 ****
--- 787,791 ----
static struct svccmd *
svccmd_insert(struct service *service, char *name, struct svccmd *svccmd, struct modcmd *modcmd) {
+ unsigned int ii;
svccmd->parent = service;
svccmd->name = name;
***************
*** 788,792 ****
svccmd->command->bind_count++;
dict_insert(service->commands, svccmd->name, svccmd);
! dict_insert(service->modules, svccmd->command->parent->name, svccmd->command->parent);
return svccmd;
}
--- 793,802 ----
svccmd->command->bind_count++;
dict_insert(service->commands, svccmd->name, svccmd);
! for (ii=0; ii<service->modules.used; ++ii) {
! if (service->modules.list[ii] == svccmd->command->parent) break;
! }
! if (ii == service->modules.used) {
! module_list_append(&service->modules, svccmd->command->parent);
! }
return svccmd;
}
***************
*** 966,980 ****
}
! static void
! service_rebuild_modules(struct service *service) {
dict_iterator_t it;
struct svccmd *cmd;
- dict_delete(service->modules);
- service->modules = dict_new();
for (it = dict_first(service->commands); it; it = iter_next(it)) {
cmd = iter_data(it);
! dict_insert(service->modules, cmd->command->parent->name, cmd->command->parent);
}
}
--- 976,991 ----
}
! static int
! service_recheck_bindings(struct service *service, struct module *module) {
dict_iterator_t it;
struct svccmd *cmd;
for (it = dict_first(service->commands); it; it = iter_next(it)) {
cmd = iter_data(it);
! if (cmd->command->parent == module) return 0;
}
+ /* No more bindings, remove it from our list. */
+ module_list_remove(&service->modules, module);
+ return 1;
}
***************
*** 1000,1003 ****
--- 1011,1015 ----
struct userNode *bot;
struct svccmd *bound;
+ struct module *module;
const char *svcname;
unsigned int arg, ii;
***************
*** 1031,1038 ****
*/
bot = cmd->parent->bot;
dict_remove(service->commands, bound->name);
- service_rebuild_modules(service);
send_message(user, bot, MCMSG_COMMAND_UNBOUND, cmdname, service->bot->nick);
!
return 1;
}
--- 1043,1052 ----
*/
bot = cmd->parent->bot;
+ module = cmd->command->parent;
dict_remove(service->commands, bound->name);
send_message(user, bot, MCMSG_COMMAND_UNBOUND, cmdname, service->bot->nick);
! if (service_recheck_bindings(service, module)) {
! send_message(user, bot, MCMSG_HELPFILE_UNBOUND, module->name, module->name);
! }
return 1;
}
***************
*** 1104,1108 ****
static MODCMD_FUNC(cmd_command) {
! struct svccmd *svccmd;
unsigned int flags, shown_flags, nn, pos;
char buf[MAXLEN];
--- 1118,1122 ----
static MODCMD_FUNC(cmd_command) {
! struct svccmd *svccmd, *other;
unsigned int flags, shown_flags, nn, pos;
char buf[MAXLEN];
***************
*** 1113,1118 ****
return 0;
}
! snprintf(buf, sizeof(buf), "*%s.%s", svccmd->command->parent->name, svccmd->command->name);
if (svccmd->alias.used) {
reply(MCMSG_COMMAND_ALIASES, svccmd->name, buf);
} else {
--- 1127,1139 ----
return 0;
}
! other = dict_find(svccmd->parent->commands, svccmd->command->name, NULL);
! if (other && !other->alias.used && (other->command == svccmd->command)) {
! pos = snprintf(buf, sizeof(buf), "%s", other->name);
! } else {
! pos = snprintf(buf, sizeof(buf), "*%s.%s", svccmd->command->parent->name, svccmd->command->name);
! }
if (svccmd->alias.used) {
+ buf[pos++] = ' ';
+ unsplit_string((unsigned char**)svccmd->alias.list+1, svccmd->alias.used-1, buf+pos);
reply(MCMSG_COMMAND_ALIASES, svccmd->name, buf);
} else {
***************
*** 1228,1237 ****
}
changed = 0;
! log(MAIN_LOG, LOG_OTHER, "Parsing command modifiers, starting at %d of %d\n", arg, argc);
! for (; arg+1 < argc; arg += 2) {
if (svccmd_configure(svccmd, user, cmd->parent->bot, argv[arg], argv[arg+1])) {
reply(MCMSG_COMMAND_MODIFIED, argv[arg], svccmd->name);
changed = 1;
}
}
if (changed) modcmd_set_effective_flags(svccmd);
--- 1249,1258 ----
}
changed = 0;
! while (arg+1 < argc) {
if (svccmd_configure(svccmd, user, cmd->parent->bot, argv[arg], argv[arg+1])) {
reply(MCMSG_COMMAND_MODIFIED, argv[arg], svccmd->name);
changed = 1;
}
+ arg += 2;
}
if (changed) modcmd_set_effective_flags(svccmd);
***************
*** 1502,1505 ****
--- 1523,1555 ----
}
+ static MODCMD_FUNC(cmd_helpfiles) {
+ struct service *service;
+ unsigned int ii;
+
+ if (!(service = dict_find(services, argv[1], NULL))) {
+ reply(MCMSG_UNKNOWN_SERVICE, argv[1]);
+ return 0;
+ }
+
+ if (argc < 3) {
+ for (ii=0; ii<service->modules.used; ++ii) {
+ reply(MCMSG_HELPFILE_SEQUENCE, ii+1, service->modules.list[ii]->name);
+ }
+ return 0;
+ }
+
+ service->modules.used = 0;
+ for (ii=0; ii<argc-2; ii++) {
+ struct module *module = dict_find(modules, argv[ii+2], NULL);
+ if (!module) {
+ reply(MCMSG_UNKNOWN_MODULE, argv[ii+2]);
+ continue;
+ }
+ module_list_append(&service->modules, module);
+ }
+ reply(MCMSG_HELPFILE_SEQUENCE_SET, service->bot->nick);
+ return 1;
+ }
+
void
modcmd_nick_change(struct userNode *user, const char *new_nick) {
***************
*** 1577,1585 ****
static int
modcmd_saxdb_write(struct saxdb_context *ctx) {
dict_iterator_t it, it2;
saxdb_start_record(ctx, "services", 1);
for (it = dict_first(services); it; it = iter_next(it)) {
! struct service *service = iter_data(it);
saxdb_start_record(ctx, service->bot->nick, 1);
for (it2 = dict_first(service->commands); it2; it2 = iter_next(it2)) {
--- 1627,1638 ----
static int
modcmd_saxdb_write(struct saxdb_context *ctx) {
+ struct string_list slist;
dict_iterator_t it, it2;
+ struct service *service;
+ unsigned int ii;
saxdb_start_record(ctx, "services", 1);
for (it = dict_first(services); it; it = iter_next(it)) {
! service = iter_data(it);
saxdb_start_record(ctx, service->bot->nick, 1);
for (it2 = dict_first(service->commands); it2; it2 = iter_next(it2)) {
***************
*** 1589,1592 ****
--- 1642,1657 ----
}
saxdb_end_record(ctx);
+ saxdb_start_record(ctx, "helpfiles", 1);
+ slist.size = 0;
+ for (it = dict_first(services); it; it = iter_next(it)) {
+ service = iter_data(it);
+ slist.used = 0;
+ for (ii = 0; ii < service->modules.used; ++ii) {
+ string_list_append(&slist, service->modules.list[ii]->name);
+ }
+ saxdb_write_string_list(ctx, iter_key(it), &slist);
+ }
+ if (slist.list) free(slist.list);
+ saxdb_end_record(ctx);
return 0;
}
***************
*** 1606,1610 ****
help_command = modcmd_register(modcmd_module, "help", cmd_help, 1, 0, NULL);
modcmd_register(modcmd_module, "command", cmd_command, 2, 0, NULL);
! modcmd_register(modcmd_module, "modcmd", cmd_modcmd, 4, MODCMD_KEEP_BOUND, "access", "999", NULL);
modcmd_register(modcmd_module, "god", cmd_god, 0, MODCMD_REQUIRE_AUTHED, "flags", "+oper,+networkhelper", NULL);
modcmd_register(modcmd_module, "readhelp", cmd_readhelp, 2, 0, "access", "650", NULL);
--- 1671,1675 ----
help_command = modcmd_register(modcmd_module, "help", cmd_help, 1, 0, NULL);
modcmd_register(modcmd_module, "command", cmd_command, 2, 0, NULL);
! modcmd_register(modcmd_module, "modcmd", cmd_modcmd, 4, MODCMD_KEEP_BOUND, "template", "bind", NULL);
modcmd_register(modcmd_module, "god", cmd_god, 0, MODCMD_REQUIRE_AUTHED, "flags", "+oper,+networkhelper", NULL);
modcmd_register(modcmd_module, "readhelp", cmd_readhelp, 2, 0, "access", "650", NULL);
***************
*** 1615,1618 ****
--- 1680,1684 ----
modcmd_register(modcmd_module, "stats services", cmd_stats_services, 1, 0, "access", "0", NULL);
modcmd_register(modcmd_module, "showcommands", cmd_showcommands, 1, 0, "flags", "+acceptchan", NULL);
+ modcmd_register(modcmd_module, "helpfiles", cmd_helpfiles, 2, 0, "template", "bind", NULL);
}
***************
*** 1743,1746 ****
--- 1809,1837 ----
}
modcmd_db_load_command(service, iter_key(it2), rd2->d.object);
+ }
+ }
+ db2 = database_get_data(db, "helpfiles", RECDB_OBJECT);
+ for (it = dict_first(db2); it; it = iter_next(it)) {
+ struct module *module;
+ struct string_list *slist;
+ unsigned int ii;
+
+ rd = iter_data(it);
+ if (rd->type != RECDB_STRING_LIST) {
+ log(MAIN_LOG, LOG_ERROR, "Bad type for 'helpfiles/%s' in modcmd db (expected string list)\n", iter_key(it));
+ continue;
+ }
+ slist = rd->d.slist;
+ if (!(service = service_find(iter_key(it)))) {
+ /* We probably whined about the service being missing above. */
+ continue;
+ }
+ service->modules.used = 0;
+ for (ii=0; ii<slist->used; ++ii) {
+ if (!(module = dict_find(modules, slist->list[ii], NULL))) {
+ log(MAIN_LOG, LOG_ERROR, "Unknown module '%s' listed in modcmd 'helpfiles/%s'\n", slist->list[ii], iter_key(it));
+ continue;
+ }
+ module_list_append(&service->modules, module);
}
}
Index: modcmd.h
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** modcmd.h 29 Oct 2002 01:57:10 -0000 1.12
--- modcmd.h 29 Oct 2002 04:31:29 -0000 1.13
***************
*** 39,42 ****
--- 39,43 ----
DECLARE_LIST(svccmd_list, struct svccmd*);
+ DECLARE_LIST(module_list, struct module*);
#if defined(__GNUC__) && (__GNUC__ < 3)
***************
*** 94,98 ****
struct service {
struct userNode *bot;
! dict_t modules; /* contains struct module* */
dict_t commands; /* contains struct svccmd* */
struct helpserv_bot *hs;
--- 95,99 ----
struct service {
struct userNode *bot;
! struct module_list modules;
dict_t commands; /* contains struct svccmd* */
struct helpserv_bot *hs;
Index: modcmd.help
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.help,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** modcmd.help 26 Oct 2002 22:51:41 -0000 1.7
--- modcmd.help 29 Oct 2002 04:31:29 -0000 1.8
***************
*** 66,67 ****
--- 66,71 ----
"Shows commands which you can execute (with their required access levels). If you give a numeric $O access level or text $C access name, it further restricts output to only show commands which can be executed by users with that access.",
"$uSee Also:$u command");
+ "helpfiles" ("/msg $S HELPFILES <service> [module list]",
+ "With only a service nick, shows the helpfiles used by that service.",
+ "With a list of modules, sets the order that the service will look up non-command help entries.",
+ "$uSee Also:$u bind, unbind");
|
|
From: Entrope <en...@us...> - 2002-10-29 01:57:13
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv23692/src
Modified Files:
modcmd.c modcmd.h
Log Message:
fix the (as it turns out, over-)simplified permissions checking
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** modcmd.c 28 Oct 2002 02:01:47 -0000 1.34
--- modcmd.c 29 Oct 2002 01:57:10 -0000 1.35
***************
*** 29,32 ****
--- 29,33 ----
#define MCMSG_BAD_OPSERV_LEVEL "Invalid $O access level %s."
#define MCMSG_BAD_CHANSERV_LEVEL "Invalid $C access level %s."
+ #define MCMSG_LEVEL_TOO_HIGH "You cannot set the access requirements to %s (that is too high)."
#define MCMSG_UNKNOWN_COMMAND "Unknown command name %s (as template for %s in service %s)."
#define MCMSG_BAD_WEIGHT "Invalid command weight %s."
***************
*** 244,253 ****
static void
svccmd_copy_rules(struct svccmd *dest, struct svccmd *src) {
! dest->weight = src->weight;
! dest->flags = src->flags;
! dest->req_account_flags = src->req_account_flags;
! dest->deny_account_flags = src->deny_account_flags;
! dest->min_opserv_level = src->min_opserv_level;
! dest->min_channel_access = src->min_channel_access;
}
--- 245,260 ----
static void
svccmd_copy_rules(struct svccmd *dest, struct svccmd *src) {
! dest->flags |= src->flags;
! dest->req_account_flags |= src->req_account_flags;
! dest->deny_account_flags |= src->deny_account_flags;
! if (src->weight > dest->weight) {
! dest->weight = src->weight;
! }
! if (src->min_opserv_level > dest->min_opserv_level) {
! dest->min_opserv_level = src->min_opserv_level;
! }
! if (src->min_channel_access > dest->min_channel_access) {
! dest->min_channel_access = src->min_channel_access;
! }
}
***************
*** 311,315 ****
return 0;
}
! cmd->min_opserv_level = atoi(value);
return 1;
} else if (!irccasecmp(param, "level") || !irccasecmp(param, "access")) {
--- 318,326 ----
return 0;
}
! if (user && (!user->handle_info || (newval > user->handle_info->opserv_level))) {
! send_message(user, bot, MCMSG_LEVEL_TOO_HIGH, value);
! return 0;
! }
! cmd->min_opserv_level = newval;
return 1;
} else if (!irccasecmp(param, "level") || !irccasecmp(param, "access")) {
***************
*** 341,344 ****
--- 352,366 ----
}
+ static void
+ modcmd_set_effective_flags(struct svccmd *cmd) {
+ int flags = cmd->flags | cmd->command->flags;
+ if (cmd->min_opserv_level > 0) flags |= MODCMD_REQUIRE_OPER;
+ if (cmd->min_channel_access > ulNone) flags |= MODCMD_REQUIRE_CHANUSER;
+ if (flags & MODCMD_REQUIRE_CHANUSER) flags |= MODCMD_REQUIRE_REGCHAN;
+ if (flags & MODCMD_REQUIRE_JOINABLE) flags |= MODCMD_REQUIRE_CHANNEL;
+ if (flags & (MODCMD_REQUIRE_STAFF|MODCMD_REQUIRE_HELPING)) flags |= MODCMD_REQUIRE_AUTHED;
+ cmd->effective_flags = flags;
+ }
+
struct modcmd *
modcmd_register(struct module *module, const char *name, modcmd_func_t func, unsigned int min_argc, unsigned int flags, ...) {
***************
*** 379,382 ****
--- 401,405 ----
}
}
+ modcmd_set_effective_flags(newcmd->defaults);
va_end(args);
return newcmd;
***************
*** 391,414 ****
unsigned int uData_checked = 0;
struct userData *uData = NULL;
! int rflags = 0;
! if (cmd->flags & MODCMD_DISABLED) {
if (noisy) send_message(user, bot, MSG_COMMAND_DISABLED, cmd->name);
return 0;
}
! if ((cmd->flags & MODCMD_REQUIRE_QUALIFIED) && !server_qualified) {
if (noisy) send_message(user, bot, MCMSG_MUST_QUALIFY, bot->nick, cmd->name, bot->nick);
return 0;
}
! if ((cmd->flags & MODCMD_REQUIRE_AUTHED) && !user->handle_info) {
if (noisy) send_message(user, bot, MSG_AUTHENTICATE);
return 0;
}
if (channel || noisy) {
! if ((cmd->flags & MODCMD_REQUIRE_CHANNEL) && !channel) {
if (noisy) send_message(user, bot, MSG_INVALID_CHANNEL);
return 0;
}
! if (cmd->flags & MODCMD_REQUIRE_REGCHAN) {
if (!channel) {
/* XXX: could maybe figure out better way to handle this case */
--- 414,437 ----
unsigned int uData_checked = 0;
struct userData *uData = NULL;
! int rflags = 0, flags = cmd->effective_flags;
! if (flags & MODCMD_DISABLED) {
if (noisy) send_message(user, bot, MSG_COMMAND_DISABLED, cmd->name);
return 0;
}
! if ((flags & MODCMD_REQUIRE_QUALIFIED) && !server_qualified) {
if (noisy) send_message(user, bot, MCMSG_MUST_QUALIFY, bot->nick, cmd->name, bot->nick);
return 0;
}
! if ((flags & MODCMD_REQUIRE_AUTHED) && !user->handle_info) {
if (noisy) send_message(user, bot, MSG_AUTHENTICATE);
return 0;
}
if (channel || noisy) {
! if ((flags & MODCMD_REQUIRE_CHANNEL) && !channel) {
if (noisy) send_message(user, bot, MSG_INVALID_CHANNEL);
return 0;
}
! if (flags & MODCMD_REQUIRE_REGCHAN) {
if (!channel) {
/* XXX: could maybe figure out better way to handle this case */
***************
*** 420,424 ****
}
}
! if (cmd->flags & MODCMD_REQUIRE_CHANUSER) {
if (!uData_checked) uData = _GetChannelUser(channel->channel_info, user->handle_info, 1, 0), uData_checked = 1;
if (!uData) {
--- 443,447 ----
}
}
! if (flags & MODCMD_REQUIRE_CHANUSER) {
if (!uData_checked) uData = _GetChannelUser(channel->channel_info, user->handle_info, 1, 0), uData_checked = 1;
if (!uData) {
***************
*** 430,434 ****
}
}
! if (cmd->flags & MODCMD_REQUIRE_JOINABLE) {
if (!uData_checked) uData = _GetChannelUser(channel->channel_info, user->handle_info, 1, 0), uData_checked = 1;
if ((channel->modes & (MODE_INVITEONLY|MODE_KEY))
--- 453,457 ----
}
}
! if (flags & MODCMD_REQUIRE_JOINABLE) {
if (!uData_checked) uData = _GetChannelUser(channel->channel_info, user->handle_info, 1, 0), uData_checked = 1;
if ((channel->modes & (MODE_INVITEONLY|MODE_KEY))
***************
*** 440,444 ****
}
}
! if ((cmd->flags & MODCMD_TOY) && channel) {
char opt = channel->channel_info ? channel->channel_info->options[optToys] : 'n';
switch (opt) {
--- 463,467 ----
}
}
! if ((flags & MODCMD_TOY) && channel) {
char opt = channel->channel_info ? channel->channel_info->options[optToys] : 'n';
switch (opt) {
***************
*** 454,461 ****
}
}
! if (cmd->flags & MODCMD_REQUIRE_STAFF) {
! if (((cmd->flags & MODCMD_REQUIRE_OPER) && IsOper(user))
! || ((cmd->flags & MODCMD_REQUIRE_NETWORK_HELPER) && IsNetworkHelper(user))
! || ((cmd->flags & MODCMD_REQUIRE_SUPPORT_HELPER) && IsSupportHelper(user))) {
/* allow it */
} else {
--- 477,484 ----
}
}
! if (flags & MODCMD_REQUIRE_STAFF) {
! if (((flags & MODCMD_REQUIRE_OPER) && IsOper(user))
! || ((flags & MODCMD_REQUIRE_NETWORK_HELPER) && IsNetworkHelper(user))
! || ((flags & MODCMD_REQUIRE_SUPPORT_HELPER) && IsSupportHelper(user))) {
/* allow it */
} else {
***************
*** 464,468 ****
}
}
! if ((cmd->flags & MODCMD_REQUIRE_HELPING) && !HANDLE_FLAGGED(user->handle_info, HELPING)) {
if (noisy) send_message(user, bot, MCMSG_MUST_BE_HELPING);
return 0;
--- 487,491 ----
}
}
! if ((flags & MODCMD_REQUIRE_HELPING) && !HANDLE_FLAGGED(user->handle_info, HELPING)) {
if (noisy) send_message(user, bot, MCMSG_MUST_BE_HELPING);
return 0;
***************
*** 489,498 ****
/* If it's an override, return a special value. */
! if ((cmd->flags & MODCMD_REQUIRE_CHANUSER)
&& noisy
&& (uData->access > ulOwner)
&& (!(uData = _GetChannelUser(channel->channel_info, user->handle_info, 0, 0))
|| uData->access < cmd->min_channel_access)
! && !(cmd->flags & (MODCMD_REQUIRE_STAFF|MODCMD_REQUIRE_HELPING))) {
rflags |= ACTION_OVERRIDE;
}
--- 512,521 ----
/* If it's an override, return a special value. */
! if ((flags & MODCMD_REQUIRE_CHANUSER)
&& noisy
&& (uData->access > ulOwner)
&& (!(uData = _GetChannelUser(channel->channel_info, user->handle_info, 0, 0))
|| uData->access < cmd->min_channel_access)
! && !(flags & (MODCMD_REQUIRE_STAFF|MODCMD_REQUIRE_HELPING))) {
rflags |= ACTION_OVERRIDE;
}
***************
*** 612,616 ****
/* Figure out what actions we should do for it.. */
if (cmd_arg && (cmd->flags & MODCMD_TOY)) {
! /* Don't let user manually specify a channel. */
channel = NULL;
}
--- 635,639 ----
/* Figure out what actions we should do for it.. */
if (cmd_arg && (cmd->flags & MODCMD_TOY)) {
! /* Do not let user manually specify a channel. */
channel = NULL;
}
***************
*** 1082,1086 ****
static MODCMD_FUNC(cmd_command) {
struct svccmd *svccmd;
! unsigned int shown_flags, nn, pos;
char buf[MAXLEN];
--- 1105,1109 ----
static MODCMD_FUNC(cmd_command) {
struct svccmd *svccmd;
! unsigned int flags, shown_flags, nn, pos;
char buf[MAXLEN];
***************
*** 1096,1106 ****
reply(MCMSG_COMMAND_BINDING, svccmd->name, buf);
}
if ((svccmd->parent && svccmd->parent->privileged && !IsOper(user))
! || ((svccmd->flags & MODCMD_REQUIRE_STAFF)
&& !IsOper(user) && !IsNetworkHelper(user) && !IsSupportHelper(user))) {
reply(MCMSG_INSPECTION_REFUSED, svccmd->name);
return 0;
}
! if (svccmd->flags & MODCMD_DISABLED) {
reply(MSG_COMMAND_DISABLED, svccmd->name);
return 1;
--- 1119,1130 ----
reply(MCMSG_COMMAND_BINDING, svccmd->name, buf);
}
+ flags = svccmd->effective_flags;
if ((svccmd->parent && svccmd->parent->privileged && !IsOper(user))
! || ((flags & MODCMD_REQUIRE_STAFF)
&& !IsOper(user) && !IsNetworkHelper(user) && !IsSupportHelper(user))) {
reply(MCMSG_INSPECTION_REFUSED, svccmd->name);
return 0;
}
! if (flags & MODCMD_DISABLED) {
reply(MSG_COMMAND_DISABLED, svccmd->name);
return 1;
***************
*** 1124,1137 ****
shown_flags |= MODCMD_REQUIRE_AUTHED;
}
! if (!svccmd->flags && !shown_flags) {
reply(MCMSG_NEED_NOTHING, svccmd->name);
return 1;
}
! if (svccmd->flags & ~shown_flags & MODCMD_REQUIRE_HELPING) {
reply(MCMSG_MUST_BE_HELPING);
shown_flags |= MODCMD_REQUIRE_AUTHED | MODCMD_REQUIRE_STAFF;
}
! if (svccmd->flags & ~shown_flags & MODCMD_REQUIRE_STAFF) {
! switch (svccmd->flags & MODCMD_REQUIRE_STAFF) {
default: case MODCMD_REQUIRE_STAFF:
strcpy(buf, "network staff");
--- 1148,1161 ----
shown_flags |= MODCMD_REQUIRE_AUTHED;
}
! if (!flags && !shown_flags) {
reply(MCMSG_NEED_NOTHING, svccmd->name);
return 1;
}
! if (flags & ~shown_flags & MODCMD_REQUIRE_HELPING) {
reply(MCMSG_MUST_BE_HELPING);
shown_flags |= MODCMD_REQUIRE_AUTHED | MODCMD_REQUIRE_STAFF;
}
! if (flags & ~shown_flags & MODCMD_REQUIRE_STAFF) {
! switch (flags & MODCMD_REQUIRE_STAFF) {
default: case MODCMD_REQUIRE_STAFF:
strcpy(buf, "network staff");
***************
*** 1159,1184 ****
shown_flags |= MODCMD_REQUIRE_AUTHED;
}
! if (svccmd->flags & ~shown_flags & MODCMD_REQUIRE_JOINABLE) {
reply(MCMSG_NEED_JOINABLE);
shown_flags |= MODCMD_REQUIRE_CHANUSER;
}
! if (svccmd->flags & ~shown_flags & MODCMD_REQUIRE_CHANUSER) {
reply(MCMSG_NEED_CHANUSER);
shown_flags |= MODCMD_REQUIRE_REGCHAN | MODCMD_REQUIRE_CHANNEL | MODCMD_REQUIRE_AUTHED;
}
! if (svccmd->flags & ~shown_flags & MODCMD_REQUIRE_REGCHAN) {
reply(MCMSG_NEED_REGCHAN);
shown_flags |= MODCMD_REQUIRE_CHANNEL;
}
! if (svccmd->flags & ~shown_flags & MODCMD_REQUIRE_CHANNEL) {
reply(MCMSG_NEED_CHANNEL);
}
! if (svccmd->flags & ~shown_flags & MODCMD_REQUIRE_AUTHED) {
reply(MCMSG_NEED_AUTHED);
}
! if (svccmd->flags & ~shown_flags & MODCMD_TOY) {
reply(MCMSG_IS_TOY, svccmd->name);
}
! if (svccmd->flags & ~shown_flags & MODCMD_REQUIRE_QUALIFIED) {
const char *botnick = svccmd->parent ? svccmd->parent->bot->nick : "SomeBot";
reply(MCMSG_MUST_QUALIFY, botnick, svccmd->name, botnick);
--- 1183,1208 ----
shown_flags |= MODCMD_REQUIRE_AUTHED;
}
! if (flags & ~shown_flags & MODCMD_REQUIRE_JOINABLE) {
reply(MCMSG_NEED_JOINABLE);
shown_flags |= MODCMD_REQUIRE_CHANUSER;
}
! if (flags & ~shown_flags & MODCMD_REQUIRE_CHANUSER) {
reply(MCMSG_NEED_CHANUSER);
shown_flags |= MODCMD_REQUIRE_REGCHAN | MODCMD_REQUIRE_CHANNEL | MODCMD_REQUIRE_AUTHED;
}
! if (flags & ~shown_flags & MODCMD_REQUIRE_REGCHAN) {
reply(MCMSG_NEED_REGCHAN);
shown_flags |= MODCMD_REQUIRE_CHANNEL;
}
! if (flags & ~shown_flags & MODCMD_REQUIRE_CHANNEL) {
reply(MCMSG_NEED_CHANNEL);
}
! if (flags & ~shown_flags & MODCMD_REQUIRE_AUTHED) {
reply(MCMSG_NEED_AUTHED);
}
! if (flags & ~shown_flags & MODCMD_TOY) {
reply(MCMSG_IS_TOY, svccmd->name);
}
! if (flags & ~shown_flags & MODCMD_REQUIRE_QUALIFIED) {
const char *botnick = svccmd->parent ? svccmd->parent->bot->nick : "SomeBot";
reply(MCMSG_MUST_QUALIFY, botnick, svccmd->name, botnick);
***************
*** 1204,1208 ****
}
changed = 0;
! for (arg++; arg+1 < argc; arg += 2) {
if (svccmd_configure(svccmd, user, cmd->parent->bot, argv[arg], argv[arg+1])) {
reply(MCMSG_COMMAND_MODIFIED, argv[arg], svccmd->name);
--- 1228,1233 ----
}
changed = 0;
! log(MAIN_LOG, LOG_OTHER, "Parsing command modifiers, starting at %d of %d\n", arg, argc);
! for (; arg+1 < argc; arg += 2) {
if (svccmd_configure(svccmd, user, cmd->parent->bot, argv[arg], argv[arg+1])) {
reply(MCMSG_COMMAND_MODIFIED, argv[arg], svccmd->name);
***************
*** 1210,1213 ****
--- 1235,1239 ----
}
}
+ if (changed) modcmd_set_effective_flags(svccmd);
return changed;
}
***************
*** 1430,1434 ****
if (svccmd->min_opserv_level > 0) show_opserv_level = 1;
if (svccmd->min_channel_access > ulNone) show_channel_access = 1;
! if (svccmd->flags & (MODCMD_REQUIRE_STAFF|MODCMD_REQUIRE_HELPING) & ~ignore_flags) show_channel_access = 1;
svccmd_list_append(&commands, svccmd);
}
--- 1456,1464 ----
if (svccmd->min_opserv_level > 0) show_opserv_level = 1;
if (svccmd->min_channel_access > ulNone) show_channel_access = 1;
! if (svccmd->effective_flags
! & (MODCMD_REQUIRE_STAFF|MODCMD_REQUIRE_HELPING)
! & ~ignore_flags) {
! show_channel_access = 1;
! }
svccmd_list_append(&commands, svccmd);
}
***************
*** 1454,1460 ****
if (show_channel_access) {
const char *access;
! if (svccmd->flags & MODCMD_REQUIRE_HELPING) access = "helping";
! else if (svccmd->flags & MODCMD_REQUIRE_STAFF) {
! switch (svccmd->flags & MODCMD_REQUIRE_STAFF) {
case MODCMD_REQUIRE_OPER: access = "oper"; break;
case MODCMD_REQUIRE_OPER | MODCMD_REQUIRE_NETWORK_HELPER:
--- 1484,1491 ----
if (show_channel_access) {
const char *access;
! int flags = svccmd->effective_flags;
! if (flags & MODCMD_REQUIRE_HELPING) access = "helping";
! else if (flags & MODCMD_REQUIRE_STAFF) {
! switch (flags & MODCMD_REQUIRE_STAFF) {
case MODCMD_REQUIRE_OPER: access = "oper"; break;
case MODCMD_REQUIRE_OPER | MODCMD_REQUIRE_NETWORK_HELPER:
***************
*** 1647,1650 ****
--- 1678,1682 ----
}
}
+ modcmd_set_effective_flags(svccmd);
}
Index: modcmd.h
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** modcmd.h 28 Oct 2002 02:01:47 -0000 1.11
--- modcmd.h 29 Oct 2002 01:57:10 -0000 1.12
***************
*** 113,116 ****
--- 113,117 ----
unsigned int min_opserv_level;
unsigned int min_channel_access;
+ unsigned int effective_flags;
};
|
|
From: Entrope <en...@us...> - 2002-10-29 01:56:31
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv23437/src
Modified Files:
opserv.c
Log Message:
move "gtrace ungline" definition below "gline" definition (needed with new modcmd changes)
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.285
retrieving revision 1.286
diff -C2 -r1.285 -r1.286
*** opserv.c 28 Oct 2002 02:01:47 -0000 1.285
--- opserv.c 29 Oct 2002 01:56:28 -0000 1.286
***************
*** 4028,4032 ****
opserv_define_func("GTRACE COUNT", NULL, 0, 0);
opserv_define_func("GTRACE PRINT", NULL, 0, 0);
- modcmd_register(opserv_module, "GTRACE UNGLINE", NULL, 0, 0, "template", "ungline", NULL);
opserv_define_func("INVITEME", cmd_inviteme, 100, 0);
opserv_define_func("JOIN", cmd_join, 601, 1);
--- 4028,4031 ----
***************
*** 4079,4082 ****
--- 4078,4082 ----
opserv_define_func("UNGAG", cmd_ungag, 600, 0);
opserv_define_func("UNGLINE", cmd_ungline, 600, 0);
+ modcmd_register(opserv_module, "GTRACE UNGLINE", NULL, 0, 0, "template", "ungline", NULL);
opserv_define_func("UNJUPE", cmd_unjupe, 900, 0);
opserv_define_func("UNRESERVE", cmd_unreserve, 800, 0);
|
|
From: Entrope <en...@us...> - 2002-10-29 01:55:31
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv23089/src
Modified Files:
proto-p10.c
Log Message:
look up hidden_host_suffix (again) on rehash
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -r1.40 -r1.41
*** proto-p10.c 23 Oct 2002 12:37:54 -0000 1.40
--- proto-p10.c 29 Oct 2002 01:55:28 -0000 1.41
***************
*** 1331,1334 ****
--- 1331,1339 ----
}
+ static void
+ p10_conf_reload(void) {
+ hidden_host_suffix = conf_get_data("server/hidden_host", RECDB_QSTRING);
+ }
+
void
init_parse(void)
***************
*** 1365,1369 ****
}
self = AddServer(NULL, str, 0, boot_time, now, numer, desc);
! hidden_host_suffix = conf_get_data("server/hidden_host", RECDB_QSTRING);
irc_func_dict = dict_new();
--- 1370,1374 ----
}
self = AddServer(NULL, str, 0, boot_time, now, numer, desc);
! conf_register_reload(p10_conf_reload);
irc_func_dict = dict_new();
|
|
From: Entrope <en...@us...> - 2002-10-29 01:54:49
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv22854/src
Modified Files:
opserv.help
Log Message:
update help entries to match bind/unbind (etc) instead of alias/unalias
Index: opserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.help,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -r1.53 -r1.54
*** opserv.help 26 Oct 2002 16:17:19 -0000 1.53
--- opserv.help 29 Oct 2002 01:54:44 -0000 1.54
***************
*** 243,247 ****
"GLINES the host of the specified nick for one hour If no reason is given, use a default reason.",
"$uSee Also:$u gline, ungline");
! "GLINE" ("/msg $O GLINE <user@host> <duration in seconds> <reason>",
"Issues a GLINE (network ban) on the network for the speicified user@host for the specified duration (making the expiration time: net time + duration).",
"$uSee Also:$u trace, ungline");
--- 243,247 ----
"GLINES the host of the specified nick for one hour If no reason is given, use a default reason.",
"$uSee Also:$u gline, ungline");
! "GLINE" ("/msg $O GLINE <user@host> <duration> <reason>",
"Issues a GLINE (network ban) on the network for the speicified user@host for the specified duration (making the expiration time: net time + duration).",
"$uSee Also:$u trace, ungline");
***************
*** 370,375 ****
"These commands control how other services behave.",
" ADDNOTE [${level/addnote}]",
- " ALIAS [${level/alias}]",
" BANEMAIL [${level/banemail}]",
" DELNOTE [${level/delnote}]",
" GAG [${level/gag}]",
--- 370,375 ----
"These commands control how other services behave.",
" ADDNOTE [${level/addnote}]",
" BANEMAIL [${level/banemail}]",
+ " BIND [${level/bind}]",
" DELNOTE [${level/delnote}]",
" GAG [${level/gag}]",
***************
*** 377,382 ****
" QUERY [${level/query}]",
" SET [${level/set}]",
- " UNALIAS [${level/unalias}]",
" UNBANEMAIL [${level/unbanemail}]",
" UNGAG [${level/ungag}]");
"ADDNOTE" ("/msg $O ADDNOTE <typename> <set-access> [access-arg] <view-access> <max-length>",
--- 377,382 ----
" QUERY [${level/query}]",
" SET [${level/set}]",
" UNBANEMAIL [${level/unbanemail}]",
+ " UNBIND [${level/unbind}]",
" UNGAG [${level/ungag}]");
"ADDNOTE" ("/msg $O ADDNOTE <typename> <set-access> [access-arg] <view-access> <max-length>",
***************
*** 389,396 ****
"If the note type already exists, it is modified with the new values you specify.",
"$uSee Also:$u delnote");
- "ALIAS" ("/msg $O ALIAS <service> <alias> <command>",
- "Creates an alias for the specified service's command. If the given alias is currently pointing at a different command, it will be modified.",
- "$bservice$b must be the canonical name of the service, not its current nick.",
- "$uSee Also:$u stats aliases, unalias");
"DELNOTE" ("/msg $O DELNOTE <typename> [FORCE]",
"Permanently deletes a note type. Without the argument $bFORCE$b, it will only delete an unused note type. With the argument $bFORCE$b, it will delete the note from all channels and then delete the note type.",
--- 389,392 ----
***************
*** 408,414 ****
"Modifies the internal configuration database. Currently, only keys that have been previously set may be modified.",
"$uSee Also:$u query");
- "UNALIAS" ("/msg $O UNALIAS <service> <alias>",
- "Removes an existing alias for the specified services.",
- "$uSee Also:$u alias, stats aliases");
"UNGAG" ("/msg $O UNGAG <hostmask>",
"Ungags a gaged hostmask and displays how many users were affected by $bungag$b. You can get a list of gaged hostmasks from $bgags$b.",
--- 404,407 ----
***************
*** 434,438 ****
"STATS" ("/msg $O STATS <subject>",
"Displays statistics about a specified subject. Subjects include:",
- "$bALIASES$b: List of aliases (optional argument: service name).",
"$bALERTS$b: The list of current \"alerts\".",
"$bBAD$b: Current list of bad words and exempted channels.",
--- 427,430 ----
|
|
From: Entrope <en...@us...> - 2002-10-28 02:27:51
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv29691/src
Modified Files:
chanserv.c
Log Message:
... someone shoot me, i cannot count parentheses. must have been that glass of wine with dinner ...
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.300
retrieving revision 1.301
diff -C2 -r1.300 -r1.301
*** chanserv.c 28 Oct 2002 02:27:12 -0000 1.300
--- chanserv.c 28 Oct 2002 02:27:49 -0000 1.301
***************
*** 1446,1450 ****
for(user=channel->users; user; user=user->next)
{
! if((user->present && (user->access >= ulMaster)) break;
}
if(user) continue;
--- 1446,1450 ----
for(user=channel->users; user; user=user->next)
{
! if(user->present && (user->access >= ulMaster)) break;
}
if(user) continue;
|
|
From: Entrope <en...@us...> - 2002-10-28 02:27:15
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv29331/src
Modified Files:
chanserv.c
Log Message:
fix previous commit to make sure the master-or-above is actually in the channel
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.299
retrieving revision 1.300
diff -C2 -r1.299 -r1.300
*** chanserv.c 28 Oct 2002 02:01:45 -0000 1.299
--- chanserv.c 28 Oct 2002 02:27:12 -0000 1.300
***************
*** 1446,1450 ****
for(user=channel->users; user; user=user->next)
{
! if(user->access >= ulMaster) break;
}
if(user) continue;
--- 1446,1450 ----
for(user=channel->users; user; user=user->next)
{
! if((user->present && (user->access >= ulMaster)) break;
}
if(user) continue;
|
|
From: Entrope <en...@us...> - 2002-10-28 02:01:50
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv15924/src
Modified Files:
chanserv.c modcmd.c modcmd.h nickserv.c opserv.c
Log Message:
remove modcmd template system; just clone requirements when making a new command
add new flag to svccmd_can_invoke
add callbacks for unbinding commands (so Byte can "?unbind ChanServ set\ nodelete")
do not expire channels that still have a master-or-above in the channel
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.298
retrieving revision 1.299
diff -C2 -r1.298 -r1.299
*** chanserv.c 26 Oct 2002 22:50:53 -0000 1.298
--- chanserv.c 28 Oct 2002 02:01:45 -0000 1.299
***************
*** 1427,1431 ****
--- 1427,1433 ----
struct chanData *channel, *next;
struct chanNode *save;
+ struct userData *user;
char delay[INTERVALLEN], reason[INTERVALLEN + 64];
+ int suspended;
(void)data;
***************
*** 1437,1460 ****
next = channel->next;
! if(IsProtected(channel))
! {
! continue;
! }
!
! if((now - channel->visited) > chanserv_conf.channel_expire_delay)
! {
! int suspended = IsSuspended(channel);
! log(CS_LOG, LOG_INFO, "(%s) Channel registration expired.\n", (suspended ? channel->suspended->name : channel->channel->name));
!
! /* Because we have a chanData * and not a chanNode *, save
! the chanNode *, then call unregister_channel(). */
! save = channel->channel;
! unregister_channel(channel);
!
! if(!suspended)
! {
! DelChannelUser(chanserv, save, reason, 0);
! }
! }
}
--- 1439,1459 ----
next = channel->next;
! /* See if the channel can be expired. */
! if((now - channel->visited) <= chanserv_conf.channel_expire_delay) continue;
! if(IsProtected(channel)) continue;
!
! /* Make sure there are no high-ranking users still in the channel. */
! for(user=channel->users; user; user=user->next)
! {
! if(user->access >= ulMaster) break;
! }
! if(user) continue;
!
! /* Unregister the channel */
! suspended = IsSuspended(channel);
! log(CS_LOG, LOG_INFO, "(%s) Channel registration expired.\n", (suspended ? channel->suspended->name : channel->channel->name));
! save = channel->channel;
! unregister_channel(channel);
! if(!suspended) DelChannelUser(chanserv, save, reason, 0);
}
***************
*** 5414,5417 ****
--- 5413,5426 ----
static struct svccmd_list set_shows_list;
+ static void
+ handle_svccmd_unbind(struct svccmd *target) {
+ unsigned int ii;
+ for (ii=0; ii<set_shows_list.used; ++ii) {
+ if (target == set_shows_list.list[ii]) {
+ set_shows_list.used = 0;
+ }
+ }
+ }
+
static CHANSERV_FUNC(cmd_set)
{
***************
*** 5435,5439 ****
if(!subcmd)
{
! log(CS_LOG, LOG_ERROR, "Unable to find set option %s.\n", name);
continue;
}
--- 5444,5448 ----
if(!subcmd)
{
! log(CS_LOG, LOG_ERROR, "Unable to find set option \"%s\".\n", name);
continue;
}
***************
*** 5445,5452 ****
{
chanserv_notice(user, CSMSG_CHANNEL_OPTIONS);
- /* Do this so options are presented in a consistent order. */
for(ii = 0; ii < set_shows_list.used; ii++)
{
! set_shows_list.list[ii]->command->func(user, channel, 1, argv+1, set_shows_list.list[ii]);
}
return 1;
--- 5454,5461 ----
{
chanserv_notice(user, CSMSG_CHANNEL_OPTIONS);
for(ii = 0; ii < set_shows_list.used; ii++)
{
! subcmd = set_shows_list.list[ii];
! subcmd->command->func(user, channel, 1, argv+1, subcmd);
}
return 1;
***************
*** 7094,7097 ****
--- 7103,7107 ----
dict_set_free_data(mask_dnrs, free);
+ reg_svccmd_unbind_func(handle_svccmd_unbind);
chanserv_module = module_register("ChanServ", CS_LOG, "chanserv.help", chanserv_expand_variable);
DEFINE_COMMAND(register, 1, MODCMD_REQUIRE_AUTHED, "flags", "+acceptchan,+helping", NULL);
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -r1.33 -r1.34
*** modcmd.c 26 Oct 2002 22:51:40 -0000 1.33
--- modcmd.c 28 Oct 2002 02:01:47 -0000 1.34
***************
*** 73,77 ****
#define MCMSG_NEED_AUTHED "You must be authenticated with $N."
#define MCMSG_IS_TOY "$b%s$b is a toy command."
- #define MCMSG_INHERITED_REQS "Some of the above requirements may have been inherited from the %s requirements."
#define MCMSG_END_REQUIREMENTS "End of requirements for $b%s$b."
#define MSMSG_ALREADY_HELPING "You already have security override enabled."
--- 73,76 ----
***************
*** 93,97 ****
};
[...1001 lines suppressed...]
free(ptempl->base);
free(ptempl);
}
-
- in_setup = 0;
}
--- 1820,1832 ----
/* Only overwrite the current template if we have a valid template. */
if (!strcmp(ptempl->base, "*")) {
! /* Do nothing. */
} else if ((svccmd = svccmd_resolve_name(ptempl->cmd, ptempl->base))) {
! svccmd_copy_rules(ptempl->cmd, svccmd);
} else {
! assert(ptempl->cmd->parent);
! log(MAIN_LOG, LOG_ERROR, "Unable to resolve template name %s for command %s in service %s.\n", ptempl->base, ptempl->cmd->name, ptempl->cmd->parent->bot->nick);
}
free(ptempl->base);
free(ptempl);
}
}
Index: modcmd.h
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** modcmd.h 18 Sep 2002 14:50:19 -0000 1.10
--- modcmd.h 28 Oct 2002 02:01:47 -0000 1.11
***************
*** 86,94 ****
* need "extra" data.
*
! * When checking to see if a user may invoke a command, the "template"
! * chain is followed, and the user must meet all the requirements
! * before the command is executed. As an exception, for the "staff"
! * permission checks (oper/network helper/support helper), any one is
! * sufficient to permit the command usage.
*/
--- 86,93 ----
* need "extra" data.
*
! * The user must meet all the requirements (in flags, access levels,
! * etc.) before the command is executed. As an exception, for the
! * "staff" permission checks (oper/network helper/support helper), any
! * one is sufficient to permit the command usage.
*/
***************
*** 107,111 ****
struct modcmd *command; /* what is the implementation? */
struct string_list alias; /* if it's a complicated binding, what is the expansion? */
- struct svccmd *template; /* where we look for permissions? */
unsigned int uses; /* how many times was this command used? */
float weight; /* how much should it count against the command policer? */
--- 106,109 ----
***************
*** 158,165 ****
struct svccmd *service_bind_modcmd(struct service *service, struct modcmd *cmd, const char *name);
- /* Alter a configurable parameter for a command. On success, return
- * non-zero; on failure, report to user why it failed and return zero.
- */
- int svccmd_configure(struct svccmd *cmd, struct userNode *user, struct userNode *bot, const char *param, const char *value);
/* Send help for a command to a user. */
int svccmd_send_help(struct userNode *user, struct userNode *bot, struct svccmd *cmd);
--- 156,159 ----
***************
*** 167,175 ****
int svccmd_send_help_2(struct userNode *user, struct service *service, const char *topic);
/* Check whether a user may invoke a command or not. If they can,
! * return non-zero. If they cannot, tell them why not and return 0.
*/
! int svccmd_can_invoke(struct userNode *user, struct userNode *bot, struct svccmd *cmd, struct chanNode *channel, unsigned int server_qualified);
/* Execute a command. Returns non-zero on success. */
int svccmd_invoke_argv(struct userNode *user, struct service *service, struct chanNode *channel, unsigned int argc, unsigned char *argv[], unsigned int server_qualified);
/* Initialize the module command subsystem. */
--- 161,177 ----
int svccmd_send_help_2(struct userNode *user, struct service *service, const char *topic);
/* Check whether a user may invoke a command or not. If they can,
! * return non-zero (if debit is non-zero, also debit the command's
! * weight against the user's command policer). If they cannot (and
! * noisy is non-zero), tell them why not and return 0.
! *
*/
! int svccmd_can_invoke(struct userNode *user, struct userNode *bot, struct svccmd *cmd, struct chanNode *channel, char server_qualified, char debit, char noisy);
/* Execute a command. Returns non-zero on success. */
int svccmd_invoke_argv(struct userNode *user, struct service *service, struct chanNode *channel, unsigned int argc, unsigned char *argv[], unsigned int server_qualified);
+ /* Get notification when a command is being unbound. This lets
+ * services which cache svccmd references remove them.
+ */
+ typedef void (*svccmd_unbind_func_t)(struct svccmd *target);
+ void reg_svccmd_unbind_func(svccmd_unbind_func_t handler);
/* Initialize the module command subsystem. */
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.211
retrieving revision 1.212
diff -C2 -r1.211 -r1.212
*** nickserv.c 21 Oct 2002 02:37:22 -0000 1.211
--- nickserv.c 28 Oct 2002 02:01:47 -0000 1.212
***************
*** 2713,2720 ****
}
! if (subcmd && !svccmd_can_invoke(user, nickserv, subcmd, NULL, 0)) {
! nickserv_notice(user, NSMSG_NO_ACCESS);
! return 0;
! }
discrim = nickserv_discrim_create(user, argc-2, argv+2);
--- 2713,2717 ----
}
! if (subcmd && !svccmd_can_invoke(user, nickserv, subcmd, NULL, 0, 0, 1)) return 0;
discrim = nickserv_discrim_create(user, argc-2, argv+2);
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.284
retrieving revision 1.285
diff -C2 -r1.284 -r1.285
*** opserv.c 26 Oct 2002 16:17:18 -0000 1.284
--- opserv.c 28 Oct 2002 02:01:47 -0000 1.285
***************
*** 2282,2290 ****
exp.value.table.contents[row] = calloc(exp.value.table.width, sizeof(char*));
exp.value.table.contents[row][0] = iter_key(it);
! level = 0;
! do {
! if (level < cmd->min_opserv_level) level = cmd->min_opserv_level;
! cmd = cmd->template;
! } while (cmd);
if (!level_strings[level]) {
level_strings[level] = malloc(16);
--- 2282,2286 ----
exp.value.table.contents[row] = calloc(exp.value.table.width, sizeof(char*));
exp.value.table.contents[row][0] = iter_key(it);
! level = cmd->min_opserv_level;
if (!level_strings[level]) {
level_strings[level] = malloc(16);
***************
*** 2297,2305 ****
exp.type = HF_STRING;
if (cmd) {
! level = 0;
! do {
! if (level < cmd->min_opserv_level) level = cmd->min_opserv_level;
! cmd = cmd->template;
! } while (cmd);
exp.value.str = malloc(16);
snprintf(exp.value.str, 16, "%3d", level);
--- 2293,2297 ----
exp.type = HF_STRING;
if (cmd) {
! level = cmd->min_opserv_level;
exp.value.str = malloc(16);
snprintf(exp.value.str, 16, "%3d", level);
***************
*** 3243,3247 ****
return 0;
}
! if (!svccmd_can_invoke(user, opserv, subcmd, channel, 0)) return 0;
if (!irccasecmp(argv[1], "print")) action = trace_print_func;
else if (!irccasecmp(argv[1], "count")) action = trace_count_func;
--- 3235,3239 ----
return 0;
}
! if (!svccmd_can_invoke(user, opserv, subcmd, channel, 0, 0, 1)) return 0;
if (!irccasecmp(argv[1], "print")) action = trace_print_func;
else if (!irccasecmp(argv[1], "count")) action = trace_count_func;
***************
*** 3457,3461 ****
sprintf(buf, "%s %s", argv[0], argv[0]);
if ((subcmd = opserv_get_command(buf))
! && !svccmd_can_invoke(user, cmd->parent->bot, subcmd, channel, 0)) {
return 0;
}
--- 3449,3453 ----
sprintf(buf, "%s %s", argv[0], argv[0]);
if ((subcmd = opserv_get_command(buf))
! && !svccmd_can_invoke(user, cmd->parent->bot, subcmd, channel, 0, 0, 1)) {
return 0;
}
***************
*** 3551,3555 ****
sprintf(buf, "%s %s", argv[0], argv[0]);
if ((subcmd = opserv_get_command(buf))
! && !svccmd_can_invoke(user, cmd->parent->bot, subcmd, channel, 0)) {
return 0;
}
--- 3543,3547 ----
sprintf(buf, "%s %s", argv[0], argv[0]);
if ((subcmd = opserv_get_command(buf))
! && !svccmd_can_invoke(user, cmd->parent->bot, subcmd, channel, 0, 0, 1)) {
return 0;
}
***************
*** 3801,3805 ****
return 0;
}
! if (!svccmd_can_invoke(user, opserv, subcmd, channel, 0)) return 0;
if (opserv_add_user_alert(user, name, reaction, unsplit_string(argv + 3, argc - 3, NULL))) {
opserv_notice(user, OSMSG_ADDED_ALERT, name);
--- 3793,3797 ----
return 0;
}
! if (!svccmd_can_invoke(user, opserv, subcmd, channel, 0, 0, 1)) return 0;
if (opserv_add_user_alert(user, name, reaction, unsplit_string(argv + 3, argc - 3, NULL))) {
opserv_notice(user, OSMSG_ADDED_ALERT, name);
|
|
From: Entrope <en...@us...> - 2002-10-28 01:56:04
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv12708/src
Modified Files:
helpserv.c
Log Message:
fix memory leak when writing database
Index: helpserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpserv.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -r1.43 -r1.44
*** helpserv.c 26 Oct 2002 16:40:55 -0000 1.43
--- helpserv.c 28 Oct 2002 01:56:01 -0000 1.44
***************
*** 2974,2977 ****
--- 2974,2978 ----
}
saxdb_write_string_list(ctx, KEY_PAGE_DEST, slist);
+ free_string_list(slist);
for (pagesrc=0; pagesrc<PGSRC_COUNT; pagesrc++) {
const char *src = page_type_names[hs->page_types[pagesrc]];
|
|
From: Entrope <en...@us...> - 2002-10-28 01:55:36
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv12485/src
Modified Files:
chanserv.help
Log Message:
add peoninvite help entry
Index: chanserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.help,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -r1.41 -r1.42
*** chanserv.help 26 Oct 2002 15:18:15 -0000 1.41
--- chanserv.help 28 Oct 2002 01:55:33 -0000 1.42
***************
*** 348,351 ****
--- 348,352 ----
"DYNLIMIT: Adjusts user limit (+l channel mode) to prevent join floods.",
"TOPICSNARF: Topics set manually (by /TOPIC #channel ...) change default $C topic",
+ "PEONINVITE: Indicates whether peons may use the $bINVITEME$b command.",
"$bIRCOP ONLY$b:",
"NODELETE: Prevents channel deletion.",
|
|
From: Entrope <en...@us...> - 2002-10-28 01:54:56
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv12087/src Modified Files: proto-common.c Log Message: include <sys/socket.h> to hopefully fix cygwin compile Index: proto-common.c =================================================================== RCS file: /cvsroot/srvx/services/src/proto-common.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** proto-common.c 23 Oct 2002 16:02:08 -0000 1.20 --- proto-common.c 28 Oct 2002 01:54:53 -0000 1.21 *************** *** 26,29 **** --- 26,32 ---- #include "policer.h" #include "timeq.h" + #ifdef HAVE_SYS_SOCKET_H + #include <sys/socket.h> + #endif unsigned int lines_processed; |
|
From: Entrope <en...@us...> - 2002-10-28 01:54:27
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv11798/src
Modified Files:
saxdb.c
Log Message:
add a space after opening { in a record
Index: saxdb.c
===================================================================
RCS file: /cvsroot/srvx/services/src/saxdb.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** saxdb.c 18 Sep 2002 14:54:21 -0000 1.16
--- saxdb.c 28 Oct 2002 01:54:23 -0000 1.17
***************
*** 239,243 ****
saxdb_pre_object(dest);
saxdb_put_qstring(dest, name);
! saxdb_put_string(dest, " {");
int_list_append(&dest->complex, complex);
if (complex) {
--- 239,243 ----
saxdb_pre_object(dest);
saxdb_put_qstring(dest, name);
! saxdb_put_string(dest, " { ");
int_list_append(&dest->complex, complex);
if (complex) {
|
|
From: Adrian D. <sai...@us...> - 2002-10-27 20:13:31
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv27472
Modified Files:
helpserv.c
Log Message:
Fix some problems with "empty no more" alerts (happened too much) and request on join (helpers got requests)
Give credit to the last helper to leave the help channel with the empty alert
Index: helpserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpserv.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -r1.42 -r1.43
*** helpserv.c 26 Oct 2002 16:15:15 -0000 1.42
--- helpserv.c 26 Oct 2002 16:40:55 -0000 1.43
***************
*** 198,202 ****
#define HSMSG_PAGE_IDLE_HEADER "$b%u users$b in %s $bidle at least %s$b:"
#define HSMSG_PAGE_EMPTYALERT "$b%s has no helpers present$b"
! #define HSMSG_PAGE_ONLYTRIALALERT "$b%s has no full helpers present (%d trial%s)$b"
#define HSMSG_PAGE_EMPTYNOMORE "%s has joined %s; cancelling the \"no helpers present\" alert"
--- 198,204 ----
#define HSMSG_PAGE_IDLE_HEADER "$b%u users$b in %s $bidle at least %s$b:"
#define HSMSG_PAGE_EMPTYALERT "$b%s has no helpers present$b"
! #define HSMSG_PAGE_ONLYTRIALALERT "$b%s has no full helpers present (%d trial%s present)$b"
! #define HSMSG_PAGE_FIRSTEMPTYALERT "$b%s has no helpers present because %s has left$b"
! #define HSMSG_PAGE_FIRSTONLYTRIALALERT "$b%s has no full helpers present because %s has left (%d trial%s present)$b"
#define HSMSG_PAGE_EMPTYNOMORE "%s has joined %s; cancelling the \"no helpers present\" alert"
***************
*** 408,411 ****
--- 410,415 ----
unsigned int req_on_join : 1;
+ unsigned int helpchan_empty : 1;
+
time_t registered;
char *registrar;
***************
*** 2194,2201 ****
}
! static void run_empty_interval(void *data) {
! struct helpserv_bot *hs=data;
! dict_iterator_t it;
int num_trials=0;
for (it=dict_first(hs->users); it; it=iter_next(it)) {
--- 2198,2208 ----
}
! /* Returns -1 if there's any helpers,
! * 0 if there are no helpers
! * >1 if there are trials (number of trials)
! */
! static int find_helpchan_helpers(struct helpserv_bot *hs) {
int num_trials=0;
+ dict_iterator_t it;
for (it=dict_first(hs->users); it; it=iter_next(it)) {
***************
*** 2203,2211 ****
if (find_handle_in_channel(hs->helpchan, hs_user->handle, NULL)) {
! if (hs_user->level >= HlHelper) return;
num_trials++;
}
}
if (num_trials) {
helpserv_page(PGSRC_ALERT, HSMSG_PAGE_ONLYTRIALALERT, hs->helpchan->name, num_trials, (num_trials == 1 ? "" : "s"));
--- 2210,2232 ----
if (find_handle_in_channel(hs->helpchan, hs_user->handle, NULL)) {
! if (hs_user->level >= HlHelper) {
! hs->helpchan_empty = 0;
! return -1;
! }
num_trials++;
}
}
+ hs->helpchan_empty = 1;
+ return num_trials;
+ }
+
+
+ static void run_empty_interval(void *data) {
+ struct helpserv_bot *hs=data;
+ int num_trials=find_helpchan_helpers(hs);
+
+ if (num_trials == -1) return;
+
if (num_trials) {
helpserv_page(PGSRC_ALERT, HSMSG_PAGE_ONLYTRIALALERT, hs->helpchan->name, num_trials, (num_trials == 1 ? "" : "s"));
***************
*** 3202,3207 ****
if (hs->intervals[INTERVAL_EMPTY_INTERVAL]) {
! timeq_del(0, run_empty_interval, hs, TIMEQ_IGNORE_WHEN);
! run_empty_interval(hs);
}
}
--- 3223,3236 ----
if (hs->intervals[INTERVAL_EMPTY_INTERVAL]) {
! int num_trials;
! if ((num_trials = find_helpchan_helpers(hs)) >= 0) {
! if (num_trials) {
! helpserv_page(PGSRC_ALERT, HSMSG_PAGE_FIRSTONLYTRIALALERT, hs->helpchan->name, user->nick, num_trials, (num_trials == 1 ? "" : "s"));
! } else {
! helpserv_page(PGSRC_ALERT, HSMSG_PAGE_FIRSTEMPTYALERT, hs->helpchan->name, user->nick);
! }
! timeq_del(0, run_empty_interval, hs, TIMEQ_IGNORE_WHEN);
! timeq_add(now + hs->intervals[INTERVAL_EMPTY_INTERVAL], run_empty_interval, hs);
! }
}
}
***************
*** 3371,3375 ****
struct helpserv_bot *hs=botlist->list[i];
- helpserv_message(hs, user, MSGTYPE_GREETING);
associate_requests_bybot(hs, user, 1);
--- 3400,3403 ----
***************
*** 3380,3391 ****
if (!hs_user->join_time) hs_user->join_time = now;
! if (hs_user->level >= HlHelper && hs->intervals[INTERVAL_EMPTY_INTERVAL]) {
timeq_del(0, run_empty_interval, hs, TIMEQ_IGNORE_WHEN);
helpserv_page(PGSRC_ALERT, HSMSG_PAGE_EMPTYNOMORE, user->nick, hs->helpchan->name);
}
}
}
! /* Make sure this is at the end (because of the continue) */
if (hs->req_on_join) {
struct helpserv_reqlist *reqlist;
--- 3408,3423 ----
if (!hs_user->join_time) hs_user->join_time = now;
! if (hs_user->level >= HlHelper && hs->intervals[INTERVAL_EMPTY_INTERVAL] && hs->helpchan_empty) {
! hs->helpchan_empty = 0;
timeq_del(0, run_empty_interval, hs, TIMEQ_IGNORE_WHEN);
helpserv_page(PGSRC_ALERT, HSMSG_PAGE_EMPTYNOMORE, user->nick, hs->helpchan->name);
}
+ continue; /* Don't want helpers to have request-on-join */
}
}
! helpserv_message(hs, user, MSGTYPE_GREETING);
!
! /* Make sure this is at the end (because of the continues) */
if (hs->req_on_join) {
struct helpserv_reqlist *reqlist;
|
|
From: Entrope <en...@us...> - 2002-10-26 22:51:44
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv2412/src
Modified Files:
modcmd.c modcmd.help
Log Message:
implement and document a "showcommands" command (see featreq #572558)
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -r1.32 -r1.33
*** modcmd.c 11 Oct 2002 03:11:57 -0000 1.32
--- modcmd.c 26 Oct 2002 22:51:40 -0000 1.33
***************
*** 27,32 ****
#define MCMSG_BARE_FLAG "Flag %.*s must be preceeded by a + or -."
#define MCMSG_UNKNOWN_FLAG "Unknown module flag %.*s."
! #define MCMSG_BAD_OPSERV_LEVEL "Invalid OpServ access level %s."
! #define MCMSG_BAD_CHANSERV_LEVEL "Invalid ChanServ access level %s."
#define MCMSG_UNKNOWN_COMMAND "Unknown command name %s (as template for %s in service %s)."
#define MCMSG_BAD_WEIGHT "Invalid command weight %s."
--- 27,32 ----
#define MCMSG_BARE_FLAG "Flag %.*s must be preceeded by a + or -."
#define MCMSG_UNKNOWN_FLAG "Unknown module flag %.*s."
! #define MCMSG_BAD_OPSERV_LEVEL "Invalid $O access level %s."
! #define MCMSG_BAD_CHANSERV_LEVEL "Invalid $C access level %s."
#define MCMSG_UNKNOWN_COMMAND "Unknown command name %s (as template for %s in service %s)."
#define MCMSG_BAD_WEIGHT "Invalid command weight %s."
***************
*** 450,454 ****
*/
static int
! svccmd_can_invoke_real(struct userNode *user, struct userNode *bot, struct svccmd *cmd, struct chanNode *channel, int server_qualified, int debit) {
unsigned int uData_checked = 0;
struct userData *uData = NULL;
--- 450,454 ----
*/
static int
! svccmd_can_invoke_real(struct userNode *user, struct userNode *bot, struct svccmd *cmd, struct chanNode *channel, char server_qualified, char debit, char noisy) {
unsigned int uData_checked = 0;
struct userData *uData = NULL;
***************
*** 456,517 ****
if (cmd->flags & MODCMD_DISABLED) {
! send_message(user, bot, MSG_COMMAND_DISABLED, cmd->name);
return 0;
}
if ((cmd->flags & MODCMD_REQUIRE_QUALIFIED) && !server_qualified) {
! send_message(user, bot, MCMSG_MUST_QUALIFY, bot->nick, cmd->name, bot->nick);
return 0;
}
if ((cmd->flags & MODCMD_REQUIRE_AUTHED) && !user->handle_info) {
! send_message(user, bot, MSG_AUTHENTICATE);
return 0;
}
! if ((cmd->flags & MODCMD_REQUIRE_CHANNEL) && !channel) {
! send_message(user, bot, MSG_INVALID_CHANNEL);
! return 0;
! }
! if (cmd->flags & MODCMD_REQUIRE_REGCHAN) {
! if (!channel) {
! /* XXX: could maybe figure out better way to handle this case */
! send_message(user, bot, MSG_INVALID_CHANNEL);
return 0;
! } else {
! if (!channel->channel_info) {
! send_message(user, bot, MCMSG_CHAN_NOT_REGISTERED, channel->name);
return 0;
}
}
! }
! if (cmd->flags & MODCMD_REQUIRE_CHANUSER) {
! if (!uData_checked) uData = _GetChannelUser(channel->channel_info, user->handle_info, 1, 0), uData_checked = 1;
! if (!uData) {
! send_message(user, bot, MCMSG_NO_CHANNEL_ACCESS, channel->name);
! return 0;
! } else if (uData->access < cmd->min_channel_access) {
! send_message(user, bot, MCMSG_LOW_CHANNEL_ACCESS, channel->name);
! return 0;
}
! }
! if (cmd->flags & MODCMD_REQUIRE_JOINABLE) {
! if (!uData_checked) uData = _GetChannelUser(channel->channel_info, user->handle_info, 1, 0), uData_checked = 1;
! if ((channel->modes & (MODE_INVITEONLY|MODE_KEY))
! && (!channel->channel_info || !uData)
! && !IsService(user)
! && !GetUserMode(channel, user)) {
! send_message(user, bot, MCMSG_REQUIRES_JOINABLE, channel->name);
! return 0;
}
! }
! if ((cmd->flags & MODCMD_TOY) && channel) {
! char opt = channel->channel_info ? channel->channel_info->options[optToys] : 'n';
! switch (opt) {
! case 'd':
! send_message(user, bot, MCMSG_TOYS_DISABLED, channel->name);
! return 0;
! case 'n':
! rflags |= ACTION_NOCHANNEL;
! break;
! case 'p':
! break;
}
}
--- 456,517 ----
if (cmd->flags & MODCMD_DISABLED) {
! if (noisy) send_message(user, bot, MSG_COMMAND_DISABLED, cmd->name);
return 0;
}
if ((cmd->flags & MODCMD_REQUIRE_QUALIFIED) && !server_qualified) {
! if (noisy) send_message(user, bot, MCMSG_MUST_QUALIFY, bot->nick, cmd->name, bot->nick);
return 0;
}
if ((cmd->flags & MODCMD_REQUIRE_AUTHED) && !user->handle_info) {
! if (noisy) send_message(user, bot, MSG_AUTHENTICATE);
return 0;
}
! if (channel || noisy) {
! if ((cmd->flags & MODCMD_REQUIRE_CHANNEL) && !channel) {
! if (noisy) send_message(user, bot, MSG_INVALID_CHANNEL);
return 0;
! }
! if (cmd->flags & MODCMD_REQUIRE_REGCHAN) {
! if (!channel) {
! /* XXX: could maybe figure out better way to handle this case */
! if (noisy) send_message(user, bot, MSG_INVALID_CHANNEL);
! return 0;
! } else if (!channel->channel_info) {
! if (noisy) send_message(user, bot, MCMSG_CHAN_NOT_REGISTERED, channel->name);
return 0;
}
}
! if (cmd->flags & MODCMD_REQUIRE_CHANUSER) {
! if (!uData_checked) uData = _GetChannelUser(channel->channel_info, user->handle_info, 1, 0), uData_checked = 1;
! if (!uData) {
! if (noisy) send_message(user, bot, MCMSG_NO_CHANNEL_ACCESS, channel->name);
! return 0;
! } else if (uData->access < cmd->min_channel_access) {
! if (noisy) send_message(user, bot, MCMSG_LOW_CHANNEL_ACCESS, channel->name);
! return 0;
! }
}
! if (cmd->flags & MODCMD_REQUIRE_JOINABLE) {
! if (!uData_checked) uData = _GetChannelUser(channel->channel_info, user->handle_info, 1, 0), uData_checked = 1;
! if ((channel->modes & (MODE_INVITEONLY|MODE_KEY))
! && (!channel->channel_info || !uData)
! && !IsService(user)
! && !GetUserMode(channel, user)) {
! if (noisy) send_message(user, bot, MCMSG_REQUIRES_JOINABLE, channel->name);
! return 0;
! }
}
! if ((cmd->flags & MODCMD_TOY) && channel) {
! char opt = channel->channel_info ? channel->channel_info->options[optToys] : 'n';
! switch (opt) {
! case 'd':
! if (noisy) send_message(user, bot, MCMSG_TOYS_DISABLED, channel->name);
! return 0;
! case 'n':
! rflags |= ACTION_NOCHANNEL;
! break;
! case 'p':
! break;
! }
}
}
***************
*** 522,539 ****
/* allow it */
} else {
! send_message(user, bot, MSG_COMMAND_PRIVILEGED, cmd->name);
return 0;
}
}
if ((cmd->flags & MODCMD_REQUIRE_HELPING) && !HANDLE_FLAGGED(user->handle_info, HELPING)) {
! send_message(user, bot, MCMSG_MUST_BE_HELPING);
return 0;
}
if (cmd->min_opserv_level > 0) {
! if (!oper_has_access(user, bot, cmd->min_opserv_level, 0)) return 0;
}
if (cmd->req_account_flags || cmd->deny_account_flags) {
if (!user->handle_info) {
! send_message(user, bot, MSG_AUTHENTICATE);
return 0;
}
--- 522,539 ----
/* allow it */
} else {
! if (noisy) send_message(user, bot, MSG_COMMAND_PRIVILEGED, cmd->name);
return 0;
}
}
if ((cmd->flags & MODCMD_REQUIRE_HELPING) && !HANDLE_FLAGGED(user->handle_info, HELPING)) {
! if (noisy) send_message(user, bot, MCMSG_MUST_BE_HELPING);
return 0;
}
if (cmd->min_opserv_level > 0) {
! if (!oper_has_access(user, bot, cmd->min_opserv_level, !noisy)) return 0;
}
if (cmd->req_account_flags || cmd->deny_account_flags) {
if (!user->handle_info) {
! if (noisy) send_message(user, bot, MSG_AUTHENTICATE);
return 0;
}
***************
*** 541,550 ****
if ((cmd->req_account_flags & ~user->handle_info->flags)
|| (cmd->deny_account_flags & user->handle_info->flags)) {
! send_message(user, bot, MSG_COMMAND_PRIVILEGED, cmd->name);
return 0;
}
}
if (debit && !policer_conforms(user->command_policer, now, cmd->weight)) {
! send_message(user, bot, MSG_COMMAND_FLOOD);
return 0;
}
--- 541,550 ----
if ((cmd->req_account_flags & ~user->handle_info->flags)
|| (cmd->deny_account_flags & user->handle_info->flags)) {
! if (noisy) send_message(user, bot, MSG_COMMAND_PRIVILEGED, cmd->name);
return 0;
}
}
if (debit && !policer_conforms(user->command_policer, now, cmd->weight)) {
! if (noisy) send_message(user, bot, MSG_COMMAND_FLOOD);
return 0;
}
***************
*** 552,555 ****
--- 552,556 ----
/* If it's an override, return a special value. */
if ((cmd->flags & MODCMD_REQUIRE_CHANUSER)
+ && noisy
&& (uData->access > ulOwner)
&& (!(uData = _GetChannelUser(channel->channel_info, user->handle_info, 0, 0))
***************
*** 565,569 ****
struct svccmd collapsed;
svccmd_collapse(cmd, &collapsed, 0);
! return svccmd_can_invoke_real(user, bot, &collapsed, channel, server_qualified, 0);
}
--- 566,570 ----
struct svccmd collapsed;
svccmd_collapse(cmd, &collapsed, 0);
! return svccmd_can_invoke_real(user, bot, &collapsed, channel, server_qualified, 0, 1);
}
***************
*** 684,688 ****
channel = NULL;
}
! perms = svccmd_can_invoke_real(user, service->bot, &cmd, channel, server_qualified, 1);
if (!perms) return 0;
if (argc < cmd.command->min_argc) {
--- 685,689 ----
channel = NULL;
}
! perms = svccmd_can_invoke_real(user, service->bot, &cmd, channel, server_qualified, 1, 1);
if (!perms) return 0;
if (argc < cmd.command->min_argc) {
***************
*** 1455,1458 ****
--- 1456,1537 ----
}
+ static MODCMD_FUNC(cmd_showcommands) {
+ struct svccmd_list commands;
+ struct svccmd collapsed;
+ struct helpfile_table tbl;
+ struct svccmd *svccmd;
+ dict_iterator_t it;
+ unsigned int ii, ignore_flags = 0;
+ unsigned int max_opserv_level = 1000;
+ enum userLevel max_chanserv_level = ulOwner;
+ char show_opserv_level = 0, show_channel_access = 0;
+
+ /* Check to see what the max access they want to see is. */
+ for (ii=1; ii<argc; ++ii) {
+ if (isdigit(argv[ii][0])) {
+ max_opserv_level = atoi(argv[ii]);
+ } else {
+ max_chanserv_level = user_level_from_name(argv[ii]);
+ if ((max_chanserv_level == ulNone) && irccasecmp(argv[ii], "none")) {
+ reply(MCMSG_BAD_CHANSERV_LEVEL, argv[ii]);
+ return 0;
+ }
+ }
+ }
+
+ /* Find the matching commands. */
+ svccmd_list_init(&commands);
+ if (cmd->parent->privileged) ignore_flags = MODCMD_REQUIRE_OPER;
+ for (it = dict_first(cmd->parent->commands); it; it = iter_next(it)) {
+ svccmd = iter_data(it);
+ if (strchr(svccmd->name, ' ')) continue;
+ svccmd_collapse(svccmd, &collapsed, 0);
+ if (!svccmd_can_invoke_real(user, cmd->parent->bot, &collapsed, channel, 1, 0, 0)) continue;
+ if (collapsed.min_opserv_level > max_opserv_level) continue;
+ if (collapsed.min_channel_access > max_chanserv_level) continue;
+ if (collapsed.min_opserv_level > 0) show_opserv_level = 1;
+ if (collapsed.min_channel_access > ulNone) show_channel_access = 1;
+ if (collapsed.flags & (MODCMD_REQUIRE_STAFF|MODCMD_REQUIRE_HELPING) & ~ignore_flags) show_channel_access = 1;
+ svccmd_list_append(&commands, svccmd);
+ }
+
+ /* Build the table. */
+ tbl.length = commands.used + 1;
+ tbl.width = 1 + show_opserv_level + show_channel_access;
+ tbl.flags = TABLE_REPEAT_ROWS;
+ tbl.contents = calloc(tbl.length, sizeof(tbl.contents[0]));
+ tbl.contents[0] = calloc(tbl.width, sizeof(tbl.contents[0][0]));
+ tbl.contents[0][0] = "Command";
+ if (show_opserv_level && show_channel_access) {
+ tbl.contents[0][1] = "OpServ Access";
+ tbl.contents[0][2] = "ChanServ Access";
+ } else if (show_opserv_level || show_channel_access) {
+ tbl.contents[0][1] = "Access";
+ }
+ for (ii=0; ii<commands.used; ++ii) {
+ svccmd = commands.list[ii];
+ tbl.contents[ii+1] = calloc(tbl.width, sizeof(tbl.contents[0][0]));
+ tbl.contents[ii+1][0] = svccmd->name;
+ svccmd_collapse(svccmd, &collapsed, 0);
+ if (show_opserv_level) tbl.contents[ii+1][1] = strtab(collapsed.min_opserv_level);
+ if (show_channel_access) {
+ const char *access;
+ if (collapsed.flags & MODCMD_REQUIRE_HELPING) access = "helping";
+ else if (collapsed.flags & MODCMD_REQUIRE_STAFF) {
+ switch (collapsed.flags & MODCMD_REQUIRE_STAFF) {
+ case MODCMD_REQUIRE_OPER: access = "oper"; break;
+ case MODCMD_REQUIRE_OPER | MODCMD_REQUIRE_NETWORK_HELPER:
+ case MODCMD_REQUIRE_NETWORK_HELPER: access = "net.helper"; break;
+ default: access = "staff"; break;
+ }
+ } else access = user_level_from_level(collapsed.min_channel_access);
+ tbl.contents[ii+1][1+show_opserv_level] = access;
+ }
+ }
+ svccmd_list_clean(&commands);
+ table_send(cmd->parent->bot, user->nick, 0, 0, tbl);
+ return 0;
+ }
+
void
modcmd_nick_change(struct userNode *user, const char *new_nick) {
***************
*** 1563,1566 ****
--- 1642,1646 ----
modcmd_register(modcmd_module, "stats modules", cmd_stats_modules, 1, 0, "access", "0", NULL);
modcmd_register(modcmd_module, "stats services", cmd_stats_services, 1, 0, "access", "0", NULL);
+ modcmd_register(modcmd_module, "showcommands", cmd_showcommands, 1, 0, NULL);
}
Index: modcmd.help
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.help,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** modcmd.help 24 Sep 2002 19:21:01 -0000 1.6
--- modcmd.help 26 Oct 2002 22:51:41 -0000 1.7
***************
*** 63,64 ****
--- 63,67 ----
"When a bot nick is given, shows commands bound to that service.",
"$uSee Also:$u stats modules, command, modcmd, bind, unbind");
+ "showcommands" ("/msg $S SHOWCOMMANDS [opserv-access] [channel-access]",
+ "Shows commands which you can execute (with their required access levels). If you give a numeric $O access level or text $C access name, it further restricts output to only show commands which can be executed by users with that access.",
+ "$uSee Also:$u command");
|
|
From: Entrope <en...@us...> - 2002-10-26 22:50:56
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv1293/src
Modified Files:
chanserv.c
Log Message:
change from using "account_flags" "+g" to using "flags" "+helping"
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.297
retrieving revision 1.298
diff -C2 -r1.297 -r1.298
*** chanserv.c 26 Oct 2002 15:18:15 -0000 1.297
--- chanserv.c 26 Oct 2002 22:50:53 -0000 1.298
***************
*** 7095,7103 ****
chanserv_module = module_register("ChanServ", CS_LOG, "chanserv.help", chanserv_expand_variable);
! DEFINE_COMMAND(register, 1, MODCMD_REQUIRE_AUTHED, "account_flags", "+g", "flags", "+acceptchan", NULL);
! DEFINE_COMMAND(noregister, 1, MODCMD_REQUIRE_AUTHED, "account_flags", "+g", NULL);
DEFINE_COMMAND(allowregister, 2, 0, "template", "noregister", NULL);
DEFINE_COMMAND(move, 2, MODCMD_REQUIRE_AUTHED|MODCMD_REQUIRE_REGCHAN, "template", "register", NULL);
! DEFINE_COMMAND(csuspend, 2, MODCMD_REQUIRE_AUTHED|MODCMD_REQUIRE_REGCHAN, "account_flags", "+g", NULL);
DEFINE_COMMAND(cunsuspend, 2, MODCMD_REQUIRE_AUTHED, "template", "csuspend", NULL);
DEFINE_COMMAND(createnote, 5, 0, "access", "800", NULL);
--- 7095,7103 ----
chanserv_module = module_register("ChanServ", CS_LOG, "chanserv.help", chanserv_expand_variable);
! DEFINE_COMMAND(register, 1, MODCMD_REQUIRE_AUTHED, "flags", "+acceptchan,+helping", NULL);
! DEFINE_COMMAND(noregister, 1, MODCMD_REQUIRE_AUTHED, "flags", "+helping", NULL);
DEFINE_COMMAND(allowregister, 2, 0, "template", "noregister", NULL);
DEFINE_COMMAND(move, 2, MODCMD_REQUIRE_AUTHED|MODCMD_REQUIRE_REGCHAN, "template", "register", NULL);
! DEFINE_COMMAND(csuspend, 2, MODCMD_REQUIRE_AUTHED|MODCMD_REQUIRE_REGCHAN, "flags", "+helping", NULL);
DEFINE_COMMAND(cunsuspend, 2, MODCMD_REQUIRE_AUTHED, "template", "csuspend", NULL);
DEFINE_COMMAND(createnote, 5, 0, "access", "800", NULL);
***************
*** 7110,7114 ****
DEFINE_COMMAND(deluser, 2, MODCMD_REQUIRE_CHANUSER, "access", "master", NULL);
! DEFINE_COMMAND(mdelowner, 2, MODCMD_REQUIRE_CHANUSER, "account_flags", "+g", NULL);
DEFINE_COMMAND(mdelcoowner, 2, MODCMD_REQUIRE_CHANUSER, "access", "owner", NULL);
DEFINE_COMMAND(mdelmaster, 2, MODCMD_REQUIRE_CHANUSER, "access", "coowner", NULL);
--- 7110,7114 ----
DEFINE_COMMAND(deluser, 2, MODCMD_REQUIRE_CHANUSER, "access", "master", NULL);
! DEFINE_COMMAND(mdelowner, 2, MODCMD_REQUIRE_CHANUSER, "flags", "+helping", NULL);
DEFINE_COMMAND(mdelcoowner, 2, MODCMD_REQUIRE_CHANUSER, "access", "owner", NULL);
DEFINE_COMMAND(mdelmaster, 2, MODCMD_REQUIRE_CHANUSER, "access", "coowner", NULL);
***************
*** 7178,7184 ****
DEFINE_COMMAND(emote, 2, 0, "flags", "+oper,+acceptchan", NULL);
DEFINE_COMMAND(expire, 1, 0, "flags", "+oper", NULL);
! DEFINE_COMMAND(last, 1, 0, "account_flags", "+g", "flags", "+nolog", NULL);
! DEFINE_COMMAND(search, 3, 0, "account_flags", "+g", "flags", "+nolog", NULL);
! DEFINE_COMMAND(unvisited, 1, 0, "account_flags", "+g", "flags", "+nolog", NULL);
DEFINE_COMMAND(unf, 1, 0, "flags", "+nolog,+toy,+acceptchan", NULL);
--- 7178,7184 ----
DEFINE_COMMAND(emote, 2, 0, "flags", "+oper,+acceptchan", NULL);
DEFINE_COMMAND(expire, 1, 0, "flags", "+oper", NULL);
! DEFINE_COMMAND(last, 1, 0, "flags", "+nolog,+helping", NULL);
! DEFINE_COMMAND(search, 3, 0, "flags", "+nolog,+helping", NULL);
! DEFINE_COMMAND(unvisited, 1, 0, "flags", "+nolog,+helping", NULL);
DEFINE_COMMAND(unf, 1, 0, "flags", "+nolog,+toy,+acceptchan", NULL);
|
|
From: Entrope <en...@us...> - 2002-10-26 16:17:22
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv13028/src
Modified Files:
opserv.c opserv.help
Log Message:
add "log" trace criteria (really an action modifier, but .. whatever)
allow an oper to kill or gline self, since we handle that better now
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.283
retrieving revision 1.284
diff -C2 -r1.283 -r1.284
*** opserv.c 23 Oct 2002 12:37:54 -0000 1.283
--- opserv.c 26 Oct 2002 16:17:18 -0000 1.284
***************
*** 318,322 ****
char *mask_nick, *mask_ident, *mask_host, *mask_info, *server, *ip_mask_str, *reason;
unsigned long limit, ip_addr, ip_mask, min_level, max_level, domain_depth, duration, min_clones;
! unsigned int match_opers : 1, chan_req_modes : 2, chan_no_modes : 2;
time_t min_ts, max_ts;
} *discrim_t;
--- 318,323 ----
char *mask_nick, *mask_ident, *mask_host, *mask_info, *server, *ip_mask_str, *reason;
unsigned long limit, ip_addr, ip_mask, min_level, max_level, domain_depth, duration, min_clones;
! unsigned int match_opers : 1, option_log : 1;
! unsigned int chan_req_modes : 2, chan_no_modes : 2;
time_t min_ts, max_ts;
} *discrim_t;
***************
*** 2848,2857 ****
for (i=0; i<argc; i++) {
! /* Assume all criteria require arguments. */
if (i == argc - 1) {
opserv_notice(user, MSG_MISSING_PARAMS, argv[i]);
return NULL;
}
! if (!irccasecmp(argv[i], "mask")) {
if (!is_ircmask(argv[++i])) {
opserv_notice(user, OSMSG_INVALID_IRCMASK, argv[i]);
--- 2849,2862 ----
for (i=0; i<argc; i++) {
! if (irccasecmp(argv[i], "log") == 0) {
! discrim->option_log = 1;
! continue;
! }
! /* Assume all other criteria require arguments. */
if (i == argc - 1) {
opserv_notice(user, MSG_MISSING_PARAMS, argv[i]);
return NULL;
}
! if (irccasecmp(argv[i], "mask") == 0) {
if (!is_ircmask(argv[++i])) {
opserv_notice(user, OSMSG_INVALID_IRCMASK, argv[i]);
***************
*** 3053,3058 ****
}
for (nn=0; nn<matched.used; nn++) {
! if (dsf(matched.list[nn], data)) {
/* If a search function returns true, it ran into a
problem. Stop going through the list. */
--- 3058,3075 ----
}
+ if (!matched.used) {
+ userList_clean(&matched);
+ return 0;
+ }
+
+ if (discrim->option_log) {
+ log(OS_LOG, LOG_OTHER, "Logging matches for search:\n");
+ }
for (nn=0; nn<matched.used; nn++) {
! struct userNode *user = matched.list[nn];
! if (discrim->option_log) {
! log(OS_LOG, LOG_OTHER, " %s!%s@%s\n", user->nick, user->ident, user->hostname);
! }
! if (dsf(user, data)) {
/* If a search function returns true, it ran into a
problem. Stop going through the list. */
***************
*** 3060,3064 ****
}
}
!
count = matched.used;
userList_clean(&matched);
--- 3077,3083 ----
}
}
! if (discrim->option_log) {
! log(OS_LOG, LOG_OTHER, "End of matching users.\n");
! }
count = matched.used;
userList_clean(&matched);
***************
*** 3095,3101 ****
struct discrim_and_source *das = extra;
- /* See the comment in trace_kill_func() below. */
- if (das->source == match) return 0;
-
if (is_oper_victim(das->source, match, das->discrim->match_opers)) {
opserv_block(match, das->source->handle_info->handle, das->discrim->reason, das->discrim->duration);
--- 3114,3117 ----
***************
*** 3110,3118 ****
struct discrim_and_source *das = extra;
- /* If the person who issues a trace kill is among its victims,
- is_oper_victim will dereference a pointer to a user that doesn't
- exist anymore. We skip killing the issuing user to avoid this. */
- if (das->source == match) return 0;
-
if (is_oper_victim(das->source, match, das->discrim->match_opers)) {
char *reason;
--- 3126,3129 ----
***************
*** 3581,3584 ****
--- 3592,3598 ----
if (discrim_match(alert->discrim, user)) {
+ if (alert->discrim->option_log) {
+ log(OS_LOG, LOG_OTHER, "Alert %s triggered by user %s!%s@%s (%s).\n", key, user->nick, user->ident, user->hostname, alert->discrim->reason);
+ }
switch (alert->reaction) {
case REACT_KILL:
***************
*** 3592,3596 ****
/* fall through to REACT_NOTICE case */
case REACT_NOTICE:
! opserv_alert(OSMSG_ALERT_TRIGGERED, key, user->nick, user->ident, user->hostname, alert->discrim->reason);
break;
}
--- 3606,3610 ----
/* fall through to REACT_NOTICE case */
case REACT_NOTICE:
! opserv_alert(OSMSG_ALERT_TRIGGERED, key, user->nick, user->ident, user->hostname, alert->discrim->reason);
break;
}
Index: opserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.help,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -r1.52 -r1.53
*** opserv.help 21 Oct 2002 03:49:14 -0000 1.52
--- opserv.help 26 Oct 2002 16:17:19 -0000 1.53
***************
*** 82,85 ****
--- 82,86 ----
"$bCLONES$b min Ignore clients from hosts with fewer than this many connections.",
"$bABUSE OPERS$b Force adverse actions to affect opers as well.",
+ "$bLOG$b Record matching users in $O's log file (in addition to acting).",
"Additionally, the $bCHANNEL$b target may be prefixed with @ to select channel operators, + to select voiced users (will not select chanops unless @ is also used), or - to select non-voiced non-chanop users. For example, CHANNEL #foo will select all users in #foo; CHANNEL +#foo will select only users voiced in #foo; CHANNEL @+#foo will select ops and voiced users in #foo; etc.");
"WHOIS" ("/msg $O WHOIS <nick>",
|
|
From: Entrope <en...@us...> - 2002-10-26 16:15:20
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv11466/src
Modified Files:
helpserv.c helpserv.help
Log Message:
change HelpServ "set" output to always show the real option name
add ReqOnJoin option to helpserv.help
Index: helpserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpserv.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -r1.41 -r1.42
*** helpserv.c 25 Oct 2002 13:04:16 -0000 1.41
--- helpserv.c 26 Oct 2002 16:15:15 -0000 1.42
***************
*** 146,155 ****
#define HSMSG_QUEUE_OPTIONS "HelpServ Queue Options:"
#define HSMSG_STRING_VALUE "$b%19s $b%s"
- #define HSMSG_PAGE_TARGET_VALUE "$b%9s page dest $b%s"
- #define HSMSG_PAGE_TYPE_VALUE "$b%9s page type $b%s"
#define HSMSG_MESSAGE_VALUE "$b%11s message $b%s"
- #define HSMSG_INTERVAL_VALUE "$b%19s $b%s"
- #define HSMSG_PERSIST_VALUE "$b%19s $b%s"
- #define HSMSG_BINARY_VALUE "$b%19s $b%s"
#define HSMSG_INTEGER_VALUE "$b%19s $b%lu"
#define HSMSG_INVALID_INTERVAL "Sorry, %s must be %s %s."
--- 146,150 ----
***************
*** 2426,2429 ****
--- 2421,2426 ----
static int opt_page_target(struct userNode *user, struct helpserv_bot *hs, int from_opserv, int argc, unsigned char *argv[], enum page_source idx) {
int changed = 0;
+ char target_name[32];
+
if (argc > 0) {
if (!IsOper(user)) {
***************
*** 2442,2446 ****
}
}
! helpserv_notice(user, HSMSG_PAGE_TARGET_VALUE, page_source_names[idx], hs->page_targets[idx] ? hs->page_targets[idx]->name : "None");
return changed;
}
--- 2439,2444 ----
}
}
! sprintf(target_name, "%sPageTarget", (idx != PGSRC_COMMAND) ? page_source_names[idx] : "");
! helpserv_notice(user, HSMSG_STRING_VALUE, target_name, hs->page_targets[idx] ? hs->page_targets[idx]->name : "None");
return changed;
}
***************
*** 2469,2472 ****
--- 2467,2471 ----
enum page_type new_type;
int changed=0;
+ char target_name[32];
if (argc > 0) {
***************
*** 2479,2483 ****
changed = 1;
}
! helpserv_notice(user, HSMSG_PAGE_TYPE_VALUE, page_source_names[idx], page_type_names[hs->page_types[idx]]);
return changed;
}
--- 2478,2483 ----
changed = 1;
}
! sprintf(target_name, "%sPageDest", (idx != PGSRC_COMMAND) ? page_source_names[idx] : "");
! helpserv_notice(user, HSMSG_STRING_VALUE, target_name, page_type_names[hs->page_types[idx]]);
return changed;
}
***************
*** 2504,2508 ****
changed = 1;
}
! helpserv_notice(user, HSMSG_MESSAGE_VALUE, message_type_names[idx], hs->messages[idx] ? hs->messages[idx] : "None");
return changed;
}
--- 2504,2508 ----
changed = 1;
}
! helpserv_notice(user, HSMSG_STRING_VALUE, message_type_names[idx], hs->messages[idx] ? hs->messages[idx] : "None");
return changed;
}
***************
*** 2512,2524 ****
}
! static HELPSERV_OPTION(opt_openreq) {
return opt_message(user, hs, from_opserv, argc, argv, MSGTYPE_REQ_OPENED);
}
! static HELPSERV_OPTION(opt_assignreq) {
return opt_message(user, hs, from_opserv, argc, argv, MSGTYPE_REQ_ASSIGNED);
}
! static HELPSERV_OPTION(opt_closereq) {
return opt_message(user, hs, from_opserv, argc, argv, MSGTYPE_REQ_CLOSED);
}
--- 2512,2524 ----
}
! static HELPSERV_OPTION(opt_req_opened) {
return opt_message(user, hs, from_opserv, argc, argv, MSGTYPE_REQ_OPENED);
}
! static HELPSERV_OPTION(opt_req_assigned) {
return opt_message(user, hs, from_opserv, argc, argv, MSGTYPE_REQ_ASSIGNED);
}
! static HELPSERV_OPTION(opt_req_closed) {
return opt_message(user, hs, from_opserv, argc, argv, MSGTYPE_REQ_CLOSED);
}
***************
*** 2543,2547 ****
}
intervalString(buf, hs->intervals[idx]);
! helpserv_notice(user, HSMSG_INTERVAL_VALUE, interval_type_names[idx], hs->intervals[idx] ? buf : "0 (Disabled)");
return changed;
}
--- 2543,2547 ----
}
intervalString(buf, hs->intervals[idx]);
! helpserv_notice(user, HSMSG_STRING_VALUE, interval_type_names[idx], hs->intervals[idx] ? buf : "0 (Disabled)");
return changed;
}
***************
*** 2609,2613 ****
changed = 1;
}
! helpserv_notice(user, HSMSG_PERSIST_VALUE, persistence_type_names[idx], persistence_length_names[hs->persist_types[idx]]);
return changed;
}
--- 2609,2613 ----
changed = 1;
}
! helpserv_notice(user, HSMSG_STRING_VALUE, persistence_type_names[idx], persistence_length_names[hs->persist_types[idx]]);
return changed;
}
***************
*** 2674,2678 ****
} \
} \
! helpserv_notice(user, HSMSG_BINARY_VALUE, (name), (var) ? "Enabled" : "Disabled"); \
return changed; \
} while (0);
--- 2674,2678 ----
} \
} \
! helpserv_notice(user, HSMSG_STRING_VALUE, (name), (var) ? "Enabled" : "Disabled"); \
return changed; \
} while (0);
***************
*** 2680,2688 ****
static HELPSERV_OPTION(opt_privmsg_only) {
! OPTION_BINARY(hs->privmsg_only, "Privmsg Only");
}
static HELPSERV_OPTION(opt_req_on_join) {
! OPTION_BINARY(hs->req_on_join, "Join opens request");
}
--- 2680,2688 ----
static HELPSERV_OPTION(opt_privmsg_only) {
! OPTION_BINARY(hs->privmsg_only, "PrivmsgOnly");
}
static HELPSERV_OPTION(opt_req_on_join) {
! OPTION_BINARY(hs->req_on_join, "ReqOnJoin");
}
***************
*** 2695,2699 ****
opt_pagetarget_command, opt_pagetarget_alert, opt_pagetarget_status,
opt_pagetype, opt_alert_page_type, opt_status_page_type,
! opt_greeting, opt_openreq, opt_assignreq, opt_closereq,
opt_idle_delay, opt_whine_delay, opt_whine_interval,
opt_empty_interval, opt_stale_delay, opt_request_persistence,
--- 2695,2699 ----
opt_pagetarget_command, opt_pagetarget_alert, opt_pagetarget_status,
opt_pagetype, opt_alert_page_type, opt_status_page_type,
! opt_greeting, opt_req_opened, opt_req_assigned, opt_req_closed,
opt_idle_delay, opt_whine_delay, opt_whine_interval,
opt_empty_interval, opt_stale_delay, opt_request_persistence,
***************
*** 3873,3879 ****
helpserv_define_option("STATUSPAGETYPE", opt_status_page_type);
helpserv_define_option("GREETING", opt_greeting);
! helpserv_define_option("OPENREQ", opt_openreq);
! helpserv_define_option("ASSIGNREQ", opt_assignreq);
! helpserv_define_option("CLOSEREQ", opt_closereq);
helpserv_define_option("IDLEDELAY", opt_idle_delay);
helpserv_define_option("WHINEDELAY", opt_whine_delay);
--- 3873,3879 ----
helpserv_define_option("STATUSPAGETYPE", opt_status_page_type);
helpserv_define_option("GREETING", opt_greeting);
! helpserv_define_option("REQOPENED", opt_req_opened);
! helpserv_define_option("REQASSIGNED", opt_req_assigned);
! helpserv_define_option("REQCLOSED", opt_req_closed);
helpserv_define_option("IDLEDELAY", opt_idle_delay);
helpserv_define_option("WHINEDELAY", opt_whine_delay);
Index: helpserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/helpserv.help,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** helpserv.help 29 Sep 2002 00:06:00 -0000 1.11
--- helpserv.help 26 Oct 2002 16:15:16 -0000 1.12
***************
*** 119,127 ****
"/msg $S SET [<option> [new-value]]",
"Change service options. If no option is specified, show all options. If no value is specified, show current value of option.",
! "PageTarget Send command pages to this channel (this can only be set by an oper)",
"PageType Delivery type for command pages (sent by the PAGE command)",
! "AlertPageTarget Send alert pages to this channel (this can only be set by an oper)",
! "AlertPageType Delivery type for alert pages (to gain the helpers' attention)",
! "StatusPageTarget Send status pages to this channel (this can only be set by an oper)",
"StatusPageType Delivery type for status pages (less urgent information, such as requests being opened/assigned/closed)",
"Greeting Message sent to users joining channel",
--- 119,127 ----
"/msg $S SET [<option> [new-value]]",
"Change service options. If no option is specified, show all options. If no value is specified, show current value of option.",
! "PageTarget Send command pages to this channel",
"PageType Delivery type for command pages (sent by the PAGE command)",
! "AlertPageTarget Send alert pages to this channel",
! "AlertPageType Delivery type for alert pages (to gain helpers' attention)",
! "StatusPageTarget Send status pages to this channel",
"StatusPageType Delivery type for status pages (less urgent information, such as requests being opened/assigned/closed)",
"Greeting Message sent to users joining channel",
***************
*** 138,141 ****
--- 138,142 ----
"Notification Notification to helpers of events concerning their requests",
"PrivmsgOnly Messages to users are sent as privmsg (overriding account preference)",
+ "ReqOnJoin Automatically opens a request for a user who joins the channel",
"$uSee also:$u set <option-name>");
"SET PAGETARGET" ("$bSET PAGETARGET$b",
|
|
From: Entrope <en...@us...> - 2002-10-26 15:18:18
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv8747/src
Modified Files:
chanserv.c chanserv.help
Log Message:
make sure !wipeinfo doesn't work on higher-ranked users
document !wipeinfo
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.296
retrieving revision 1.297
diff -C2 -r1.296 -r1.297
*** chanserv.c 23 Oct 2002 12:37:53 -0000 1.296
--- chanserv.c 26 Oct 2002 15:18:15 -0000 1.297
***************
*** 4278,4286 ****
static MODCMD_FUNC(cmd_wipeinfo)
{
- /* TODO */
struct handle_info *victim;
! struct userData *ud;
REQUIRE_PARAMS(2);
if(!(victim = chanserv_get_handle_info(user, argv[1]))) return 0;
if(!(ud = GetTrueChannelAccess(channel->channel_info, victim)))
--- 4278,4286 ----
static MODCMD_FUNC(cmd_wipeinfo)
{
struct handle_info *victim;
! struct userData *ud, *actor;
REQUIRE_PARAMS(2);
+ actor = GetChannelAccess(channel->channel_info, user->handle_info);
if(!(victim = chanserv_get_handle_info(user, argv[1]))) return 0;
if(!(ud = GetTrueChannelAccess(channel->channel_info, victim)))
***************
*** 4289,4293 ****
return 0;
}
! if (ud->info) free(ud->info);
ud->info = NULL;
reply(CSMSG_WIPED_INFO_LINE, argv[1], channel->name);
--- 4289,4298 ----
return 0;
}
! if(ud->access >= actor->access)
! {
! reply(MSG_USER_OUTRANKED, victim->handle);
! return 0;
! }
! if(ud->info) free(ud->info);
ud->info = NULL;
reply(CSMSG_WIPED_INFO_LINE, argv[1], channel->name);
Index: chanserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.help,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -r1.40 -r1.41
*** chanserv.help 21 Oct 2002 02:59:49 -0000 1.40
--- chanserv.help 26 Oct 2002 15:18:15 -0000 1.41
***************
*** 34,38 ****
" DEVOICE Remove voice from the specified user.",
" SUSPEND Suspend a user's access to a channel.",
! " UNSUSPEND Restore a user's access to a channel."
);
"BAN MANAGEMENT" ("$bBan Management Commands:$b",
--- 34,39 ----
" DEVOICE Remove voice from the specified user.",
" SUSPEND Suspend a user's access to a channel.",
! " UNSUSPEND Restore a user's access to a channel.",
! " WIPEINFO Remove a lower-ranked user's infoline."
);
"BAN MANAGEMENT" ("$bBan Management Commands:$b",
***************
*** 523,526 ****
--- 524,529 ----
"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");
+ "WIPEINFO" ("/msg $C WIPEINFO <#channel> <nick|*account>",
+ "Removes the named user's infoline in the channel.");
"WLIST" ("/msg $C WLIST <#channel>",
"This command lists all users of level $bOwner$b on a channel's userlist.",
|
|
From: Entrope <en...@us...> - 2002-10-26 15:17:50
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv8450/src
Modified Files:
ioset.c ioset.h main.c
Log Message:
make sure we don't try to do disk i/o during a signal
(this code somehow got lost in the past while)
Index: ioset.c
===================================================================
RCS file: /cvsroot/srvx/services/src/ioset.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** ioset.c 16 Oct 2002 03:35:21 -0000 1.11
--- ioset.c 26 Oct 2002 15:17:46 -0000 1.12
***************
*** 22,25 ****
--- 22,27 ----
#include "log.h"
#include "timeq.h"
+ #include "saxdb.h"
+ #include "conf.h"
#ifdef HAVE_FCNTL_H
***************
*** 41,44 ****
--- 43,48 ----
extern int uplink_connect(void);
int clock_skew;
+ int do_write_dbs;
+ int do_reopen;
static struct io_fd **fds;
***************
*** 399,402 ****
--- 403,416 ----
/* Call any timeq events we need to call. */
timeq_run();
+ if (do_write_dbs) {
+ saxdb_write_all();
+ do_write_dbs = 0;
+ }
+ if (do_reopen) {
+ extern char *services_config;
+ conf_read(services_config);
+ reopen_logs();
+ do_reopen = 0;
+ }
}
}
Index: ioset.h
===================================================================
RCS file: /cvsroot/srvx/services/src/ioset.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** ioset.h 5 Sep 2002 14:55:48 -0000 1.5
--- ioset.h 26 Oct 2002 15:17:46 -0000 1.6
***************
*** 46,49 ****
--- 46,51 ----
extern int clock_skew;
+ extern int do_write_dbs;
+ extern int do_reopen;
struct io_fd *ioset_add(int fd);
Index: main.c
===================================================================
RCS file: /cvsroot/srvx/services/src/main.c,v
retrieving revision 1.141
retrieving revision 1.142
diff -C2 -r1.141 -r1.142
*** main.c 23 Oct 2002 12:39:39 -0000 1.141
--- main.c 26 Oct 2002 15:17:46 -0000 1.142
***************
*** 382,386 ****
log(MAIN_LOG, LOG_INFO, "%s -- writing databases.\n", strsignal(x));
#endif
! saxdb_write_all();
}
--- 382,386 ----
log(MAIN_LOG, LOG_INFO, "%s -- writing databases.\n", strsignal(x));
#endif
! do_write_dbs = 1;
}
***************
*** 410,415 ****
log(MAIN_LOG, LOG_INFO, "%s -- rehashing.\n", strsignal(x));
#endif
! conf_read(services_config);
! reopen_logs();
}
--- 410,414 ----
log(MAIN_LOG, LOG_INFO, "%s -- rehashing.\n", strsignal(x));
#endif
! do_reopen = 1;
}
|
|
From: Entrope <en...@us...> - 2002-10-25 17:35:35
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv21393/src
Modified Files:
helpserv.c
Log Message:
name the helpserv help file and expander function when registering its module
Index: helpserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpserv.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -r1.40 -r1.41
*** helpserv.c 23 Oct 2002 12:37:53 -0000 1.40
--- helpserv.c 25 Oct 2002 13:04:16 -0000 1.41
***************
*** 3927,3931 ****
reg_exit_func(helpserv_db_cleanup);
! helpserv_module = module_register("helpserv", HS_LOG, NULL, NULL);
modcmd_register(helpserv_module, "helpserv", cmd_helpserv, 1, MODCMD_REQUIRE_AUTHED|MODCMD_NO_LOG, "access", "800", NULL);
}
--- 3927,3931 ----
reg_exit_func(helpserv_db_cleanup);
! helpserv_module = module_register("helpserv", HS_LOG, "helpserv.help", helpserv_expand_variable);
modcmd_register(helpserv_module, "helpserv", cmd_helpserv, 1, MODCMD_REQUIRE_AUTHED|MODCMD_NO_LOG, "access", "800", NULL);
}
|
|
From: Entrope <en...@us...> - 2002-10-25 16:22:06
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv20896/src
Modified Files:
helpfile.c
Log Message:
don't crash if the requested help file is missing
Index: helpfile.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpfile.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -r1.56 -r1.57
*** helpfile.c 21 Sep 2002 21:51:30 -0000 1.56
--- helpfile.c 25 Oct 2002 13:03:52 -0000 1.57
***************
*** 26,29 ****
--- 26,30 ----
#define DEFAULT_LINE_SIZE MAX_LINE_SIZE
#define DEFAULT_TABLE_SIZE 80
+ #define HFMSG_MISSING_HELPFILE "The help file could not be found. Sorry!"
#define HFMSG_HELP_NOT_STRING "Help file error (help data was not a string)."
***************
*** 440,448 ****
const char *str;
if (!topic) topic = "<index>";
! if (hf) {
! rec = dict_find(hf->db, topic, NULL);
! } else {
! rec = NULL;
}
if (!rec) {
rec = dict_find(hf->db, "<missing>", NULL);
--- 441,449 ----
const char *str;
if (!topic) topic = "<index>";
! if (!hf) {
! _send_help(dest, src, NULL, HFMSG_MISSING_HELPFILE);
! return 0;
}
+ rec = dict_find(hf->db, topic, NULL);
if (!rec) {
rec = dict_find(hf->db, "<missing>", NULL);
|
|
From: Entrope <en...@us...> - 2002-10-23 16:22:58
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv26453/src
Modified Files:
Tag: rel-1_1-branch
chanserv.c hash.c hash.h helpserv.c opserv.c
Log Message:
backport kick-on-join bug fix from 1.2 branch
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.232.2.10
retrieving revision 1.232.2.11
diff -C2 -r1.232.2.10 -r1.232.2.11
*** chanserv.c 21 Oct 2002 03:04:40 -0000 1.232.2.10
--- chanserv.c 23 Oct 2002 16:22:45 -0000 1.232.2.11
***************
*** 6227,6231 ****
/* welcome to my worst nightmare. warning: read the code below
at your own risk. */
! static void
handle_join(struct userNode *user, struct chanNode *channel)
{
--- 6227,6231 ----
/* welcome to my worst nightmare. warning: read the code below
at your own risk. */
! static int
handle_join(struct userNode *user, struct chanNode *channel)
{
***************
*** 6241,6258 ****
{
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;
--- 6241,6252 ----
{
struct suspended *suspended = dict_find(sChannels, channel->name, NULL);
! if(!suspended) return 0;
channel->channel_info = suspended->cData;
suspended->cData->channel = channel;
}
! return 0;
}
! if(IsLocal(user) || IsSuspended(channel->channel_info)) return 0;
cData = channel->channel_info;
***************
*** 6282,6286 ****
/* Riding a netburst. Naughty. */
KickChannelUser(user, channel, chanserv, CSMSG_NETRIDE_DETECTED);
! return;
}
}
--- 6276,6280 ----
/* Riding a netburst. Naughty. */
KickChannelUser(user, channel, chanserv, CSMSG_NETRIDE_DETECTED);
! return 1;
}
}
***************
*** 6318,6322 ****
AddChannelBan(1, &ban, channel, chanserv, now, 1);
KickChannelUser(user, channel, chanserv, kick_reason);
! return;
}
}
--- 6312,6316 ----
AddChannelBan(1, &ban, channel, chanserv, now, 1);
KickChannelUser(user, channel, chanserv, kick_reason);
! return 1;
}
}
***************
*** 6325,6329 ****
so we might as well short-circuit all of this stuff during bursts.
*/
! if(user->uplink->burst) return;
if((channel == chanserv_conf.support_channel) && IsHelper(user))
--- 6319,6323 ----
so we might as well short-circuit all of this stuff during bursts.
*/
! if(user->uplink->burst) return 0;
if((channel == chanserv_conf.support_channel) && IsHelper(user))
***************
*** 6398,6401 ****
--- 6392,6396 ----
}
}
+ return 0;
}
Index: hash.c
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.c,v
retrieving revision 1.159.2.1
retrieving revision 1.159.2.2
diff -C2 -r1.159.2.1 -r1.159.2.2
*** hash.c 18 Oct 2002 18:55:05 -0000 1.159.2.1
--- hash.c 23 Oct 2002 16:22:48 -0000 1.159.2.2
***************
*** 827,836 ****
modeList_append(&user->channels, mNode);
- if (IsLocal(user)) irc_join(user, channel);
-
for (n=0; n<jf_used; n++) {
! jf_list[n](user, channel);
}
return mNode;
}
--- 827,835 ----
modeList_append(&user->channels, mNode);
for (n=0; n<jf_used; n++) {
! if (jf_list[n](user, channel)) return NULL;
}
+ if (IsLocal(user)) irc_join(user, channel);
return mNode;
}
Index: hash.h
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.h,v
retrieving revision 1.81.2.1
retrieving revision 1.81.2.2
diff -C2 -r1.81.2.1 -r1.81.2.2
*** hash.h 26 Jul 2002 04:08:43 -0000 1.81.2.1
--- hash.h 23 Oct 2002 16:22:50 -0000 1.81.2.2
***************
*** 207,211 ****
typedef void (*new_channel_func_t) (struct chanNode *chan);
void reg_new_channel_func(new_channel_func_t handler);
! typedef void (*join_func_t) (struct userNode *user, struct chanNode *chan);
void reg_join_func(join_func_t handler);
typedef void (*del_channel_func_t) (struct chanNode *chan);
--- 207,211 ----
typedef void (*new_channel_func_t) (struct chanNode *chan);
void reg_new_channel_func(new_channel_func_t handler);
! typedef int (*join_func_t) (struct userNode *user, struct chanNode *chan);
void reg_join_func(join_func_t handler);
typedef void (*del_channel_func_t) (struct chanNode *chan);
Index: helpserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpserv.c,v
retrieving revision 1.14.2.8
retrieving revision 1.14.2.9
diff -C2 -r1.14.2.8 -r1.14.2.9
*** helpserv.c 8 Oct 2002 22:34:53 -0000 1.14.2.8
--- helpserv.c 23 Oct 2002 16:22:51 -0000 1.14.2.9
***************
*** 3256,3267 ****
* req->user to the user joining for all requests owned by the user's handle
* (if any) with a req->user == NULL */
! static void handle_join(struct userNode *user, struct chanNode *chan) {
struct helpserv_botlist *botlist;
unsigned int i;
const int from_opserv = 0; /* for helpserv_notice */
! if (IsLocal(user) || self->uplink->burst) {
! return;
! }
if ((botlist = dict_find(helpserv_bots_bychan_dict, chan->name, NULL))) {
--- 3256,3265 ----
* req->user to the user joining for all requests owned by the user's handle
* (if any) with a req->user == NULL */
! static int handle_join(struct userNode *user, struct chanNode *chan) {
struct helpserv_botlist *botlist;
unsigned int i;
const int from_opserv = 0; /* for helpserv_notice */
! if (IsLocal(user) || self->uplink->burst) return 0;
if ((botlist = dict_find(helpserv_bots_bychan_dict, chan->name, NULL))) {
***************
*** 3280,3283 ****
--- 3278,3282 ----
}
}
+ return 0;
}
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.235.2.7
retrieving revision 1.235.2.8
diff -C2 -r1.235.2.7 -r1.235.2.8
*** opserv.c 4 Aug 2002 20:11:12 -0000 1.235.2.7
--- opserv.c 23 Oct 2002 16:22:52 -0000 1.235.2.8
***************
*** 2294,2303 ****
}
! static void
opserv_join_check(struct userNode *user, struct chanNode *channel)
{
! if(IsService(user)) {
! return;
! }
if (channel->bad_channel) {
--- 2294,2301 ----
}
! static int
opserv_join_check(struct userNode *user, struct chanNode *channel)
{
! if (IsService(user)) return 0;
if (channel->bad_channel) {
***************
*** 2312,2315 ****
--- 2310,2314 ----
DelUser(user, opserv, 1, OSMSG_ILLEGAL_KILL_REASON);
}
+ return 1;
}
***************
*** 2333,2336 ****
--- 2332,2336 ----
channel->join_flooded = 0;
}
+ return 0;
}
|