srvx-commits Mailing List for srvx IRC Services (Page 33)
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-08-07 01:44:33
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv11075/src
Modified Files:
nickserv.c modcmd.h modcmd.c
Log Message:
add modcmd flag for must-be-helping (and use that for nickserv level 0 commands)
log overrides properly .. note that staff-only flags will suppress the override
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.186
retrieving revision 1.187
diff -C2 -r1.186 -r1.187
*** nickserv.c 5 Aug 2002 03:22:19 -0000 1.186
--- nickserv.c 7 Aug 2002 01:44:30 -0000 1.187
***************
*** 3095,3098 ****
--- 3095,3104 ----
return modcmd_register(nickserv_module, name, func, 1, (must_auth ? MODCMD_REQUIRE_AUTHED : 0), "access", buf, NULL);
}
+ } else if (min_level == 0) {
+ if (must_be_qualified) {
+ return modcmd_register(nickserv_module, name, func, 1, (must_auth ? MODCMD_REQUIRE_AUTHED : 0), "flags", "+helping", NULL);
+ } else {
+ return modcmd_register(nickserv_module, name, func, 1, (must_auth ? MODCMD_REQUIRE_AUTHED : 0), "flags", "+helping", NULL);
+ }
} else {
if (must_be_qualified) {
Index: modcmd.h
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** modcmd.h 5 Aug 2002 01:26:56 -0000 1.6
--- modcmd.h 7 Aug 2002 01:44:30 -0000 1.7
***************
*** 56,59 ****
--- 56,60 ----
#define MODCMD_REQUIRE_NETWORK_HELPER 0x080000
#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)
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** modcmd.c 5 Aug 2002 19:32:20 -0000 1.15
--- modcmd.c 7 Aug 2002 01:44:30 -0000 1.16
***************
*** 40,43 ****
--- 40,44 ----
#define MCMSG_LOW_CHANNEL_ACCESS "You lack sufficient access to %s to use this command."
#define MCMSG_REQUIRES_JOINABLE "You must be in %s (or on its userlist) to use this command."
+ #define MCMSG_MUST_BE_HELPING "You must have security override (helping mode) on to use this command."
#define MCMSG_MISSING_COMMAND "You must specify a command as well as a channel."
#define MCMSG_NO_CHANNEL_BEFORE "You may not give a channel name before this command."
***************
*** 107,110 ****
--- 108,112 ----
{ "regchan", MODCMD_REQUIRE_REGCHAN },
{ "supporthelper", MODCMD_REQUIRE_SUPPORT_HELPER },
+ { "helping", MODCMD_REQUIRE_HELPING },
{ NULL, 0 }
};
***************
*** 270,274 ****
if (to->flags & MODCMD_REQUIRE_CHANUSER) to->flags |= MODCMD_REQUIRE_REGCHAN;
if (to->flags & MODCMD_REQUIRE_JOINABLE) to->flags |= MODCMD_REQUIRE_CHANNEL;
! if (to->flags & MODCMD_REQUIRE_STAFF) to->flags |= MODCMD_REQUIRE_AUTHED;
}
--- 272,276 ----
if (to->flags & MODCMD_REQUIRE_CHANUSER) to->flags |= MODCMD_REQUIRE_REGCHAN;
if (to->flags & MODCMD_REQUIRE_JOINABLE) to->flags |= MODCMD_REQUIRE_CHANNEL;
! if (to->flags & (MODCMD_REQUIRE_STAFF|MODCMD_REQUIRE_HELPING)) to->flags |= MODCMD_REQUIRE_AUTHED;
}
***************
*** 451,454 ****
--- 453,459 ----
}
}
+ if ((cmd->flags & MODCMD_REQUIRE_HELPING) && !HANDLE_FLAGGED(user->handle_info, HELPING)) {
+ send_message(user, bot, MCMSG_MUST_BE_HELPING);
+ }
if (cmd->min_opserv_level > 0) {
if (!oper_has_access(user, bot, cmd->min_opserv_level, 0)) return 0;
***************
*** 471,474 ****
--- 476,485 ----
}
+ /* If it's an override, return a special value. */
+ if ((cmd->flags & MODCMD_REQUIRE_CHANUSER)
+ && (uData->access > ulOwner)
+ && !(cmd->flags & (MODCMD_REQUIRE_STAFF|MODCMD_REQUIRE_HELPING))) {
+ return 2;
+ }
return 1;
}
***************
*** 533,537 ****
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;
/* Find the command argument. */
--- 544,548 ----
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. */
***************
*** 598,602 ****
return 0;
}
! if (!svccmd_can_invoke_real(user, service->bot, &cmd, channel, server_qualified, 1)) return 0;
pcmd->uses++;
if (!cmd.command->func(user, channel, argc, argv, pcmd)) return 0;
--- 609,614 ----
return 0;
}
! perms = svccmd_can_invoke_real(user, service->bot, &cmd, channel, server_qualified, 1);
! if (!perms) return 0;
pcmd->uses++;
if (!cmd.command->func(user, channel, argc, argv, pcmd)) return 0;
***************
*** 615,619 ****
pos += sprintf(logbuf+pos, "/%s@%s/%ld.%ld.%ld.%ld", user->ident, user->hostname, (user->ip >> 24) & 255, (user->ip >> 16) & 255, (user->ip >> 8) & 255, user->ip & 255);
}
! pos += sprintf(logbuf+pos, ":%s]: ", (user->handle_info ? user->handle_info->handle : ""));
unsplit_string(argv, argc, logbuf+pos);
log(cmd.command->parent->clog, LOG_INFO, "%s\n", logbuf);
--- 627,637 ----
pos += sprintf(logbuf+pos, "/%s@%s/%ld.%ld.%ld.%ld", user->ident, user->hostname, (user->ip >> 24) & 255, (user->ip >> 16) & 255, (user->ip >> 8) & 255, user->ip & 255);
}
! if (user->handle_info) {
! pos += sprintf(logbuf+pos, ":%s", user->handle_info->handle);
! if (perms & 2) {
! pos += sprintf(logbuf+pos, ":override");
! }
! }
! pos += sprintf(logbuf+pos, "]: ");
unsplit_string(argv, argc, logbuf+pos);
log(cmd.command->parent->clog, LOG_INFO, "%s\n", logbuf);
***************
*** 1110,1113 ****
--- 1128,1135 ----
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;
}
if (collapsed.flags & ~shown_flags & MODCMD_REQUIRE_STAFF) {
|
|
From: Zoot <zo...@us...> - 2002-08-06 16:12:15
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv21676/src
Modified Files:
proto-p10.c proto.h
Log Message:
Always use the 'J10' protocol when introducing self, and support ircu 2.10.11's AsLL round-trip pings.
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** proto-p10.c 5 Aug 2002 03:22:19 -0000 1.10
--- proto-p10.c 6 Aug 2002 16:12:07 -0000 1.11
***************
*** 245,250 ****
if (srv == self) {
/* The +s, ignored by Run's ircu, means "service" to Undernet's ircu */
! putsock("%s %s %d %li %li %c10 %s%s +s :%s",
! CMD_SERVER, srv->name, srv->hops+1, srv->boot, srv->link, (srv->self_burst ? 'J' : 'P'), srv->numeric, extranum, srv->description);
} else {
putsock("%s %s %s %d %li %li %c10 %s%s +s :%s",
--- 245,250 ----
if (srv == self) {
/* The +s, ignored by Run's ircu, means "service" to Undernet's ircu */
! putsock("%s %s %d %li %li J10 %s%s +s :%s",
! CMD_SERVER, srv->name, srv->hops+1, srv->boot, srv->link, srv->numeric, extranum, srv->description);
} else {
putsock("%s %s %s %d %li %li %c10 %s%s +s :%s",
***************
*** 357,363 ****
void
! irc_pong(const char *data)
{
! putsock("%s %s %s :%s", self->numeric, CMD_PONG, self->name, data);
}
--- 357,363 ----
void
! irc_pong(const char *who, const char *data)
{
! putsock("%s %s %s :%s", self->numeric, CMD_PONG, who, data);
}
***************
*** 687,692 ****
static CMD_FUNC(cmd_ping)
{
! (void)argc;(void)argv;
! irc_pong(origin);
timeq_del(0, timed_send_ping, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_DATA);
timeq_del(0, timed_ping_timeout, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_DATA);
--- 687,698 ----
static CMD_FUNC(cmd_ping)
{
! if(argc > 3)
! {
! irc_pong(argv[2], argv[1]);
! }
! else
! {
! irc_pong(self->name, origin);
! }
timeq_del(0, timed_send_ping, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_DATA);
timeq_del(0, timed_ping_timeout, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_DATA);
Index: proto.h
===================================================================
RCS file: /cvsroot/srvx/services/src/proto.h,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -r1.56 -r1.57
*** proto.h 4 Aug 2002 21:12:57 -0000 1.56
--- proto.h 6 Aug 2002 16:12:07 -0000 1.57
***************
*** 121,125 ****
void irc_introduce(const char *passwd);
void irc_ping(const char *something);
! void irc_pong(const char *data);
void irc_quit(struct userNode *user, const char *message);
void irc_squit(struct server *srv, const char *message, const char *service_message);
--- 121,125 ----
void irc_introduce(const char *passwd);
void irc_ping(const char *something);
! void irc_pong(const char *who, const char *data);
void irc_quit(struct userNode *user, const char *message);
void irc_squit(struct server *srv, const char *message, const char *service_message);
|
|
From: Zoot <zo...@us...> - 2002-08-06 02:32:43
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv21226/src
Modified Files:
chanserv.c
Log Message:
Implement a new protection setting that punishes non-users for attacking other non-users.
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.265
retrieving revision 1.266
diff -C2 -r1.265 -r1.266
*** chanserv.c 5 Aug 2002 03:29:59 -0000 1.265
--- chanserv.c 6 Aug 2002 02:32:38 -0000 1.266
***************
*** 1377,1380 ****
--- 1377,1382 ----
struct userData *cs_victim, *cs_aggressor;
+ /* Don't protect if no one is to be protected, someone is attacking
+ himself, or if the aggressor is an IRC Operator. */
if(protect == 'n' || victim == aggressor || IsOper(aggressor))
{
***************
*** 1382,1387 ****
}
! if(!(cs_victim = GetChannelAccess(channel, victim->handle_info))) return 0;
! if(!(cs_aggressor = GetChannelAccess(channel, aggressor->handle_info))) return 1;
switch(protect)
--- 1384,1409 ----
}
! /* Don't protect if the victim isn't authenticated (because they
! can't be a channel user), unless we are to protect non-users
! also. */
! cs_victim = GetChannelAccess(channel, victim->handle_info);
! if(protect != 'a' && !cs_victim)
! {
! return 0;
! }
!
! /* Protect if the aggressor isn't a user because at this point,
! the aggressor can only be less than or equal to the victim. */
! cs_aggressor = GetChannelAccess(channel, aggressor->handle_info);
! if(!cs_aggressor)
! {
! return 1;
! }
!
! /* If the aggressor was a user, then the victim can't be helped. */
! if(!cs_victim)
! {
! return 0;
! }
switch(protect)
***************
*** 5270,5273 ****
--- 5292,5296 ----
struct valueData values[] =
{
+ {"Non-users and users will be protected from those of equal or lower access.", 'a'},
{"Users will be protected from those of equal or lower access.", 'e'},
{"Users will be protected from those of lower access.", 'l'},
|
|
From: Adrian D. <sai...@us...> - 2002-08-05 20:46:07
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv9489
Modified Files:
recdb.c
Log Message:
Put ftello into the HAVE_MMAP ifdef (it's only needed for mmap anyway)
Remove RECDB_FILE's updating of ->pos because it doesn't ever read it.
Index: recdb.c
===================================================================
RCS file: /cvsroot/srvx/services/src/recdb.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -r1.41 -r1.42
*** recdb.c 5 Aug 2002 03:20:24 -0000 1.41
--- recdb.c 5 Aug 2002 20:46:03 -0000 1.42
***************
*** 284,288 ****
case RECDB_FILE:
res = fgetc(recdb->f);
- recdb->pos++;
break;
case RECDB_STRING:
--- 284,287 ----
***************
*** 305,309 ****
case RECDB_FILE:
ungetc(c, recdb->f);
- recdb->pos--;
break;
case RECDB_STRING:
--- 304,307 ----
***************
*** 866,873 ****
{
RECDB_OUT fileinfo;
off_t original_offset;
- fileinfo.f = file;
fileinfo.pos = original_offset = ftello(file);
fileinfo.tablvl = 0;
#ifdef NDEBUG
--- 864,873 ----
{
RECDB_OUT fileinfo;
+ #ifdef HAVE_MMAP
off_t original_offset;
fileinfo.pos = original_offset = ftello(file);
+ #endif
+ fileinfo.f = file;
fileinfo.tablvl = 0;
#ifdef NDEBUG
|
|
From: Zoot <zo...@us...> - 2002-08-05 19:32:23
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv7154/src
Modified Files:
modcmd.c
Log Message:
Fix expansion of aliases that refer to arguments not provided.
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** modcmd.c 5 Aug 2002 19:09:18 -0000 1.14
--- modcmd.c 5 Aug 2002 19:32:20 -0000 1.15
***************
*** 503,507 ****
case '-':
if (end_num[1] == 0) {
! ubound = old_argc;
break;
} else if (isdigit(end_num[1])) {
--- 503,507 ----
case '-':
if (end_num[1] == 0) {
! ubound = old_argc - 1;
break;
} else if (isdigit(end_num[1])) {
***************
*** 514,518 ****
return 0;
}
! for (jj=lbound; jj<=ubound; ) new_argv[new_argc++] = old_argv[jj++];
} else {
log(MAIN_LOG, LOG_ERROR, "Alias expansion: I do not know how to handle %s (%s.%s arg %d)\n", arg, cmd->parent->bot->nick, cmd->name, ii);
--- 514,525 ----
return 0;
}
! if(ubound >= old_argc) {
! ubound = old_argc - 1;
! }
! if(lbound < old_argc) {
! for (jj = lbound; jj <= ubound; ) {
! new_argv[new_argc++] = old_argv[jj++];
! }
! }
} else {
log(MAIN_LOG, LOG_ERROR, "Alias expansion: I do not know how to handle %s (%s.%s arg %d)\n", arg, cmd->parent->bot->nick, cmd->name, ii);
|
|
From: Zoot <zo...@us...> - 2002-08-05 19:09:27
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv29322/src
Modified Files:
modcmd.c
Log Message:
Fix a small memory leak in modcmd and set up the ChanServ compatibility aliases correctly.
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** modcmd.c 5 Aug 2002 03:22:19 -0000 1.13
--- modcmd.c 5 Aug 2002 19:09:18 -0000 1.14
***************
*** 141,144 ****
--- 141,145 ----
struct service *service = data;
dict_delete(service->commands);
+ dict_delete(service->modules);
free(service);
}
***************
*** 1374,1387 ****
if ((nick = conf_get_data("services/ChanServ/nick", RECDB_QSTRING))
&& (service = service_find(nick))) {
! service_make_alias(service, "addowner", "adduser", "owner", "$1", NULL);
! service_make_alias(service, "addcoowner", "adduser", "coowner", "$1", NULL);
! service_make_alias(service, "addmaster", "adduser", "master", "$1", NULL);
! service_make_alias(service, "addop", "adduser", "op", "$1", NULL);
! service_make_alias(service, "addpeon", "adduser", "peon", "$1", NULL);
! service_make_alias(service, "delowner", "deluser", "owner", "$1", NULL);
! service_make_alias(service, "delcoowner", "deluser", "coowner", "$1", NULL);
! service_make_alias(service, "delmaster", "deluser", "master", "$1", NULL);
! service_make_alias(service, "delop", "deluser", "op", "$1", NULL);
! service_make_alias(service, "delpeon", "deluser", "peon", "$1", NULL);
service_make_alias(service, "command", "*modcmd.command", NULL);
}
--- 1375,1388 ----
if ((nick = conf_get_data("services/ChanServ/nick", RECDB_QSTRING))
&& (service = service_find(nick))) {
! service_make_alias(service, "addowner", "*chanserv.adduser", "owner", "$1", NULL);
! service_make_alias(service, "addcoowner", "*chanserv.adduser", "coowner", "$1", NULL);
! service_make_alias(service, "addmaster", "*chanserv.adduser", "master", "$1", NULL);
! service_make_alias(service, "addop", "*chanserv.adduser", "op", "$1", NULL);
! service_make_alias(service, "addpeon", "*chanserv.adduser", "peon", "$1", NULL);
! service_make_alias(service, "delowner", "*chanserv.deluser", "owner", "$1", NULL);
! service_make_alias(service, "delcoowner", "*chanserv.deluser", "coowner", "$1", NULL);
! service_make_alias(service, "delmaster", "*chanserv.deluser", "master", "$1", NULL);
! service_make_alias(service, "delop", "*chanserv.deluser", "op", "$1", NULL);
! service_make_alias(service, "delpeon", "*chanserv.deluser", "peon", "$1", NULL);
service_make_alias(service, "command", "*modcmd.command", NULL);
}
|
|
From: Entrope <en...@us...> - 2002-08-05 03:30:02
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv1178/src
Modified Files:
chanserv.c
Log Message:
quash a warning introduced by the last commit
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.264
retrieving revision 1.265
diff -C2 -r1.264 -r1.265
*** chanserv.c 5 Aug 2002 03:22:19 -0000 1.264
--- chanserv.c 5 Aug 2002 03:29:59 -0000 1.265
***************
*** 3856,3860 ****
struct userData *uData;
struct userNode *invite;
- char *reason;
uData = GetChannelUser(channel->channel_info, user->handle_info);
--- 3856,3859 ----
***************
*** 3887,3896 ****
if(user != invite)
{
! if(argc > 2)
! {
! reason = unsplit_string(argv + 2, argc - 2, NULL);
! }
! chanserv_notice(invite, CSMSG_INVITING_YOU, user->nick, channel->name, (argc > 2) ? ": " : ".", (argc > 2) ? reason : "");
}
irc_invite(chanserv, invite, channel);
--- 3886,3892 ----
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);
|
|
From: Entrope <en...@us...> - 2002-08-05 03:22:22
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv31973/src
Modified Files:
tools.c proto-p10.c proto-bahamut.c opserv.help opserv.c
nickserv.c modcmd.help modcmd.c helpserv.c global.c common.h
chanserv.help chanserv.c
Log Message:
un-break changes in unsplit_string() commit by doing it the cleaner way anyway
update help files (especially modcmd.help)
Index: tools.c
===================================================================
RCS file: /cvsroot/srvx/services/src/tools.c,v
retrieving revision 1.110
retrieving revision 1.111
diff -C2 -r1.110 -r1.111
*** tools.c 5 Aug 2002 01:46:27 -0000 1.110
--- tools.c 5 Aug 2002 03:22:18 -0000 1.111
***************
*** 876,893 ****
}
! void
! unsplit_string(unsigned char *set[], unsigned int max)
{
static unsigned char unsplit_buffer[MAXLEN*2];
unsigned int ii, jj, pos;
for (ii=pos=0; ii<max; ii++) {
for (jj=0; set[ii][jj]; jj++) {
! unsplit_buffer[pos++] = set[ii][jj];
}
! unsplit_buffer[pos++] = ' ';
}
! unsplit_buffer[--pos] = 0;
! set[0] = unsplit_buffer;
}
--- 876,894 ----
}
! char *
! unsplit_string(unsigned char *set[], unsigned int max, char *dest)
{
static unsigned char unsplit_buffer[MAXLEN*2];
unsigned int ii, jj, pos;
+ if (!dest) dest = unsplit_buffer;
for (ii=pos=0; ii<max; ii++) {
for (jj=0; set[ii][jj]; jj++) {
! dest[pos++] = set[ii][jj];
}
! dest[pos++] = ' ';
}
! dest[--pos] = 0;
! return dest;
}
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** proto-p10.c 4 Aug 2002 21:12:57 -0000 1.9
--- proto-p10.c 5 Aug 2002 03:22:19 -0000 1.10
***************
*** 968,973 ****
case 332:
if (argc < 4) return 0;
! unsplit_string(argv+3, argc-3);
! safestrncpy(cn->topic, argv[3], sizeof(cn->topic));
break;
case 333:
--- 968,972 ----
case 332:
if (argc < 4) return 0;
! safestrncpy(cn->topic, unsplit_string(argv+3, argc-3, NULL), sizeof(cn->topic));
break;
case 333:
***************
*** 1285,1290 ****
}
if (!res) {
! unsplit_string(argv, argc);
! log(MAIN_LOG, LOG_ERROR, "PARSE ERROR on line: %s\n", line);
} else if (!recursive) {
unsigned int i;
--- 1284,1288 ----
}
if (!res) {
! log(MAIN_LOG, LOG_ERROR, "PARSE ERROR on line: %s\n", unsplit_string(argv, argc, NULL));
} else if (!recursive) {
unsigned int i;
Index: proto-bahamut.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-bahamut.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** proto-bahamut.c 4 Aug 2002 21:12:57 -0000 1.10
--- proto-bahamut.c 5 Aug 2002 03:22:19 -0000 1.11
***************
*** 1006,1011 ****
}
if (!res) {
! unsplit_string(argv, argc);
! log(MAIN_LOG, LOG_ERROR, "PARSE ERROR on line: %s\n", line);
} else if (!recursive) {
unsigned int i;
--- 1006,1010 ----
}
if (!res) {
! log(MAIN_LOG, LOG_ERROR, "PARSE ERROR on line: %s\n", unsplit_string(argv, argc, NULL));
} else if (!recursive) {
unsigned int i;
Index: opserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.help,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -r1.45 -r1.46
*** opserv.help 30 Jul 2002 02:15:11 -0000 1.45
--- opserv.help 5 Aug 2002 03:22:19 -0000 1.46
***************
*** 524,528 ****
" RAW [${level/raw}]",
" STATS [${level/stats}]",
- " TIMECMD [${level/version}]",
" VERSION [${level/version}]");
"DUMP" ("$bDUMP$b",
--- 524,527 ----
***************
*** 553,559 ****
"$bUPTIME$b: Srvx uptime, lines processed, and CPU time.",
"$bWARN$b: The list of channels with activity warnings.");
- "TIMECMD" ("$bTIMECMD$b",
- "/msg $O TIMECMD <command>",
- "Determines how long it takes for the specified $b$O$b command to complete.");
"VERSION" ("$bVERSION$b",
"/msg $O VERSION ",
--- 552,555 ----
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.259
retrieving revision 1.260
diff -C2 -r1.259 -r1.260
*** opserv.c 5 Aug 2002 03:20:24 -0000 1.259
--- opserv.c 5 Aug 2002 03:22:19 -0000 1.260
***************
*** 522,527 ****
} else {
if (argv[2]) {
! unsplit_string(argv+1, argc-1);
! reason = strdup(argv[1]);
} else reason = strdup("No reason");
dict_insert(opserv_chan_warn, strdup(argv[1]), reason);
--- 522,526 ----
} else {
if (argv[2]) {
! reason = strdup(unsplit_string(argv+1, argc-1, NULL));
} else reason = strdup("No reason");
dict_insert(opserv_chan_warn, strdup(argv[1]), reason);
***************
*** 691,695 ****
OPSERV_MIN_PARMS(4, false); /* name, numeric, desc */
- unsplit_string(argv+3, argc-3);
num = atoi(argv[2]);
if ((num < 64) && !force_n2k) {
--- 690,693 ----
***************
*** 710,714 ****
return 0;
}
! snprintf(srvdesc, sizeof(srvdesc), "JUPE %s", argv[3]);
newsrv = AddServer(self, argv[1], 1, now, now, numeric, srvdesc);
if (!newsrv) {
--- 708,712 ----
return 0;
}
! snprintf(srvdesc, sizeof(srvdesc), "JUPE %s", unsplit_string(argv+3, argc-3, NULL));
newsrv = AddServer(self, argv[1], 1, now, now, numeric, srvdesc);
if (!newsrv) {
***************
*** 724,727 ****
--- 722,727 ----
{
struct server *srv;
+ char *reason;
+
OPSERV_MIN_PARMS(2, false);
srv = GetServerH(argv[1]);
***************
*** 731,740 ****
return 0;
} else {
! if (argc > 2) {
! unsplit_string(argv+2, argc-2);
! } else {
! argv[2] = "Unjuping server";
! }
! DelServer(srv, 1, argv[2]);
return 1;
}
--- 731,736 ----
return 0;
} else {
! reason = (argc > 2) ? unsplit_string(argv+2, argc-2, NULL) : "Unjuping server";
! DelServer(srv, 1, reason);
return 1;
}
***************
*** 750,758 ****
void uplink_select(char *name);
int uplink_valid(char *name);
OPSERV_MIN_PARMS(2, false);
! unsplit_string(argv+1, argc-1);
! if(!strcmp(cManager.uplink->name, argv[1]))
{
opserv_notice(user, OSMSG_CURRENT_UPLINK, cManager.uplink->name);
--- 746,755 ----
void uplink_select(char *name);
int uplink_valid(char *name);
+ char *target;
OPSERV_MIN_PARMS(2, false);
! target = unsplit_string(argv+1, argc-1, NULL);
! if(!strcmp(cManager.uplink->name, target))
{
opserv_notice(user, OSMSG_CURRENT_UPLINK, cManager.uplink->name);
***************
*** 760,770 ****
}
! if(!uplink_valid(argv[1]))
{
! opserv_notice(user, OSMSG_INVALID_UPLINK, argv[1]);
return 0;
}
! uplink_select(argv[1]);
irc_squit(self, "Reconnecting.", NULL);
--- 757,767 ----
}
! if(!uplink_valid(target))
{
! opserv_notice(user, OSMSG_INVALID_UPLINK, target);
return 0;
}
! uplink_select(target);
irc_squit(self, "Reconnecting.", NULL);
***************
*** 774,785 ****
static OPSERV_FUNC(cmd_die)
{
! char *reason;
OPSERV_MIN_PARMS(2, false);
! unsplit_string(argv+1, argc-1);
!
! reason = alloca(strlen(argv[1]) + strlen(user->nick) + 20);
! sprintf(reason, "Disconnected by %s [%s]", user->nick, argv[1]);
! irc_squit(self, reason, argv[1]);
quit_services = 1;
return 1;
--- 771,781 ----
static OPSERV_FUNC(cmd_die)
{
! char *reason, *text;
OPSERV_MIN_PARMS(2, false);
! text = unsplit_string(argv+1, argc-1, NULL);
! reason = alloca(strlen(text) + strlen(user->nick) + 20);
! sprintf(reason, "Disconnected by %s [%s]", user->nick, text);
! irc_squit(self, reason, text);
quit_services = 1;
return 1;
***************
*** 790,801 ****
extern int services_argc;
extern char **services_argv;
! char **restart_argv, *reason;
OPSERV_MIN_PARMS(2, false);
! unsplit_string(argv+1, argc-1);
!
! reason = alloca(strlen(argv[1]) + strlen(user->nick) + 17);
! sprintf(reason, "Restarted by %s [%s]", user->nick, argv[1]);
! irc_squit(self, reason, argv[1]);
/* Append a NULL to the end of argv[]. */
--- 786,796 ----
extern int services_argc;
extern char **services_argv;
! char **restart_argv, *reason, *text;
OPSERV_MIN_PARMS(2, false);
! text = unsplit_string(argv+1, argc-1, NULL);
! reason = alloca(strlen(text) + strlen(user->nick) + 17);
! sprintf(reason, "Restarted by %s [%s]", user->nick, text);
! irc_squit(self, reason, text);
/* Append a NULL to the end of argv[]. */
***************
*** 834,837 ****
--- 829,833 ----
struct userNode *target;
struct gline *gline;
+ char *reason;
OPSERV_MIN_PARMS(2, false);
***************
*** 845,854 ****
return 0;
}
! if (argc > 2) {
! unsplit_string(argv+2, argc-2);
! gline = opserv_block(target, user->handle_info->handle, argv[2], 0);
! } else {
! gline = opserv_block(target, user->handle_info->handle, NULL, 0);
! }
opserv_notice(user, OSMSG_GLINE_ISSUED, gline->target);
return 1;
--- 841,846 ----
return 0;
}
! reason = (argc > 2) ? unsplit_string(argv+2, argc-2, NULL) : NULL;
! gline = opserv_block(target, user->handle_info->handle, reason, 0);
opserv_notice(user, OSMSG_GLINE_ISSUED, gline->target);
return 1;
***************
*** 858,864 ****
{
unsigned long duration;
! OPSERV_MIN_PARMS(4, false);
! unsplit_string(argv+3, argc-3);
if (!is_gline(argv[1])) {
opserv_notice(user, MSG_INVALID_GLINE, argv[1]);
--- 850,858 ----
{
unsigned long duration;
! char *reason;
! struct gline *gline;
+ OPSERV_MIN_PARMS(4, false);
+ reason = unsplit_string(argv+3, argc-3, NULL);
if (!is_gline(argv[1])) {
opserv_notice(user, MSG_INVALID_GLINE, argv[1]);
***************
*** 875,880 ****
}
gline_remove(argv[1], 0);
! gline_add(user->handle_info->handle, argv[1], duration, argv[3], now, 1);
! opserv_notice(user, OSMSG_GLINE_ISSUED, argv[1]);
return 1;
}
--- 869,874 ----
}
gline_remove(argv[1], 0);
! gline = gline_add(user->handle_info->handle, argv[1], duration, reason, now, 1);
! opserv_notice(user, OSMSG_GLINE_ISSUED, gline->target);
return 1;
}
***************
*** 1005,1010 ****
sprintf(reason, OSMSG_KICK_REQUESTED, user->nick);
} else {
! unsplit_string(argv+2, argc-2);
! reason = argv[2];
}
target = GetUserH(argv[1]);
--- 999,1003 ----
sprintf(reason, OSMSG_KICK_REQUESTED, user->nick);
} else {
! reason = unsplit_string(argv+2, argc-2, NULL);
}
target = GetUserH(argv[1]);
***************
*** 1039,1044 ****
sprintf(reason, OSMSG_KICK_REQUESTED, user->nick);
} else {
! unsplit_string(argv+1, argc-1);
! reason = argv[1];
}
limit = user->handle_info->opserv_level;
--- 1032,1036 ----
sprintf(reason, OSMSG_KICK_REQUESTED, user->nick);
} else {
! reason = unsplit_string(argv+1, argc-1, NULL);
}
limit = user->handle_info->opserv_level;
***************
*** 1070,1075 ****
sprintf(reason, OSMSG_KICK_REQUESTED, user->nick);
} else {
! unsplit_string(argv+2, argc-2);
! reason = argv[2];
}
target = GetUserH(argv[1]);
--- 1062,1066 ----
sprintf(reason, OSMSG_KICK_REQUESTED, user->nick);
} else {
! reason = unsplit_string(argv+2, argc-2, NULL);
}
target = GetUserH(argv[1]);
***************
*** 1101,1106 ****
sprintf(reason, OSMSG_KICK_REQUESTED, user->nick);
} else {
! unsplit_string(argv+1, argc-1);
! reason = argv[1];
}
/* ban everybody first */
--- 1092,1096 ----
sprintf(reason, OSMSG_KICK_REQUESTED, user->nick);
} else {
! reason = unsplit_string(argv+1, argc-1, NULL);
}
/* ban everybody first */
***************
*** 1128,1137 ****
char *reason;
OPSERV_NEED_CHANNEL();
! if (argc < 2) {
! reason = "Leaving.";
! } else {
! unsplit_string(argv+1, argc-1);
! reason = argv[1];
! }
opserv_notice(user, OSMSG_LEAVING, channel->name);
DelChannelUser(opserv, channel, reason, 0);
--- 1118,1122 ----
char *reason;
OPSERV_NEED_CHANNEL();
! reason = (argc < 2) ? "Leaving." : unsplit_string(argv+1, argc-1, NULL);
opserv_notice(user, OSMSG_LEAVING, channel->name);
DelChannelUser(opserv, channel, reason, 0);
***************
*** 1141,1146 ****
static OPSERV_FUNC(cmd_mode)
{
OPSERV_MIN_PARMS(2, true);
! unsplit_string(argv+1, argc-1);
if (channel->modes & MODE_KEY) {
char *mc = alloca(strlen(channel->key)+4);
--- 1126,1132 ----
static OPSERV_FUNC(cmd_mode)
{
+ char *changes;
OPSERV_MIN_PARMS(2, true);
! changes = unsplit_string(argv+1, argc-1, NULL);
if (channel->modes & MODE_KEY) {
char *mc = alloca(strlen(channel->key)+4);
***************
*** 1148,1153 ****
irc_mode(opserv, channel, mc);
}
! mod_chanmode(channel, argv[1], NULL, 0);
! irc_mode(opserv, channel, argv[1]);
opserv_notice(user, OSMSG_MODE_SET, channel->name);
return 1;
--- 1134,1139 ----
irc_mode(opserv, channel, mc);
}
! mod_chanmode(channel, changes, NULL, 0);
! irc_mode(opserv, channel, changes);
opserv_notice(user, OSMSG_MODE_SET, channel->name);
return 1;
***************
*** 1750,1762 ****
static OPSERV_FUNC(cmd_dump)
{
! char *linedup;
OPSERV_MIN_PARMS(2, false);
! unsplit_string(argv+1, argc-1);
/* assume it's only valid IRC if we can parse it */
- linedup = alloca(strlen(argv[1])+1);
- strcpy(linedup, argv[1]);
if (parse_line(linedup, 1)) {
! irc_raw(argv[1]);
opserv_notice(user, OSMSG_LINE_DUMPED);
} else {
--- 1736,1747 ----
static OPSERV_FUNC(cmd_dump)
{
! char linedup[MAXLEN], *original;
OPSERV_MIN_PARMS(2, false);
! original = unsplit_string(argv+1, argc-1, NULL);
! safestrncpy(linedup, original, sizeof(linedup));
/* assume it's only valid IRC if we can parse it */
if (parse_line(linedup, 1)) {
! irc_raw(original);
opserv_notice(user, OSMSG_LINE_DUMPED);
} else {
***************
*** 1768,1781 ****
static OPSERV_FUNC(cmd_raw)
{
! char *linedup;
OPSERV_MIN_PARMS(2, false);
! unsplit_string(argv+1, argc-1);
/* Try to parse the line before sending it; if it's too wrong,
* maybe it will core us instead of our uplink. */
- linedup = alloca(strlen(argv[1])+1);
- strcpy(linedup, argv[1]);
parse_line(linedup, 1);
! irc_raw(argv[1]);
opserv_notice(user, OSMSG_LINE_DUMPED);
return 1;
--- 1753,1765 ----
static OPSERV_FUNC(cmd_raw)
{
! char linedup[MAXLEN], *original;
OPSERV_MIN_PARMS(2, false);
! original = unsplit_string(argv+1, argc-1, NULL);
! safestrncpy(linedup, original, sizeof(linedup));
/* Try to parse the line before sending it; if it's too wrong,
* maybe it will core us instead of our uplink. */
parse_line(linedup, 1);
! irc_raw(original);
opserv_notice(user, OSMSG_LINE_DUMPED);
return 1;
***************
*** 1809,1814 ****
OPSERV_MIN_PARMS(5, false);
! unsplit_string(argv+4, argc-4);
! resv = opserv_add_reserve(user, argv[1], argv[2], argv[3], argv[4]);
if (resv) {
opserv_notice(user, OSMSG_COLLIDED_NICK, resv->nick);
--- 1793,1797 ----
OPSERV_MIN_PARMS(5, false);
! resv = opserv_add_reserve(user, argv[1], argv[2], argv[3], unsplit_string(argv+4, argc-4, NULL));
if (resv) {
opserv_notice(user, OSMSG_COLLIDED_NICK, resv->nick);
***************
*** 1826,1831 ****
OPSERV_MIN_PARMS(5, false);
! unsplit_string(argv+4, argc-4);
! resv = opserv_add_reserve(user, argv[1], argv[2], argv[3], argv[4]);
if (resv) {
resv->modes |= FLAGS_PERSISTENT;
--- 1809,1813 ----
OPSERV_MIN_PARMS(5, false);
! resv = opserv_add_reserve(user, argv[1], argv[2], argv[3], unsplit_string(argv+4, argc-4, NULL));
if (resv) {
resv->modes |= FLAGS_PERSISTENT;
***************
*** 1875,1880 ****
OPSERV_MIN_PARMS(2, false);
! unsplit_string(argv+1, argc-1);
! if ((reason = sockcheck_add_test(argv[1]))) {
opserv_notice(user, OSMSG_DEFPROXY_FAILED, reason);
return 0;
--- 1857,1861 ----
OPSERV_MIN_PARMS(2, false);
! if ((reason = sockcheck_add_test(unsplit_string(argv+1, argc-1, NULL)))) {
opserv_notice(user, OSMSG_DEFPROXY_FAILED, reason);
return 0;
***************
*** 2265,2268 ****
--- 2246,2250 ----
{
unsigned long interval;
+ char *reason;
OPSERV_MIN_PARMS(5, false);
***************
*** 2270,2276 ****
return opserv_notice(user, OSMSG_ALREADY_TRUSTED, argv[1]);
}
! unsplit_string(argv+4, argc-4);
interval = ParseInterval(argv[3]);
! opserv_add_trusted_host(argv[1], strtoul(argv[2], NULL, 0), user->handle_info->handle, now, interval ? (now + interval) : 0, argv[4]);
return opserv_notice(user, OSMSG_ADDED_TRUSTED);
}
--- 2252,2258 ----
return opserv_notice(user, OSMSG_ALREADY_TRUSTED, argv[1]);
}
! reason = unsplit_string(argv+4, argc-4, NULL);
interval = ParseInterval(argv[3]);
! opserv_add_trusted_host(argv[1], strtoul(argv[2], NULL, 0), user->handle_info->handle, now, interval ? (now + interval) : 0, reason);
return opserv_notice(user, OSMSG_ADDED_TRUSTED);
}
***************
*** 2303,2306 ****
--- 2285,2289 ----
clone = GetUserH(argv[2]);
if (!irccasecmp(argv[1], "ADD")) {
+ char *userinfo;
if (argc < 5) {
opserv_notice(user, MSG_MISSING_PARAMS, argv[1]);
***************
*** 2312,2316 ****
return 0;
}
! unsplit_string(argv+4, argc-4);
for (i=0; argv[3][i]; i++) {
if (argv[3][i] == '@') {
--- 2295,2299 ----
return 0;
}
! userinfo = unsplit_string(argv+4, argc-4, NULL);
for (i=0; argv[3][i]; i++) {
if (argv[3][i] == '@') {
***************
*** 2324,2328 ****
return 0;
}
! if (!(clone = AddClone(argv[2], argv[3], argv[3]+i, argv[4]))) {
opserv_notice(user, OSMSG_CLONE_FAILED, argv[2]);
return 0;
--- 2307,2311 ----
return 0;
}
! if (!(clone = AddClone(argv[2], argv[3], argv[3]+i, userinfo))) {
opserv_notice(user, OSMSG_CLONE_FAILED, argv[2]);
return 0;
***************
*** 2342,2347 ****
const char *reason;
if (argc > 3) {
! unsplit_string(argv+3, argc-3);
! reason = argv[3];
} else {
char *tmp;
--- 2325,2329 ----
const char *reason;
if (argc > 3) {
! reason = unsplit_string(argv+3, argc-3, NULL);
} else {
char *tmp;
***************
*** 2402,2407 ****
}
if (!irccasecmp(argv[1], "SAY")) {
! unsplit_string(argv+4, argc-4);
! irc_privmsg(clone, argv[3], argv[4]);
opserv_notice(user, OSMSG_CLONE_SAID, clone->nick, argv[3]);
return 1;
--- 2384,2389 ----
}
if (!irccasecmp(argv[1], "SAY")) {
! char *text = unsplit_string(argv+4, argc-4, NULL);
! irc_privmsg(clone, argv[3], text);
opserv_notice(user, OSMSG_CLONE_SAID, clone->nick, argv[3]);
return 1;
***************
*** 2492,2497 ****
{
OPSERV_MIN_PARMS(3, 0);
! unsplit_string(argv+2, argc-2);
! return opserv_ban_email(user, argv[1], argv[2]);
}
--- 2474,2478 ----
{
OPSERV_MIN_PARMS(3, 0);
! return opserv_ban_email(user, argv[1], unsplit_string(argv+2, argc-2, NULL));
}
***************
*** 3096,3099 ****
--- 3077,3081 ----
struct record_data *rd;
unsigned int i;
+ char *nodename;
(void)channel;
***************
*** 3106,3113 ****
}
! unsplit_string(argv+1, argc-1);
! if(!(rd = conf_get_node(argv[1])))
{
! opserv_notice(user, OSMSG_UNKNOWN_OPTION, argv[1]);
return 0;
}
--- 3088,3095 ----
}
! nodename = unsplit_string(argv+1, argc-1, NULL);
! if(!(rd = conf_get_node(nodename)))
{
! opserv_notice(user, OSMSG_UNKNOWN_OPTION, nodename);
return 0;
}
***************
*** 3115,3123 ****
if(rd->type == RECDB_QSTRING)
{
! opserv_notice(user, OSMSG_OPTION_IS, argv[1], rd->d.qstring);
}
else if(rd->type == RECDB_STRING_LIST)
{
! opserv_notice(user, OSMSG_OPTION_LIST, argv[1]);
if (rd->d.slist->used)
--- 3097,3105 ----
if(rd->type == RECDB_QSTRING)
{
! opserv_notice(user, OSMSG_OPTION_IS, nodename, rd->d.qstring);
}
else if(rd->type == RECDB_STRING_LIST)
{
! opserv_notice(user, OSMSG_OPTION_LIST, nodename);
if (rd->d.slist->used)
***************
*** 3135,3139 ****
else if(rd->type == RECDB_OBJECT)
{
! opserv_notice(user, OSMSG_OPTION_KEYS, argv[1]);
dict_foreach(rd->d.object, query_keys_helper, user);
}
--- 3117,3121 ----
else if(rd->type == RECDB_OBJECT)
{
! opserv_notice(user, OSMSG_OPTION_KEYS, nodename);
dict_foreach(rd->d.object, query_keys_helper, user);
}
***************
*** 3248,3253 ****
discrim->limit = strtoul(argv[++i], NULL, 10);
} else if (irccasecmp(argv[i], "reason") == 0) {
! unsplit_string(argv+i+1, argc-i-1);
! discrim->reason = argv[++i];
i = argc;
} else if (irccasecmp(argv[i], "last") == 0) {
--- 3230,3234 ----
discrim->limit = strtoul(argv[++i], NULL, 10);
} else if (irccasecmp(argv[i], "reason") == 0) {
! discrim->reason = unsplit_string(argv+i+1, argc-i-1, NULL);
i = argc;
} else if (irccasecmp(argv[i], "last") == 0) {
***************
*** 4131,4137 ****
unsigned int gagged;
unsigned long duration;
OPSERV_MIN_PARMS(4, false);
! unsplit_string(argv + 3, argc - 3);
if (!is_ircmask(argv[1])) {
--- 4112,4119 ----
unsigned int gagged;
unsigned long duration;
+ char *reason;
OPSERV_MIN_PARMS(4, false);
! reason = unsplit_string(argv + 3, argc - 3, NULL);
if (!is_ircmask(argv[1])) {
***************
*** 4150,4154 ****
duration = ParseInterval(argv[2]);
! gagged = gag_create(argv[1], user->handle_info->handle, argv[3], (duration?now+duration:0));
if (gagged) {
--- 4132,4136 ----
duration = ParseInterval(argv[2]);
! gagged = gag_create(argv[1], user->handle_info->handle, reason, (duration?now+duration:0));
if (gagged) {
***************
*** 4218,4223 ****
}
if (!svccmd_can_invoke(user, opserv, subcmd, channel, 0)) return 0;
! unsplit_string(argv + 3, argc - 3);
! if (opserv_add_user_alert(user, name, reaction, argv[3])) {
opserv_notice(user, OSMSG_ADDED_ALERT, name);
}
--- 4200,4204 ----
}
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);
}
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.185
retrieving revision 1.186
diff -C2 -r1.185 -r1.186
*** nickserv.c 4 Aug 2002 23:17:12 -0000 1.185
--- nickserv.c 5 Aug 2002 03:22:19 -0000 1.186
***************
*** 1777,1782 ****
hi->infoline = NULL;
} else {
! unsplit_string(argv+1, argc-1);
! hi->infoline = strdup(argv[1]);
}
}
--- 1777,1781 ----
hi->infoline = NULL;
} else {
! hi->infoline = strdup(unsplit_string(argv+1, argc-1, NULL));
}
}
***************
*** 2023,2032 ****
if ((argc > 1) && is_valid_oper(user, nickserv_conf.set_epithet_level, 0)) {
! unsplit_string(argv+1, argc-1);
if (hi->epithet) free(hi->epithet);
! if ((argv[1][0] == '*') && !argv[1][1]) {
hi->epithet = NULL;
} else {
! hi->epithet = strdup(argv[1]);
}
}
--- 2022,2031 ----
if ((argc > 1) && is_valid_oper(user, nickserv_conf.set_epithet_level, 0)) {
! char *epithet = unsplit_string(argv+1, argc-1, NULL);
if (hi->epithet) free(hi->epithet);
! if ((epithet[0] == '*') && !epithet[1]) {
hi->epithet = NULL;
} else {
! hi->epithet = strdup(epithet);
}
}
Index: modcmd.help
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.help,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** modcmd.help 30 Jul 2002 02:15:11 -0000 1.1
--- modcmd.help 5 Aug 2002 03:22:19 -0000 1.2
***************
*** 1,11 ****
! "bind" ("BIND ME");
! "help" ("$bHELP$b",
! "/msg $S HELP [command]",
"Help will show you the information for the given command.",
"All help files will use the same syntax, with optional parameters listed in [] and required parameters listed in <>.",
"To see what commands are available for use with $S, type /msg $S help index. For help on any specific command or topic, type /msg $S help help command.");
! "readhelp" ("$bREADHELP$b",
! "/msg $S READHELP [module]",
! "Re-reads the module's help file from disk. If no module name is given, default to the current bot.",
"$uSee Also:$u help");
! "unbind" ("UNBIND ME");
--- 1,50 ----
! "bind" ("/msg $S BIND <service> <bindname> <command> [additional args..]",
! "Binds a command to an existing service. $bbindname$b is the name of the new command for the service. $bcommand$b may be:",
! " CommandName To refer to a command on the same service.",
! " ServiceNick.CommandName To refer to a command bound on a different service.",
! " *ModuleName.CommandName To bind a command directly from a module (note the asterisk before the module name).",
! " *ModuleName.* To bind all commands from the named module.",
! "For simplicity, you cannot bind to a command that is itself an alias. Certain commands will not bound with the last form; you must bind them by name.",
! "(A command binding is very similar to an alias, but only pays the speed penalty for alias expansion when there are additional arguments in the binding.)",
! "$uSee also:$u unbind");
! "help" ("/msg $S HELP [command]",
"Help will show you the information for the given command.",
"All help files will use the same syntax, with optional parameters listed in [] and required parameters listed in <>.",
"To see what commands are available for use with $S, type /msg $S help index. For help on any specific command or topic, type /msg $S help help command.");
! "readhelp" ("/msg $S READHELP <module>",
! "Re-reads the module's help file from disk.",
"$uSee Also:$u help");
! "unbind" ("/msg $S UNBIND <service> <command>",
! "Unbinds a command from a service, so that it is no longer accessible.",
! "Some commands (such as $bauth$b and $bbind$b) will not let you unbind their last binding -- for obvious reasons.",
! "$uSee Also:$u bind");
! "timecmd" ("/msg $S TIMECMD <command and args>",
! "Reports how long it takes to run the specified command.");
! "command" ("/msg $S COMMAND <command>",
! "Shows the restrictions on who can use the named command (and how).");
! "modcmd" ("/msg $S MODCMD <command> <option> <newval> [additional option/value pairs..]",
! "Changes the named option(s) for the specified command. The command name may be prefixed with $bServiceNick.$b to specify another service's command (for example, $N.AUTH to refer to the auth command).",
! "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",
! " WEIGHT How much the command counts against the anti-flood policer",
! "See the $bmodcmd flags$b entry for a list of supported flags.");
! "modcmd flags" ("The following flags are supported for commands:",
! " ACCEPTCHAN Treat a normal channel name (if specified) as the context for the command",
! " ACCEPTPLUSCHAN Accept modeless channel names as well as normal channel names",
! " AUTHED Require that the user be authed to use the command",
! " CHANNEL Require that an existing channel be given as the context",
! " CHANUSER Require that the user have $C access to the context",
! " DISABLED Command is disabled",
! " JOINABLE Require that the user have $C access to the channel, be in the channel, or be network staff to use the command",
! " KEEPBOUND Do not let the last instance of the command be removed",
! " LOGHOSTMASK Log the user's ident, hostname and IP (as well as nick and account name)",
! " NOLOG Do not log the command at all",
! " NETWORKHELPER Allow network helpers to use the command",
! " OPER Allow opers to use the command",
! " QUALIFIED Require $b/msg Service@$s$b addressing when using the command",
! " REGCHAN Require a registered channel to be give as the context",
! " SUPPORTHELPER Allow support helpers to use the command",
! "Note: If any of SUPPORTHELPER, NETWORKHELPER, OPER, any of the specified flags is considered sufficient. For example, NETWORKHELPER and OPER both specified means both network helpers and opers can use the command.");
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** modcmd.c 5 Aug 2002 03:20:24 -0000 1.12
--- modcmd.c 5 Aug 2002 03:22:19 -0000 1.13
***************
*** 49,52 ****
--- 49,53 ----
#define MCMSG_UNKNOWN_COMMAND_2 "Unknown command name %s (relative to service %s)."
#define MCMSG_INSPECTION_REFUSED "You do not have access to inspect command %s."
+ #define MCMSG_CANNOT_DOUBLE_ALIAS "You cannot bind to a complex (argument-carrying) bind."
#define MCMSG_BAD_ALIAS_ARGUMENT "Invalid alias argument $b%s$b."
#define MCMSG_COMMAND_BOUND "New command %s bound to %s."
***************
*** 607,612 ****
}
pos += sprintf(logbuf+pos, ":%s]: ", (user->handle_info ? user->handle_info->handle : ""));
! unsplit_string(argv, argc);
! strcpy(logbuf+pos, argv[0]);
log(cmd.command->parent->clog, LOG_INFO, "%s\n", logbuf);
}
--- 608,612 ----
}
pos += sprintf(logbuf+pos, ":%s]: ", (user->handle_info ? user->handle_info->handle : ""));
! unsplit_string(argv, argc, logbuf+pos);
log(cmd.command->parent->clog, LOG_INFO, "%s\n", logbuf);
}
***************
*** 624,631 ****
/* If it's an alias, show what it's an alias for. */
if (cmd->alias.used) {
! char *arg0 = cmd->alias.list[0];
! unsplit_string((unsigned char**)cmd->alias.list, cmd->alias.used);
! send_message(user, bot, MCMSG_COMMAND_ALIASES, cmd->name, cmd->alias.list[0]);
! cmd->alias.list[0] = arg0;
}
/* Show the help entry for the underlying command. */
--- 624,630 ----
/* If it's an alias, show what it's an alias for. */
if (cmd->alias.used) {
! char alias_text[MAXLEN];
! unsplit_string((unsigned char**)cmd->alias.list, cmd->alias.used, alias_text);
! send_message(user, bot, MCMSG_COMMAND_ALIASES, cmd->name, alias_text);
}
/* Show the help entry for the underlying command. */
***************
*** 830,833 ****
--- 829,838 ----
return 0;
}
+ if (template->alias.used) {
+ send_message(user, cmd->parent->bot, MCMSG_CANNOT_DOUBLE_ALIAS);
+ free(newcmd->name);
+ free(newcmd);
+ return 0;
+ }
if (argc > 4) {
***************
*** 997,1005 ****
struct timeval start, stop;
! if (argc > 1) {
! modname = argv[1];
! } else {
! modname = cmd->parent->bot->nick;
! }
if (!(module = module_find(modname))) {
send_message(user, cmd->parent->bot, MSG_MODULE_UNKNOWN, modname);
--- 1002,1007 ----
struct timeval start, stop;
! assert(argc > 1);
! modname = argv[1];
if (!(module = module_find(modname))) {
send_message(user, cmd->parent->bot, MSG_MODULE_UNKNOWN, modname);
***************
*** 1035,1040 ****
topic = NULL;
} else {
! topic = argv[1];
! unsplit_string(argv+1, argc-1);
}
return svccmd_send_help_2(user, cmd->parent, topic);
--- 1037,1041 ----
topic = NULL;
} else {
! topic = unsplit_string(argv+1, argc-1, NULL);
}
return svccmd_send_help_2(user, cmd->parent, topic);
***************
*** 1043,1050 ****
static MODCMD_FUNC(cmd_timecmd) {
struct timeval start, stop;
! unsplit_string(argv+1, argc-1);
gettimeofday(&start, NULL);
! svccmd_invoke(user, cmd->parent, channel, argv[1], 0);
gettimeofday(&stop, NULL);
stop.tv_sec -= start.tv_sec;
--- 1044,1052 ----
static MODCMD_FUNC(cmd_timecmd) {
struct timeval start, stop;
+ char *cmd_text;
! cmd_text = unsplit_string(argv+1, argc-1, NULL);
gettimeofday(&start, NULL);
! svccmd_invoke(user, cmd->parent, channel, cmd_text, 0);
gettimeofday(&stop, NULL);
stop.tv_sec -= start.tv_sec;
***************
*** 1054,1058 ****
stop.tv_usec += 1000000;
}
! send_message(user, cmd->parent->bot, MCMSG_COMMAND_TIME, argv[1], stop.tv_sec, stop.tv_usec);
return 1;
}
--- 1056,1060 ----
stop.tv_usec += 1000000;
}
! send_message(user, cmd->parent->bot, MCMSG_COMMAND_TIME, cmd_text, stop.tv_sec, stop.tv_usec);
return 1;
}
Index: helpserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpserv.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** helpserv.c 5 Aug 2002 03:20:24 -0000 1.21
--- helpserv.c 5 Aug 2002 03:22:19 -0000 1.22
***************
*** 833,838 ****
if (retval && !(cmd->flags & CMD_IGNORE_EVENT)) {
! unsplit_string(argv, argc);
! log(HS_LOG, LOG_INFO, "%s[%s] (%s): %s%s\n", user->nick, user->handle_info->handle, botnick, argv[0], (cmd->flags & (CMD_NOT_OVERRIDE|CMD_FROM_OPSERV_ONLY) ? "" : " (override)"));
}
--- 833,838 ----
if (retval && !(cmd->flags & CMD_IGNORE_EVENT)) {
! char *cmd_text = unsplit_string(argv, argc, 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)"));
}
***************
*** 897,902 ****
topic = NULL;
} else {
! topic = argv[1];
! unsplit_string(argv+1, argc-1);
}
helpserv_help(hs, from_opserv, user, topic);
--- 897,901 ----
topic = NULL;
} else {
! topic = unsplit_string(argv+1, argc-1, NULL);
}
helpserv_help(hs, from_opserv, user, topic);
***************
*** 1532,1536 ****
static HELPSERV_FUNC(cmd_addnote) {
! char text[MAX_LINE_SIZE], timestr[MAX_LINE_SIZE];
struct helpserv_request *req;
--- 1531,1535 ----
static HELPSERV_FUNC(cmd_addnote) {
! char text[MAX_LINE_SIZE], timestr[MAX_LINE_SIZE], *note;
struct helpserv_request *req;
***************
*** 1542,1551 ****
}
! unsplit_string(argv+2, argc-2);
strftime(timestr, MAX_LINE_SIZE, HSFMT_TIME, localtime(&now));
snprintf(text, MAX_LINE_SIZE, HSMSG_REQMSG_HELPER_NOTE, timestr);
string_list_append(req->text, strdup(text));
! snprintf(text, MAX_LINE_SIZE, HSMSG_REQMSG_HELPER_NOTE2, user->handle_info->handle, argv[2]);
string_list_append(req->text, strdup(text));
--- 1541,1550 ----
}
! note = unsplit_string(argv+2, argc-2, NULL);
strftime(timestr, MAX_LINE_SIZE, HSFMT_TIME, localtime(&now));
snprintf(text, MAX_LINE_SIZE, HSMSG_REQMSG_HELPER_NOTE, timestr);
string_list_append(req->text, strdup(text));
! snprintf(text, MAX_LINE_SIZE, HSMSG_REQMSG_HELPER_NOTE2, user->handle_info->handle, note);
string_list_append(req->text, strdup(text));
***************
*** 1558,1563 ****
REQUIRE_PARMS(2);
! unsplit_string(argv+1, argc-1);
! helpserv_page(PGSRC_COMMAND, HSMSG_PAGE_REQUEST, user->nick, argv[1]);
return 1;
--- 1557,1561 ----
REQUIRE_PARMS(2);
! helpserv_page(PGSRC_COMMAND, HSMSG_PAGE_REQUEST, user->nick, unsplit_string(argv+1, argc-1, NULL));
return 1;
***************
*** 2347,2353 ****
if (argc > 0) {
if (hs->messages[idx]) free(hs->messages[idx]);
! unsplit_string(argv, argc);
! hs->messages[idx] = strcmp(argv[0], "*") ? strdup(argv[0]) : NULL;
changed = 1;
}
--- 2345,2351 ----
if (argc > 0) {
+ char *msg = unsplit_string(argv, argc, NULL);
if (hs->messages[idx]) free(hs->messages[idx]);
! hs->messages[idx] = strcmp(msg, "*") ? strdup(msg) : NULL;
changed = 1;
}
Index: global.c
===================================================================
RCS file: /cvsroot/srvx/services/src/global.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -r1.47 -r1.48
*** global.c 1 Aug 2002 03:20:06 -0000 1.47
--- global.c 5 Aug 2002 03:22:19 -0000 1.48
***************
*** 95,99 ****
static struct globalMessage*
! message_add(long flags, time_t posted, unsigned long duration, char *from, char *msg)
{
struct globalMessage *message;
--- 95,99 ----
static struct globalMessage*
! message_add(long flags, time_t posted, unsigned long duration, char *from, const char *msg)
{
struct globalMessage *message;
***************
*** 177,182 ****
{
i++;
! unsplit_string(argv + i, argc - i);
! text = argv[i];
break;
} else if (!irccasecmp(argv[i], "sourceless")) {
--- 177,181 ----
{
i++;
! text = unsplit_string(argv + i, argc - i, NULL);
break;
} else if (!irccasecmp(argv[i], "sourceless")) {
***************
*** 378,382 ****
{
struct globalMessage *message = NULL;
! const char *recipient = NULL;
long target = 0;
--- 377,381 ----
{
struct globalMessage *message = NULL;
! const char *recipient = NULL, *text;
long target = 0;
***************
*** 401,406 ****
}
! unsplit_string(argv + 2, argc - 2);
! message = message_add(target | MESSAGE_OPTION_IMMEDIATE, now, 0, user->handle_info->handle, argv[2]);
if(!message)
--- 400,405 ----
}
! text = unsplit_string(argv + 2, argc - 2, NULL);
! message = message_add(target | MESSAGE_OPTION_IMMEDIATE, now, 0, user->handle_info->handle, text);
if(!message)
Index: common.h
===================================================================
RCS file: /cvsroot/srvx/services/src/common.h,v
retrieving revision 1.76
retrieving revision 1.77
diff -C2 -r1.76 -r1.77
*** common.h 30 Jul 2002 02:15:11 -0000 1.76
--- common.h 5 Aug 2002 03:22:19 -0000 1.77
***************
*** 126,130 ****
int split_ircmask(char *text, char **nick, char **ident, char **host);
! void unsplit_string(unsigned char *set[], unsigned int max);
#define DECLARE_LIST(STRUCTNAME,ITEMTYPE) struct STRUCTNAME {\
--- 126,130 ----
int split_ircmask(char *text, char **nick, char **ident, char **host);
! char *unsplit_string(unsigned char *set[], unsigned int max, char *dest);
#define DECLARE_LIST(STRUCTNAME,ITEMTYPE) struct STRUCTNAME {\
Index: chanserv.help
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.help,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -r1.37 -r1.38
*** chanserv.help 30 Jul 2002 02:15:11 -0000 1.37
--- chanserv.help 5 Aug 2002 03:22:19 -0000 1.38
***************
*** 40,43 ****
--- 40,44 ----
" BAN Ban a user from a channel.",
" KICKBAN Kick and ban a user from a channel.",
+ " BANS List lasting bans in a channel",
" ADDBAN Add a permanent ban for a user.",
" ADDTIMEDBAN Add a ban that expires in the specified time.",
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.263
retrieving revision 1.264
diff -C2 -r1.263 -r1.264
*** chanserv.c 5 Aug 2002 03:20:24 -0000 1.263
--- chanserv.c 5 Aug 2002 03:22:19 -0000 1.264
***************
*** 1492,1496 ****
static CHANSERV_FUNC(cmd_noregister)
{
! const char *target = NULL;
unsigned int arg = 1;
--- 1492,1496 ----
static CHANSERV_FUNC(cmd_noregister)
{
! const char *target = NULL, *reason;
unsigned int arg = 1;
***************
*** 1512,1516 ****
}
! unsplit_string(argv + arg, argc - arg);
if((*target == '*') && !get_handle_info(target + 1))
{
--- 1512,1516 ----
}
! reason = unsplit_string(argv + arg, argc - arg, NULL);
if((*target == '*') && !get_handle_info(target + 1))
{
***************
*** 1519,1523 ****
}
! chanserv_add_dnr(target, user->handle_info->handle, argv[arg]);
chanserv_notice(user, CSMSG_NOREGISTER_CHANNEL, target);
--- 1519,1523 ----
}
! chanserv_add_dnr(target, user->handle_info->handle, reason);
chanserv_notice(user, CSMSG_NOREGISTER_CHANNEL, target);
***************
*** 2743,2748 ****
if(argc > offset)
{
! unsplit_string(argv + offset, argc - offset);
! reason = argv[offset];
}
--- 2743,2747 ----
if(argc > offset)
{
! reason = unsplit_string(argv + offset, argc - offset, NULL);
}
***************
*** 3728,3731 ****
--- 3727,3731 ----
{
struct chanData *cData;
+ char *topic;
cData = channel->channel_info;
***************
*** 3743,3752 ****
}
! unsplit_string(argv + 1, argc - 1);
/* If they say "!topic *", use an empty topic. */
! if ((argv[1][0] == '*') && (argv[1][1] == 0)) {
! argv[1][0] = 0;
}
! if(bad_topic(channel, user, argv[1]))
{
char *topic_mask = cData->topic_mask;
--- 3743,3752 ----
}
! topic = unsplit_string(argv + 1, argc - 1, NULL);
/* If they say "!topic *", use an empty topic. */
! if ((topic[0] == '*') && (topic[1] == 0)) {
! topic[0] = 0;
}
! if(bad_topic(channel, user, topic))
{
char *topic_mask = cData->topic_mask;
***************
*** 3762,3768 ****
case '*':
if (starpos != -1) goto bad_mask;
! len = strlen(argv[1]);
if ((dpos + len) > TOPICLEN) len = TOPICLEN + 1 - dpos;
! memcpy(new_topic+dpos, argv[1], len);
dpos += len;
starpos = pos;
--- 3762,3768 ----
case '*':
if (starpos != -1) goto bad_mask;
! len = strlen(topic);
if ((dpos + len) > TOPICLEN) len = TOPICLEN + 1 - dpos;
! memcpy(new_topic+dpos, topic, len);
dpos += len;
starpos = pos;
***************
*** 3788,3792 ****
else
{
! SetChannelTopic(channel, chanserv, argv[1], 1);
}
--- 3788,3792 ----
else
{
! SetChannelTopic(channel, chanserv, topic, 1);
}
***************
*** 3802,3806 ****
static CHANSERV_FUNC(cmd_mode)
{
! char modes[MODELEN];
(void)argc; (void)argv;
--- 3802,3806 ----
static CHANSERV_FUNC(cmd_mode)
{
! char modes[MODELEN], *changes;
(void)argc; (void)argv;
***************
*** 3822,3833 ****
}
! unsplit_string(argv + 1, argc - 1);
! if(!verify_chanmode(argv[1]))
{
! chanserv_notice(user, CSMSG_MODES_INVALID, argv[1]);
return 0;
}
! mod_chanmode(channel, argv[1], NULL, 0);
if(!check_user_level(user, channel, channel->channel_info->options[optEnfModes], 1, 0))
--- 3822,3833 ----
}
! changes = unsplit_string(argv + 1, argc - 1, NULL);
! if(!verify_chanmode(changes))
{
! chanserv_notice(user, CSMSG_MODES_INVALID, changes);
return 0;
}
! mod_chanmode(channel, changes, NULL, 0);
if(!check_user_level(user, channel, channel->channel_info->options[optEnfModes], 1, 0))
***************
*** 3847,3852 ****
}
! irc_mode(chanserv, channel, argv[1]);
! chanserv_notice(user, CSMSG_MODES_SET, argv[1]);
return 1;
}
--- 3847,3852 ----
}
! irc_mode(chanserv, channel, changes);
! chanserv_notice(user, CSMSG_MODES_SET, changes);
return 1;
}
***************
*** 3856,3859 ****
--- 3856,3860 ----
struct userData *uData;
struct userNode *invite;
+ char *reason;
uData = GetChannelUser(channel->channel_info, user->handle_info);
***************
*** 3888,3895 ****
if(argc > 2)
{
! unsplit_string(argv + 2, argc - 2);
}
! chanserv_notice(invite, CSMSG_INVITING_YOU, user->nick, channel->name, (argc > 2) ? ": " : ".", (argc > 2) ? (char *)argv[2] : "");
}
irc_invite(chanserv, invite, channel);
--- 3889,3896 ----
if(argc > 2)
{
! reason = unsplit_string(argv + 2, argc - 2, NULL);
}
! chanserv_notice(invite, CSMSG_INVITING_YOU, user->nick, channel->name, (argc > 2) ? ": " : ".", (argc > 2) ? reason : "");
}
irc_invite(chanserv, invite, channel);
***************
*** 4217,4220 ****
--- 4218,4222 ----
{
struct userData *uData;
+ char *infoline;
uData = GetChannelAccess(channel->channel_info, user->handle_info);
***************
*** 4242,4248 ****
}
! unsplit_string(argv + 1, argc - 1);
if(uData->info) free(uData->info);
! if(argv[1][0] == '*' && argv[1][1] == 0)
{
uData->info = NULL;
--- 4244,4250 ----
}
! infoline = unsplit_string(argv + 1, argc - 1, NULL);
if(uData->info) free(uData->info);
! if(infoline[0] == '*' && infoline[1] == 0)
{
uData->info = NULL;
***************
*** 4251,4256 ****
else
{
! uData->info = strdup(argv[1]);
! chanserv_notice(user, CSMSG_SET_INFO_LINE, argv[1]);
}
--- 4253,4258 ----
else
{
! uData->info = strdup(infoline);
! chanserv_notice(user, CSMSG_SET_INFO_LINE, infoline);
}
***************
*** 4382,4385 ****
--- 4384,4388 ----
else
{
+ char *note_text;
ntype = dict_find(note_types, argv[1], NULL);
if(!ntype)
***************
*** 4390,4395 ****
else if(note_type_settable_by_user(channel, ntype, user))
{
! unsplit_string(argv+2, argc-2);
! chanserv_add_channel_note(cData, ntype, user->handle_info->handle, argv[2]);
chanserv_notice(user, CSMSG_NOTE_SET, ntype->name, channel->name);
}
--- 4393,4398 ----
else if(note_type_settable_by_user(channel, ntype, user))
{
! note_text = unsplit_string(argv+2, argc-2, NULL);
! chanserv_add_channel_note(cData, ntype, user->handle_info->handle, note_text);
chanserv_notice(user, CSMSG_NOTE_SET, ntype->name, channel->name);
}
***************
*** 4505,4515 ****
static CHANSERV_FUNC(cmd_say)
{
! assert(argc >= 2); (void)user;
if (channel) {
! unsplit_string(argv + 1, argc - 1);
! send_channel_message(channel, cmd->parent->bot, "%s", argv[1]);
} else if (GetUserH(argv[1])) {
! unsplit_string(argv + 2, argc - 2);
! send_target_message(1, argv[1], cmd->parent->bot, "%s", argv[2]);
} else {
send_message(user, cmd->parent->bot, "You must specify the name of a channel or user.");
--- 4508,4519 ----
static CHANSERV_FUNC(cmd_say)
{
! char *msg;
! assert(argc >= 2);
if (channel) {
! msg = unsplit_string(argv + 1, argc - 1, NULL);
! send_channel_message(channel, cmd->parent->bot, "%s", msg);
} else if (GetUserH(argv[1])) {
! msg = unsplit_string(argv + 2, argc - 2, NULL);
! send_target_message(1, argv[1], cmd->parent->bot, "%s", msg);
} else {
send_message(user, cmd->parent->bot, "You must specify the name of a channel or user.");
***************
*** 4521,4532 ****
static CHANSERV_FUNC(cmd_emote)
{
! assert(argc >= 2); (void)user;
if (channel) {
/* CTCP is so annoying. */
! unsplit_string(argv + 1, argc - 1);
! send_channel_message(channel, cmd->parent->bot, "\001ACTION %s\001", argv[1]);
} else if (GetUserH(argv[1])) {
! unsplit_string(argv + 2, argc - 2);
! send_target_message(1, argv[1], cmd->parent->bot, "\001ACTION %s\001", argv[2]);
} else {
send_message(user, cmd->parent->bot, "You must specify the name of a channel or user.");
--- 4525,4537 ----
static CHANSERV_FUNC(cmd_emote)
{
! char *msg;
! assert(argc >= 2);
if (channel) {
/* CTCP is so annoying. */
! msg = unsplit_string(argv + 1, argc - 1, NULL);
! send_channel_message(channel, cmd->parent->bot, "\001ACTION %s\001", msg);
} else if (GetUserH(argv[1])) {
! msg = unsplit_string(argv + 2, argc - 2, NULL);
! send_target_message(1, argv[1], cmd->parent->bot, "\001ACTION %s\001", msg);
} else {
send_message(user, cmd->parent->bot, "You must specify the name of a channel or user.");
***************
*** 4667,4671 ****
}
! unsplit_string(argv + 2, argc - 2);
suspended = calloc(1, sizeof(*suspended));
--- 4672,4676 ----
}
! unsplit_string(argv + 2, argc - 2, reason);
suspended = calloc(1, sizeof(*suspended));
***************
*** 4679,4683 ****
timeq_add(suspended->expires, chanserv_expire_suspension, suspended);
}
! suspended->reason = strdup(argv[2]);
suspended->cData = channel->channel_info;
suspended->previous = suspended->cData->suspended;
--- 4684,4688 ----
timeq_add(suspended->expires, chanserv_expire_suspension, suspended);
}
! suspended->reason = strdup(reason);
suspended->cData = channel->channel_info;
suspended->previous = suspended->cData->suspended;
***************
*** 4959,4962 ****
--- 4964,4969 ----
if(argc > 0)
{
+ char *topic;
+
if(!check_user_level(user, channel, channel->channel_info->options[optEnfTopic], 1, 0))
{
***************
*** 4965,4971 ****
}
! unsplit_string(argv, argc);
! if(argv[0][0] == '*' && argv[0][1] == 0)
{
channel->channel_info->topic[0] = 0;
--- 4972,4978 ----
}
! topic = unsplit_string(argv, argc, NULL);
! if(topic[0] == '*' && topic[1] == 0)
{
channel->channel_info->topic[0] = 0;
***************
*** 4973,4977 ****
else
{
! safestrncpy(channel->channel_info->topic, argv[0], sizeof(channel->topic));
if(channel->channel_info->topic_mask
&& !match_ircglob(channel->channel_info->topic, channel->channel_info->topic_mask))
--- 4980,4984 ----
else
{
! safestrncpy(channel->channel_info->topic, topic, sizeof(channel->topic));
if(channel->channel_info->topic_mask
&& !match_ircglob(channel->channel_info->topic, channel->channel_info->topic_mask))
***************
*** 4992,4995 ****
--- 4999,5003 ----
{
struct chanData *cData = channel->channel_info;
+ char *mask;
if(!check_user_level(user, channel, cData->options[optEnfTopic], 1, 0))
***************
*** 4999,5006 ****
}
! unsplit_string(argv, argc);
if(cData->topic_mask) free(cData->topic_mask);
! if(argv[0][0] == '*' && argv[0][1] == 0)
{
cData->topic_mask = 0;
--- 5007,5014 ----
}
! mask = unsplit_string(argv, argc, NULL);
if(cData->topic_mask) free(cData->topic_mask);
! if(mask[0] == '*' && mask[1] == 0)
{
cData->topic_mask = 0;
***************
*** 5008,5012 ****
else
{
! cData->topic_mask = strdup(argv[0]);
if(!cData->topic[0])
{
--- 5016,5020 ----
else
{
! cData->topic_mask = strdup(mask);
if(!cData->topic[0])
{
***************
*** 5030,5036 ****
if(argc > 0)
{
! unsplit_string(argv, argc);
! if(argv[0][0] == '*' && argv[0][1] == 0)
{
free(*data);
--- 5038,5044 ----
if(argc > 0)
{
! char *greeting = unsplit_string(argv, argc, NULL);
! if(greeting[0] == '*' && greeting[1] == 0)
{
free(*data);
***************
*** 5041,5045 ****
unsigned int length;
! length = strlen(argv[0]);
if(length > chanserv_conf.greeting_length)
{
--- 5049,5053 ----
unsigned int length;
! length = strlen(greeting);
if(length > chanserv_conf.greeting_length)
{
***************
*** 5048,5052 ****
}
! *data = strdup(argv[0]);
}
}
--- 5056,5060 ----
}
! *data = strdup(greeting);
}
}
|
|
From: Adrian D. <sai...@us...> - 2002-08-05 03:20:27
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv31618
Modified Files:
chanserv.c checkdb.c gline.c helpserv.c modcmd.c opserv.c
recdb.c
Log Message:
recdb.c: read and write using mmap() if possible (faster)
recdb.c: Parse \<octal> qstrings like most other programs do (no leading 0 for characters > 077)
others: Open db files to be written using write_database() as read+write (required for mmap)
Also, change tabs to spaces in a couple places near other changes
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.262
retrieving revision 1.263
diff -C2 -r1.262 -r1.263
*** chanserv.c 5 Aug 2002 01:26:05 -0000 1.262
--- chanserv.c 5 Aug 2002 03:20:24 -0000 1.263
***************
*** 6887,6891 ****
chanserv_db_write(void)
{
! FILE *f = fopen(TEMP_DB_NAME, "w");
dict_t db = alloc_database();
--- 6887,6891 ----
chanserv_db_write(void)
{
! FILE *f = fopen(TEMP_DB_NAME, "w+");
dict_t db = alloc_database();
Index: checkdb.c
===================================================================
RCS file: /cvsroot/srvx/services/src/checkdb.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** checkdb.c 30 Jul 2002 02:15:11 -0000 1.7
--- checkdb.c 5 Aug 2002 03:20:24 -0000 1.8
***************
*** 65,69 ****
f = stdout;
} else {
! if (!(f = fopen(argv[2], "w"))) {
fprintf(stderr, "fopen: %s\n", strerror(errno));
return 4;
--- 65,69 ----
f = stdout;
} else {
! if (!(f = fopen(argv[2], "w+"))) {
fprintf(stderr, "fopen: %s\n", strerror(errno));
return 4;
Index: gline.c
===================================================================
RCS file: /cvsroot/srvx/services/src/gline.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** gline.c 30 Jul 2002 02:15:11 -0000 1.27
--- gline.c 5 Aug 2002 03:20:24 -0000 1.28
***************
*** 246,250 ****
dict_t db = alloc_database();
heap_remove_pred(gline_heap, gline_insert_entry, db);
! dbfile = fopen(TEMP_DB_NAME, "w");
write_database(dbfile, db);
fclose(dbfile);
--- 246,250 ----
dict_t db = alloc_database();
heap_remove_pred(gline_heap, gline_insert_entry, db);
! dbfile = fopen(TEMP_DB_NAME, "w+");
write_database(dbfile, db);
fclose(dbfile);
Index: helpserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpserv.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** helpserv.c 30 Jul 2002 02:15:11 -0000 1.20
--- helpserv.c 5 Aug 2002 03:20:24 -0000 1.21
***************
*** 20,23 ****
--- 20,24 ----
/* TODO List for helpserv.c
+ * - ?clone uses a new way to check for a valid nick name (for multi-protocol support) - need to do that in ?helpserv register
* - cmd_close should optionally take another argument (a reason/comment)
* Wishlist for helpserv.c
***************
*** 2914,2918 ****
/* now write the entire database */
! f = fopen(TEMP_DB_NAME, "w");
write_database(f, db);
fclose(f);
--- 2915,2919 ----
/* now write the entire database */
! f = fopen(TEMP_DB_NAME, "w+");
write_database(f, db);
fclose(f);
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** modcmd.c 5 Aug 2002 01:46:27 -0000 1.11
--- modcmd.c 5 Aug 2002 03:20:24 -0000 1.12
***************
*** 982,986 ****
dict_insert(db2, "services", alloc_record_data_object(db));
! dbfile = fopen(TEMP_DB_NAME, "w");
write_database(dbfile, db2);
fclose(dbfile);
--- 982,986 ----
dict_insert(db2, "services", alloc_record_data_object(db));
! dbfile = fopen(TEMP_DB_NAME, "w+");
write_database(dbfile, db2);
fclose(dbfile);
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.258
retrieving revision 1.259
diff -C2 -r1.258 -r1.259
*** opserv.c 4 Aug 2002 21:12:57 -0000 1.258
--- opserv.c 5 Aug 2002 03:20:24 -0000 1.259
***************
*** 3030,3039 ****
dict_insert(db, KEY_MAX_CLIENTS, alloc_record_data_object(subdb));
/* now write the entire database */
! f = fopen(TEMP_DB_NAME, "w");
write_database(f, db);
fclose(f);
free_database(db);
if (rename(TEMP_DB_NAME, OPSERV_DB_NAME) == -1) {
! log(NS_LOG, LOG_ERROR, "unable to rename new db to old: %s\n", strerror(errno));
}
last_db_write = now;
--- 3030,3039 ----
dict_insert(db, KEY_MAX_CLIENTS, alloc_record_data_object(subdb));
/* now write the entire database */
! f = fopen(TEMP_DB_NAME, "w+");
write_database(f, db);
fclose(f);
free_database(db);
if (rename(TEMP_DB_NAME, OPSERV_DB_NAME) == -1) {
! log(NS_LOG, LOG_ERROR, "unable to rename new db to old: %s\n", strerror(errno));
}
last_db_write = now;
Index: recdb.c
===================================================================
RCS file: /cvsroot/srvx/services/src/recdb.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -r1.40 -r1.41
*** recdb.c 3 Aug 2002 02:26:18 -0000 1.40
--- recdb.c 5 Aug 2002 03:20:24 -0000 1.41
***************
*** 22,25 ****
--- 22,34 ----
#include "log.h"
+ #ifdef HAVE_FCNTL_H
+ #include <fcntl.h>
+ #endif
+ #include <sys/mman.h>
+ #include <sys/stat.h>
+
+ /* 4 MiB on x86 */
+ #define MMAP_MAP_LENGTH (getpagesize()*1024)
+
/* file format (grammar in Backus-Naur Form):
*
***************
*** 42,52 ****
};
typedef struct recdb_file {
const char *source;
! union {
! FILE *f;
! unsigned char *s;
! } s;
! int is_file : 1;
struct recdb_context ctx;
jmp_buf env;
--- 51,67 ----
};
+ enum recdb_filetype {
+ RECDB_FILE,
+ RECDB_STRING,
+ RECDB_MMAP
+ };
+
typedef struct recdb_file {
const char *source;
! FILE *f; /* For RECDB_FILE, RECDB_MMAP */
! unsigned char *s; /* For RECDB_STRING, RECDB_MMAP */
! enum recdb_filetype type;
! size_t length;
! off_t pos;
struct recdb_context ctx;
jmp_buf env;
***************
*** 54,58 ****
typedef struct recdb_outfile {
! FILE *f;
int tablvl;
#ifdef NDEBUG
--- 69,86 ----
typedef struct recdb_outfile {
! FILE *f; /* For RECDB_FILE, RECDB_MMAP */
! unsigned char *s; /* For RECDB_STRING, RECDB_MMAP */
! union {
! struct { /* For RECDB_STRING */
! size_t chunksize;
! size_t alloc_length;
! } s;
! struct { /* For RECDB_MMAP */
! off_t mmap_begin;
! size_t mmap_length;
! } m;
! } state;
! enum recdb_filetype type;
! off_t pos;
int tablvl;
#ifdef NDEBUG
***************
*** 61,64 ****
--- 89,96 ----
} RECDB_OUT;
+ #ifdef HAVE_MMAP
+ static int mmap_error=0;
+ #endif
+
#define EOL '\n'
***************
*** 160,164 ****
new_list->used = slist->used;
for (i=0; i<new_list->used; i++) {
! new_list->list[i] = strdup(slist->list[i]);
}
return new_list;
--- 192,196 ----
new_list->used = slist->used;
for (i=0; i<new_list->used; i++) {
! new_list->list[i] = strdup(slist->list[i]);
}
return new_list;
***************
*** 173,187 ****
for (part=new_path; *new_path; new_path++) {
! if (*new_path != '/') continue;
! *new_path = 0;
! rd = dict_find(db, part, NULL);
! if (!rd || rd->type != RECDB_OBJECT) {
! free(orig_path);
! return NULL;
! }
! db = rd->d.object;
! part = new_path+1;
}
--- 205,219 ----
for (part=new_path; *new_path; new_path++) {
! if (*new_path != '/') continue;
! *new_path = 0;
! rd = dict_find(db, part, NULL);
! if (!rd || rd->type != RECDB_OBJECT) {
! free(orig_path);
! return NULL;
! }
! db = rd->d.object;
! part = new_path+1;
}
***************
*** 229,233 ****
dbeof(RECDB *recdb)
{
! return (recdb->is_file) ? feof(recdb->s.f) : !*recdb->s.s;
}
--- 261,278 ----
dbeof(RECDB *recdb)
{
! switch (recdb->type) {
! case RECDB_FILE:
! return feof(recdb->f);
! break;
! case RECDB_STRING:
! return !*recdb->s;
! break;
! case RECDB_MMAP:
! return ((size_t)recdb->pos >= recdb->length);
! break;
! default:
! return 1;
! break;
! }
}
***************
*** 236,243 ****
{
int res;
! if (recdb->is_file) {
! res = fgetc(recdb->s.f);
! } else {
! res = dbeof(recdb) ? EOF : *recdb->s.s++;
}
if (res == EOL) recdb->ctx.line++, recdb->ctx.col=1;
--- 281,296 ----
{
int res;
! switch (recdb->type) {
! case RECDB_FILE:
! res = fgetc(recdb->f);
! recdb->pos++;
! break;
! case RECDB_STRING:
! case RECDB_MMAP:
! res = dbeof(recdb) ? EOF : recdb->s[recdb->pos++];
! break;
! default:
! res = EOF;
! break;
}
if (res == EOL) recdb->ctx.line++, recdb->ctx.col=1;
***************
*** 249,256 ****
dbungetc(int c, RECDB *recdb)
{
! if (recdb->is_file) {
! ungetc(c, recdb->s.f);
! } else {
! *(--recdb->s.s) = c;
}
if (c == EOL) recdb->ctx.line--, recdb->ctx.col=-1;
--- 302,314 ----
dbungetc(int c, RECDB *recdb)
{
! switch (recdb->type) {
! case RECDB_FILE:
! ungetc(c, recdb->f);
! recdb->pos--;
! break;
! case RECDB_STRING:
! case RECDB_MMAP:
! recdb->s[--recdb->pos] = c;
! break;
}
if (c == EOL) recdb->ctx.line--, recdb->ctx.col=-1;
***************
*** 258,261 ****
--- 316,382 ----
}
+ static void
+ dbputc(int c, RECDB_OUT *file)
+ {
+ switch (file->type) {
+ case RECDB_FILE:
+ putc(c, file->f);
+ break;
+ case RECDB_MMAP:
+ #ifdef HAVE_MMAP
+ if (mmap_error) {
+ return;
+ }
+ if ((size_t)file->pos >= file->state.m.mmap_length) {
+ if (munmap(file->s, file->state.m.mmap_length)) {
+ log(MAIN_LOG, LOG_WARNING, "Unable to munmap output db: %s", strerror(errno));
+ mmap_error++;
+ return;
+ }
+ file->state.m.mmap_begin += file->state.m.mmap_length;
+ if ((file->s = mmap(NULL, file->state.m.mmap_length, PROT_WRITE, MAP_SHARED, fileno(file->f), file->state.m.mmap_begin)) == MAP_FAILED) {
+ log(MAIN_LOG, LOG_WARNING, "Unable to re-mmap output db: %s", strerror(errno));
+ file->s = NULL;
+ mmap_error++;
+ return;
+ }
+ ftruncate(fileno(file->f), file->state.m.mmap_begin+file->state.m.mmap_length);
+ file->pos = 0;
+ }
+ file->s[file->pos++] = (unsigned char)c;
+ #endif
+ break;
+ case RECDB_STRING:
+ if ((size_t)file->pos >= file->state.s.alloc_length) {
+ file->state.s.alloc_length += file->state.s.chunksize;
+ realloc(file->s, file->state.s.alloc_length);
+ }
+ file->s[file->pos++] = (unsigned char)c;
+ break;
+ default:
+ break;
+ }
+ }
+
+ /* This could be optimized, but it's only used for 2 to 5 char long strings */
+ static void
+ dbputs(const char *s, RECDB_OUT *file)
+ {
+ size_t i;
+
+ switch (file->type) {
+ case RECDB_FILE:
+ fputs(s, file->f);
+ break;
+ case RECDB_MMAP:
+ case RECDB_STRING:
+ for (i=0; s[i]; i++) {
+ dbputc(((const unsigned char *)s)[i], file);
+ }
+ default:
+ break;
+ }
+ }
+
/* returns first non-whitespace, non-comment character (-1 for EOF found) */
int
***************
*** 264,289 ****
int c, d, in_comment = 0;
while (!dbeof(recdb)) {
! c = dbgetc(recdb);
! if (c == EOF) return EOF;
! if (isspace(c)) continue;
! if (c != '/') return c;
! if ((d = dbgetc(recdb)) == '*') {
! /* C style comment, with slash star comment star slash */
! in_comment = 1;
! do {
! do {
! c = dbgetc(recdb);
! } while (c != '*' && c != EOF);
! if ((c = dbgetc(recdb)) == '/') in_comment = 0;
! } while (in_comment);
! } else if (d == '/') {
! /* C++ style comment, with slash slash comment newline */
! do {
! c = dbgetc(recdb);
! } while (c != EOF && c != EOL);
! } else {
! if (d != EOF) dbungetc(d, recdb);
! return c;
! }
}
return -1;
--- 385,410 ----
int c, d, in_comment = 0;
while (!dbeof(recdb)) {
! c = dbgetc(recdb);
! if (c == EOF) return EOF;
! if (isspace(c)) continue;
! if (c != '/') return c;
! if ((d = dbgetc(recdb)) == '*') {
! /* C style comment, with slash star comment star slash */
! in_comment = 1;
! do {
! do {
! c = dbgetc(recdb);
! } while (c != '*' && c != EOF);
! if ((c = dbgetc(recdb)) == '/') in_comment = 0;
! } while (in_comment);
! } else if (d == '/') {
! /* C++ style comment, with slash slash comment newline */
! do {
! c = dbgetc(recdb);
! } while (c != EOF && c != EOL);
! } else {
! if (d != EOF) dbungetc(d, recdb);
! return c;
! }
}
return -1;
***************
*** 312,321 ****
} else {
switch (c = dbgetc(recdb)) {
! case '0': /* either \0 or \0<octal> */
{
! char digits[4] = { '\0', '\0', '\0', '\0' };
! for (i=0; i < 3; i++) {
! /* \0177 is the highest possible, so \0200 would be invalid */
! if ((i == 3) && (digits[0] != '1')) {
break;
}
--- 433,450 ----
} else {
switch (c = dbgetc(recdb)) {
! case '0': /* \<octal>, 000 through 377 */
! case '1':
! case '2':
! case '3':
! case '4':
! case '5':
! case '6':
! case '7':
{
! char digits[3] = { (char)c, '\0', '\0' };
! for (i=1; i < 3; i++) {
! /* Maximum of \377, so there's a max of 2 digits
! * if digits[0] > '3' (no \400, but \40 is fine) */
! if (i == 2 && digits[0] > '3') {
break;
}
***************
*** 397,405 ****
dict_set_free_keys(obj, free);
while (!dbeof(recdb)) {
! if ((c = parse_skip_ws(recdb)) == '}') break;
! if (c == EOF) break;
dbungetc(c, recdb);
! parse_record_int(recdb, &name, &rd);
! dict_insert(obj, name, rd);
}
return obj;
--- 526,534 ----
dict_set_free_keys(obj, free);
while (!dbeof(recdb)) {
! if ((c = parse_skip_ws(recdb)) == '}') break;
! if (c == EOF) break;
dbungetc(c, recdb);
! parse_record_int(recdb, &name, &rd);
! dict_insert(obj, name, rd);
}
return obj;
***************
*** 415,425 ****
slist = alloc_string_list(4);
while (true) {
! c = parse_skip_ws(recdb);
! if (c == EOF || c == ')') break;
! dbungetc(c, recdb);
! string_list_append(slist, parse_qstring(recdb));
! c = parse_skip_ws(recdb);
! if (c == EOF || c == ')') break;
! if (c != ',') ABORT(recdb, EXPECTED_COMMA, c);
}
return slist;
--- 544,554 ----
slist = alloc_string_list(4);
while (true) {
! c = parse_skip_ws(recdb);
! if (c == EOF || c == ')') break;
! dbungetc(c, recdb);
! string_list_append(slist, parse_qstring(recdb));
! c = parse_skip_ws(recdb);
! if (c == EOF || c == ')') break;
! if (c != ',') ABORT(recdb, EXPECTED_COMMA, c);
}
return slist;
***************
*** 433,439 ****
c = parse_skip_ws(recdb);
if (c == EOF) {
! if (!*pname) return;
! free(*pname);
! ABORT(recdb, EXPECTED_RECORD_DATA, EOF);
}
if (c == '=') c = parse_skip_ws(recdb);
--- 562,568 ----
c = parse_skip_ws(recdb);
if (c == EOF) {
! if (!*pname) return;
! free(*pname);
! ABORT(recdb, EXPECTED_RECORD_DATA, EOF);
}
if (c == '=') c = parse_skip_ws(recdb);
***************
*** 461,465 ****
dict_set_free_keys(db, free);
while (!dbeof(recdb)) {
! parse_record_int(recdb, &name, &rd);
if (name) dict_insert(db, name, rd);
}
--- 590,594 ----
dict_set_free_keys(db, free);
while (!dbeof(recdb)) {
! parse_record_int(recdb, &name, &rd);
if (name) dict_insert(db, name, rd);
}
***************
*** 490,495 ****
{
log(MAIN_LOG, LOG_ERROR, "%s (got '%c') at %s line %d column %d\n",
! failure_reason(code), code & 255,
! recdb->source, recdb->ctx.line, recdb->ctx.col);
}
--- 619,624 ----
{
log(MAIN_LOG, LOG_ERROR, "%s (got '%c') at %s line %d column %d\n",
! failure_reason(code), code & 255,
! recdb->source, recdb->ctx.line, recdb->ctx.col);
}
***************
*** 502,515 ****
*prd = NULL;
recdb.source = "<user-supplied text>";
! recdb.s.s = strdup(text);
! recdb.is_file = 0;
recdb.ctx.line = recdb.ctx.col = 1;
if ((res = setjmp(recdb.env)) == 0) {
! parse_record_int(&recdb, pname, prd);
! return 0;
} else {
! if (*pname) free(*pname);
! if (*prd) free(*prd);
! return failure_reason(res);
}
}
--- 631,647 ----
*prd = NULL;
recdb.source = "<user-supplied text>";
! recdb.f = NULL;
! recdb.s = strdup(text);
! recdb.length = strlen(text);
! recdb.pos = 0;
! recdb.type = RECDB_STRING;
recdb.ctx.line = recdb.ctx.col = 1;
if ((res = setjmp(recdb.env)) == 0) {
! parse_record_int(&recdb, pname, prd);
! return 0;
} else {
! if (*pname) free(*pname);
! if (*prd) free(*prd);
! return failure_reason(res);
}
}
***************
*** 521,539 ****
int res;
dict_t db;
recdb.source = filename;
! recdb.s.f = fopen(filename, "r");
! if (!recdb.s.f) {
! log(MAIN_LOG, LOG_ERROR, "Unable to open database file '%s' for reading\n", filename);
! return NULL;
}
! recdb.is_file = 1;
recdb.ctx.line = recdb.ctx.col = 1;
if ((res = setjmp(recdb.env)) == 0) {
! db = parse_database_int(&recdb);
} else {
! explain_failure(&recdb, res);
_exit(1);
}
! fclose(recdb.s.f);
return db;
}
--- 653,709 ----
int res;
dict_t db;
+ struct stat statinfo;
+
recdb.source = filename;
! if (!(recdb.f = fopen(filename, "r"))) {
! log(MAIN_LOG, LOG_ERROR, "Unable to open database file '%s' for reading: %s\n", filename, strerror(errno));
! return NULL;
! }
!
! if (fstat(fileno(recdb.f), &statinfo)) {
! log(MAIN_LOG, LOG_ERROR, "Unable to fstat database file '%s': %s\n", filename, strerror(errno));
! return NULL;
}
! recdb.length = (size_t)statinfo.st_size;
!
! #ifdef HAVE_MMAP
! /* Try mmap */
! if (!mmap_error && (recdb.s = mmap(NULL, recdb.length, PROT_READ|PROT_WRITE, MAP_PRIVATE, fileno(recdb.f), 0)) != MAP_FAILED) {
! recdb.type = RECDB_MMAP;
! } else {
! /* Fall back to stdio */
! if (!mmap_error) {
! log(MAIN_LOG, LOG_WARNING, "Unable to mmap database file '%s' (falling back to stdio): %s\n", filename, strerror(errno));
! mmap_error = 1;
! }
! #else
! if (1) {
! #endif
! recdb.s = NULL;
! recdb.type = RECDB_FILE;
! }
!
recdb.ctx.line = recdb.ctx.col = 1;
+ recdb.pos = 0;
+
if ((res = setjmp(recdb.env)) == 0) {
! db = parse_database_int(&recdb);
} else {
! explain_failure(&recdb, res);
_exit(1);
}
!
! switch (recdb.type) {
! case RECDB_MMAP:
! #ifdef HAVE_MMAP
! munmap(recdb.s, recdb.length);
! #endif
! case RECDB_FILE:
! fclose(recdb.f);
! break;
! /* Appease gcc */
! default:
! break;
! }
return db;
}
***************
*** 544,565 ****
write_qstring(RECDB_OUT *file, const char *str)
{
! fputc('"', file->f);
while (*str) {
switch (*str) {
! case '\a': fputs("\\a", file->f); break;
! case '\b': fputs("\\b", file->f); break;
! case '\t': fputs("\\t", file->f); break;
! case EOL: fputs("\\n", file->f); break;
! case '\v': fputs("\\v", file->f); break;
! case '\f': fputs("\\f", file->f); break;
! case '\r': fputs("\\r", file->f); break;
! case '\\': fputs("\\\\", file->f); break;
! case '"': fputs("\\\"", file->f); break;
default:
if (!isprint(*str)) {
unsigned int chr = (unsigned char)(*str);
! fprintf(file->f, "\\x%.2x", chr);
} else {
! fputc(*str, file->f);
}
break;
--- 714,737 ----
write_qstring(RECDB_OUT *file, const char *str)
{
! dbputc('"', file);
while (*str) {
switch (*str) {
! case '\a': dbputs("\\a", file); break;
! case '\b': dbputs("\\b", file); break;
! case '\t': dbputs("\\t", file); break;
! case EOL: dbputs("\\n", file); break;
! case '\v': dbputs("\\v", file); break;
! case '\f': dbputs("\\f", file); break;
! case '\r': dbputs("\\r", file); break;
! case '\\': dbputs("\\\\", file); break;
! case '"': dbputs("\\\"", file); break;
default:
if (!isprint(*str)) {
unsigned int chr = (unsigned char)(*str);
! char buf[5];
! sprintf(buf, "\\x%.2x", chr);
! dbputs(buf, file);
} else {
! dbputc(*str, file);
}
break;
***************
*** 567,571 ****
str++;
}
! fputc('"', file->f);
}
--- 739,743 ----
str++;
}
! dbputc('"', file);
}
***************
*** 584,588 ****
int i;
! fputs("{\n", file->f);
#ifdef NDEBUG
file->need_tab = 1;
--- 756,760 ----
int i;
! dbputs("{\n", file);
#ifdef NDEBUG
file->need_tab = 1;
***************
*** 594,603 ****
#ifdef NDEBUG
! fputc('\n', file->f);
#endif
for (i=0; i < file->tablvl; i++) {
! fputc('\t', file->f);
}
! fputc('}', file->f);
}
--- 766,775 ----
#ifdef NDEBUG
! dbputc('\n', file);
#endif
for (i=0; i < file->tablvl; i++) {
! dbputc('\t', file);
}
! dbputc('}', file);
}
***************
*** 606,618 ****
{
unsigned int i;
! fputc('(', file->f);
if (slist->used) {
! write_qstring(file, slist->list[0]);
! for (i=1; i<slist->used; i++) {
! fputs(", ", file->f);
! write_qstring(file, slist->list[i]);
! }
}
! fputc(')', file->f);
}
--- 778,790 ----
{
unsigned int i;
! dbputc('(', file);
if (slist->used) {
! write_qstring(file, slist->list[0]);
! for (i=1; i<slist->used; i++) {
! dbputs(", ", file);
! write_qstring(file, slist->list[i]);
! }
}
! dbputc(')', file);
}
***************
*** 628,631 ****
--- 800,804 ----
}
+ /* It's probably not worth the overhead of making this use mmap */
void
write_record(FILE *file, const char *name, struct record_data *rd)
***************
*** 634,637 ****
--- 807,812 ----
fileinfo.f = file;
+ fileinfo.type = RECDB_FILE;
+ fileinfo.pos = 0;
fileinfo.tablvl = 0;
#ifdef NDEBUG
***************
*** 648,652 ****
#ifdef NDEBUG
if (rd->type == RECDB_OBJECT && !file->need_tab) {
! fputc('\n', file->f);
file->need_tab = 1;
}
--- 823,827 ----
#ifdef NDEBUG
if (rd->type == RECDB_OBJECT && !file->need_tab) {
! dbputc('\n', file);
file->need_tab = 1;
}
***************
*** 655,659 ****
#endif
for (i=0; i < file->tablvl; i++) {
! fputc('\t', file->f);
}
#ifdef NDEBUG
--- 830,834 ----
#endif
for (i=0; i < file->tablvl; i++) {
! dbputc('\t', file);
}
#ifdef NDEBUG
***************
*** 662,677 ****
#endif
write_qstring(file, name);
! fputc(' ', file->f);
write_record_data(file, rd);
! fputc(';', file->f);
#ifdef NDEBUG
if (rd->type == RECDB_OBJECT) {
! fputc('\n', file->f);
file->need_tab = 1;
} else {
! fputc(' ', file->f);
}
#else
! fputc('\n', file->f);
#endif
}
--- 837,852 ----
#endif
write_qstring(file, name);
! dbputc(' ', file);
write_record_data(file, rd);
! dbputc(';', file);
#ifdef NDEBUG
if (rd->type == RECDB_OBJECT) {
! dbputc('\n', file);
file->need_tab = 1;
} else {
! dbputc(' ', file);
}
#else
! dbputc('\n', file);
#endif
}
***************
*** 682,698 ****
RECDB_OUT *file = extra;
write_record2(file, key, data);
! fputc(EOL, file->f);
return 0;
}
void
write_database(FILE *file, dict_t db)
{
RECDB_OUT fileinfo;
fileinfo.f = file;
fileinfo.tablvl = 0;
#ifdef NDEBUG
fileinfo.need_tab = 0;
#endif
dict_foreach(db, write_database_helper, &fileinfo);
}
--- 857,931 ----
RECDB_OUT *file = extra;
write_record2(file, key, data);
! dbputc(EOL, file);
return 0;
}
+ /* Note: this *needs* the file opened as "w+" or else mmap() will fail */
void
write_database(FILE *file, dict_t db)
{
RECDB_OUT fileinfo;
+ off_t original_offset;
+
fileinfo.f = file;
+ fileinfo.pos = original_offset = ftello(file);
fileinfo.tablvl = 0;
#ifdef NDEBUG
fileinfo.need_tab = 0;
#endif
+
+ #ifdef HAVE_MMAP
+ if (mmap_error) {
+ #endif
+ fileinfo.type = RECDB_FILE;
+ dict_foreach(db, write_database_helper, &fileinfo);
+ return;
+ #ifdef HAVE_MMAP
+ }
+
+ fileinfo.type = RECDB_MMAP;
+ fileinfo.state.m.mmap_length = MMAP_MAP_LENGTH;
+ fileinfo.state.m.mmap_begin = fileinfo.pos / fileinfo.state.m.mmap_length;
+ fileinfo.pos %= MMAP_MAP_LENGTH;
+
+ fflush(file);
+
+ if (ftruncate(fileno(fileinfo.f), fileinfo.state.m.mmap_begin+fileinfo.state.m.mmap_length)) {
+ log(MAIN_LOG, LOG_WARNING, "Unable to ftruncate to extend output: %s\n", strerror(errno));
+ mmap_error = 1;
+
+ /* As mmap_error is true, it will now use stdio */
+ write_database(file, db);
+ return;
+ }
+
+ if ((fileinfo.s = mmap(NULL, fileinfo.state.m.mmap_length, PROT_WRITE, MAP_SHARED, fileno(fileinfo.f), fileinfo.state.m.mmap_begin)) == MAP_FAILED) {
+ log(MAIN_LOG, LOG_WARNING, "Unable to mmap output: %s\n", strerror(errno));
+ mmap_error = 1;
+
+ ftruncate(fileno(fileinfo.f), original_offset);
+ fseeko(fileinfo.f, original_offset, SEEK_SET);
+
+ write_database(file, db);
+ return;
+ }
+
dict_foreach(db, write_database_helper, &fileinfo);
+
+ if (mmap_error) {
+ if (fileinfo.s) {
+ munmap(fileinfo.s, fileinfo.state.m.mmap_length);
+ }
+
+ ftruncate(fileno(fileinfo.f), original_offset);
+ fseeko(fileinfo.f, original_offset, SEEK_SET);
+
+ write_database(file, db);
+ return;
+ }
+
+ munmap(fileinfo.s, fileinfo.state.m.mmap_length);
+ ftruncate(fileno(fileinfo.f), fileinfo.state.m.mmap_begin+fileinfo.pos); /* Clean up the extra space */
+ fseeko(fileinfo.f, (off_t)0, SEEK_END);
+ #endif
}
|
|
From: Adrian D. <sai...@us...> - 2002-08-05 03:04:48
|
Update of /cvsroot/srvx/services In directory usw-pr-cvs1:/tmp/cvs-serv28641 Modified Files: configure.in Log Message: Add autoconf test for mmap() Index: configure.in =================================================================== RCS file: /cvsroot/srvx/services/configure.in,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -r1.52 -r1.53 *** configure.in 30 Jul 2002 02:15:12 -0000 1.52 --- configure.in 5 Aug 2002 03:04:46 -0000 1.53 *************** *** 94,97 **** --- 94,100 ---- AC_CHECK_FUNCS(select socket strcspn strspn strtod strtoul,,AC_MSG_ERROR([a required function was not found. srvx build will fail.])) + dnl Check if mmap() works. Autoconf has its own test for this. + AC_FUNC_MMAP + dnl Define a helper macro used below for a few things. define([CACHE_COMPILE],[ |
|
From: Entrope <en...@us...> - 2002-08-05 02:58:21
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv27400/src Modified Files: compat.h Log Message: move alloca compat code to top of file (for portability to AIX's compiler) Index: compat.h =================================================================== RCS file: /cvsroot/srvx/services/src/compat.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** compat.h 3 Aug 2002 02:26:18 -0000 1.10 --- compat.h 5 Aug 2002 02:58:17 -0000 1.11 *************** *** 4,7 **** --- 4,25 ---- #include "config.h" + /* AIX's compiler requires this to be the first thing in the compiled + * files. Yay for braindead compilers. */ + #if defined(__GNUC__) && !defined(HAVE_ALLOCA_H) + # define alloca __builtin_alloca + #else + # if defined(HAVE_ALLOCA_H) && defined(CAN_INCLUDE_ALLOCA_H) + # include <alloca.h> + # else + # ifdef _AIX + # pragma alloca + # else + # ifndef alloca + char *alloca(); + # endif + # endif + # endif + #endif + /* These are ANSI C89 headers, so everybody should have them. If * they're missing, we probably don't care much about the platform. *************** *** 20,39 **** #include <stdlib.h> #include <string.h> - - #if defined(__GNUC__) && !defined(HAVE_ALLOCA_H) - # define alloca __builtin_alloca - #else - # if defined(HAVE_ALLOCA_H) && defined(CAN_INCLUDE_ALLOCA_H) - # include <alloca.h> - # else - # ifdef _AIX - # pragma alloca - # else - # ifndef alloca - char *alloca(); - # endif - # endif - # endif - #endif #ifdef TIME_WITH_SYS_TIME --- 38,41 ---- |
|
From: Entrope <en...@us...> - 2002-08-05 01:46:31
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv12720/src
Modified Files:
modcmd.c tools.c
Log Message:
kludge around what happens when you unsplit_string() when parts of argv are alias-substituted
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** modcmd.c 5 Aug 2002 01:26:56 -0000 1.10
--- modcmd.c 5 Aug 2002 01:46:27 -0000 1.11
***************
*** 593,597 ****
if (!cmd.command->func(user, channel, argc, argv, pcmd)) return 0;
if (!(cmd.flags & MODCMD_NO_LOG)) {
! unsigned int pos, ii, jj;
char logbuf[2*MAXLEN];
--- 593,597 ----
if (!cmd.command->func(user, channel, argc, argv, pcmd)) return 0;
if (!(cmd.flags & MODCMD_NO_LOG)) {
! unsigned int pos;
char logbuf[2*MAXLEN];
***************
*** 607,617 ****
}
pos += sprintf(logbuf+pos, ":%s]: ", (user->handle_info ? user->handle_info->handle : ""));
! for (ii=0; ii<argc; ii++) {
! for (jj=0; argv[ii][jj]; ) {
! logbuf[pos++] = argv[ii][jj++];
! }
! logbuf[pos++] = ' ';
! }
! logbuf[--pos] = 0;
log(cmd.command->parent->clog, LOG_INFO, "%s\n", logbuf);
}
--- 607,612 ----
}
pos += sprintf(logbuf+pos, ":%s]: ", (user->handle_info ? user->handle_info->handle : ""));
! unsplit_string(argv, argc);
! strcpy(logbuf+pos, argv[0]);
log(cmd.command->parent->clog, LOG_INFO, "%s\n", logbuf);
}
***************
*** 629,644 ****
/* If it's an alias, show what it's an alias for. */
if (cmd->alias.used) {
! char display[MAXLEN], *word;
! unsigned int pos, len;
!
! for (nn = pos = 0; nn < cmd->alias.used; ++nn) {
! word = cmd->alias.list[nn];
! len = strlen(word);
! memcpy(display+pos, word, len);
! pos += len;
! display[pos++] = ' ';
! }
! display[--pos] = 0;
! send_message(user, bot, MCMSG_COMMAND_ALIASES, cmd->name, display);
}
/* Show the help entry for the underlying command. */
--- 624,631 ----
/* If it's an alias, show what it's an alias for. */
if (cmd->alias.used) {
! char *arg0 = cmd->alias.list[0];
! unsplit_string((unsigned char**)cmd->alias.list, cmd->alias.used);
! send_message(user, bot, MCMSG_COMMAND_ALIASES, cmd->name, cmd->alias.list[0]);
! cmd->alias.list[0] = arg0;
}
/* Show the help entry for the underlying command. */
Index: tools.c
===================================================================
RCS file: /cvsroot/srvx/services/src/tools.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -C2 -r1.109 -r1.110
*** tools.c 30 Jul 2002 02:15:10 -0000 1.109
--- tools.c 5 Aug 2002 01:46:27 -0000 1.110
***************
*** 879,891 ****
unsplit_string(unsigned char *set[], unsigned int max)
{
! unsigned char *str = set[0];
! if (!max) return;
! while (1) {
! while (*str++) ;
! str--;
! if (!--max) break;
! while (!*str) *str++ = ' ';
}
! *str = 0;
}
--- 879,893 ----
unsplit_string(unsigned char *set[], unsigned int max)
{
! static unsigned char unsplit_buffer[MAXLEN*2];
! unsigned int ii, jj, pos;
!
! for (ii=pos=0; ii<max; ii++) {
! for (jj=0; set[ii][jj]; jj++) {
! unsplit_buffer[pos++] = set[ii][jj];
! }
! unsplit_buffer[pos++] = ' ';
}
! unsplit_buffer[--pos] = 0;
! set[0] = unsplit_buffer;
}
|
|
From: Entrope <en...@us...> - 2002-08-05 01:26:59
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv8318/src
Modified Files:
modcmd.h modcmd.c helpfile.h helpfile.c
Log Message:
fix "/msg chanserv #channel command"
make *modcmd.help work right for non-command topics
Index: modcmd.h
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** modcmd.h 4 Aug 2002 23:17:12 -0000 1.5
--- modcmd.h 5 Aug 2002 01:26:56 -0000 1.6
***************
*** 88,91 ****
--- 88,92 ----
struct service {
struct userNode *bot;
+ dict_t modules; /* contains struct module* */
dict_t commands; /* contains struct svccmd* */
struct helpserv_bot *hs;
***************
*** 157,161 ****
int svccmd_send_help(struct userNode *user, struct userNode *bot, struct svccmd *cmd);
/* .. and if somebody doesn't have a modcmd handy .. */
! int svccmd_send_help_2(struct userNode *user, struct userNode *bot, 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.
--- 158,162 ----
int svccmd_send_help(struct userNode *user, struct userNode *bot, struct svccmd *cmd);
/* .. and if somebody doesn't have a modcmd handy .. */
! 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.
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** modcmd.c 4 Aug 2002 23:17:12 -0000 1.9
--- modcmd.c 5 Aug 2002 01:26:56 -0000 1.10
***************
*** 572,581 ****
* it as a channel name, and hide it from logging.
*/
! if ((cmd_arg == 0)
! && (argc > 1)
&& (cmd.flags & MODCMD_ACCEPT_CHANNEL)
&& IsChannelName(argv[1])
&& ((argv[1][0] != '+') || (cmd.flags & MODCMD_ACCEPT_PCHANNEL))) {
! if (!(channel = dict_find(channels, argv[1-cmd_arg], NULL))) {
send_message(user, service->bot, MSG_INVALID_CHANNEL);
return 0;
--- 572,580 ----
* it as a channel name, and hide it from logging.
*/
! if ((argc > 1)
&& (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;
***************
*** 648,658 ****
int
! svccmd_send_help_2(struct userNode *user, struct userNode *bot, struct service *service, const char *topic) {
struct svccmd *cmd;
if ((cmd = dict_find(service->commands, topic, NULL))) {
! return svccmd_send_help(user, bot, cmd);
} else {
! /* TODO: try to send from the default helpfile (or default module's helpfile) instead */
! send_message(user, bot, MSG_TOPIC_UNKNOWN);
return 0;
}
--- 647,666 ----
int
! svccmd_send_help_2(struct userNode *user, struct service *service, const char *topic) {
struct svccmd *cmd;
if ((cmd = dict_find(service->commands, topic, NULL))) {
! 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)) {
! return send_help(user, service->bot, module->helpfile, topic);
! }
! }
! send_message(user, service->bot, MSG_TOPIC_UNKNOWN);
return 0;
}
***************
*** 704,707 ****
--- 712,716 ----
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;
***************
*** 719,722 ****
--- 728,743 ----
}
+ static struct svccmd *
+ svccmd_insert(struct service *service, char *name, struct svccmd *svccmd, struct modcmd *modcmd) {
+ svccmd->parent = service;
+ svccmd->name = name;
+ svccmd->command = modcmd;
+ svccmd->command->bind_count++;
+ dict_insert(service->commands, svccmd->name, svccmd);
+ dict_insert(service->modules, svccmd->command->parent->name, svccmd->command->parent);
+ return svccmd;
+ }
+
+
struct svccmd *
service_bind_modcmd(struct service *service, struct modcmd *cmd, const char *name) {
***************
*** 728,738 ****
}
svccmd = calloc(1, sizeof(*svccmd));
- svccmd->name = strdup(name);
- svccmd->command = cmd;
- svccmd->parent = service;
svccmd->weight = 1.0;
svccmd->template = cmd->defaults;
! dict_insert(service->commands, svccmd->name, svccmd);
! return svccmd;
}
--- 749,755 ----
}
svccmd = calloc(1, sizeof(*svccmd));
svccmd->weight = 1.0;
svccmd->template = cmd->defaults;
! return svccmd_insert(service, strdup(name), svccmd, cmd);
}
***************
*** 826,832 ****
return 0;
}
! newcmd->template = template;
! newcmd->command = template->command;
!
if (argc > 4) {
/* a more complicated alias; fix it up */
--- 843,847 ----
return 0;
}
!
if (argc > 4) {
/* a more complicated alias; fix it up */
***************
*** 847,856 ****
}
! newcmd->command->bind_count++;
! dict_insert(newcmd->parent->commands, newcmd->name, newcmd);
send_message(user, cmd->parent->bot, MCMSG_COMMAND_BOUND, newcmd->name, newcmd->parent->bot->nick);
return 1;
}
static MODCMD_FUNC(cmd_unbind) {
struct service *service;
--- 862,884 ----
}
! 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;
}
+ 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);
+ }
+ }
+
static MODCMD_FUNC(cmd_unbind) {
struct service *service;
***************
*** 875,878 ****
--- 903,907 ----
}
dict_remove(service->commands, bound->name);
+ service_rebuild_modules(service);
send_message(user, cmd->parent->bot, MCMSG_COMMAND_UNBOUND, cmdname, service->bot->nick);
return 1;
***************
*** 1022,1026 ****
unsplit_string(argv+1, argc-1);
}
! return svccmd_send_help_2(user, cmd->parent->bot, cmd->parent, topic);
}
--- 1051,1055 ----
unsplit_string(argv+1, argc-1);
}
! return svccmd_send_help_2(user, cmd->parent, topic);
}
***************
*** 1227,1233 ****
/* Now that we know we have a command to use, fill in the basics. */
svccmd = calloc(1, sizeof(*svccmd));
! svccmd->name = strdup(cmdname);
! svccmd->parent = service;
! svccmd->command = modcmd;
if ((str = database_get_data(obj, "template", RECDB_QSTRING))) {
svccmd_configure(svccmd, NULL, service->bot, "template", str);
--- 1256,1260 ----
/* Now that we know we have a command to use, fill in the basics. */
svccmd = calloc(1, sizeof(*svccmd));
! svccmd_insert(service, strdup(cmdname), svccmd, modcmd);
if ((str = database_get_data(obj, "template", RECDB_QSTRING))) {
svccmd_configure(svccmd, NULL, service->bot, "template", str);
***************
*** 1255,1259 ****
}
}
- dict_insert(service->commands, svccmd->name, svccmd);
}
--- 1282,1285 ----
***************
*** 1274,1279 ****
va_end(args);
svccmd = calloc(1, sizeof(*svccmd));
- svccmd->name = strdup(alias);
- svccmd->parent = service;
svccmd->template = svccmd_resolve_name(svccmd, argv[0]);
if (!svccmd->template) {
--- 1300,1303 ----
***************
*** 1283,1287 ****
return NULL;
}
- svccmd->command = svccmd->template->command;
if (argc > 1) {
svccmd->alias.used = svccmd->alias.size = argc;
--- 1307,1310 ----
***************
*** 1289,1294 ****
for (nn=0; nn<argc; nn++) svccmd->alias.list[nn] = strdup(argv[nn]);
}
! dict_insert(service->commands, svccmd->name, svccmd);
! return svccmd;
}
--- 1312,1316 ----
for (nn=0; nn<argc; nn++) svccmd->alias.list[nn] = strdup(argv[nn]);
}
! return svccmd_insert(service, strdup(alias), svccmd, svccmd->template->command);
}
Index: helpfile.h
===================================================================
RCS file: /cvsroot/srvx/services/src/helpfile.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** helpfile.h 2 Jul 2002 00:25:16 -0000 1.22
--- helpfile.h 5 Aug 2002 01:26:56 -0000 1.23
***************
*** 22,27 ****
#define HELPFILE_H
- struct helpfile;
-
struct userNode;
struct handle_info;
--- 22,25 ----
***************
*** 56,59 ****
--- 54,62 ----
typedef struct helpfile_expansion (*expand_func_t)(char *variable);
typedef void (*irc_send_func)(struct userNode *from, const char *to, const char *msg);
+
+ struct helpfile {
+ struct dict *db;
+ expand_func_t expand;
+ };
#ifdef __GNUC__
Index: helpfile.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpfile.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -r1.53 -r1.54
*** helpfile.c 4 Aug 2002 18:10:02 -0000 1.53
--- helpfile.c 5 Aug 2002 01:26:56 -0000 1.54
***************
*** 28,36 ****
#define HFMSG_HELP_NOT_STRING "Help file error (help data was not a string)."
- struct helpfile {
- dict_t db;
- expand_func_t expand;
- };
-
extern struct userNode *global, *chanserv, *opserv, *nickserv;
struct userNode *message_dest;
--- 28,31 ----
|
|
From: Entrope <en...@us...> - 2002-08-05 01:26:09
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv8092/src
Modified Files:
chanserv.c
Log Message:
make "/msg chanserv access" show access in all channels, and say so
(not just ones where infoline is set)
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.261
retrieving revision 1.262
diff -C2 -r1.261 -r1.262
*** chanserv.c 4 Aug 2002 23:17:12 -0000 1.261
--- chanserv.c 5 Aug 2002 01:26:05 -0000 1.262
***************
*** 289,293 ****
#define CSMSG_IS_CHANSERV "$b$C$b is the $bchannel service bot$b."
#define CSMSG_ACCESS_SELF_ONLY "You may only see the list of infolines for yourself (by using $b%s$b with no arguments)."
! #define CSMSG_INFOLINE_LIST "Showing all infolines for account $b%s$b:"
#define CSMSG_USER_NO_ACCESS "%s lacks access to %s."
#define CSMSG_USER_HAS_ACCESS "%s is %s $b%s$b in %s."
--- 289,293 ----
#define CSMSG_IS_CHANSERV "$b$C$b is the $bchannel service bot$b."
#define CSMSG_ACCESS_SELF_ONLY "You may only see the list of infolines for yourself (by using $b%s$b with no arguments)."
! #define CSMSG_INFOLINE_LIST "Showing all channel entries for account $b%s$b:"
#define CSMSG_USER_NO_ACCESS "%s lacks access to %s."
#define CSMSG_USER_HAS_ACCESS "%s is %s $b%s$b in %s."
***************
*** 3286,3292 ****
chanserv_notice(user, CSMSG_INFOLINE_LIST, target_handle->handle);
for (cList = target_handle->channels; cList; cList = cList->next) {
! if(!cList->user->info) continue;
chanName = cList->channel->channel ? cList->channel->channel->name : cList->channel->suspended->name;
! chanserv_notice(user, "[%s (%s)] %s", chanName, accessNames[cList->user->access], cList->user->info);
}
return 1;
--- 3286,3297 ----
chanserv_notice(user, CSMSG_INFOLINE_LIST, target_handle->handle);
for (cList = target_handle->channels; cList; cList = cList->next) {
! if(cList->user->access == ulHelper) continue;
chanName = cList->channel->channel ? cList->channel->channel->name : cList->channel->suspended->name;
! if(cList->user->info)
! {
! chanserv_notice(user, "[%s (%s)] %s", chanName, accessNames[cList->user->access], cList->user->info);
! } else {
! chanserv_notice(user, "[%s (%s)]", chanName, accessNames[cList->user->access]);
! }
}
return 1;
|
|
From: Entrope <en...@us...> - 2002-08-04 23:17:15
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv16083/src
Modified Files:
nickserv.c modcmd.h modcmd.c chanserv.c
Log Message:
make the modcmd logging system support logging full ident@hostmask
enable that on appropriate commands by default
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.184
retrieving revision 1.185
diff -C2 -r1.184 -r1.185
*** nickserv.c 3 Aug 2002 04:27:03 -0000 1.184
--- nickserv.c 4 Aug 2002 23:17:12 -0000 1.185
***************
*** 894,898 ****
{
struct handle_info *hi;
! const char *email_addr;
struct userNode *settee;
--- 894,898 ----
{
struct handle_info *hi;
! const char *email_addr, *password;
struct userNode *settee;
***************
*** 956,962 ****
}
! if ((hi = nickserv_register(user, settee, argv[1], argv[2]))) {
! log(NS_LOG, LOG_INFO, "Registered account '%s' to "IDENT_FORMAT".\n", argv[1], IDENT_DATA(user));
!
/* Add any masks they should get. */
if (nickserv_conf.default_hostmask) {
--- 956,962 ----
}
! password = argv[2];
! argv[2] = "****";
! if ((hi = nickserv_register(user, settee, argv[1], password))) {
/* Add any masks they should get. */
if (nickserv_conf.default_hostmask) {
***************
*** 1020,1028 ****
if ((hi = nickserv_register(user, settee, argv[1], argv[2]))) {
string_list_append(hi->masks, mask);
- if (settee) {
- log(NS_LOG, LOG_INFO, "%s registered account '%s' to "IDENT_FORMAT".\n", user->nick, argv[1], IDENT_DATA(settee));
- } else {
- log(NS_LOG, LOG_INFO, "%s registered account '%s' (no current user).\n", user->nick, argv[1]);
- }
return 1;
} else {
--- 1020,1023 ----
***************
*** 1047,1051 ****
}
- log(NS_LOG, LOG_OTHER, "Responded to inquiry about account '%s' from nick %s.\n", hi->handle, user->nick);
nickserv_notice(user, NSMSG_HANDLEINFO_ON, hi->handle);
nickserv_notice(user, NSMSG_HANDLEINFO_REGGED, ctime(&hi->registered));
--- 1042,1045 ----
***************
*** 1267,1270 ****
--- 1261,1265 ----
hi = dict_find(nickserv_handle_dict, argv[1], NULL);
passwd = argv[2];
+ argv[2] = "****";
} else if (argc == 2) {
if (nickserv_conf.disable_nicks) {
***************
*** 1284,1287 ****
--- 1279,1283 ----
}
passwd = argv[1];
+ argv[1] = "****";
} else {
nickserv_notice(user, MSG_MISSING_PARAMS, argv[0]);
***************
*** 1334,1338 ****
set_user_handle_info(user, hi);
nickserv_notice(user, NSMSG_AUTH_SUCCESS);
- log(NS_LOG, LOG_INFO, IDENT_FORMAT" was authenticated to account '%s'.\n", IDENT_DATA(user), hi->handle);
return 1;
}
--- 1330,1333 ----
***************
*** 1362,1370 ****
nickserv_notice(target, NSMSG_AUTH_ALLOWED_MSG, hi->handle, hi->handle);
if (nickserv_conf.email_enabled) nickserv_notice(target, NSMSG_AUTH_ALLOWED_EMAIL);
- log(NS_LOG, LOG_INFO, "%s allowed "IDENT_FORMAT" to authenticate to account '%s'.\n", user->handle_info->handle, IDENT_DATA(target), hi->handle);
} else {
if (dict_remove(nickserv_allow_auth_dict, target->nick)) {
nickserv_notice(user, NSMSG_AUTH_NORMAL_ONLY, target->nick);
- log(NS_LOG, LOG_INFO, "%s removed "IDENT_FORMAT"'s authorization to auth without hostmask.\n", user->handle_info->handle, IDENT_DATA(target));
} else {
nickserv_notice(user, NSMSG_AUTH_UNSPECIAL, target->nick);
--- 1357,1363 ----
***************
*** 1439,1442 ****
--- 1432,1436 ----
}
cryptpass(argv[2], crypted);
+ argv[2] = "****";
nickserv_make_cookie(user, hi, PASSWORD_CHANGE, crypted);
return 1;
***************
*** 1511,1515 ****
if (n >= nickserv_conf.nicks_per_handle) {
nickserv_notice(user, NSMSG_TOO_MANY_NICKS);
- log(NS_LOG, LOG_OTHER, "Account '%s' had too many nicks registered to it.\n", user->handle_info->handle);
return 0;
}
--- 1505,1508 ----
***************
*** 1527,1531 ****
if (target && target != user) {
nickserv_notice(user, NSMSG_NICK_IN_USE, nick);
- log(NS_LOG, LOG_OTHER, "Account '%s' tried to register someone else's nick.\n", user->handle_info->handle);
return 0;
}
--- 1520,1523 ----
***************
*** 1541,1545 ****
return 0;
}
- log(NS_LOG, LOG_OTHER, "Account '%s' tried to register someone else's nick.\n", user->handle_info->handle);
}
ni = dict_find(nickserv_nick_dict, nick, NULL);
--- 1533,1536 ----
***************
*** 1550,1554 ****
register_nick(nick, user->handle_info);
nickserv_notice(user, NSMSG_REGNICK_SUCCESS, nick);
- log(NS_LOG, LOG_OTHER, "Account '%s' registered nick '%s'.\n", user->handle_info->handle, nick);
return 1;
}
--- 1541,1544 ----
***************
*** 1563,1566 ****
--- 1553,1558 ----
old_pass = argv[1];
new_pass = argv[2];
+ argv[1] = "*OLDPASS*";
+ argv[2] = "*NEWPASS*";
if (!is_secure_password(hi->handle, new_pass, user)) return 0;
if (!checkpass(old_pass, hi->passwd)) {
***************
*** 1570,1574 ****
cryptpass(new_pass, hi->passwd);
nickserv_notice(user, NSMSG_PASS_SUCCESS);
- log(NS_LOG, LOG_OTHER, IDENT_FORMAT" changed passwords for their account '%s'.\n", IDENT_DATA(user), hi->handle);
return 1;
}
--- 1562,1565 ----
***************
*** 1588,1592 ****
string_list_append(hi->masks, new_mask);
nickserv_notice(user, NSMSG_ADDMASK_SUCCESS, new_mask);
- log(NS_LOG, LOG_OTHER, "'%s' added new mask '%s' to account '%s'.\n", user->nick, new_mask, hi->handle);
return 1;
}
--- 1579,1582 ----
***************
*** 1630,1634 ****
hi->masks->list[i] = hi->masks->list[--hi->masks->used];
nickserv_notice(user, NSMSG_DELMASK_SUCCESS, old_mask);
- log(NS_LOG, LOG_OTHER, "'%s' deleted mask '%s' from account '%s'.\n", user->nick, old_mask, hi->handle);
free(old_mask);
return 1;
--- 1620,1623 ----
***************
*** 2017,2022 ****
nickserv_notice(user, NSMSG_OPSERV_LEVEL_BAD);
} else {
- log(NS_LOG, LOG_INFO, "Account %s setting oper level for account %s to %d (from %d)\n",
- user->handle_info->handle, hi->handle, new_level, hi->opserv_level);
hi->opserv_level = new_level;
}
--- 2006,2009 ----
***************
*** 2037,2042 ****
if ((argc > 1) && is_valid_oper(user, nickserv_conf.set_epithet_level, 0)) {
unsplit_string(argv+1, argc-1);
- log(NS_LOG, LOG_INFO, "%s (%s) setting epithet for account %s to `%s'\n",
- user->nick, user->handle_info->handle, hi->handle, argv[1]);
if (hi->epithet) free(hi->epithet);
if ((argv[1][0] == '*') && !argv[1][1]) {
--- 2024,2027 ----
***************
*** 2066,2070 ****
if (!victim || (victim == user)) continue;
DelUser(victim, nickserv, true, NSMSG_KILL_MESSAGE);
- log(NS_LOG, LOG_OTHER, "Account '%s' requested a kill for %s.\n", hi->handle, victim->nick);
count++;
}
--- 2051,2054 ----
***************
*** 2093,2097 ****
DelUser(victim, nickserv, true, NSMSG_KILL_MESSAGE);
nickserv_notice(user, NSMSG_SINGLE_KILL, argv[i]);
- log(NS_LOG, LOG_OTHER, "Account '%s' requested a kill for %s.\n", hi->handle, victim->nick);
}
}
--- 2077,2080 ----
***************
*** 2114,2122 ****
if (hi != ni->owner) {
nickserv_notice(user, NSMSG_NOT_YOUR_NICK, nick);
- log(NS_LOG, LOG_OTHER, "User '%s' tried to unregister nick '%s' belonging to account '%s'.\n", user->nick, ni->nick, ni->owner->handle);
return 0;
}
nickserv_notice(user, NSMSG_UNREGNICK_SUCCESS, ni->nick);
- log(NS_LOG, LOG_INFO, "User '%s' (account '%s') unregistered nick %s.\n", user->nick, hi->handle, ni->nick);
delete_nick(ni);
return 1;
--- 2097,2103 ----
***************
*** 2137,2141 ****
}
nickserv_notice(user, NSMSG_UNREGNICK_SUCCESS, ni->nick);
- log(NS_LOG, LOG_INFO, "User '%s' unregistered nick '%s' belonging to account '%s'.\n", user->nick, ni->nick, ni->owner->handle);
delete_nick(ni);
return 1;
--- 2118,2121 ----
***************
*** 2145,2159 ****
{
struct handle_info *hi;
NICKSERV_MIN_PARMS(2);
hi = user->handle_info;
! if (checkpass(argv[1], hi->passwd)) {
! log(NS_LOG, LOG_INFO, "%s unregistered their account %s.\n", user->nick, hi->handle);
nickserv_unregister_handle(hi, user);
} else {
log(NS_LOG, LOG_INFO, "Account '%s' tried to unregister with the wrong password.\n", hi->handle);
nickserv_notice(user, NSMSG_PASSWORD_INVALID);
}
- return 0;
}
--- 2125,2142 ----
{
struct handle_info *hi;
+ char *passwd;
NICKSERV_MIN_PARMS(2);
hi = user->handle_info;
! passwd = argv[1];
! argv[1] = "****";
! if (checkpass(passwd, hi->passwd)) {
nickserv_unregister_handle(hi, user);
+ return 1;
} else {
log(NS_LOG, LOG_INFO, "Account '%s' tried to unregister with the wrong password.\n", hi->handle);
nickserv_notice(user, NSMSG_PASSWORD_INVALID);
+ return 0;
}
}
***************
*** 2895,2900 ****
}
nickserv_notice(user, NSMSG_DB_MERGED, argv[1], stop.tv_sec, stop.tv_usec/1000);
! log(NS_LOG, LOG_INFO, "%s merged %s into the database.\n", user->nick, argv[1]);
! return 0;
}
--- 2878,2882 ----
}
nickserv_notice(user, NSMSG_DB_MERGED, argv[1], stop.tv_sec, stop.tv_usec/1000);
! return 1;
}
***************
*** 3110,3114 ****
sprintf(buf, "%u", min_level);
if (must_be_qualified) {
! return modcmd_register(nickserv_module, name, func, 1, (must_auth ? MODCMD_REQUIRE_AUTHED : 0), "access", buf, "flags", "+qualified", NULL);
} else {
return modcmd_register(nickserv_module, name, func, 1, (must_auth ? MODCMD_REQUIRE_AUTHED : 0), "access", buf, NULL);
--- 3092,3096 ----
sprintf(buf, "%u", min_level);
if (must_be_qualified) {
! return modcmd_register(nickserv_module, name, func, 1, (must_auth ? MODCMD_REQUIRE_AUTHED : 0), "access", buf, "flags", "+qualified,+loghostmask", NULL);
} else {
return modcmd_register(nickserv_module, name, func, 1, (must_auth ? MODCMD_REQUIRE_AUTHED : 0), "access", buf, NULL);
***************
*** 3116,3120 ****
} else {
if (must_be_qualified) {
! return modcmd_register(nickserv_module, name, func, 1, (must_auth ? MODCMD_REQUIRE_AUTHED : 0), "flags", "+qualified", NULL);
} else {
return modcmd_register(nickserv_module, name, func, 1, (must_auth ? MODCMD_REQUIRE_AUTHED : 0), NULL);
--- 3098,3102 ----
} else {
if (must_be_qualified) {
! return modcmd_register(nickserv_module, name, func, 1, (must_auth ? MODCMD_REQUIRE_AUTHED : 0), "flags", "+qualified,+loghostmask", NULL);
} else {
return modcmd_register(nickserv_module, name, func, 1, (must_auth ? MODCMD_REQUIRE_AUTHED : 0), NULL);
***************
*** 3165,3169 ****
nickserv_module = module_register("NickServ", NS_LOG, "nickserv.help", nickserv_help_expand);
! modcmd_register(nickserv_module, "AUTH", cmd_auth, 2, MODCMD_KEEP_BOUND, "flags", "+qualified", NULL);
nickserv_define_func("ALLOWAUTH", cmd_allowauth, 0, 1, 0);
nickserv_define_func("REGISTER", cmd_register, -1, 0, 1);
--- 3147,3151 ----
nickserv_module = module_register("NickServ", NS_LOG, "nickserv.help", nickserv_help_expand);
! modcmd_register(nickserv_module, "AUTH", cmd_auth, 2, MODCMD_KEEP_BOUND, "flags", "+qualified,+loghostmask", NULL);
nickserv_define_func("ALLOWAUTH", cmd_allowauth, 0, 1, 0);
nickserv_define_func("REGISTER", cmd_register, -1, 0, 1);
Index: modcmd.h
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** modcmd.h 3 Aug 2002 04:27:03 -0000 1.4
--- modcmd.h 4 Aug 2002 23:17:12 -0000 1.5
***************
*** 32,36 ****
#if __GNUC__ >= 2
! #define MODCMD_FUNC(NAME) int NAME(struct userNode *user, struct chanNode *channel __attribute__((unused)), unsigned int argc, unsigned char *argv[], struct svccmd *cmd __attribute__((unused)))
#else
#define MODCMD_FUNC(NAME) int NAME(struct userNode *user, struct chanNode *channel, unsigned int argc, unsigned char *argv[], struct svccmd *cmd)
--- 32,36 ----
#if __GNUC__ >= 2
! #define MODCMD_FUNC(NAME) int NAME(struct userNode *user, struct chanNode *channel __attribute__((unused)), unsigned int argc __attribute__((unused)), unsigned char *argv[], struct svccmd *cmd __attribute__((unused)))
#else
#define MODCMD_FUNC(NAME) int NAME(struct userNode *user, struct chanNode *channel, unsigned int argc, unsigned char *argv[], struct svccmd *cmd)
***************
*** 45,48 ****
--- 45,49 ----
#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
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** modcmd.c 4 Aug 2002 21:11:36 -0000 1.8
--- modcmd.c 4 Aug 2002 23:17:12 -0000 1.9
***************
*** 99,102 ****
--- 99,103 ----
{ "joinable", MODCMD_REQUIRE_JOINABLE },
{ "keepbound", MODCMD_KEEP_BOUND },
+ { "loghostmask", MODCMD_LOG_HOSTMASK },
{ "nolog", MODCMD_NO_LOG },
{ "networkhelper", MODCMD_REQUIRE_NETWORK_HELPER },
***************
*** 602,606 ****
pos = 0;
if (channel) pos += sprintf(logbuf+pos, "(%s) ", channel->name);
! pos += sprintf(logbuf+pos, "[%s:%s]: ", user->nick, (user->handle_info ? user->handle_info->handle : ""));
for (ii=0; ii<argc; ii++) {
for (jj=0; argv[ii][jj]; ) {
--- 603,611 ----
pos = 0;
if (channel) pos += sprintf(logbuf+pos, "(%s) ", channel->name);
! pos += sprintf(logbuf+pos, "[%s", user->nick);
! if (cmd.flags & MODCMD_LOG_HOSTMASK) {
! pos += sprintf(logbuf+pos, "/%s@%s/%ld.%ld.%ld.%ld", user->ident, user->hostname, (user->ip >> 24) & 255, (user->ip >> 16) & 255, (user->ip >> 8) & 255, user->ip & 255);
! }
! pos += sprintf(logbuf+pos, ":%s]: ", (user->handle_info ? user->handle_info->handle : ""));
for (ii=0; ii<argc; ii++) {
for (jj=0; argv[ii][jj]; ) {
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.260
retrieving revision 1.261
diff -C2 -r1.260 -r1.261
*** chanserv.c 4 Aug 2002 21:10:03 -0000 1.260
--- chanserv.c 4 Aug 2002 23:17:12 -0000 1.261
***************
*** 6986,6990 ****
DEFINE_COMMAND(cunsuspend, 2, MODCMD_REQUIRE_AUTHED, "template", "csuspend", NULL);
! DEFINE_COMMAND(unregister, 1, MODCMD_REQUIRE_AUTHED|MODCMD_REQUIRE_REGCHAN, "access", "owner", NULL);
DEFINE_COMMAND(merge, 2, MODCMD_REQUIRE_AUTHED, "access", "owner", NULL);
--- 6986,6990 ----
DEFINE_COMMAND(cunsuspend, 2, MODCMD_REQUIRE_AUTHED, "template", "csuspend", NULL);
! DEFINE_COMMAND(unregister, 1, MODCMD_REQUIRE_AUTHED|MODCMD_REQUIRE_REGCHAN, "access", "owner", "flags", "+loghostmask", NULL);
DEFINE_COMMAND(merge, 2, MODCMD_REQUIRE_AUTHED, "access", "owner", NULL);
***************
*** 7001,7005 ****
DEFINE_COMMAND(opchan, 1, MODCMD_REQUIRE_REGCHAN, "access", "peon", NULL);
DEFINE_COMMAND(clvl, 3, MODCMD_REQUIRE_CHANUSER, "access", "master", NULL);
! DEFINE_COMMAND(giveownership, 2, MODCMD_REQUIRE_CHANUSER, "access", "owner", NULL);
DEFINE_COMMAND(up, 1, MODCMD_REQUIRE_CHANUSER, NULL);
--- 7001,7005 ----
DEFINE_COMMAND(opchan, 1, MODCMD_REQUIRE_REGCHAN, "access", "peon", NULL);
DEFINE_COMMAND(clvl, 3, MODCMD_REQUIRE_CHANUSER, "access", "master", NULL);
! DEFINE_COMMAND(giveownership, 2, MODCMD_REQUIRE_CHANUSER, "access", "owner", "flags", "+loghostmask", NULL);
DEFINE_COMMAND(up, 1, MODCMD_REQUIRE_CHANUSER, NULL);
|
|
From: Entrope <en...@us...> - 2002-08-04 21:13:00
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv21766/src
Modified Files:
main.c opserv.c proto-bahamut.c proto-common.c proto-p10.c
proto.h
Log Message:
make irc_squit() take a second message (so ?die, ?restart don't show the issuing user's name)
opserv.c: fix channel-requiring commands to be permanently marked as such
Index: main.c
===================================================================
RCS file: /cvsroot/srvx/services/src/main.c,v
retrieving revision 1.130
retrieving revision 1.131
diff -C2 -r1.130 -r1.131
*** main.c 4 Aug 2002 13:55:06 -0000 1.130
--- main.c 4 Aug 2002 21:12:57 -0000 1.131
***************
*** 203,207 ****
if(oldUplink)
{
! irc_squit(self, "Uplinks updated; selecting new uplink.");
}
--- 203,207 ----
if(oldUplink)
{
! irc_squit(self, "Uplinks updated; selecting new uplink.", NULL);
}
***************
*** 389,393 ****
log(MAIN_LOG, LOG_INFO, "%s -- exiting.\n", strsignal(x));
#endif
! irc_squit(self, "Exiting on signal from console.");
quit_services = 1;
}
--- 389,393 ----
log(MAIN_LOG, LOG_INFO, "%s -- exiting.\n", strsignal(x));
#endif
! irc_squit(self, "Exiting on signal from console.", NULL);
quit_services = 1;
}
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.257
retrieving revision 1.258
diff -C2 -r1.257 -r1.258
*** opserv.c 4 Aug 2002 20:11:18 -0000 1.257
--- opserv.c 4 Aug 2002 21:12:57 -0000 1.258
***************
*** 679,683 ****
(void)user;(void)channel;(void)argc;(void)argv;
! irc_squit(self, "Reconnecting.");
return 1;
--- 679,683 ----
(void)user;(void)channel;(void)argc;(void)argv;
! irc_squit(self, "Reconnecting.", NULL);
return 1;
***************
*** 767,771 ****
uplink_select(argv[1]);
! irc_squit(self, "Reconnecting.");
return 1;
--- 767,771 ----
uplink_select(argv[1]);
! irc_squit(self, "Reconnecting.", NULL);
return 1;
***************
*** 781,787 ****
reason = alloca(strlen(argv[1]) + strlen(user->nick) + 20);
sprintf(reason, "Disconnected by %s [%s]", user->nick, argv[1]);
!
! irc_squit(self, reason);
!
quit_services = 1;
return 1;
--- 781,785 ----
reason = alloca(strlen(argv[1]) + strlen(user->nick) + 20);
sprintf(reason, "Disconnected by %s [%s]", user->nick, argv[1]);
! irc_squit(self, reason, argv[1]);
quit_services = 1;
return 1;
***************
*** 799,804 ****
reason = alloca(strlen(argv[1]) + strlen(user->nick) + 17);
sprintf(reason, "Restarted by %s [%s]", user->nick, argv[1]);
!
! irc_squit(self, reason);
/* Append a NULL to the end of argv[]. */
--- 797,801 ----
reason = alloca(strlen(argv[1]) + strlen(user->nick) + 17);
sprintf(reason, "Restarted by %s [%s]", user->nick, argv[1]);
! irc_squit(self, reason, argv[1]);
/* Append a NULL to the end of argv[]. */
***************
*** 2518,2533 ****
opserv_define_func(const char *name, modcmd_func_t *func, int min_level, int reqchan)
{
! char buf[16], *flags;
sprintf(buf, "%d", min_level);
switch (reqchan) {
- default: case 0: flags = NULL; break;
case 1: flags = "+acceptchan"; break;
! case 2: flags = "+channel"; break;
! case 3: flags = "+channel,+acceptpluschan"; break;
}
if (flags) {
! return modcmd_register(opserv_module, name, func, 0, 0, "level", buf, "flags", flags, NULL);
} else {
! return modcmd_register(opserv_module, name, func, 0, 0, "level", buf, NULL);
}
}
--- 2515,2530 ----
opserv_define_func(const char *name, modcmd_func_t *func, int min_level, int reqchan)
{
! char buf[16], *flags = NULL;
! unsigned int iflags = 0;
sprintf(buf, "%d", min_level);
switch (reqchan) {
case 1: flags = "+acceptchan"; break;
! case 3: flags = "+acceptpluschan"; /* fall through */
! case 2: iflags = MODCMD_REQUIRE_CHANNEL; break;
}
if (flags) {
! return modcmd_register(opserv_module, name, func, 0, iflags, "level", buf, "flags", flags, NULL);
} else {
! return modcmd_register(opserv_module, name, func, 0, iflags, "level", buf, NULL);
}
}
Index: proto-bahamut.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-bahamut.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** proto-bahamut.c 4 Aug 2002 13:55:06 -0000 1.9
--- proto-bahamut.c 4 Aug 2002 21:12:57 -0000 1.10
***************
*** 76,80 ****
if (!serv) return;
if (announce && (serv->uplink == self) && (serv != self->uplink)) {
! irc_squit(serv, message);
}
for (nn=serv->children.used; nn>0;) {
--- 76,80 ----
if (!serv) return;
if (announce && (serv->uplink == self) && (serv != self->uplink)) {
! irc_squit(serv, message, NULL);
}
for (nn=serv->children.used; nn>0;) {
***************
*** 106,109 ****
--- 106,110 ----
}
}
+ if (strlen(nick) > nicklen) return 0;
return 1;
}
***************
*** 125,134 ****
}
- if (strlen(nick) > nicklen) {
- log(MAIN_LOG, LOG_ERROR, "AddUser(%p, %s, ...): nick too long (detected max is %d)\n", uplink, nick, nicklen);
- irc_squit(self, "Nick too long; see main.log for details");
- return NULL;
- }
-
uNode = calloc(1, sizeof(*uNode));
safestrncpy(uNode->nick, nick, sizeof(uNode->nick));
--- 126,129 ----
***************
*** 296,305 ****
void
! irc_squit(struct server *srv, const char *message) {
/* If we're leaving the network, QUIT all our clients. */
if ((srv == self) && (cManager.uplink->state == CONNECTED)) {
dict_iterator_t it;
for (it = dict_first(srv->users); it; it = iter_next(it)) {
! irc_quit(iter_data(it), message);
}
}
--- 291,301 ----
void
! irc_squit(struct server *srv, const char *message, const char *service_message) {
! if (!service_message) service_message = message;
/* If we're leaving the network, QUIT all our clients. */
if ((srv == self) && (cManager.uplink->state == CONNECTED)) {
dict_iterator_t it;
for (it = dict_first(srv->users); it; it = iter_next(it)) {
! irc_quit(iter_data(it), service_message);
}
}
Index: proto-common.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-common.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** proto-common.c 4 Aug 2002 13:55:06 -0000 1.6
--- proto-common.c 4 Aug 2002 21:12:57 -0000 1.7
***************
*** 347,351 ****
timeouts per time period exceeds some amount, the uplink could
be marked as unavalable.*/
! irc_squit(self, "Ping timeout.");
}
--- 347,351 ----
timeouts per time period exceeds some amount, the uplink could
be marked as unavalable.*/
! irc_squit(self, "Ping timeout.", NULL);
}
***************
*** 361,365 ****
this happens, though there should be a way of resetting
the flag. */
! irc_squit(self, "Incorrect password received.");
return 1;
}
--- 361,365 ----
this happens, though there should be a way of resetting
the flag. */
! irc_squit(self, "Incorrect password received.", NULL);
return 1;
}
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** proto-p10.c 4 Aug 2002 13:55:06 -0000 1.8
--- proto-p10.c 4 Aug 2002 21:12:57 -0000 1.9
***************
*** 295,300 ****
void
! irc_squit(struct server *srv, const char *message)
{
/* Are we leaving the network? */
if (srv == self && cManager.uplink->state == CONNECTED) {
--- 295,302 ----
void
! irc_squit(struct server *srv, const char *message, const char *service_message)
{
+ if (!service_message) service_message = message;
+
/* Are we leaving the network? */
if (srv == self && cManager.uplink->state == CONNECTED) {
***************
*** 304,308 ****
for (i = 0; i <= self->num_mask; i++) {
if (!self->users[i]) continue;
! irc_quit(self->users[i], message);
}
}
--- 306,310 ----
for (i = 0; i <= self->num_mask; i++) {
if (!self->users[i]) continue;
! irc_quit(self->users[i], service_message);
}
}
***************
*** 699,703 ****
(void)origin; (void)argc; (void)argv;
change_nicklen(9);
! irc_squit(self, "Got erroneous nickname, truncating nicks");
return 1;
}
--- 701,705 ----
(void)origin; (void)argc; (void)argv;
change_nicklen(9);
! irc_squit(self, "Got erroneous nickname, truncating nicks.", NULL);
return 1;
}
***************
*** 1438,1442 ****
* (This code is only to handle killing juped servers.) */
if (announce && (serv->uplink == self) && (serv != self->uplink)) {
! irc_squit(serv, message);
}
--- 1440,1444 ----
* (This code is only to handle killing juped servers.) */
if (announce && (serv->uplink == self) && (serv != self->uplink)) {
! irc_squit(serv, message, NULL);
}
***************
*** 1501,1504 ****
--- 1503,1507 ----
if (!isalnum(*nick) && !strchr("{|}~[\\]^-_`", *nick)) return 0;
}
+ if (strlen(nick) > nicklen) return 0;
return 1;
}
***************
*** 1528,1537 ****
if (!is_valid_nick(nick)) {
log(MAIN_LOG, LOG_WARNING, "AddUser(%p, %s, ...): invalid nickname detected.\n", uplink, nick);
- return NULL;
- }
-
- if (strlen(nick) > nicklen) {
- log(MAIN_LOG, LOG_ERROR, "AddUser(%p, %s, ...): nick too long (detected max is %d)\n", uplink, nick, nicklen);
- irc_squit(self, "Nick too long; see main.log for details");
return NULL;
}
--- 1531,1534 ----
Index: proto.h
===================================================================
RCS file: /cvsroot/srvx/services/src/proto.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -r1.55 -r1.56
*** proto.h 30 Jul 2002 02:15:11 -0000 1.55
--- proto.h 4 Aug 2002 21:12:57 -0000 1.56
***************
*** 123,127 ****
void irc_pong(const char *data);
void irc_quit(struct userNode *user, const char *message);
! void irc_squit(struct server *srv, const char *message);
/* messages */
--- 123,127 ----
void irc_pong(const char *data);
void irc_quit(struct userNode *user, const char *message);
! void irc_squit(struct server *srv, const char *message, const char *service_message);
/* messages */
|
|
From: Entrope <en...@us...> - 2002-08-04 21:11:39
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv21377/src
Modified Files:
modcmd.c
Log Message:
allow setting a command's template to * (meaning none)
fix another stupid aliasing bug
fix a logging bug
report MODCMD_REQUIRE_QUALIFIED in *modcmd.command
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** modcmd.c 3 Aug 2002 04:27:03 -0000 1.7
--- modcmd.c 4 Aug 2002 21:11:36 -0000 1.8
***************
*** 35,39 ****
#define MCMSG_BAD_WEIGHT "Invalid command weight %s."
#define MCMSG_BAD_OPTION "Unknown option %s."
! #define MCMSG_MUST_QUALIFY "You $bMUST$b \"/msg $S@$s %s\" (not just /msg $S)."
#define MCMSG_CHAN_NOT_REGISTERED "%s has not been registered with $C."
#define MCMSG_NO_CHANNEL_ACCESS "You lack access to %s."
--- 35,39 ----
#define MCMSG_BAD_WEIGHT "Invalid command weight %s."
#define MCMSG_BAD_OPTION "Unknown option %s."
! #define MCMSG_MUST_QUALIFY "You $bMUST$b \"/msg %s@$s %s\" (not just /msg %s)."
#define MCMSG_CHAN_NOT_REGISTERED "%s has not been registered with $C."
#define MCMSG_NO_CHANNEL_ACCESS "You lack access to %s."
***************
*** 243,246 ****
--- 243,273 ----
}
+ static void
+ svccmd_collapse(struct svccmd *from, struct svccmd *to, int omit_command) {
+ struct svccmd *cmd2;
+
+ memcpy(to, from, sizeof(*to));
+ if (!omit_command) to->flags |= from->command->flags;
+ for (cmd2 = from->template; cmd2; cmd2 = cmd2->template) {
+ to->flags |= cmd2->flags;
+ to->req_account_flags |= cmd2->req_account_flags;
+ to->deny_account_flags |= cmd2->deny_account_flags;
+ if (cmd2->min_opserv_level > to->min_opserv_level) {
+ to->min_opserv_level = cmd2->min_opserv_level;
+ }
+ if (cmd2->min_channel_access > to->min_channel_access) {
+ to->min_channel_access = cmd2->min_channel_access;
+ }
+ if (cmd2->weight > to->weight) {
+ to->weight = cmd2->weight;
+ }
+ }
+ if (to->min_opserv_level > 0) to->flags |= MODCMD_REQUIRE_OPER;
+ if (to->min_channel_access > ulNone) to->flags |= MODCMD_REQUIRE_CHANUSER;
+ if (to->flags & MODCMD_REQUIRE_CHANUSER) to->flags |= MODCMD_REQUIRE_REGCHAN;
+ if (to->flags & MODCMD_REQUIRE_JOINABLE) to->flags |= MODCMD_REQUIRE_CHANNEL;
+ if (to->flags & MODCMD_REQUIRE_STAFF) to->flags |= MODCMD_REQUIRE_AUTHED;
+ }
+
int
svccmd_configure(struct svccmd *cmd, struct userNode *user, struct userNode *bot, const char *param, const char *value) {
***************
*** 315,319 ****
return 1;
} 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);
--- 342,351 ----
return 1;
} else {
! if (!strcmp(value, "*")) {
! struct svccmd newvals;
! svccmd_collapse(cmd, &newvals, 1);
! 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);
***************
*** 349,379 ****
}
- static void
- svccmd_collapse(struct svccmd *from, struct svccmd *to, int omit_command) {
- struct svccmd *cmd2;
-
- memcpy(to, from, sizeof(*to));
- if (!omit_command) to->flags |= from->command->flags;
- for (cmd2 = from->template; cmd2; cmd2 = cmd2->template) {
- to->flags |= cmd2->flags;
- to->req_account_flags |= cmd2->req_account_flags;
- to->deny_account_flags |= cmd2->deny_account_flags;
- if (cmd2->min_opserv_level > to->min_opserv_level) {
- to->min_opserv_level = cmd2->min_opserv_level;
- }
- if (cmd2->min_channel_access > to->min_channel_access) {
- to->min_channel_access = cmd2->min_channel_access;
- }
- if (cmd2->weight > to->weight) {
- to->weight = cmd2->weight;
- }
- }
- if (to->min_opserv_level > 0) to->flags |= MODCMD_REQUIRE_OPER;
- if (to->min_channel_access > ulNone) to->flags |= MODCMD_REQUIRE_CHANUSER;
- if (to->flags & MODCMD_REQUIRE_CHANUSER) to->flags |= MODCMD_REQUIRE_REGCHAN;
- if (to->flags & MODCMD_REQUIRE_JOINABLE) to->flags |= MODCMD_REQUIRE_CHANNEL;
- if (to->flags & MODCMD_REQUIRE_STAFF) to->flags |= MODCMD_REQUIRE_AUTHED;
- }
-
/* This is kind of a lame hack, but it is actually simpler than having
* the permission check vary based on the command itself, or having a
--- 381,384 ----
***************
*** 390,394 ****
}
if ((cmd->flags & MODCMD_REQUIRE_QUALIFIED) && !server_qualified) {
! send_message(user, bot, MCMSG_MUST_QUALIFY, cmd->name);
return 0;
}
--- 395,399 ----
}
if ((cmd->flags & MODCMD_REQUIRE_QUALIFIED) && !server_qualified) {
! send_message(user, bot, MCMSG_MUST_QUALIFY, bot->nick, cmd->name, bot->nick);
return 0;
}
***************
*** 478,483 ****
unsigned char *arg;
! for (ii=new_argc=0; ii<old_argc; ++ii) {
! arg = old_argv[ii];
if (arg[0] != '$') {
new_argv[new_argc++] = arg;
--- 483,488 ----
unsigned char *arg;
! for (ii=new_argc=0; ii<cmd->alias.used; ++ii) {
! arg = cmd->alias.list[ii];
if (arg[0] != '$') {
new_argv[new_argc++] = arg;
***************
*** 519,523 ****
struct svccmd cmd, *pcmd;
unsigned int cmd_arg;
- char logbuf[2*MAXLEN];
/* Find the command argument. */
--- 524,527 ----
***************
*** 561,564 ****
--- 565,569 ----
return 0;
}
+ argv = new_argv;
}
***************
*** 566,570 ****
* it as a channel name, and hide it from logging.
*/
! if ((argc > 1)
&& (cmd.flags & MODCMD_ACCEPT_CHANNEL)
&& IsChannelName(argv[1])
--- 571,576 ----
* it as a channel name, and hide it from logging.
*/
! if ((cmd_arg == 0)
! && (argc > 1)
&& (cmd.flags & MODCMD_ACCEPT_CHANNEL)
&& IsChannelName(argv[1])
***************
*** 585,590 ****
if (!svccmd_can_invoke_real(user, service->bot, &cmd, channel, server_qualified, 1)) return 0;
pcmd->uses++;
if (!(cmd.flags & MODCMD_NO_LOG)) {
! unsigned int pos=0, ii, jj;
/* We reassemble the input line here. This lets services do
--- 591,598 ----
if (!svccmd_can_invoke_real(user, service->bot, &cmd, channel, server_qualified, 1)) return 0;
pcmd->uses++;
+ if (!cmd.command->func(user, channel, argc, argv, pcmd)) return 0;
if (!(cmd.flags & MODCMD_NO_LOG)) {
! unsigned int pos, ii, jj;
! char logbuf[2*MAXLEN];
/* We reassemble the input line here. This lets services do
***************
*** 592,595 ****
--- 600,604 ----
* while still having the commands logged uniformly.
*/
+ pos = 0;
if (channel) pos += sprintf(logbuf+pos, "(%s) ", channel->name);
pos += sprintf(logbuf+pos, "[%s:%s]: ", user->nick, (user->handle_info ? user->handle_info->handle : ""));
***************
*** 601,607 ****
}
logbuf[--pos] = 0;
- }
- if (!cmd.command->func(user, channel, argc, argv, pcmd)) return 0;
- if (!(cmd.flags & MODCMD_NO_LOG)) {
log(cmd.command->parent->clog, LOG_INFO, "%s\n", logbuf);
}
--- 610,613 ----
***************
*** 611,623 ****
int
svccmd_send_help(struct userNode *user, struct userNode *bot, struct svccmd *cmd) {
/* Show command name (in bold). */
! send_message(user, bot, "$b%s$b", cmd->name);
/* If it's an alias, show what it's an alias for. */
if (cmd->alias.used) {
char display[MAXLEN], *word;
! unsigned int pos, arg, len;
! for (arg = pos = 0; arg < cmd->alias.used; ++arg) {
! word = cmd->alias.list[arg];
len = strlen(word);
memcpy(display+pos, word, len);
--- 617,633 ----
int
svccmd_send_help(struct userNode *user, struct userNode *bot, struct svccmd *cmd) {
+ char cmdname[MAXLEN];
+ unsigned int nn;
/* Show command name (in bold). */
! for (nn=0; cmd->name[nn]; nn++) cmdname[nn] = toupper(cmd->name[nn]);
! cmdname[nn] = 0;
! send_message(user, bot, "$b%s$b", cmdname);
/* If it's an alias, show what it's an alias for. */
if (cmd->alias.used) {
char display[MAXLEN], *word;
! unsigned int pos, len;
! for (nn = pos = 0; nn < cmd->alias.used; ++nn) {
! word = cmd->alias.list[nn];
len = strlen(word);
memcpy(display+pos, word, len);
***************
*** 917,921 ****
}
if (cmd->template != modcmd->defaults) {
! if (cmd->template->parent == cmd->parent) {
sprintf(buf, "%s", cmd->template->name);
} else if (cmd->template->parent) {
--- 927,933 ----
}
if (cmd->template != modcmd->defaults) {
! if (!cmd->template) {
! strcpy(buf, "*");
! } else if (cmd->template->parent == cmd->parent) {
sprintf(buf, "%s", cmd->template->name);
} else if (cmd->template->parent) {
***************
*** 1113,1116 ****
--- 1125,1132 ----
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) {
if (svccmd->template->parent) {
***************
*** 1135,1139 ****
return 0;
}
! for (arg = 2; arg+2 < argc; arg += 2) {
if (svccmd_configure(svccmd, user, cmd->parent->bot, argv[arg], argv[arg+1])) changed = 1;
}
--- 1151,1155 ----
return 0;
}
! for (arg = 2; arg+1 < argc; arg += 2) {
if (svccmd_configure(svccmd, user, cmd->parent->bot, argv[arg], argv[arg+1])) changed = 1;
}
***************
*** 1209,1215 ****
svccmd->parent = service;
svccmd->command = modcmd;
- svccmd->template = modcmd->defaults;
if ((str = database_get_data(obj, "template", RECDB_QSTRING))) {
svccmd_configure(svccmd, NULL, service->bot, "template", str);
}
if ((str = database_get_data(obj, "account_flags", RECDB_QSTRING))) {
--- 1225,1232 ----
svccmd->parent = service;
svccmd->command = modcmd;
if ((str = database_get_data(obj, "template", RECDB_QSTRING))) {
svccmd_configure(svccmd, NULL, service->bot, "template", str);
+ } else {
+ svccmd->template = modcmd->defaults;
}
if ((str = database_get_data(obj, "account_flags", RECDB_QSTRING))) {
***************
*** 1380,1384 ****
pending_templates = ptempl->next;
/* Only overwrite the current template if we have a valid template. */
! if (!(svccmd = svccmd_resolve_name(ptempl->cmd, ptempl->base))) {
if (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);
--- 1397,1405 ----
pending_templates = ptempl->next;
/* Only overwrite the current template if we have a valid template. */
! if (!strcmp(ptempl->base, "*")) {
! ptempl->cmd->template = NULL;
! } else if ((svccmd = svccmd_resolve_name(ptempl->cmd, ptempl->base))) {
! ptempl->cmd->template = svccmd;
! } else {
if (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);
***************
*** 1386,1392 ****
log(MAIN_LOG, LOG_ERROR, "Unable to resolve template name %s for command %s in module %s.\n", ptempl->base, ptempl->cmd->name, ptempl->cmd->command->parent->name);
}
- continue;
}
- ptempl->cmd->template = svccmd;
free(ptempl->base);
free(ptempl);
--- 1407,1411 ----
|
|
From: Entrope <en...@us...> - 2002-08-04 21:10:06
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv20976/src
Modified Files:
chanserv.c
Log Message:
fix some !access bugs
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.259
retrieving revision 1.260
diff -C2 -r1.259 -r1.260
*** chanserv.c 4 Aug 2002 13:49:50 -0000 1.259
--- chanserv.c 4 Aug 2002 21:10:03 -0000 1.260
***************
*** 3267,3270 ****
--- 3267,3275 ----
target_handle = user->handle_info;
+ if(!target_handle)
+ {
+ chanserv_notice(user, MSG_AUTHENTICATE);
+ return 0;
+ }
if(argc > 1)
{
***************
*** 3283,3287 ****
if(!cList->user->info) continue;
chanName = cList->channel->channel ? cList->channel->channel->name : cList->channel->suspended->name;
! chanserv_notice(user, "[%s] %s", chanName, cList->user->info);
}
return 1;
--- 3288,3292 ----
if(!cList->user->info) continue;
chanName = cList->channel->channel ? cList->channel->channel->name : cList->channel->suspended->name;
! chanserv_notice(user, "[%s (%s)] %s", chanName, accessNames[cList->user->access], cList->user->info);
}
return 1;
***************
*** 3311,3315 ****
}
! /* could assert(target || target_handle); */
if(target == chanserv)
--- 3316,3320 ----
}
! assert(target || target_handle);
if(target == chanserv)
***************
*** 3377,3381 ****
* if the requestor is in the channel or it's their own
* handle. */
! if(uData->info && (GetUserMode(channel, user) || target_handle == user->handle_info))
{
chanserv_notice(user, "[%s] %s", (target ? target->nick : target_handle->handle), uData->info);
--- 3382,3386 ----
* if the requestor is in the channel or it's their own
* handle. */
! if(uData->info && (GetUserMode(channel, user) || (target_handle == user->handle_info)))
{
chanserv_notice(user, "[%s] %s", (target ? target->nick : target_handle->handle), uData->info);
***************
*** 7031,7035 ****
DEFINE_COMMAND(peek, 1, MODCMD_REQUIRE_REGCHAN, "access", "op", "flags", "+nolog", NULL);
! DEFINE_COMMAND(access, 1, 0, "flags", "+nolog", NULL);
DEFINE_COMMAND(users, 1, MODCMD_REQUIRE_REGCHAN, "flags", "+nolog,+joinable", NULL);
DEFINE_COMMAND(wlist, 1, MODCMD_REQUIRE_REGCHAN, "flags", "+nolog,+joinable", NULL);
--- 7036,7040 ----
DEFINE_COMMAND(peek, 1, MODCMD_REQUIRE_REGCHAN, "access", "op", "flags", "+nolog", NULL);
! DEFINE_COMMAND(access, 1, 0, "flags", "+nolog,+acceptchan", NULL);
DEFINE_COMMAND(users, 1, MODCMD_REQUIRE_REGCHAN, "flags", "+nolog,+joinable", NULL);
DEFINE_COMMAND(wlist, 1, MODCMD_REQUIRE_REGCHAN, "flags", "+nolog,+joinable", NULL);
|
|
From: Zoot <zo...@us...> - 2002-08-04 20:11:22
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv6740/src
Modified Files:
opserv.c
Log Message:
Fix up the log type labels for Global and HelpServ.
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.256
retrieving revision 1.257
diff -C2 -r1.256 -r1.257
*** opserv.c 4 Aug 2002 13:47:55 -0000 1.256
--- opserv.c 4 Aug 2002 20:11:18 -0000 1.257
***************
*** 3978,3981 ****
--- 3978,3983 ----
case NS_LOG: service = "$N"; break;
case OS_LOG: service = "$O"; break;
+ case HS_LOG: service = "HelpServ"; break;
+ case G_LOG: service = "$G"; break;
case PC_LOG: service = "proxycheck"; break;
default: service = "unknown"; break;
|
|
From: Zoot <zo...@us...> - 2002-08-04 20:11:16
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv6733/src
Modified Files:
Tag: rel-1_1-branch
opserv.c
Log Message:
Fix up the log type labels for Global.
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.235.2.6
retrieving revision 1.235.2.7
diff -C2 -r1.235.2.6 -r1.235.2.7
*** opserv.c 1 Aug 2002 00:00:50 -0000 1.235.2.6
--- opserv.c 4 Aug 2002 20:11:12 -0000 1.235.2.7
***************
*** 4079,4082 ****
--- 4079,4083 ----
case NS_LOG: service = "$N"; break;
case OS_LOG: service = "$O"; break;
+ case G_LOG: service = "$G"; break;
case PC_LOG: service = "proxycheck"; break;
default: service = "unknown"; break;
|
|
From: Zoot <zo...@us...> - 2002-08-04 18:10:05
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv10256/src
Modified Files:
helpfile.c
Log Message:
Restore Global's user notices to working order.
Index: helpfile.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpfile.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -r1.52 -r1.53
*** helpfile.c 4 Aug 2002 13:53:59 -0000 1.52
--- helpfile.c 4 Aug 2002 18:10:02 -0000 1.53
***************
*** 42,46 ****
struct handle_info *hi;
! if (IsChannelName(to)) {
message_dest = NULL;
hi = NULL;
--- 42,46 ----
struct handle_info *hi;
! if (IsChannelName(to) || *to == '$') {
message_dest = NULL;
hi = NULL;
***************
*** 157,161 ****
int ret, use_color;
! if (IsChannelName(dest)) {
message_dest = NULL;
} else if (!(message_dest = GetUserH(dest))) {
--- 157,161 ----
int ret, use_color;
! if (IsChannelName(dest) || *dest == '$') {
message_dest = NULL;
} else if (!(message_dest = GetUserH(dest))) {
|
|
From: Entrope <en...@us...> - 2002-08-04 13:55:10
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv20446/src
Modified Files:
proto-p10.c proto-common.c proto-bahamut.c main.c
Log Message:
make ping_freq and ping_timeout private to proto-*.c
Index: proto-p10.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-p10.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** proto-p10.c 2 Aug 2002 00:15:25 -0000 1.7
--- proto-p10.c 4 Aug 2002 13:55:06 -0000 1.8
***************
*** 1150,1153 ****
--- 1150,1160 ----
init_parse(void)
{
+ int tmp;
+
+ tmp = conf_server_ping_freq();
+ if (tmp != -1) ping_freq = tmp;
+ tmp = conf_server_ping_timeout();
+ if (tmp != -1) ping_timeout = tmp;
+
irc_func_dict = dict_new();
dict_insert(irc_func_dict, CMD_BURST, cmd_burst);
Index: proto-common.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-common.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** proto-common.c 30 Jul 2002 02:15:11 -0000 1.5
--- proto-common.c 4 Aug 2002 13:55:06 -0000 1.6
***************
*** 40,47 ****
static char replay_line[MAXLEN+80];
static struct io_fd *socket_io_fd;
extern struct cManagerNode cManager;
extern unsigned long burst_length;
- extern int ping_freq, ping_timeout;
extern struct cManagerNode cManager;
extern struct policer_params *oper_policer_params, *luser_policer_params;
--- 40,47 ----
static char replay_line[MAXLEN+80];
static struct io_fd *socket_io_fd;
+ static int ping_freq = 120, ping_timeout = 30;
extern struct cManagerNode cManager;
extern unsigned long burst_length;
extern struct cManagerNode cManager;
extern struct policer_params *oper_policer_params, *luser_policer_params;
Index: proto-bahamut.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-bahamut.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** proto-bahamut.c 2 Aug 2002 00:41:16 -0000 1.8
--- proto-bahamut.c 4 Aug 2002 13:55:06 -0000 1.9
***************
*** 948,951 ****
--- 948,958 ----
void init_parse(void) {
+ int tmp;
+
+ tmp = conf_server_ping_freq();
+ if (tmp != -1) ping_freq = tmp;
+ tmp = conf_server_ping_timeout();
+ if (tmp != -1) ping_timeout = tmp;
+
service_msginfo_dict = dict_new();
dict_set_free_data(service_msginfo_dict, free);
Index: main.c
===================================================================
RCS file: /cvsroot/srvx/services/src/main.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -C2 -r1.129 -r1.130
*** main.c 30 Jul 2002 02:15:11 -0000 1.129
--- main.c 4 Aug 2002 13:55:06 -0000 1.130
***************
*** 63,67 ****
unsigned long burst_length = 0;
- int ping_freq = 120, ping_timeout = 30;
int silent, quit_services, max_cycles;
--- 63,66 ----
***************
*** 642,646 ****
int main(int argc, char *argv[])
{
! int tmp, daemon;
pid_t pid = 0;
FILE *file_out;
--- 641,645 ----
int main(int argc, char *argv[])
{
! int daemon;
pid_t pid = 0;
FILE *file_out;
***************
*** 788,795 ****
reg_exit_func(main_shutdown);
- tmp = conf_server_ping_freq();
- if (tmp != -1) ping_freq = tmp;
- tmp = conf_server_ping_timeout();
- if (tmp != -1) ping_timeout = tmp;
modcmd_init();
timeq_init();
--- 787,790 ----
|
|
From: Entrope <en...@us...> - 2002-08-04 13:54:03
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv20219/src
Modified Files:
helpfile.c
Log Message:
make $s use self->name rather than looking things up in conf all the time
Index: helpfile.c
===================================================================
RCS file: /cvsroot/srvx/services/src/helpfile.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -r1.51 -r1.52
*** helpfile.c 30 Jul 2002 02:15:11 -0000 1.51
--- helpfile.c 4 Aug 2002 13:53:59 -0000 1.52
***************
*** 19,26 ****
*/
- #include "conf.h"
#include "helpfile.h"
#include "log.h"
#include "nickserv.h"
#define DEFAULT_LINE_SIZE MAX_LINE_SIZE
--- 19,26 ----
*/
#include "helpfile.h"
#include "log.h"
#include "nickserv.h"
+ #include "recdb.h"
#define DEFAULT_LINE_SIZE MAX_LINE_SIZE
***************
*** 297,301 ****
break;
case 's':
! value = (char*)conf_server_name();
break;
case 'H':
--- 297,301 ----
break;
case 's':
! value = self->name;
break;
case 'H':
|
|
From: Entrope <en...@us...> - 2002-08-04 13:49:54
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv19463/src
Modified Files:
chanserv.c
Log Message:
fix crash for "/msg chanserv down"
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.258
retrieving revision 1.259
diff -C2 -r1.258 -r1.259
*** chanserv.c 3 Aug 2002 04:27:03 -0000 1.258
--- chanserv.c 4 Aug 2002 13:49:50 -0000 1.259
***************
*** 6999,7003 ****
DEFINE_COMMAND(up, 1, MODCMD_REQUIRE_CHANUSER, NULL);
! DEFINE_COMMAND(down, 1, 0, NULL);
DEFINE_COMMAND(upall, 1, MODCMD_REQUIRE_AUTHED, NULL);
DEFINE_COMMAND(downall, 1, MODCMD_REQUIRE_AUTHED, NULL);
--- 6999,7003 ----
DEFINE_COMMAND(up, 1, MODCMD_REQUIRE_CHANUSER, NULL);
! DEFINE_COMMAND(down, 1, MODCMD_REQUIRE_CHANNEL, NULL);
DEFINE_COMMAND(upall, 1, MODCMD_REQUIRE_AUTHED, NULL);
DEFINE_COMMAND(downall, 1, MODCMD_REQUIRE_AUTHED, NULL);
|
|
From: Entrope <en...@us...> - 2002-08-04 13:47:58
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv19097/src
Modified Files:
opserv.c
Log Message:
quash warning from previous patch (only shows gcc-2.96?)
make ?clearhost do the same check
allow ?addtrust to accept 0 as a limit meaning unlimited
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.255
retrieving revision 1.256
diff -C2 -r1.255 -r1.256
*** opserv.c 4 Aug 2002 01:48:39 -0000 1.255
--- opserv.c 4 Aug 2002 13:47:55 -0000 1.256
***************
*** 167,171 ****
#define OSMSG_RESERVED_NICK_ITEM "%s"
#define OSMSG_TRUSTED_LIST "List of trusted hosts:"
! #define OSMSG_HOST_IS_TRUSTED "%s (limit %lu; set %s ago by %s; expires %s: %s)"
#define OSMSG_UPTIME_STATS "Uptime: %s (%u lines processed, CPU time %.2fu/%.2fs)"
#define OSMSG_NO_LAST_WRITE "Last Database Write: Never"
--- 167,171 ----
#define OSMSG_RESERVED_NICK_ITEM "%s"
#define OSMSG_TRUSTED_LIST "List of trusted hosts:"
! #define OSMSG_HOST_IS_TRUSTED "%s (%s; set %s ago by %s; expires %s: %s)"
#define OSMSG_UPTIME_STATS "Uptime: %s (%u lines processed, CPU time %.2fu/%.2fs)"
#define OSMSG_NO_LAST_WRITE "Last Database Write: Never"
***************
*** 1533,1542 ****
{
struct trusted_host *th;
! char length[INTERVALLEN], issued[INTERVALLEN];
th = data;
if (th->issued) intervalString(issued, now - th->issued);
if (th->expires) intervalString(length, th->expires - now);
! opserv_notice(extra, OSMSG_HOST_IS_TRUSTED, key, th->limit, (th->issued ? issued : "some time"), (th->issuer ? th->issuer : "<unknown>"), (th->expires ? length : "never"), (th->reason ? th->reason : "<unknown>"));
return 0;
}
--- 1533,1543 ----
{
struct trusted_host *th;
! char length[INTERVALLEN], issued[INTERVALLEN], limit[128];
th = data;
if (th->issued) intervalString(issued, now - th->issued);
if (th->expires) intervalString(length, th->expires - now);
! if (th->limit) sprintf(limit, "limit %lu", th->limit);
! opserv_notice(extra, OSMSG_HOST_IS_TRUSTED, key, (th->limit ? limit : "no limit"), (th->issued ? issued : "some time"), (th->issuer ? th->issuer : "<unknown>"), (th->expires ? length : "never"), (th->reason ? th->reason : "<unknown>"));
return 0;
}
***************
*** 1698,1702 ****
for (n=1; n<argc; n++) {
struct userNode *un = GetUserH(argv[n]);
- char *scanhost;
if (un) {
--- 1699,1702 ----
***************
*** 1708,1717 ****
opserv_notice(user, OSMSG_ADDRESS_QUEUED, hnamebuf);
}
! } else if (getipbyname(scanhost, &addr)) {
! sockcheck_queue_address(addr);
! opserv_notice(user, OSMSG_ADDRESS_QUEUED, scanhost);
! } else {
! opserv_notice(user, OSMSG_NO_SUCH_ADDRESS, scanhost);
! }
}
return 1;
--- 1708,1720 ----
opserv_notice(user, OSMSG_ADDRESS_QUEUED, hnamebuf);
}
! } else {
! char *scanhost = argv[n];
! if (getipbyname(scanhost, &addr)) {
! sockcheck_queue_address(addr);
! opserv_notice(user, OSMSG_ADDRESS_QUEUED, scanhost);
! } else {
! opserv_notice(user, OSMSG_NO_SUCH_ADDRESS, scanhost);
! }
! }
}
return 1;
***************
*** 1720,1724 ****
static OPSERV_FUNC(cmd_clearhost)
{
! unsigned int n, i;
OPSERV_MIN_PARMS(2, false);
--- 1723,1728 ----
static OPSERV_FUNC(cmd_clearhost)
{
! unsigned int n;
! char hnamebuf[64];
OPSERV_MIN_PARMS(2, false);
***************
*** 1726,1744 ****
for (n=1; n<argc; n++) {
struct userNode *un = GetUserH(argv[n]);
! char *scanhost;
! if (!un) {
! scanhost = argv[n];
} else {
! scanhost = un->hostname;
}
!
! if ((i = sockcheck_uncache_host(scanhost)) && i != (unsigned)-1) {
! opserv_notice(user, OSMSG_HOST_CLEARED, scanhost);
! } else if (i == (unsigned)-1) {
opserv_notice(user, OSMSG_HOST_BUSY, scanhost);
! } else {
opserv_notice(user, OSMSG_HOST_NOTCLEARED, scanhost);
! }
}
return 1;
--- 1730,1750 ----
for (n=1; n<argc; n++) {
struct userNode *un = GetUserH(argv[n]);
! const char *scanhost;
! int i;
! if (un) {
! sprintf(hnamebuf, "%ld.%ld.%ld.%ld", (un->ip >> 24) & 255, (un->ip >> 16) & 255, (un->ip >> 8) & 255, un->ip & 255);
! scanhost = hnamebuf;
} else {
! scanhost = argv[n];
}
! i = sockcheck_uncache_host(scanhost);
! if (i == -1) {
opserv_notice(user, OSMSG_HOST_BUSY, scanhost);
! } else if (i == 0) {
opserv_notice(user, OSMSG_HOST_NOTCLEARED, scanhost);
! } else {
! opserv_notice(user, OSMSG_HOST_CLEARED, scanhost);
! }
}
return 1;
***************
*** 1943,1947 ****
opserv_notice(ohi->clients.list[nn], OSMSG_CLONE_WARNING);
}
! } else if (ohi->clients.used > limit) {
char *target = alloca(3+strlen(user->hostname));
sprintf(target, "*@%s", user->hostname);
--- 1949,1953 ----
opserv_notice(ohi->clients.list[nn], OSMSG_CLONE_WARNING);
}
! } else if (limit && (ohi->clients.used > limit)) {
char *target = alloca(3+strlen(user->hostname));
sprintf(target, "*@%s", user->hostname);
***************
*** 2767,2771 ****
if (!limit || (expires && (expires < now))) return 0;
! opserv_add_trusted_host(host, strtoul(limit, NULL, 0), issuer, issued, expires, reason);
return 0;
}
--- 2773,2777 ----
if (!limit || (expires && (expires < now))) return 0;
! opserv_add_trusted_host(host, (limit ? strtoul(limit, NULL, 0) : 0), issuer, issued, expires, reason);
return 0;
}
***************
*** 2915,2920 ****
char number[16];
! snprintf(number, sizeof(number), "%lu", th->limit);
! dict_insert(subobj, KEY_LIMIT, alloc_record_data_qstring(number));
if (th->expires) {
snprintf(number, sizeof(number), FMT_TIME_T, th->expires);
--- 2921,2928 ----
char number[16];
! if (th->limit) {
! snprintf(number, sizeof(number), "%lu", th->limit);
! dict_insert(subobj, KEY_LIMIT, alloc_record_data_qstring(number));
! }
if (th->expires) {
snprintf(number, sizeof(number), FMT_TIME_T, th->expires);
|