srvx-commits Mailing List for srvx IRC Services (Page 28)
Brought to you by:
entrope
You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(80) |
Sep
(51) |
Oct
(94) |
Nov
(132) |
Dec
(85) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(163) |
Feb
(96) |
Mar
(70) |
Apr
(182) |
May
(173) |
Jun
(73) |
Jul
(101) |
Aug
(101) |
Sep
(71) |
Oct
(76) |
Nov
(58) |
Dec
(60) |
| 2003 |
Jan
(61) |
Feb
(14) |
Mar
(3) |
Apr
|
May
(7) |
Jun
(22) |
Jul
(81) |
Aug
(41) |
Sep
(34) |
Oct
(41) |
Nov
(16) |
Dec
(28) |
| 2004 |
Jan
(7) |
Feb
|
Mar
(3) |
Apr
(15) |
May
(11) |
Jun
(1) |
Jul
(4) |
Aug
(1) |
Sep
(4) |
Oct
(1) |
Nov
(1) |
Dec
(1) |
| 2005 |
Jan
(13) |
Feb
(6) |
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2009 |
Jan
|
Feb
|
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
(2) |
Feb
(3) |
Mar
(4) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
| 2012 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(4) |
Jun
|
Jul
(1) |
Aug
|
Sep
(3) |
Oct
(2) |
Nov
|
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2023 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
| 2025 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Entrope <en...@us...> - 2002-09-24 19:19:48
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv30044/src
Modified Files:
common.h tools.c
Log Message:
add strtab() utility function
Index: common.h
===================================================================
RCS file: /cvsroot/srvx/services/src/common.h,v
retrieving revision 1.82
retrieving revision 1.83
diff -C2 -r1.82 -r1.83
*** common.h 14 Sep 2002 03:48:58 -0000 1.82
--- common.h 24 Sep 2002 19:19:43 -0000 1.83
***************
*** 154,157 ****
--- 154,158 ----
const char *preposition(const char *word);
int set_policer_param(const char *param, void *data, void *extra);
+ const char *strtab(unsigned int ii);
void tools_init(void);
Index: tools.c
===================================================================
RCS file: /cvsroot/srvx/services/src/tools.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -C2 -r1.117 -r1.118
*** tools.c 14 Sep 2002 03:48:59 -0000 1.117
--- tools.c 24 Sep 2002 19:19:43 -0000 1.118
***************
*** 694,697 ****
--- 694,715 ----
}
+ struct string_list str_tab;
+
+ const char *
+ strtab(unsigned int ii) {
+ if (ii > 65536) return NULL;
+ if (ii > str_tab.size) {
+ unsigned int old_size = str_tab.size;
+ while (ii >= str_tab.size) str_tab.size <<= 1;
+ str_tab.list = realloc(str_tab.list, str_tab.size*sizeof(str_tab.list[0]));
+ memset(str_tab.list+old_size, 0, (str_tab.size-old_size)*sizeof(str_tab.list[0]));
+ }
+ if (!str_tab.list[ii]) {
+ str_tab.list[ii] = malloc(12);
+ sprintf(str_tab.list[ii], "%u", ii);
+ }
+ return str_tab.list[ii];
+ }
+
void
tools_init(void)
***************
*** 705,708 ****
--- 723,728 ----
for (upr=0xd8, lwr=0xf8; lwr <= 0xfe; ++upr, ++lwr) irc_tolower[upr] = lwr;
#endif
+ str_tab.size = 1001;
+ str_tab.list = calloc(str_tab.size, sizeof(str_tab.list[0]));
}
***************
*** 710,713 ****
tools_cleanup(void)
{
! /* NOOP */
}
--- 730,737 ----
tools_cleanup(void)
{
! unsigned int ii;
! for (ii=0; ii<str_tab.size; ++ii) {
! if (str_tab.list[ii]) free(str_tab.list[ii]);
! }
! free(str_tab.list);
}
|
|
From: Entrope <en...@us...> - 2002-09-24 02:17:38
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv24487/src
Modified Files:
proto-p10.c
Log Message:
add better support for NN2K support and configurability
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** proto-p10.c 15 Sep 2002 07:21:16 -0000 1.34
--- proto-p10.c 24 Sep 2002 02:17:35 -0000 1.35
***************
*** 1322,1326 ****
{
const char *str, *desc;
! int numnick;
char numer[COMBO_NUMERIC_LEN+1];
--- 1322,1326 ----
{
const char *str, *desc;
! int numnick, usermask;
char numer[COMBO_NUMERIC_LEN+1];
***************
*** 1338,1353 ****
}
numnick = atoi(str);
! if ((numnick < 64) && !force_n2k) {
! /* Use a three-digit numeric if we can, else use five. */
! inttobase64(numer, numnick, 1);
! numer[1] = ']';
! numer[2] = ']';
! numer[3] = 0;
} else {
! inttobase64(numer, numnick, 2);
! numer[2] = ']';
! numer[3] = ']';
! numer[4] = ']';
! numer[5] = 0;
}
str = conf_get_data("server/hostname", RECDB_QSTRING);
--- 1338,1347 ----
}
numnick = atoi(str);
! str = conf_get_data("server/max_users", RECDB_QSTRING);
! usermask = (str ? atoi(str) : 4096) - 1;
! if ((numnick < 64) && (usermask < 4096) && !force_n2k) {
! inttobase64(numer, (numnick << 12) + (usermask & 0x00fff), 5);
} else {
! inttobase64(numer, (numnick << 18) + (usermask & 0x3ffff), 3);
}
str = conf_get_data("server/hostname", RECDB_QSTRING);
|
|
From: Entrope <en...@us...> - 2002-09-24 02:17:38
|
Update of /cvsroot/srvx/services
In directory usw-pr-cvs1:/tmp/cvs-serv24487
Modified Files:
srvx.conf.example
Log Message:
add better support for NN2K support and configurability
Index: srvx.conf.example
===================================================================
RCS file: /cvsroot/srvx/services/srvx.conf.example,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** srvx.conf.example 18 Sep 2002 14:51:30 -0000 1.29
--- srvx.conf.example 24 Sep 2002 02:17:33 -0000 1.30
***************
*** 230,233 ****
--- 230,235 ----
"hidden_host" "users.Generic.NET"; // set this if you enabled ircd/Undernet's +x mode
"numeric" "10"; // hint: If you get collisions on link, CHANGE THIS.
+ "max_users" "256"; // You can save a little memory by setting this to a lower value.
+ "force_n2k" "1"; // Use extended (5-digit) numnick for self, even if 3 are possible.
"ping_freq" "60";
"ping_timeout" "90";
|
|
From: Adrian D. <sai...@us...> - 2002-09-23 00:19:11
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv2662
Modified Files:
helpserv.c modcmd.c
Log Message:
Make ?helpserv work again
Index: helpserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpserv.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** helpserv.c 11 Sep 2002 01:50:06 -0000 1.34
--- helpserv.c 23 Sep 2002 00:19:08 -0000 1.35
***************
*** 487,490 ****
--- 487,491 ----
struct helpfile *helpserv_helpfile;
+ static struct module *helpserv_module;
static dict_t helpserv_func_dict;
static dict_t helpserv_option_dict;
***************
*** 876,879 ****
--- 877,935 ----
}
+ /* Handle a control command from an IRC operator */
+ MODCMD_FUNC(cmd_helpserv) {
+ struct helpserv_bot *hs = NULL;
+ struct helpserv_cmd *cmd;
+ const int from_opserv = 1; /* for helpserv_notice */
+ char botnick[NICKLEN+1]; /* in case command is unregister */
+ int retval;
+
+ if (!helpserv_enabled) {
+ helpserv_notice(user, HSMSG_DISABLED);
+ return 0;
+ }
+
+ if (argc < 2) {
+ send_help(user, opserv, helpserv_helpfile, NULL);
+ return 0;
+ }
+
+ if (!(cmd = dict_find(helpserv_func_dict, argv[1], NULL))) {
+ helpserv_notice(user, MSG_COMMAND_UNKNOWN, argv[1]);
+ return 0;
+ }
+
+ if (!cmd->func) {
+ helpserv_notice(user, HSMSG_INTERNAL_COMMAND, argv[1]);
+ return 0;
+ }
+
+ if ((cmd->flags & CMD_NEED_BOT) && ((argc < 3) || !(hs = dict_find(helpserv_bots_dict, argv[2], NULL)))) {
+ helpserv_notice(user, HSMSG_INVALID_BOT);
+ return 0;
+ }
+
+ if (cmd->flags & CMD_NEVER_FROM_OPSERV) {
+ helpserv_notice(user, HSMSG_NO_USE_OPSERV);
+ return 0;
+ }
+
+ if (hs) {
+ argv[2] = argv[1];
+ strcpy(botnick, hs->helpserv->nick);
+ retval = cmd->func(user, hs, 1, argc-2, argv+2);
+ } else {
+ strcpy(botnick, "No bot");
+ retval = cmd->func(user, hs, 1, argc-1, argv+1);
+ }
+
+ if (retval && !(cmd->flags & CMD_IGNORE_EVENT)) {
+ char *cmd_text = unsplit_string(argv+1, argc-1, NULL);
+ log(HS_LOG, LOG_INFO, "%s[%s] (%s): %s%s\n", user->nick, user->handle_info->handle, botnick, cmd_text, (cmd->flags & (CMD_NOT_OVERRIDE|CMD_FROM_OPSERV_ONLY) ? "" : " (override)"));
+ }
+
+ return retval;
+ }
+
static HELPSERV_FUNC(cmd_version) {
(void)hs;
***************
*** 3827,3829 ****
--- 3883,3888 ----
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);
}
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** modcmd.c 18 Sep 2002 14:50:19 -0000 1.29
--- modcmd.c 23 Sep 2002 00:19:08 -0000 1.30
***************
*** 1627,1630 ****
--- 1627,1631 ----
svccmd = service_make_alias(service, "stats", "*modcmd.joiner", NULL);
svccmd->min_opserv_level = 101;
+ svccmd = service_make_alias(service, "helpserv", "*helpserv.helpserv", NULL);
}
}
|
|
From: Zoot <zo...@us...> - 2002-09-21 21:52:57
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv5903/src
Modified Files:
main.c opserv.c
Log Message:
Make some minor changes to OpServ's ?jump command.
Index: main.c
===================================================================
RCS file: /cvsroot/srvx/services/src/main.c,v
retrieving revision 1.138
retrieving revision 1.139
diff -C2 -r1.138 -r1.139
*** main.c 8 Sep 2002 04:28:38 -0000 1.138
--- main.c 21 Sep 2002 21:52:54 -0000 1.139
***************
*** 160,164 ****
}
! void uplink_compile(void)
{
const char *cycles;
--- 160,165 ----
}
! void
! uplink_compile(void)
{
const char *cycles;
***************
*** 210,214 ****
}
! int uplink_valid(char *name)
{
struct uplinkNode *uplink;
--- 211,216 ----
}
! struct uplinkNode *
! uplink_find(char *name)
{
struct uplinkNode *uplink;
***************
*** 216,234 ****
if(!cManager.enabled || !cManager.uplinks)
{
! return 0;
}
for(uplink = cManager.uplinks; uplink; uplink = uplink->next)
{
! if(!strcmp(uplink->name, name))
{
! return 1;
}
}
! return 0;
}
! void uplink_select(char *name)
{
struct uplinkNode *start, *uplink, *next;
--- 218,237 ----
if(!cManager.enabled || !cManager.uplinks)
{
! return NULL;
}
for(uplink = cManager.uplinks; uplink; uplink = uplink->next)
{
! if(!strcasecmp(uplink->name, name))
{
! return uplink;
}
}
! return NULL;
}
! void
! uplink_select(char *name)
{
struct uplinkNode *start, *uplink, *next;
***************
*** 320,324 ****
}
! int uplink_connect(void)
{
struct uplinkNode *uplink = cManager.uplink;
--- 323,328 ----
}
! int
! uplink_connect(void)
{
struct uplinkNode *uplink = cManager.uplink;
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.276
retrieving revision 1.277
diff -C2 -r1.276 -r1.277
*** opserv.c 16 Sep 2002 14:57:35 -0000 1.276
--- opserv.c 21 Sep 2002 21:52:54 -0000 1.277
***************
*** 228,233 ****
--- 228,235 ----
#define OSMSG_WARN_LISTEND "End of activity warning list."
#define OSMSG_INDEX_FORMAT "%-12s (%d)%c "
+ #define OSMSG_UPLINK_CONNECTING "Establishing connection with %s (%s:%d)."
#define OSMSG_CURRENT_UPLINK "$b%s$b is already the current uplink."
#define OSMSG_INVALID_UPLINK "$b%s$b is not a valid uplink name."
+ #define OSMSG_UPLINK_DISABLED "$b%s$b is a disabled or unavailable uplink."
#define OSMSG_STUPID_GLINE "Gline %s? Now $bthat$b would be smooth."
***************
*** 704,708 ****
extern struct cManagerNode cManager;
void uplink_select(char *name);
! int uplink_valid(char *name);
char *target;
--- 706,711 ----
extern struct cManagerNode cManager;
void uplink_select(char *name);
! struct uplinkNode *uplink_find(char *name);
! struct uplinkNode *uplink;
char *target;
***************
*** 712,724 ****
if(!strcmp(cManager.uplink->name, target))
{
! opserv_notice(user, OSMSG_CURRENT_UPLINK, cManager.uplink->name);
return 0;
}
! if(!uplink_valid(target))
{
! opserv_notice(user, OSMSG_INVALID_UPLINK, target);
return 0;
}
uplink_select(target);
--- 715,735 ----
if(!strcmp(cManager.uplink->name, target))
{
! reply(OSMSG_CURRENT_UPLINK, cManager.uplink->name);
return 0;
}
! uplink = uplink_find(target);
! if(!uplink)
{
! reply(OSMSG_INVALID_UPLINK, target);
return 0;
}
+ if(uplink->flags & UPLINK_UNAVAILABLE)
+ {
+ reply(OSMSG_UPLINK_DISABLED, uplink->name);
+ return 0;
+ }
+
+ reply(OSMSG_UPLINK_CONNECTING, uplink->name, uplink->host, uplink->port);
uplink_select(target);
|
|
From: Zoot <zo...@us...> - 2002-09-21 21:52:19
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv5662/src
Modified Files:
Tag: rel-1_1-branch
helpfile.c
Log Message:
Backport from 1.2 a fix for a bug in the line wrapping code that prevented words larger than the line width from being sent properly.
Index: helpfile.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpfile.c,v
retrieving revision 1.47
retrieving revision 1.47.2.1
diff -C2 -r1.47 -r1.47.2.1
*** helpfile.c 7 May 2002 22:53:45 -0000 1.47
--- helpfile.c 21 Sep 2002 21:52:16 -0000 1.47.2.1
***************
*** 238,241 ****
--- 238,242 ----
* the requested maximum size. But stop at line size.
*/
+ pos--;
while (*input && (*input != ' ') && (pos < MAX_LINE_SIZE)) line[pos++] = *input++;
}
|
|
From: Zoot <zo...@us...> - 2002-09-21 21:51:33
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv5543/src
Modified Files:
helpfile.c
Log Message:
Fix a bug in the line wrapping code that prevented words larger than the line width from being sent properly.
Index: helpfile.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpfile.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -r1.55 -r1.56
*** helpfile.c 5 Sep 2002 23:22:27 -0000 1.55
--- helpfile.c 21 Sep 2002 21:51:30 -0000 1.56
***************
*** 247,250 ****
--- 247,251 ----
* the requested maximum size. But stop at line size.
*/
+ pos--;
while (*input && (*input != ' ') && (pos < MAX_LINE_SIZE)) line[pos++] = *input++;
}
|
|
From: Entrope <en...@us...> - 2002-09-19 03:52:06
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv19002/src
Modified Files:
chanserv.c
Log Message:
apply a registered channel's mode to it when starting up
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.286
retrieving revision 1.287
diff -C2 -r1.286 -r1.287
*** chanserv.c 18 Sep 2002 14:51:30 -0000 1.286
--- chanserv.c 19 Sep 2002 03:52:02 -0000 1.287
***************
*** 6593,6596 ****
--- 6593,6601 ----
count = split_line(str, 0, ArrayLength(split_modes), split_modes);
parse_mode_lock(split_modes, count, cData);
+ if(!IsSuspended(cData))
+ {
+ assert(cNode);
+ mod_chanmode(cNode, chanserv, str, NULL, 0);
+ }
}
|
|
From: Entrope <en...@us...> - 2002-09-18 14:55:09
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv4983/src
Modified Files:
global.help opserv.help sendmail.help
Log Message:
add (back) some things that were left out of help files
Index: global.help
===================================================================
RCS file: /cvsroot/srvx/services/src/global.help,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** global.help 7 Sep 2002 02:31:33 -0000 1.11
--- global.help 18 Sep 2002 14:55:05 -0000 1.12
***************
*** 28,31 ****
--- 28,32 ----
"$bTarget$b is used as a sub-command in many commands. It's values are:",
"$bUSERS$b: The message will be sent to all users on the network including opers and helpers, but not channels.",
+ "$bANNOUNCEMENT$b: The message will be sent to all users who are configured to receive community announcements.",
"$bHELPERS$b: The message will be sent to helpers only.",
"$bOPERS$b: The message will be sent to opers only.",
Index: opserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.help,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -r1.49 -r1.50
*** opserv.help 7 Sep 2002 02:31:33 -0000 1.49
--- opserv.help 18 Sep 2002 14:55:05 -0000 1.50
***************
*** 386,398 ****
"SERVICES" ("$bSERVICES COMMANDS$b",
"These commands control how other services behave.",
! " ADDNOTE [${level/addnote}]",
! " ALIAS [${level/alias}]",
! " DELNOTE [${level/delnote}]",
! " GAG [${level/gag}]",
! " HELPSERV [${level/helpserv}]",
! " QUERY [${level/query}]",
! " SET [${level/set}]",
! " UNALIAS [${level/unalias}]",
! " UNGAG [${level/ungag}]");
"ADDNOTE" ("/msg $O ADDNOTE <typename> <set-access> [access-arg] <view-access> <max-length>",
"Defines a new note type. $btypename$b is the name of the note type. $bset-access$b is one of:",
--- 386,400 ----
"SERVICES" ("$bSERVICES COMMANDS$b",
"These commands control how other services behave.",
! " ADDNOTE [${level/addnote}]",
! " ALIAS [${level/alias}]",
! " BANEMAIL [${level/banemail}]",
! " DELNOTE [${level/delnote}]",
! " GAG [${level/gag}]",
! " HELPSERV [${level/helpserv}]",
! " 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>",
"Defines a new note type. $btypename$b is the name of the note type. $bset-access$b is one of:",
Index: sendmail.help
===================================================================
RCS file: /cvsroot/srvx/services/src/sendmail.help,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** sendmail.help 15 Aug 2002 02:49:26 -0000 1.1
--- sendmail.help 18 Sep 2002 14:55:06 -0000 1.2
***************
*** 2,7 ****
"Keeps srvx from sending mail to the address. The address may be a real address, or a glob that uses * and ? wildcards.",
"This also prevents anyone from using matching addresses as their account email address.",
! "$uSee Also:$u unbanemail");
"UNBANEMAIL" ("/msg $S UNBANEMAIL <address>",
"Removes an email address (or glob) from the banned email address list.",
! "$uSee Also:$u banemail");
--- 2,7 ----
"Keeps srvx from sending mail to the address. The address may be a real address, or a glob that uses * and ? wildcards.",
"This also prevents anyone from using matching addresses as their account email address.",
! "$uSee Also:$u unbanemail, stats email");
"UNBANEMAIL" ("/msg $S UNBANEMAIL <address>",
"Removes an email address (or glob) from the banned email address list.",
! "$uSee Also:$u banemail, stats email");
|
|
From: Entrope <en...@us...> - 2002-09-18 14:54:25
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv4697/src
Modified Files:
saxdb.c
Log Message:
don't try to read a mondo-db section if there was no mondo DB
Index: saxdb.c
===================================================================
RCS file: /cvsroot/srvx/services/src/saxdb.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** saxdb.c 16 Sep 2002 18:35:11 -0000 1.15
--- saxdb.c 18 Sep 2002 14:54:21 -0000 1.16
***************
*** 106,110 ****
/* Read from disk (or mondo DB) */
if (db->mondo_section) {
! if ((conf = database_get_data(mondo_db, db->mondo_section, RECDB_OBJECT))) {
db->reader(conf);
}
--- 106,110 ----
/* Read from disk (or mondo DB) */
if (db->mondo_section) {
! if (mondo_db && (conf = database_get_data(mondo_db, db->mondo_section, RECDB_OBJECT))) {
db->reader(conf);
}
|
|
From: Entrope <en...@us...> - 2002-09-18 14:54:03
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv4531/src
Modified Files:
nickserv.c proto-common.c proto.h
Log Message:
add GENMASK_NO_HIDING option for generate_hostmask(); use it for NickServ hostmask generation
fix oper_outranks() test
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.206
retrieving revision 1.207
diff -C2 -r1.206 -r1.207
*** nickserv.c 14 Sep 2002 04:01:53 -0000 1.206
--- nickserv.c 18 Sep 2002 14:53:59 -0000 1.207
***************
*** 615,619 ****
int
oper_outranks(struct userNode *user, struct handle_info *hi) {
! if (is_valid_oper(user, hi->opserv_level, 0)) return 1;
if (user->handle_info->opserv_level == hi->opserv_level) {
if ((user->handle_info->opserv_level == 1000)
--- 615,619 ----
int
oper_outranks(struct userNode *user, struct handle_info *hi) {
! if (user->handle_info->opserv_level > hi->opserv_level) return 1;
if (user->handle_info->opserv_level == hi->opserv_level) {
if ((user->handle_info->opserv_level == 1000)
***************
*** 1033,1039 ****
string_list_append(hi->masks, strdup("*@*"));
} else {
! string_list_append(hi->masks, generate_hostmask(user, GENMASK_OMITNICK));
if (user->ip != 0) {
! string_list_append(hi->masks, generate_hostmask(user, GENMASK_OMITNICK|GENMASK_BYIP));
}
}
--- 1033,1039 ----
string_list_append(hi->masks, strdup("*@*"));
} else {
! string_list_append(hi->masks, generate_hostmask(user, GENMASK_OMITNICK|GENMASK_NO_HIDING));
if (user->ip != 0) {
! string_list_append(hi->masks, generate_hostmask(user, GENMASK_OMITNICK|GENMASK_BYIP|GENMASK_NO_HIDING));
}
}
***************
*** 1082,1086 ****
}
} else if ((settee = GetUserH(argv[3]))) {
! mask = generate_hostmask(settee, GENMASK_OMITNICK);
} else {
nickserv_notice(user, NSMSG_REGISTER_BAD_NICKMASK, argv[3]);
--- 1082,1086 ----
}
} else if ((settee = GetUserH(argv[3]))) {
! mask = generate_hostmask(settee, GENMASK_OMITNICK|GENMASK_NO_HIDING);
} else {
nickserv_notice(user, NSMSG_REGISTER_BAD_NICKMASK, argv[3]);
***************
*** 1370,1374 ****
if (!policer_conforms(user->auth_policer, now, 1.0)) {
char *hostmask;
! hostmask = generate_hostmask(user, GENMASK_STRICT_HOST|GENMASK_BYIP);
log(NS_LOG, LOG_OTHER, "%s auto-gagged for repeated password guessing.\n", hostmask);
gag_create(hostmask, nickserv->nick, "Repeated password guessing.", now+nickserv_conf.autogag_duration);
--- 1370,1374 ----
if (!policer_conforms(user->auth_policer, now, 1.0)) {
char *hostmask;
! hostmask = generate_hostmask(user, GENMASK_STRICT_HOST|GENMASK_BYIP|GENMASK_NO_HIDING);
log(NS_LOG, LOG_OTHER, "%s auto-gagged for repeated password guessing.\n", hostmask);
gag_create(hostmask, nickserv->nick, "Repeated password guessing.", now+nickserv_conf.autogag_duration);
***************
*** 1646,1650 ****
{
if (argc < 2) {
! char *mask = generate_hostmask(user, GENMASK_OMITNICK);
int res = nickserv_addmask(user, user->handle_info, mask);
free(mask);
--- 1646,1650 ----
{
if (argc < 2) {
! char *mask = generate_hostmask(user, GENMASK_OMITNICK|GENMASK_NO_HIDING);
int res = nickserv_addmask(user, user->handle_info, mask);
free(mask);
Index: proto-common.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-common.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** proto-common.c 15 Sep 2002 07:20:45 -0000 1.15
--- proto-common.c 18 Sep 2002 14:53:59 -0000 1.16
***************
*** 531,535 ****
}
hostname = user->hostname;
! if (IsHiddenHost(user) && user->handle_info && hidden_host_suffix) {
hostname = alloca(strlen(user->handle_info->handle) + strlen(hidden_host_suffix) + 2);
sprintf(hostname, "%s.%s", user->handle_info->handle, hidden_host_suffix);
--- 531,535 ----
}
hostname = user->hostname;
! if (IsHiddenHost(user) && user->handle_info && hidden_host_suffix && !(options & GENMASK_NO_HIDING)) {
hostname = alloca(strlen(user->handle_info->handle) + strlen(hidden_host_suffix) + 2);
sprintf(hostname, "%s.%s", user->handle_info->handle, hidden_host_suffix);
Index: proto.h
===================================================================
RCS file: /cvsroot/srvx/services/src/proto.h,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -r1.66 -r1.67
*** proto.h 14 Sep 2002 03:48:59 -0000 1.66
--- proto.h 18 Sep 2002 14:53:59 -0000 1.67
***************
*** 192,195 ****
--- 192,196 ----
#define GENMASK_BYIP 8
#define GENMASK_SRVXMASK 16
+ #define GENMASK_NO_HIDING 128
char *generate_hostmask(struct userNode *user, int options);
|
|
From: Entrope <en...@us...> - 2002-09-18 14:52:53
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv4116/src
Modified Files:
modcmd.help
Log Message:
document separate channel_access/oper_access command options
Index: modcmd.help
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.help,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** modcmd.help 7 Sep 2002 02:55:18 -0000 1.4
--- modcmd.help 18 Sep 2002 14:52:50 -0000 1.5
***************
*** 29,33 ****
"Supported options are:",
" FLAGS Comma-separated, +/- prefixed list of flags to add or remove.",
! " ACCESS Minimum OpServ or ChanServ access (interpreted as OpServ access if numeric)",
" ACCOUNT_FLAGS Account flags to require or deny (for example, +R-S)",
" TEMPLATE Command from which to inherit access restrictions",
--- 29,35 ----
"Supported options are:",
" FLAGS Comma-separated, +/- prefixed list of flags to add or remove.",
! " CHANNEL_ACCESS Minimum ChanServ access.",
! " OPER_ACCESS Minimum OpServ access.",
! " ACCESS Alias for OPER_ACCESS (if the value starts with a digit) or CHANNEL_ACCESS (if the value does not start with a digit).",
" ACCOUNT_FLAGS Account flags to require or deny (for example, +R-S)",
" TEMPLATE Command from which to inherit access restrictions",
|
|
From: Entrope <en...@us...> - 2002-09-18 14:51:35
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv3577/src
Modified Files:
chanserv.c
Log Message:
allow ChanServ to import set options from other modules
make the list and order of options shown by !set configurable
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.285
retrieving revision 1.286
diff -C2 -r1.285 -r1.286
*** chanserv.c 16 Sep 2002 19:28:10 -0000 1.285
--- chanserv.c 18 Sep 2002 14:51:30 -0000 1.286
***************
*** 410,414 ****
struct userNode *chanserv;
- static dict_t set_func_dict;
dict_t note_types;
static dict_t sChannels;
--- 410,413 ----
***************
*** 436,439 ****
--- 435,439 ----
unsigned int max_chan_users;
unsigned int max_chan_bans;
+ struct string_list *set_shows;
struct string_list *eightball;
***************
*** 4979,4983 ****
static OPTION_FUNC(opt_defaulttopic)
{
! if(argc > 0)
{
char *topic;
--- 4979,4983 ----
static OPTION_FUNC(opt_defaulttopic)
{
! if(argc > 1)
{
char *topic;
***************
*** 4989,4993 ****
}
! topic = unsplit_string(argv, argc, NULL);
if(topic[0] == '*' && topic[1] == 0)
--- 4989,4993 ----
}
! topic = unsplit_string(argv+1, argc-1, NULL);
if(topic[0] == '*' && topic[1] == 0)
***************
*** 5013,5017 ****
static OPTION_FUNC(opt_topicmask)
{
! if(argc > 0)
{
struct chanData *cData = channel->channel_info;
--- 5013,5017 ----
static OPTION_FUNC(opt_topicmask)
{
! if(argc > 1)
{
struct chanData *cData = channel->channel_info;
***************
*** 5024,5028 ****
}
! mask = unsplit_string(argv, argc, NULL);
if(cData->topic_mask) free(cData->topic_mask);
--- 5024,5028 ----
}
! mask = unsplit_string(argv+1, argc-1, NULL);
if(cData->topic_mask) free(cData->topic_mask);
***************
*** 5053,5059 ****
(void)channel;
! if(argc > 0)
{
! char *greeting = unsplit_string(argv, argc, NULL);
if(greeting[0] == '*' && greeting[1] == 0)
--- 5053,5059 ----
(void)channel;
! if(argc > 1)
{
! char *greeting = unsplit_string(argv+1, argc-1, NULL);
if(greeting[0] == '*' && greeting[1] == 0)
***************
*** 5097,5101 ****
char modes[MODELEN];
! if(argc > 0)
{
if(!check_user_level(user, channel, channel->channel_info->options[optEnfModes], 1, 0))
--- 5097,5101 ----
char modes[MODELEN];
! if(argc > 1)
{
if(!check_user_level(user, channel, channel->channel_info->options[optEnfModes], 1, 0))
***************
*** 5104,5108 ****
return 0;
}
! if(argv[0][0] == '*' && argv[0][1] == 0)
{
channel->channel_info->mode_on = 0;
--- 5104,5108 ----
return 0;
}
! if(argv[1][0] == '*' && argv[1][1] == 0)
{
channel->channel_info->mode_on = 0;
***************
*** 5112,5118 ****
else
{
! if(!parse_mode_lock(argv, argc, channel->channel_info))
{
! chanserv_notice(user, CSMSG_INVALID_STR_SET, argv[0], "mode lock");
return 0;
}
--- 5112,5118 ----
else
{
! if(!parse_mode_lock(argv+1, argc-1, channel->channel_info))
{
! chanserv_notice(user, CSMSG_INVALID_STR_SET, argv[1], "mode lock");
return 0;
}
***************
*** 5145,5157 ****
(void)cmd;
! if(argc > 0)
{
/* Set flag according to value. */
! if(enabled_string(argv[0]))
{
cData->flags |= mask;
value = 1;
}
! else if(disabled_string(argv[0]))
{
cData->flags &= ~mask;
--- 5145,5157 ----
(void)cmd;
! if(argc > 1)
{
/* Set flag according to value. */
! if(enabled_string(argv[1]))
{
cData->flags |= mask;
value = 1;
}
! else if(disabled_string(argv[1]))
{
cData->flags &= ~mask;
***************
*** 5160,5164 ****
else
{
! chanserv_notice(user, MSG_INVALID_BINARY, argv[0]);
return 0;
}
--- 5160,5164 ----
else
{
! chanserv_notice(user, MSG_INVALID_BINARY, argv[1]);
return 0;
}
***************
*** 5181,5185 ****
(void)cmd;
! if(argc > 0)
{
/* Set flag according to value. */
--- 5181,5185 ----
(void)cmd;
! if(argc > 1)
{
/* Set flag according to value. */
***************
*** 5190,5194 ****
}
! index = atoi(argv[0]);
if(index < 0 || index >= count)
--- 5190,5194 ----
}
! index = atoi(argv[1]);
if(index < 0 || index >= count)
***************
*** 5223,5229 ****
static OPTION_FUNC(opt_nodelete)
{
! if((argc > 0) && !IsOper(user))
{
! chanserv_notice(user, MSG_SETTING_PRIVILEGED, argv[-1]);
return 0;
}
--- 5223,5229 ----
static OPTION_FUNC(opt_nodelete)
{
! if((argc > 1) && !IsOper(user))
{
! chanserv_notice(user, MSG_SETTING_PRIVILEGED, argv[0]);
return 0;
}
***************
*** 5413,5460 ****
}
static CHANSERV_FUNC(cmd_set)
{
! modcmd_func_t *opt;
! if(argc < 2)
{
! unsigned int i = 0;
! modcmd_func_t *set_display[] = {
! /* multiple-choice options */
! opt_defaulttopic, opt_topicmask, opt_greeting,
! opt_usergreeting, opt_modes, opt_pubcmd, opt_strictop,
! opt_autoop, opt_enfmodes, opt_enftopic, opt_protect,
! opt_toys, opt_setters, opt_topicrefresh, opt_ctcpusers,
! opt_ctcpreaction,
! /* binary options */
! opt_voice, opt_userinfo, opt_dynlimit, opt_topicsnarf,
! opt_nodelete
! };
chanserv_notice(user, CSMSG_CHANNEL_OPTIONS);
-
/* Do this so options are presented in a consistent order. */
! while(i < ArrayLength(set_display))
! {
! set_display[i++](user, channel, 0, NULL, NULL);
! }
!
return 1;
}
! if(!(opt = dict_find(set_func_dict, argv[1], NULL)))
{
! chanserv_notice(user, CSMSG_INVALID_OPTION, argv[1]);
! return 0;
}
-
if((argc > 2)
&& !check_user_level(user, channel, channel->channel_info->options[optSetters], 1, 0))
{
! chanserv_notice(user, CSMSG_NO_ACCESS);
return 0;
}
! return opt(user, channel, argc - 2, argv + 2, NULL);
}
--- 5413,5472 ----
}
+ static struct svccmd_list set_shows_list;
+
static CHANSERV_FUNC(cmd_set)
{
! struct svccmd *subcmd;
! char buf[MAXLEN];
! unsigned int ii;
! /* Check if we need to (re-)initialize set_shows_list. */
! if(!set_shows_list.used)
{
! if(!set_shows_list.size)
! {
! set_shows_list.size = chanserv_conf.set_shows->used;
! set_shows_list.list = calloc(set_shows_list.size, sizeof(set_shows_list.list[0]));
! }
! for(ii = 0; ii < chanserv_conf.set_shows->used; ii++)
! {
! const char *name = chanserv_conf.set_shows->list[ii];
! sprintf(buf, "%s %s", argv[0], name);
! subcmd = dict_find(cmd->parent->commands, buf, NULL);
! if(!subcmd)
! {
! log(CS_LOG, LOG_ERROR, "Unable to find set option %s.\n", name);
! continue;
! }
! svccmd_list_append(&set_shows_list, subcmd);
! }
! }
+ if(argc < 2)
+ {
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;
}
! sprintf(buf, "%s %s", argv[0], argv[1]);
! subcmd = dict_find(cmd->parent->commands, buf, NULL);
! if(!subcmd)
{
! reply(CSMSG_INVALID_OPTION, argv[1]);
! return 0;
}
if((argc > 2)
&& !check_user_level(user, channel, channel->channel_info->options[optSetters], 1, 0))
{
! reply(CSMSG_NO_ACCESS);
return 0;
}
! return subcmd->command->func(user, channel, argc - 1, argv + 1, subcmd);
}
***************
*** 6242,6245 ****
--- 6254,6287 ----
str = database_get_data(conf_node, KEY_MAX_OWNED, RECDB_QSTRING);
chanserv_conf.max_owned = str ? atoi(str) : 5;
+ free_string_list(chanserv_conf.set_shows);
+ strlist = database_get_data(conf_node, "set_shows", RECDB_STRING_LIST);
+ if(strlist)
+ {
+ strlist = string_list_copy(strlist);
+ }
+ else
+ {
+ static const char *list[] = {
+ /* multiple choice options */
+ "DefaultTopic", "TopicMask", "Greeting", "UserGreeting", "Modes",
+ "PubCmd", "StrictOp", "AutoOp", "EnfModes", "EnfTopic", "Protect",
+ "Toys", "Setters", "TopicRefresh", "CtcpUsers", "CtcpReaction",
+ /* binary options */
+ "Voice", "UserInfo", "DynLimit", "TopicSnarf", "NoDelete",
+ /* delimiter */
+ NULL };
+ unsigned int ii;
+ strlist = alloc_string_list(ArrayLength(list)-1);
+ for(ii=0; list[ii]; ii++)
+ {
+ string_list_append(strlist, strdup(list[ii]));
+ }
+ }
+ chanserv_conf.set_shows = strlist;
+ /* We don't look things up now, in case the list refers to options
+ * defined by modules initialized after this point. Just mark the
+ * function list as invalid, so it will be initialized.
+ */
+ set_shows_list.used = 0;
free_string_list(chanserv_conf.eightball);
strlist = database_get_data(conf_node, KEY_8BALL_RESPONSES, RECDB_STRING_LIST);
***************
*** 6835,6839 ****
dict_delete(sChannels);
while(channelList) unregister_channel(channelList);
- dict_delete(set_func_dict);
dict_delete(handle_dnrs);
dict_delete(plain_dnrs);
--- 6877,6880 ----
***************
*** 6841,6848 ****
dict_delete(note_types);
if(chanserv_conf.eightball) free_string_list(chanserv_conf.eightball);
}
#define DEFINE_COMMAND(NAME, MIN_ARGC, FLAGS, OPTIONS...) modcmd_register(chanserv_module, #NAME, cmd_##NAME, MIN_ARGC, FLAGS, ## OPTIONS)
! #define DEFINE_OPTION(NAME) dict_insert(set_func_dict, #NAME, opt_##NAME)
void
--- 6882,6891 ----
dict_delete(note_types);
if(chanserv_conf.eightball) free_string_list(chanserv_conf.eightball);
+ if(chanserv_conf.set_shows) free_string_list(chanserv_conf.set_shows);
+ if(set_shows_list.list) free(set_shows_list.list);
}
#define DEFINE_COMMAND(NAME, MIN_ARGC, FLAGS, OPTIONS...) modcmd_register(chanserv_module, #NAME, cmd_##NAME, MIN_ARGC, FLAGS, ## OPTIONS)
! #define DEFINE_OPTION(NAME) modcmd_register(chanserv_module, "set "#NAME, opt_##NAME, 1, 0, NULL)
void
***************
*** 6967,6971 ****
DEFINE_COMMAND(huggle, 1, 0, "flags", "+nolog,+toy,+acceptchan", NULL);
- set_func_dict = dict_new();
DEFINE_OPTION(defaulttopic);
DEFINE_OPTION(topicmask);
--- 7010,7013 ----
***************
*** 6990,6994 ****
DEFINE_OPTION(ctcpreaction);
/* compatability alias.. */
! dict_insert(set_func_dict, "topic", opt_defaulttopic);
note_types = dict_new();
--- 7032,7036 ----
DEFINE_OPTION(ctcpreaction);
/* compatability alias.. */
! modcmd_register(chanserv_module, "set topic", opt_defaulttopic, 1, 0, NULL);
note_types = dict_new();
|
|
From: Entrope <en...@us...> - 2002-09-18 14:51:35
|
Update of /cvsroot/srvx/services
In directory usw-pr-cvs1:/tmp/cvs-serv3577
Modified Files:
srvx.conf.example
Log Message:
allow ChanServ to import set options from other modules
make the list and order of options shown by !set configurable
Index: srvx.conf.example
===================================================================
RCS file: /cvsroot/srvx/services/srvx.conf.example,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** srvx.conf.example 14 Sep 2002 03:47:28 -0000 1.28
--- srvx.conf.example 18 Sep 2002 14:51:30 -0000 1.29
***************
*** 170,173 ****
--- 170,177 ----
// character to make ChanServ pay attention to you
"trigger" "!";
+ // what !set options should we show when user calls "!set" with no arguments?
+ "set_shows" ("DefaultTopic", "TopicMask", "Greeting", "UserGreeting", "Modes", "PubCmd", "StrictOp", "AutoOp", "EnfModes", "EnfTopic", "Protect", "Toys", "Setters", "TopicRefresh", "CtcpUsers", "CtcpReaction", "Mod", "Game",
+ "Voice", "UserInfo", "DynLimit", "TopicSnarf", "NoDelete");
+
// A list of !8ball responses
"8ball" ("Not a chance.",
|
|
From: Entrope <en...@us...> - 2002-09-18 14:50:22
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv2968/src
Modified Files:
modcmd.c modcmd.h
Log Message:
allow binding and unbinding of commands with spaces in their names
fail permission checks for REQUIRE_HELPING commands if user isn't helping
define struct svccmd_list
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** modcmd.c 16 Sep 2002 21:10:19 -0000 1.28
--- modcmd.c 18 Sep 2002 14:50:19 -0000 1.29
***************
*** 142,145 ****
--- 142,147 ----
}
+ DEFINE_LIST(svccmd_list, struct svccmd*);
+
static void
free_service_command(void *data) {
***************
*** 523,526 ****
--- 525,529 ----
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) {
***************
*** 894,914 ****
}
static MODCMD_FUNC(cmd_bind) {
struct service *service;
struct svccmd *template, *newcmd;
! char *svcname, *newname, *cmdname, *dot;
assert(argc > 3);
svcname = argv[1];
! newname = argv[2];
! cmdname = argv[3];
if (!(service = service_find(svcname))) {
! send_message(user, cmd->parent->bot, MCMSG_UNKNOWN_SERVICE, svcname);
return 0;
}
if ((newcmd = dict_find(service->commands, newname, NULL))) {
! send_message(user, cmd->parent->bot, MCMSG_ALREADY_BOUND, service->bot->nick, newname);
return 0;
}
--- 897,958 ----
}
+ static unsigned int
+ collapse_cmdname(unsigned char *argv[], unsigned int argc, char *dest) {
+ unsigned int ii, pos, arg;
+ if (!argc) {
+ dest[0] = 0;
+ return 0;
+ }
+ for (ii=pos=0, arg=0; argv[arg][ii]; ) {
+ if (argv[arg][ii] == '\\') {
+ if (argv[arg][ii+1]) {
+ /* escaping a real character just puts it in literally */
+ dest[pos++] = argv[arg][++ii];
+ } else if (arg == argc) {
+ /* we ran to the end of the argument list; abort */
+ break;
+ } else {
+ /* escape at end of a word is a space */
+ dest[pos++] = ' ';
+ ii = 0;
+ arg++;
+ }
+ } else {
+ /* normal characters don't need escapes */
+ dest[pos++] = argv[arg][ii++];
+ }
+ }
+ dest[pos] = 0;
+ return arg + 1;
+ }
+
static MODCMD_FUNC(cmd_bind) {
struct service *service;
struct svccmd *template, *newcmd;
! char *svcname, *dot;
! char newname[MAXLEN], cmdname[MAXLEN];
! unsigned int arg, diff;
assert(argc > 3);
svcname = argv[1];
! arg = collapse_cmdname(argv+2, argc-2, newname) + 2;
! if (!arg) {
! reply(MSG_MISSING_PARAMS, cmd->name);
! return 0;
! }
! diff = collapse_cmdname(argv+arg, argc-arg, cmdname);
! if (!diff) {
! reply(MSG_MISSING_PARAMS, cmd->name);
! return 0;
! }
! arg += diff;
if (!(service = service_find(svcname))) {
! reply(MCMSG_UNKNOWN_SERVICE, svcname);
return 0;
}
if ((newcmd = dict_find(service->commands, newname, NULL))) {
! reply(MCMSG_ALREADY_BOUND, service->bot->nick, newname);
return 0;
}
***************
*** 920,928 ****
module = module_find(cmdname);
if (!module) {
! send_message(user, cmd->parent->bot, MSG_MODULE_UNKNOWN, cmdname);
return 0;
}
count = service_bind_module(service, module);
! send_message(user, service->bot, MCMSG_MODULE_BOUND, count, module->name, service->bot->nick);
return count != 0;
}
--- 964,972 ----
module = module_find(cmdname);
if (!module) {
! reply(MSG_MODULE_UNKNOWN, cmdname);
return 0;
}
count = service_bind_module(service, module);
! reply(MCMSG_MODULE_BOUND, count, module->name, service->bot->nick);
return count != 0;
}
***************
*** 931,935 ****
newcmd->parent = service;
if (!(template = svccmd_resolve_name(newcmd, cmdname))) {
! send_message(user, cmd->parent->bot, MCMSG_UNKNOWN_COMMAND_2, cmdname, service->bot->nick);
free(newcmd->name);
free(newcmd);
--- 975,979 ----
newcmd->parent = service;
if (!(template = svccmd_resolve_name(newcmd, cmdname))) {
! reply(MCMSG_UNKNOWN_COMMAND_2, cmdname, service->bot->nick);
free(newcmd->name);
free(newcmd);
***************
*** 937,941 ****
}
if (template->alias.used) {
! send_message(user, cmd->parent->bot, MCMSG_CANNOT_DOUBLE_ALIAS);
free(newcmd->name);
free(newcmd);
--- 981,985 ----
}
if (template->alias.used) {
! reply(MCMSG_CANNOT_DOUBLE_ALIAS);
free(newcmd->name);
free(newcmd);
***************
*** 943,953 ****
}
! if (argc > 4) {
/* a more complicated alias; fix it up */
unsigned int nn;
! nn = check_alias_args(argv+3, argc-3);
! if (nn+3 < argc) {
! send_message(user, cmd->parent->bot, MCMSG_BAD_ALIAS_ARGUMENT, argv[nn+3]);
free(newcmd->name);
free(newcmd);
--- 987,997 ----
}
! if (argc > arg+1) {
/* a more complicated alias; fix it up */
unsigned int nn;
! nn = check_alias_args(argv+arg, argc-arg);
! if (nn+arg < argc) {
! reply(MCMSG_BAD_ALIAS_ARGUMENT, argv[nn+arg]);
free(newcmd->name);
free(newcmd);
***************
*** 963,967 ****
newcmd->template = template;
svccmd_insert(service, newcmd->name, newcmd, template->command);
! send_message(user, cmd->parent->bot, MCMSG_COMMAND_BOUND, newcmd->name, newcmd->parent->bot->nick);
return 1;
}
--- 1007,1011 ----
newcmd->template = template;
svccmd_insert(service, newcmd->name, newcmd, template->command);
! reply(MCMSG_COMMAND_BOUND, newcmd->name, newcmd->parent->bot->nick);
return 1;
}
***************
*** 984,1019 ****
struct userNode *bot;
struct svccmd *bound;
! const char *svcname, *cmdname;
assert(argc > 2);
svcname = argv[1];
! cmdname = argv[2];
!
if (!(service = service_find(svcname))) {
! send_message(user, cmd->parent->bot, MCMSG_UNKNOWN_SERVICE, svcname);
return 0;
}
if (!(bound = dict_find(service->commands, cmdname, NULL))) {
! send_message(user, cmd->parent->bot, MCMSG_NO_COMMAND_BOUND, service->bot->nick, cmdname);
return 0;
}
if ((bound->command->flags & MODCMD_KEEP_BOUND) && (bound->command->bind_count == 1)) {
! send_message(user, cmd->parent->bot, MCMSG_UNBIND_PROHIBITED, bound->command->name);
return 0;
}
! /* If this command is removing a binding to itself, we (and
! svccmd_invoke_argv) must take care not to dereference cmd.
! Return 0 if so - we avoid the dereference, but the
! invocation will not be logged; the alternative is to hoist
! the log message generation above the dispatch.
! */
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 cmd == bound ? 0 : 1;
}
--- 1028,1064 ----
struct userNode *bot;
struct svccmd *bound;
! const char *svcname;
! unsigned int arg;
! char cmdname[MAXLEN];
assert(argc > 2);
svcname = argv[1];
! arg = collapse_cmdname(argv+2, argc-2, cmdname) + 2;
! if (!arg) {
! reply(MSG_MISSING_PARAMS, cmd->name);
! return 0;
! }
if (!(service = service_find(svcname))) {
! reply(MCMSG_UNKNOWN_SERVICE, svcname);
return 0;
}
if (!(bound = dict_find(service->commands, cmdname, NULL))) {
! reply(MCMSG_NO_COMMAND_BOUND, service->bot->nick, cmdname);
return 0;
}
if ((bound->command->flags & MODCMD_KEEP_BOUND) && (bound->command->bind_count == 1)) {
! reply(MCMSG_UNBIND_PROHIBITED, bound->command->name);
return 0;
}
! /* If this command is removing a binding to itself, we must take
! * care not to dereference cmd.
! */
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;
}
***************
*** 1042,1045 ****
--- 1087,1091 ----
return 0;
}
+ if (old_helpfile) close_helpfile(old_helpfile);
gettimeofday(&stop, NULL);
stop.tv_sec -= start.tv_sec;
***************
*** 1201,1227 ****
static MODCMD_FUNC(cmd_modcmd) {
struct svccmd *svccmd;
! unsigned int ii, pos, arg, changed;
char cmdname[MAXLEN];
! assert(argc >= 4);
! for (ii=pos=0, arg=1; argv[arg][ii]; ) {
! if (argv[arg][ii] == '\\') {
! if (argv[arg][ii+1]) {
! /* escaping a real character just puts it in literally */
! cmdname[pos++] = argv[arg][++ii];
! } else {
! /* escape at end of a word is a space */
! cmdname[pos++] = ' ';
! ii = 0;
! arg++;
! }
! } else {
! /* normal characters don't need escapes */
! cmdname[pos++] = argv[arg][ii++];
! }
}
- cmdname[pos] = 0;
if (!(svccmd = svccmd_resolve_name(cmd, cmdname))) {
! send_message(user, cmd->parent->bot, MCMSG_UNKNOWN_COMMAND_2, cmdname, cmd->parent->bot->nick);
return 0;
}
--- 1247,1261 ----
static MODCMD_FUNC(cmd_modcmd) {
struct svccmd *svccmd;
! unsigned int arg, changed;
char cmdname[MAXLEN];
! assert(argc >= 2);
! arg = collapse_cmdname(argv+1, argc-1, cmdname) + 1;
! if (!arg || (arg+2 < argc)) {
! reply(MSG_MISSING_PARAMS, cmd->name);
! return 0;
}
if (!(svccmd = svccmd_resolve_name(cmd, cmdname))) {
! reply(MCMSG_UNKNOWN_COMMAND_2, cmdname, cmd->parent->bot->nick);
return 0;
}
***************
*** 1229,1233 ****
for (arg++; arg+1 < argc; arg += 2) {
if (svccmd_configure(svccmd, user, cmd->parent->bot, argv[arg], argv[arg+1])) {
! send_message(user, cmd->parent->bot, MCMSG_COMMAND_MODIFIED, argv[arg], svccmd->name);
changed = 1;
}
--- 1263,1267 ----
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);
changed = 1;
}
Index: modcmd.h
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** modcmd.h 15 Sep 2002 00:01:12 -0000 1.9
--- modcmd.h 18 Sep 2002 14:50:19 -0000 1.10
***************
*** 38,41 ****
--- 38,43 ----
typedef MODCMD_FUNC(modcmd_func_t);
+ DECLARE_LIST(svccmd_list, struct svccmd*);
+
#if defined(__GNUC__) && (__GNUC__ < 3)
#define reply(FMT...) send_message(user, cmd->parent->bot, FMT)
|
|
From: Entrope <en...@us...> - 2002-09-16 21:10:22
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv7357/src
Modified Files:
modcmd.c
Log Message:
fix compile error from previous commit (sigh)
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** modcmd.c 16 Sep 2002 19:28:10 -0000 1.27
--- modcmd.c 16 Sep 2002 21:10:19 -0000 1.28
***************
*** 690,693 ****
--- 690,694 ----
pcmd->uses++;
if (perms & ACTION_NOCHANNEL) channel = NULL;
+ pos = 0;
if (!(cmd.flags & MODCMD_NO_LOG)) {
/* We reassemble the input line here. This lets services do
***************
*** 695,699 ****
* while still having the commands logged uniformly.
*/
- pos = 0;
if (channel) pos += sprintf(logbuf+pos, "(%s) ", channel->name);
pos += sprintf(logbuf+pos, "[%s", user->nick);
--- 696,699 ----
|
|
From: Entrope <en...@us...> - 2002-09-16 19:28:14
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv5061/src
Modified Files:
chanserv.c modcmd.c
Log Message:
fix some potential dereferences of null pointers
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.284
retrieving revision 1.285
diff -C2 -r1.284 -r1.285
*** chanserv.c 16 Sep 2002 14:53:35 -0000 1.284
--- chanserv.c 16 Sep 2002 19:28:10 -0000 1.285
***************
*** 1890,1893 ****
--- 1890,1894 ----
if(IsSuspended(cData))
{
+ unregister_channel(cData);
dict_remove(sChannels, channel->name);
}
***************
*** 1895,1901 ****
{
sprintf(reason, "Channel unregistered by %s.", user->handle_info->handle);
DelChannelUser(chanserv, channel, reason, 0);
}
- unregister_channel(cData);
chanserv_notice(user, CSMSG_UNREG_SUCCESS, name);
sprintf(reason, "%s unregistered by %s.", name, user->handle_info->handle);
--- 1896,1902 ----
{
sprintf(reason, "Channel unregistered by %s.", user->handle_info->handle);
+ unregister_channel(cData);
DelChannelUser(chanserv, channel, reason, 0);
}
chanserv_notice(user, CSMSG_UNREG_SUCCESS, name);
sprintf(reason, "%s unregistered by %s.", name, user->handle_info->handle);
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** modcmd.c 16 Sep 2002 14:54:01 -0000 1.26
--- modcmd.c 16 Sep 2002 19:28:10 -0000 1.27
***************
*** 614,618 ****
svccmd_invoke_argv(struct userNode *user, struct service *service, struct chanNode *channel, unsigned int argc, unsigned char *argv[], unsigned int server_qualified) {
struct svccmd cmd, *pcmd;
! unsigned int cmd_arg, perms;
/* Find the command argument. */
--- 614,619 ----
svccmd_invoke_argv(struct userNode *user, struct service *service, struct chanNode *channel, unsigned int argc, unsigned char *argv[], unsigned int server_qualified) {
struct svccmd cmd, *pcmd;
! unsigned int cmd_arg, perms, pos;
! char logbuf[2*MAXLEN];
/* Find the command argument. */
***************
*** 665,673 ****
&& (cmd.flags & MODCMD_ACCEPT_CHANNEL)
&& IsChannelName(argv[1])
! && ((argv[1][0] != '+') || (cmd.flags & MODCMD_ACCEPT_PCHANNEL))) {
! if (!(channel = dict_find(channels, argv[1], NULL))) {
! send_message(user, service->bot, MSG_INVALID_CHANNEL);
! return 0;
! }
argv[1] = argv[0];
argv++, argc--;
--- 666,671 ----
&& (cmd.flags & MODCMD_ACCEPT_CHANNEL)
&& IsChannelName(argv[1])
! && ((argv[1][0] != '+') || (cmd.flags & MODCMD_ACCEPT_PCHANNEL))
! && (channel = dict_find(channels, argv[1], NULL))) {
argv[1] = argv[0];
argv++, argc--;
***************
*** 692,700 ****
pcmd->uses++;
if (perms & ACTION_NOCHANNEL) channel = NULL;
- if (!cmd.command->func(user, channel, argc, argv, pcmd)) return 0;
if (!(cmd.flags & MODCMD_NO_LOG)) {
- unsigned int pos;
- char logbuf[2*MAXLEN];
-
/* We reassemble the input line here. This lets services do
* clever things like replace passwords in argv[] with "****"
--- 690,694 ----
***************
*** 714,717 ****
--- 708,716 ----
}
pos += sprintf(logbuf+pos, "]: ");
+ }
+ if (!cmd.command->func(user, channel, argc, argv, pcmd)) return 0;
+ if (!(cmd.flags & MODCMD_NO_LOG)) {
+ /* Unsplit argv after running the function to get the benefit
+ * of any mangling/hiding done by the commands. */
unsplit_string(argv, argc, logbuf+pos);
log(cmd.command->parent->clog, LOG_INFO, "%s\n", logbuf);
|
|
From: Entrope <en...@us...> - 2002-09-16 18:35:27
|
Update of /cvsroot/srvx/services In directory usw-pr-cvs1:/tmp/cvs-serv19333 Modified Files: configure.in Log Message: test for "inline" keyword Index: configure.in =================================================================== RCS file: /cvsroot/srvx/services/configure.in,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -r1.63 -r1.64 *** configure.in 14 Sep 2002 03:45:49 -0000 1.63 --- configure.in 16 Sep 2002 18:35:24 -0000 1.64 *************** *** 13,19 **** AM_MAINTAINER_MODE ! dnl Sanity checks. AC_TYPE_SIGNAL AC_C_CONST dnl Checks for programs. --- 13,20 ---- AM_MAINTAINER_MODE ! dnl Compiler/runtime feature checks. AC_TYPE_SIGNAL AC_C_CONST + AC_C_INLINE dnl Checks for programs. |
|
From: Entrope <en...@us...> - 2002-09-16 18:35:16
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv19259/src
Modified Files:
saxdb.c
Log Message:
fix the "cheating" to add newlines between top-level mondo sections
Index: saxdb.c
===================================================================
RCS file: /cvsroot/srvx/services/src/saxdb.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** saxdb.c 8 Sep 2002 04:28:38 -0000 1.14
--- saxdb.c 16 Sep 2002 18:35:11 -0000 1.15
***************
*** 45,49 ****
};
! #define COMPLEX(CTX) ((CTX)->complex.used && ((CTX)->complex.list[(CTX)->complex.used-1]))
static struct saxdb *last_db;
--- 45,49 ----
};
! #define COMPLEX(CTX) ((CTX)->complex.used ? ((CTX)->complex.list[(CTX)->complex.used-1]) : 1)
static struct saxdb *last_db;
***************
*** 323,331 ****
saxdb_mondo_write(struct saxdb_context *ctx, struct saxdb *saxdb) {
int res;
! if (saxdb->prev) {
! if ((res = saxdb_mondo_write(ctx, saxdb->prev))) return res;
! /* cheat a little here to put a newline between mondo sections */
! saxdb_put_char(ctx, '\n');
! }
if (saxdb->mondo_section) {
saxdb_start_record(ctx, saxdb->mondo_section, 1);
--- 323,327 ----
saxdb_mondo_write(struct saxdb_context *ctx, struct saxdb *saxdb) {
int res;
! if (saxdb->prev && (res = saxdb_mondo_write(ctx, saxdb->prev))) return res;
if (saxdb->mondo_section) {
saxdb_start_record(ctx, saxdb->mondo_section, 1);
***************
*** 335,338 ****
--- 331,336 ----
}
saxdb_end_record(ctx);
+ /* cheat a little here to put a newline between mondo sections */
+ saxdb_put_char(ctx, '\n');
}
return 0;
|
|
From: Entrope <en...@us...> - 2002-09-16 14:57:38
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv3070/src
Modified Files:
opserv.c
Log Message:
add subcommand checking for ?gtrace and ?csearch commands
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.275
retrieving revision 1.276
diff -C2 -r1.275 -r1.276
*** opserv.c 14 Sep 2002 03:48:58 -0000 1.275
--- opserv.c 16 Sep 2002 14:57:35 -0000 1.276
***************
*** 3384,3387 ****
--- 3384,3389 ----
unsigned int matches;
cdiscrim_search_func action;
+ struct svccmd *subcmd;
+ char buf[MAXLEN];
OPSERV_MIN_PARMS(3, false);
***************
*** 3396,3399 ****
--- 3398,3407 ----
}
+ 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;
+ }
+
discrim = opserv_cdiscrim_create(user, argc - 2, argv + 2);
if(!discrim) {
***************
*** 3470,3477 ****
unsigned int matches;
struct gline_extra extra;
OPSERV_MIN_PARMS(3, false);
- extra.user = user;
- extra.glines = alloc_string_list(4);
if (!irccasecmp(argv[1], "print")) {
action = gtrace_print_func;
--- 3478,3485 ----
unsigned int matches;
struct gline_extra extra;
+ struct svccmd *subcmd;
+ char buf[MAXLEN];
OPSERV_MIN_PARMS(3, false);
if (!irccasecmp(argv[1], "print")) {
action = gtrace_print_func;
***************
*** 3484,3487 ****
--- 3492,3500 ----
return 0;
}
+ 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;
+ }
discrim = gline_discrim_create(user, opserv, argc-2, argv+2);
***************
*** 3494,3497 ****
--- 3507,3512 ----
}
+ extra.user = user;
+ extra.glines = alloc_string_list(4);
matches = gline_discrim_search(discrim, action, &extra);
***************
*** 3940,3943 ****
--- 3955,3961 ----
opserv_define_func("CLONE", cmd_clone, 999, 0);
opserv_define_func("COLLIDE", cmd_collide, 800, 0);
+ opserv_define_func("CSEARCH", cmd_csearch, 100, 0);
+ opserv_define_func("CSEARCH COUNT", cmd_csearch, 0, 0);
+ opserv_define_func("CSEARCH PRINT", cmd_csearch, 0, 0);
opserv_define_func("DELALERT", cmd_delalert, 800, 0);
opserv_define_func("DELBAD", cmd_delbad, 800, 0);
***************
*** 3951,3954 ****
--- 3969,3977 ----
opserv_define_func("GAG", cmd_gag, 600, 0);
opserv_define_func("GLINE", cmd_gline, 600, 0);
+ opserv_define_func("GSYNC", cmd_gsync, 600, 0);
+ opserv_define_func("GTRACE", cmd_gtrace, 100, 0);
+ 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);
***************
*** 3996,4002 ****
opserv_define_func("TRACE GAG", NULL, 600, 0);
opserv_define_func("TRACE KILL", NULL, 600, 0);
- opserv_define_func("CSEARCH", cmd_csearch, 100, 0);
- opserv_define_func("GSYNC", cmd_gsync, 600, 0);
- opserv_define_func("GTRACE", cmd_gtrace, 100, 0);
opserv_define_func("UNBAN", cmd_unban, 100, 2);
opserv_define_func("UNGAG", cmd_ungag, 600, 0);
--- 4019,4022 ----
|
|
From: Entrope <en...@us...> - 2002-09-16 14:54:04
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv1718/src
Modified Files:
modcmd.c
Log Message:
check for null modcmd functions and report them as errors
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** modcmd.c 15 Sep 2002 00:01:12 -0000 1.25
--- modcmd.c 16 Sep 2002 14:54:01 -0000 1.26
***************
*** 44,47 ****
--- 44,48 ----
#define MCMSG_COMMAND_BINDING "%s is a binding of: %s"
#define MCMSG_ALIAS_ERROR "Error in alias expansion for %s; check the error log for details."
+ #define MCMSG_INTERNAL_COMMAND "$b%s$b is an internal command and cannot be called directly; please check command bindings."
#define MCMSG_UNKNOWN_SERVICE "Unknown service %s."
#define MCMSG_ALREADY_BOUND "%s already has a command bound as %s."
***************
*** 683,686 ****
--- 684,691 ----
if (argc < cmd.command->min_argc) {
send_message(user, service->bot, MSG_MISSING_PARAMS, cmd.name);
+ return 0;
+ }
+ if (!cmd.command->func) {
+ send_message(user, service->bot, MCMSG_INTERNAL_COMMAND, cmd.name);
return 0;
}
|
|
From: Entrope <en...@us...> - 2002-09-16 14:53:43
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv1604/src
Modified Files:
chanserv.c
Log Message:
replace cmd_invite with cmd_inviteme (inviting others was a source of services abuse)
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.283
retrieving revision 1.284
diff -C2 -r1.283 -r1.284
*** chanserv.c 15 Sep 2002 00:01:11 -0000 1.283
--- chanserv.c 16 Sep 2002 14:53:35 -0000 1.284
***************
*** 237,244 ****
#define CSMSG_PROCESS_USERS "%s users in $b%s$b."
! #define CSMSG_INVITED_USER "Invited $b%s$b to join %s."
! #define CSMSG_INVITING_YOU "$b%s$b invites you to join %s%s%s"
! #define CSMSG_CANNOT_INVITE "You lack sufficient access to invite users."
! #define CSMSG_ALREADY_PRESENT "%s is $balready in %s$b."
#define CSMSG_KICK_DONE "Kicked $b%s$b from %s."
--- 237,241 ----
#define CSMSG_PROCESS_USERS "%s users in $b%s$b."
! #define CSMSG_ALREADY_PRESENT "You are already in $b%s$b."
#define CSMSG_KICK_DONE "Kicked $b%s$b from %s."
***************
*** 3950,3997 ****
}
! static CHANSERV_FUNC(cmd_invite)
{
! struct userData *uData;
! struct userNode *invite;
!
! uData = GetChannelUser(channel->channel_info, user->handle_info);
!
! if(argc > 1)
! {
! if(uData->access < ulMaster)
! {
! chanserv_notice(user, CSMSG_CANNOT_INVITE);
! return 0;
! }
!
! if(!(invite = GetUserH(argv[1])))
! {
! chanserv_notice(user, MSG_NICK_UNKNOWN, argv[1]);
! return 0;
! }
! }
! else
! {
! invite = user;
! }
!
! if(GetUserMode(channel, invite))
{
! chanserv_notice(user, CSMSG_ALREADY_PRESENT, invite->nick, channel->name);
return 0;
}
!
! if(user != invite)
! {
! char *reason = (argc > 2) ? unsplit_string(argv + 2, argc - 2, NULL) : "";
!
! chanserv_notice(invite, CSMSG_INVITING_YOU, user->nick, channel->name, (argc > 2) ? ": " : ".", reason);
! }
! irc_invite(chanserv, invite, channel);
! if(argc > 1)
! {
! chanserv_notice(user, CSMSG_INVITED_USER, argv[1], channel->name);
! }
!
return 1;
}
--- 3947,3959 ----
}
! static CHANSERV_FUNC(cmd_inviteme)
{
! (void)argv;
! if(GetUserMode(channel, user))
{
! reply(CSMSG_ALREADY_PRESENT, channel->name);
return 0;
}
! irc_invite(cmd->parent->bot, user, channel);
return 1;
}
***************
*** 6955,6959 ****
DEFINE_COMMAND(topic, 1, MODCMD_REQUIRE_REGCHAN, "template", "op", NULL);
DEFINE_COMMAND(mode, 1, MODCMD_REQUIRE_REGCHAN, "template", "op", NULL);
! DEFINE_COMMAND(invite, 1, MODCMD_REQUIRE_CHANUSER, "access", "peon", NULL);
DEFINE_COMMAND(set, 1, MODCMD_REQUIRE_CHANUSER, "access", "op", NULL);
DEFINE_COMMAND(setinfo, 1, MODCMD_REQUIRE_CHANUSER, "flags", "+nolog", NULL);
--- 6917,6921 ----
DEFINE_COMMAND(topic, 1, MODCMD_REQUIRE_REGCHAN, "template", "op", NULL);
DEFINE_COMMAND(mode, 1, MODCMD_REQUIRE_REGCHAN, "template", "op", NULL);
! DEFINE_COMMAND(inviteme, 1, MODCMD_REQUIRE_CHANUSER, "access", "peon", NULL);
DEFINE_COMMAND(set, 1, MODCMD_REQUIRE_CHANUSER, "access", "op", NULL);
DEFINE_COMMAND(setinfo, 1, MODCMD_REQUIRE_CHANUSER, "flags", "+nolog", NULL);
|
|
From: Zoot <zo...@us...> - 2002-09-15 07:21:19
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv4769/src
Modified Files:
proto-p10.c
Log Message:
Handle squits of services itself properly.
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -r1.33 -r1.34
*** proto-p10.c 14 Sep 2002 03:48:59 -0000 1.33
--- proto-p10.c 15 Sep 2002 07:21:16 -0000 1.34
***************
*** 1230,1233 ****
--- 1230,1243 ----
if (argc < 4) return 0;
if (!(server = GetServerH(argv[1]))) return 0;
+
+ if (server == self->uplink) {
+ /* Force a reconnect to the currently selected server. */
+ cManager.uplink->tries = 0;
+ log(MAIN_LOG, LOG_INFO, "Squitting from uplink: %s\n", argv[3]);
+ close_socket();
+
+ return 1;
+ }
+
DelServer(server, 0, argv[3]);
return 1;
|
|
From: Zoot <zo...@us...> - 2002-09-15 07:20:48
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv4690/src
Modified Files:
proto-common.c
Log Message:
Send the correct lines of administrative info when there are less than three lines.
Index: proto-common.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-common.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** proto-common.c 14 Sep 2002 03:48:59 -0000 1.14
--- proto-common.c 15 Sep 2002 07:20:45 -0000 1.15
***************
*** 395,403 ****
}
if ((slist = conf_get_data("server/admin", RECDB_STRING_LIST)) && slist->used) {
irc_numeric(user, 256, ":Administrative info about %s", self->name);
! switch (slist->used) {
! default: irc_numeric(user, 257, ":%s", slist->list[0]);
! case 2: irc_numeric(user, 258, ":%s", slist->list[1]);
! case 1: irc_numeric(user, 259, ":%s", slist->list[2]);
}
} else {
--- 395,403 ----
}
if ((slist = conf_get_data("server/admin", RECDB_STRING_LIST)) && slist->used) {
+ unsigned int i;
+
irc_numeric(user, 256, ":Administrative info about %s", self->name);
! for (i = 0; i < slist->used && i < 3; i++) {
! irc_numeric(user, 257 + i, ":%s", slist->list[i]);
}
} else {
|
|
From: Entrope <en...@us...> - 2002-09-15 00:01:16
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv6559/src
Modified Files:
chanserv.c modcmd.c modcmd.h
Log Message:
re-implement "toy" checking
detect and prevent setting of command template loops (fixes bug 606404)
correctly show required account flags (fixes bug 609377)
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.282
retrieving revision 1.283
diff -C2 -r1.282 -r1.283
*** chanserv.c 11 Sep 2002 01:50:04 -0000 1.282
--- chanserv.c 15 Sep 2002 00:01:11 -0000 1.283
***************
*** 376,381 ****
#define CSMSG_BAD_NUMBER "$b%s$b is an invalid number. Please use a number greater than 1 with this command."
- #define CSMSG_TOYS_DISABLED "Toys are disabled in %s."
-
/* eject_user and unban_user flags */
#define ACTION_KICK 0x0001
--- 376,379 ----
***************
*** 6999,7008 ****
DEFINE_COMMAND(unvisited, 1, 0, "account_flags", "+g", "flags", "+nolog", NULL);
! DEFINE_COMMAND(unf, 1, 0, "flags", "+nolog", NULL);
! DEFINE_COMMAND(ping, 1, 0, "flags", "+nolog", NULL);
! DEFINE_COMMAND(wut, 1, 0, "flags", "+nolog", NULL);
! DEFINE_COMMAND(8ball, 1, 0, "flags", "+nolog", NULL);
! DEFINE_COMMAND(d, 1, 0, "flags", "+nolog", NULL);
! DEFINE_COMMAND(huggle, 1, 0, "flags", "+nolog", NULL);
set_func_dict = dict_new();
--- 6997,7006 ----
DEFINE_COMMAND(unvisited, 1, 0, "account_flags", "+g", "flags", "+nolog", NULL);
! DEFINE_COMMAND(unf, 1, 0, "flags", "+nolog,+toy,+acceptchan", NULL);
! DEFINE_COMMAND(ping, 1, 0, "flags", "+nolog,+toy,+acceptchan", NULL);
! DEFINE_COMMAND(wut, 1, 0, "flags", "+nolog,+toy,+acceptchan", NULL);
! DEFINE_COMMAND(8ball, 1, 0, "flags", "+nolog,+toy,+acceptchan", NULL);
! DEFINE_COMMAND(d, 1, 0, "flags", "+nolog,+toy,+acceptchan", NULL);
! DEFINE_COMMAND(huggle, 1, 0, "flags", "+nolog,+toy,+acceptchan", NULL);
set_func_dict = dict_new();
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** modcmd.c 7 Sep 2002 02:55:18 -0000 1.24
--- modcmd.c 15 Sep 2002 00:01:12 -0000 1.25
***************
*** 42,45 ****
--- 42,46 ----
#define MCMSG_NO_PLUS_CHANNEL "You may not use a +channel with this command."
#define MCMSG_COMMAND_ALIASES "%s is an alias for: %s"
+ #define MCMSG_COMMAND_BINDING "%s is a binding of: %s"
#define MCMSG_ALIAS_ERROR "Error in alias expansion for %s; check the error log for details."
#define MCMSG_UNKNOWN_SERVICE "Unknown service %s."
***************
*** 69,72 ****
--- 70,74 ----
#define MCMSG_NEED_CHANNEL "You must specify a channel that exists."
#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."
***************
*** 76,79 ****
--- 78,85 ----
#define MSMSG_NOW_NOT_HELPING "Security override has been disabled."
#define MCMSG_JOINER_CHOICES "Subcommands of %s: %s"
+ #define MCMSG_TOYS_DISABLED "Toys are disabled in %s."
+ #define MCMSG_NO_TEMPLATE_SELF "You cannot make a command its own template."
+ #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."
struct pending_template {
***************
*** 92,95 ****
--- 98,107 ----
struct userData *_GetChannelUser(struct chanData *channel, struct handle_info *handle, int override, int allow_suspended);
+ #define ACTION_ALLOW 1
+ #define ACTION_OVERRIDE 2
+ #define ACTION_NOCHANNEL 4
+
+ #define RESOLVE_DEPTH 4
+
static struct modcmd_flag {
const char *name;
***************
*** 112,115 ****
--- 124,128 ----
{ "supporthelper", MODCMD_REQUIRE_SUPPORT_HELPER },
{ "helping", MODCMD_REQUIRE_HELPING },
+ { "toy", MODCMD_TOY },
{ NULL, 0 }
};
***************
*** 310,339 ****
cmd->flags = (cmd->flags | set_flags) & ~rem_flags;
return 1;
! } else if (!irccasecmp(param, "level") || !irccasecmp(param, "access")) {
! if (isdigit(*value)) {
! unsigned int newval = atoi(value);
! if (newval > 1000) {
! if (user) {
! send_message(user, bot, MCMSG_BAD_OPSERV_LEVEL, value);
! } else {
! log(MAIN_LOG, LOG_ERROR, "Invalid OpServ access level %s (for command %s).\n", value, cmd->name);
! }
! return 0;
}
! cmd->min_opserv_level = atoi(value);
! return 1;
! } else {
! enum userLevel ul = user_level_from_name(value);
! if (ul == ulNone) {
! if (user) {
! send_message(user, bot, MCMSG_BAD_CHANSERV_LEVEL, value);
! } else {
! log(MAIN_LOG, LOG_ERROR, "Invalid ChanServ access level %s (for command %s).\n", value, cmd->name);
! }
! return 0;
}
! cmd->min_channel_access = ul;
! return 1;
}
} else if (!irccasecmp(param, "account_flags")) {
return nickserv_modify_handle_flags(user, bot, value, &cmd->req_account_flags, &cmd->deny_account_flags);
--- 323,354 ----
cmd->flags = (cmd->flags | set_flags) & ~rem_flags;
return 1;
! } else if (!irccasecmp(param, "channel_level") || !irccasecmp(param, "channel_access")) {
! enum userLevel ul = user_level_from_name(value);
! if (!irccasecmp(value, "none")) {
! ul = ulNone;
! } else if (ul == ulNone) {
! if (user) {
! send_message(user, bot, MCMSG_BAD_CHANSERV_LEVEL, value);
! } else {
! log(MAIN_LOG, LOG_ERROR, "Invalid ChanServ access level %s (for command %s).\n", value, cmd->name);
}
! return 0;
! }
! cmd->min_channel_access = ul;
! return 1;
! } else if (!irccasecmp(param, "oper_level") || !irccasecmp(param, "oper_access")) {
! unsigned int newval = atoi(value);
! if (newval > 1000) {
! if (user) {
! send_message(user, bot, MCMSG_BAD_OPSERV_LEVEL, value);
! } else {
! log(MAIN_LOG, LOG_ERROR, "Invalid OpServ access level %s (for command %s).\n", value, cmd->name);
}
! return 0;
}
+ cmd->min_opserv_level = atoi(value);
+ return 1;
+ } else if (!irccasecmp(param, "level") || !irccasecmp(param, "access")) {
+ return svccmd_configure(cmd, user, bot, (isdigit(*value) ? "oper_access" : "channel_access"), value);
} else if (!irccasecmp(param, "account_flags")) {
return nickserv_modify_handle_flags(user, bot, value, &cmd->req_account_flags, &cmd->deny_account_flags);
***************
*** 347,350 ****
--- 362,366 ----
return 1;
} else {
+ struct svccmd *tmpl;
if (!strcmp(value, "*")) {
struct svccmd newvals;
***************
*** 352,356 ****
newvals.template = NULL;
memcpy(cmd, &newvals, sizeof(*cmd));
! } else if (!(cmd->template = svccmd_resolve_name(cmd, value))) {
if (user) {
send_message(user, bot, MCMSG_UNKNOWN_COMMAND, value, cmd->name, cmd->parent->bot->nick);
--- 368,372 ----
newvals.template = NULL;
memcpy(cmd, &newvals, sizeof(*cmd));
! } else if (!(tmpl = svccmd_resolve_name(cmd, value))) {
if (user) {
send_message(user, bot, MCMSG_UNKNOWN_COMMAND, value, cmd->name, cmd->parent->bot->nick);
***************
*** 359,362 ****
--- 375,415 ----
}
return 0;
+ } else {
+ unsigned int ii, count;
+ struct svccmd *list[RESOLVE_DEPTH];
+ list[0] = cmd;
+ list[1] = tmpl;
+ if (tmpl == cmd) {
+ send_message(user, bot, MCMSG_NO_TEMPLATE_SELF);
+ return 0;
+ }
+ for (count = 2; count < RESOLVE_DEPTH; ++count) {
+ list[count] = list[count-1]->template;
+ if (!list[count]) break;
+ for (ii=0; ii<count; ii++) {
+ if (list[ii] == list[count]) {
+ char buf[MAXLEN];
+ unsigned int jj, len;
+ struct svccmd *curr;
+
+ for (len=0, jj=ii; jj<=count; jj++) {
+ curr = list[jj];
+ if (jj > 0) len += sprintf(buf+len, " -> ");
+ if (curr->parent) {
+ len += sprintf(buf+len, "%s.%s", curr->parent->bot->nick, curr->name);
+ } else {
+ len += sprintf(buf+len, "*%s.%s", curr->command->parent->name, curr->command->name);
+ }
+ }
+ send_message(user, bot, MCMSG_RESOLVE_LOOP, buf);
+ return 0;
+ }
+ }
+ }
+ if (count == RESOLVE_DEPTH) {
+ send_message(user, bot, MCMSG_RESOLVE_TOO_DEEP, RESOLVE_DEPTH);
+ return 0;
+ }
+ cmd->template = tmpl;
}
return 1;
***************
*** 394,397 ****
--- 447,451 ----
unsigned int uData_checked = 0;
struct userData *uData = NULL;
+ int rflags = 0;
if (cmd->flags & MODCMD_DISABLED) {
***************
*** 443,446 ****
--- 497,513 ----
}
}
+ 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;
+ }
+ }
if (cmd->flags & MODCMD_REQUIRE_STAFF) {
if (((cmd->flags & MODCMD_REQUIRE_OPER) && IsOper(user))
***************
*** 482,488 ****
|| uData->access < cmd->min_channel_access)
&& !(cmd->flags & (MODCMD_REQUIRE_STAFF|MODCMD_REQUIRE_HELPING))) {
! return 2;
}
! return 1;
}
--- 549,555 ----
|| uData->access < cmd->min_channel_access)
&& !(cmd->flags & (MODCMD_REQUIRE_STAFF|MODCMD_REQUIRE_HELPING))) {
! rflags |= ACTION_OVERRIDE;
}
! return rflags | ACTION_ALLOW;
}
***************
*** 604,610 ****
--- 671,682 ----
argv[1] = argv[0];
argv++, argc--;
+ cmd_arg = 1;
}
/* 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;
+ }
perms = svccmd_can_invoke_real(user, service->bot, &cmd, channel, server_qualified, 1);
if (!perms) return 0;
***************
*** 614,617 ****
--- 686,690 ----
}
pcmd->uses++;
+ if (perms & ACTION_NOCHANNEL) channel = NULL;
if (!cmd.command->func(user, channel, argc, argv, pcmd)) return 0;
if (!(cmd.flags & MODCMD_NO_LOG)) {
***************
*** 631,635 ****
if (user->handle_info) {
pos += sprintf(logbuf+pos, ":%s", user->handle_info->handle);
! if (perms & 2) {
pos += sprintf(logbuf+pos, ":override");
}
--- 704,708 ----
if (user->handle_info) {
pos += sprintf(logbuf+pos, ":%s", user->handle_info->handle);
! if (perms & ACTION_OVERRIDE) {
pos += sprintf(logbuf+pos, ":override");
}
***************
*** 1012,1036 ****
assert(argc >= 2);
if (!(svccmd = svccmd_resolve_name(cmd, argv[1]))) {
! send_message(user, cmd->parent->bot, MCMSG_UNKNOWN_COMMAND_2, argv[1], cmd->parent->bot->nick);
return 0;
}
svccmd_collapse(svccmd, &collapsed, 0);
if ((collapsed.parent && collapsed.parent->privileged && !IsOper(user))
|| ((collapsed.flags & MODCMD_REQUIRE_STAFF)
&& !IsOper(user) && !IsNetworkHelper(user) && !IsSupportHelper(user))) {
! send_message(user, cmd->parent->bot, MCMSG_INSPECTION_REFUSED, collapsed.name);
return 0;
}
if (collapsed.flags & MODCMD_DISABLED) {
! send_message(user, cmd->parent->bot, MSG_COMMAND_DISABLED, collapsed.name);
return 1;
}
shown_flags = 0;
if (collapsed.min_opserv_level > 0) {
! send_message(user, cmd->parent->bot, MCMSG_NEED_OPSERV_LEVEL, collapsed.min_opserv_level);
shown_flags |= MODCMD_REQUIRE_OPER | MODCMD_REQUIRE_AUTHED;
}
if (collapsed.min_channel_access > 0) {
! send_message(user, cmd->parent->bot, MCMSG_NEED_CHANSERV_LEVEL, user_level_from_level(collapsed.min_channel_access));
shown_flags |= MODCMD_REQUIRE_CHANUSER | MODCMD_REQUIRE_REGCHAN | MODCMD_REQUIRE_CHANNEL | MODCMD_REQUIRE_AUTHED;
}
--- 1085,1115 ----
assert(argc >= 2);
if (!(svccmd = svccmd_resolve_name(cmd, argv[1]))) {
! reply(MCMSG_UNKNOWN_COMMAND_2, argv[1], cmd->parent->bot->nick);
return 0;
}
svccmd_collapse(svccmd, &collapsed, 0);
+ snprintf(buf, sizeof(buf), "*%s.%s", collapsed.command->parent->name, collapsed.command->name);
+ if (collapsed.alias.used) {
+ reply(MCMSG_COMMAND_ALIASES, collapsed.name, buf);
+ } else {
+ reply(MCMSG_COMMAND_BINDING, collapsed.name, buf);
+ }
if ((collapsed.parent && collapsed.parent->privileged && !IsOper(user))
|| ((collapsed.flags & MODCMD_REQUIRE_STAFF)
&& !IsOper(user) && !IsNetworkHelper(user) && !IsSupportHelper(user))) {
! reply(MCMSG_INSPECTION_REFUSED, collapsed.name);
return 0;
}
if (collapsed.flags & MODCMD_DISABLED) {
! reply(MSG_COMMAND_DISABLED, collapsed.name);
return 1;
}
shown_flags = 0;
if (collapsed.min_opserv_level > 0) {
! reply(MCMSG_NEED_OPSERV_LEVEL, collapsed.min_opserv_level);
shown_flags |= MODCMD_REQUIRE_OPER | MODCMD_REQUIRE_AUTHED;
}
if (collapsed.min_channel_access > 0) {
! reply(MCMSG_NEED_CHANSERV_LEVEL, user_level_from_level(collapsed.min_channel_access));
shown_flags |= MODCMD_REQUIRE_CHANUSER | MODCMD_REQUIRE_REGCHAN | MODCMD_REQUIRE_CHANNEL | MODCMD_REQUIRE_AUTHED;
}
***************
*** 1040,1053 ****
buf[pos++] = HANDLE_FLAGS[nn];
}
! buf[0] = 0;
! send_message(user, cmd->parent->bot, MCMSG_NEED_ACCOUNT_FLAGS, buf);
shown_flags |= MODCMD_REQUIRE_AUTHED;
}
if (!collapsed.flags && !shown_flags) {
! send_message(user, cmd->parent->bot, MCMSG_NEED_NOTHING, collapsed.name);
return 1;
}
if (collapsed.flags & ~shown_flags & MODCMD_REQUIRE_HELPING) {
! send_message(user, cmd->parent->bot, MCMSG_MUST_BE_HELPING);
shown_flags |= MODCMD_REQUIRE_AUTHED | MODCMD_REQUIRE_STAFF;
}
--- 1119,1132 ----
buf[pos++] = HANDLE_FLAGS[nn];
}
! buf[pos] = 0;
! reply(MCMSG_NEED_ACCOUNT_FLAGS, buf);
shown_flags |= MODCMD_REQUIRE_AUTHED;
}
if (!collapsed.flags && !shown_flags) {
! reply(MCMSG_NEED_NOTHING, collapsed.name);
return 1;
}
if (collapsed.flags & ~shown_flags & MODCMD_REQUIRE_HELPING) {
! reply(MCMSG_MUST_BE_HELPING);
shown_flags |= MODCMD_REQUIRE_AUTHED | MODCMD_REQUIRE_STAFF;
}
***************
*** 1076,1103 ****
break;
}
! send_message(user, cmd->parent->bot, MCMSG_NEED_STAFF_ACCESS, buf);
shown_flags |= MODCMD_REQUIRE_AUTHED;
}
if (collapsed.flags & ~shown_flags & MODCMD_REQUIRE_JOINABLE) {
! send_message(user, cmd->parent->bot, MCMSG_NEED_JOINABLE);
shown_flags |= MODCMD_REQUIRE_CHANUSER;
}
if (collapsed.flags & ~shown_flags & MODCMD_REQUIRE_CHANUSER) {
! send_message(user, cmd->parent->bot, MCMSG_NEED_CHANUSER);
shown_flags |= MODCMD_REQUIRE_REGCHAN | MODCMD_REQUIRE_CHANNEL | MODCMD_REQUIRE_AUTHED;
}
if (collapsed.flags & ~shown_flags & MODCMD_REQUIRE_REGCHAN) {
! send_message(user, cmd->parent->bot, MCMSG_NEED_REGCHAN);
shown_flags |= MODCMD_REQUIRE_CHANNEL;
}
if (collapsed.flags & ~shown_flags & MODCMD_REQUIRE_CHANNEL) {
! send_message(user, cmd->parent->bot, MCMSG_NEED_CHANNEL);
}
if (collapsed.flags & ~shown_flags & MODCMD_REQUIRE_AUTHED) {
! send_message(user, cmd->parent->bot, MCMSG_NEED_AUTHED);
}
if (collapsed.flags & ~shown_flags & MODCMD_REQUIRE_QUALIFIED) {
const char *botnick = collapsed.parent ? collapsed.parent->bot->nick : "SomeBot";
! send_message(user, cmd->parent->bot, MCMSG_MUST_QUALIFY, botnick, collapsed.name, botnick);
}
if (svccmd->template) {
--- 1155,1185 ----
break;
}
! reply(MCMSG_NEED_STAFF_ACCESS, buf);
shown_flags |= MODCMD_REQUIRE_AUTHED;
}
if (collapsed.flags & ~shown_flags & MODCMD_REQUIRE_JOINABLE) {
! reply(MCMSG_NEED_JOINABLE);
shown_flags |= MODCMD_REQUIRE_CHANUSER;
}
if (collapsed.flags & ~shown_flags & MODCMD_REQUIRE_CHANUSER) {
! reply(MCMSG_NEED_CHANUSER);
shown_flags |= MODCMD_REQUIRE_REGCHAN | MODCMD_REQUIRE_CHANNEL | MODCMD_REQUIRE_AUTHED;
}
if (collapsed.flags & ~shown_flags & MODCMD_REQUIRE_REGCHAN) {
! reply(MCMSG_NEED_REGCHAN);
shown_flags |= MODCMD_REQUIRE_CHANNEL;
}
if (collapsed.flags & ~shown_flags & MODCMD_REQUIRE_CHANNEL) {
! reply(MCMSG_NEED_CHANNEL);
}
if (collapsed.flags & ~shown_flags & MODCMD_REQUIRE_AUTHED) {
! reply(MCMSG_NEED_AUTHED);
! }
! if (collapsed.flags & ~shown_flags & MODCMD_TOY) {
! reply(MCMSG_IS_TOY, collapsed.name);
}
if (collapsed.flags & ~shown_flags & MODCMD_REQUIRE_QUALIFIED) {
const char *botnick = collapsed.parent ? collapsed.parent->bot->nick : "SomeBot";
! reply(MCMSG_MUST_QUALIFY, botnick, collapsed.name, botnick);
}
if (svccmd->template) {
***************
*** 1107,1113 ****
sprintf(buf, "*%s.%s", svccmd->template->command->parent->name, svccmd->template->command->name);
}
! send_message(user, cmd->parent->bot, MCMSG_INHERITED_REQS, buf);
}
! send_message(user, cmd->parent->bot, MCMSG_END_REQUIREMENTS, collapsed.name);
return 1;
}
--- 1189,1195 ----
sprintf(buf, "*%s.%s", svccmd->template->command->parent->name, svccmd->template->command->name);
}
! reply(MCMSG_INHERITED_REQS, buf);
}
! reply(MCMSG_END_REQUIREMENTS, collapsed.name);
return 1;
}
***************
*** 1235,1240 ****
saxdb_write_string(ctx, "command", buf);
if (cmd->alias.used) saxdb_write_string_list(ctx, "aliased", &cmd->alias);
! if (cmd->min_opserv_level > 0) saxdb_write_int(ctx, "opserv_level", cmd->min_opserv_level);
! if (cmd->min_channel_access > ulNone) saxdb_write_string(ctx, "chanserv_level", user_level_from_level(cmd->min_channel_access));
if (cmd->flags) {
for (nn=pos=0; flags[nn].name; ++nn) {
--- 1317,1322 ----
saxdb_write_string(ctx, "command", buf);
if (cmd->alias.used) saxdb_write_string_list(ctx, "aliased", &cmd->alias);
! if (cmd->min_opserv_level > 0) saxdb_write_int(ctx, "oper_access", cmd->min_opserv_level);
! if (cmd->min_channel_access > ulNone) saxdb_write_string(ctx, "channel_access", user_level_from_level(cmd->min_channel_access));
if (cmd->flags) {
for (nn=pos=0; flags[nn].name; ++nn) {
***************
*** 1365,1373 ****
svccmd_configure(svccmd, NULL, service->bot, "flags", str);
}
! if ((str = database_get_data(obj, "opserv_level", RECDB_QSTRING))) {
! svccmd_configure(svccmd, NULL, service->bot, "access", str);
! }
! if ((str = database_get_data(obj, "chanserv_level", RECDB_QSTRING))) {
! svccmd_configure(svccmd, NULL, service->bot, "access", str);
}
if ((slist = database_get_data(obj, "aliased", RECDB_STRING_LIST))) {
--- 1447,1457 ----
svccmd_configure(svccmd, NULL, service->bot, "flags", str);
}
! if ((str = database_get_data(obj, "oper_access", RECDB_QSTRING))
! || (str = database_get_data(obj, "opserv_level", RECDB_QSTRING))) {
! svccmd_configure(svccmd, NULL, service->bot, "oper_access", str);
! }
! if ((str = database_get_data(obj, "channel_access", RECDB_QSTRING))
! || (str = database_get_data(obj, "chanserv_level", RECDB_QSTRING))) {
! svccmd_configure(svccmd, NULL, service->bot, "channel_access", str);
}
if ((slist = database_get_data(obj, "aliased", RECDB_STRING_LIST))) {
Index: modcmd.h
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** modcmd.h 7 Sep 2002 02:41:49 -0000 1.8
--- modcmd.h 15 Sep 2002 00:01:12 -0000 1.9
***************
*** 45,55 ****
/* Miscellaneous flags controlling a command */
! #define MODCMD_DISABLED 0x0001
! #define MODCMD_NO_LOG 0x0002
! #define MODCMD_KEEP_BOUND 0x0004
! #define MODCMD_ACCEPT_CHANNEL 0x0008
! #define MODCMD_ACCEPT_PCHANNEL 0x0010
! #define MODCMD_NO_DEFAULT_BIND 0x0020
! #define MODCMD_LOG_HOSTMASK 0x0040
/* Requirement (access control) flags */
#define MODCMD_REQUIRE_AUTHED 0x001000
--- 45,55 ----
/* Miscellaneous flags controlling a command */
! #define MODCMD_DISABLED 0x001
! #define MODCMD_NO_LOG 0x002
! #define MODCMD_KEEP_BOUND 0x004
! #define MODCMD_ACCEPT_CHANNEL 0x008
! #define MODCMD_ACCEPT_PCHANNEL 0x010
! #define MODCMD_NO_DEFAULT_BIND 0x020
! #define MODCMD_LOG_HOSTMASK 0x040
/* Requirement (access control) flags */
#define MODCMD_REQUIRE_AUTHED 0x001000
***************
*** 63,70 ****
#define MODCMD_REQUIRE_SUPPORT_HELPER 0x100000
#define MODCMD_REQUIRE_HELPING 0x200000
#define MODCMD_REQUIRE_STAFF (MODCMD_REQUIRE_OPER|MODCMD_REQUIRE_NETWORK_HELPER|MODCMD_REQUIRE_SUPPORT_HELPER)
-
- #define MODCMD_EXECUTE 1
- #define MODCMD_LOG_COMMAND 2
/* Modularized commands work like this:
--- 63,68 ----
#define MODCMD_REQUIRE_SUPPORT_HELPER 0x100000
#define MODCMD_REQUIRE_HELPING 0x200000
+ #define MODCMD_TOY 0x400000
#define MODCMD_REQUIRE_STAFF (MODCMD_REQUIRE_OPER|MODCMD_REQUIRE_NETWORK_HELPER|MODCMD_REQUIRE_SUPPORT_HELPER)
/* Modularized commands work like this:
|