From: Entrope Date: Fri, 27 Feb 2004 16:31:57 +0000 (+0000) Subject: fix userlist presence tracking; "version" command on all services X-Git-Tag: v1.4.0-rc1~269 X-Git-Url: http://git.pk910.de/?p=srvx.git;a=commitdiff_plain;h=650dbf7e4cf451627a726cf75ca6deed79f2be00 fix userlist presence tracking; "version" command on all services * Change scan_handle_presence() to scan_user_presence(), since we always have the userData* at the caller site. * Make handle_auth() respect user suspensions. * In handle_part(), let scan_user_presence() update "seen" time. * Make ChanServ adduser command take arguments in the "expected" order ("!adduser target level", not "!adduser level target") * Add the "version" command to all built-in services git-archimport-id: srvx@srvx.net--2004-srvx/srvx--devo--1.3--patch-7 --- diff --git a/TODO b/TODO index 6c9b1c6..8c9bb50 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ ---------- - [featreq] something to turn off security override after a set period of time [featreq] an account flag that disallows users from using /ns kill (or some other way to prevent/deter nick holding on an account-level) [featreq] people cant !invite over a timeban @@ -8,8 +6,6 @@ [adam(m@myriad.lackofdiscipline.com)] we're having people grab nicks of other users who don't understand how the system works [msg(adam)] yeah, blocking account or nick registrations for an address (or block of addresses) was another featreq on the web page ---------- - [FEATREQ] Confirmation Of Channel Registration #Rowdy is now registered under handle Rowdy Please note, If you do not actively use this channel for 14 days, it will be deregistered @@ -22,3 +18,13 @@ [FEATREQ] Suspension durations and/or comments when suspending user access to a channel [FEATREQ] support "unregistered": ?ctrace print mode +s unregistered + +[FEATREQ] runtime construction of nickserv.help, rather than compile time + - Can do something like this: + "" { + "/services/nickserv/disable_nicks:false and /services/nickserv/email_enabled:false" ( "Help content with nick ownership enabled and email disabled" ); + // etc + }; + - Need a mini-language interpreter for the logic blocks; should skip + leading "[0-9A-Za-z]+: " prefix to allow sorting the entries by + priority diff --git a/src/chanserv.c b/src/chanserv.c index 19ece49..a481a9e 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -747,25 +747,20 @@ int check_user_level(struct chanNode *channel, struct userNode *user, enum level user is optional, if not null, it skips checking that userNode (for the handle_part function) */ static void -scan_handle_presence(struct chanNode *channel, struct handle_info *handle, struct userNode *user) +scan_user_presence(struct userData *uData, struct userNode *user) { - struct userData *uData; - - if(!channel->channel_info || IsSuspended(channel->channel_info)) - return; + struct modeNode *mn; - uData = GetTrueChannelAccess(channel->channel_info, handle); - if(uData) + if(IsSuspended(uData->channel) + || IsUserSuspended(uData) + || !(mn = find_handle_in_channel(uData->channel->channel, uData->handle, user))) { - struct modeNode *mn = find_handle_in_channel(channel, handle, user); - - if(mn) - { - uData->present = 1; - uData->seen = now; - } - else - uData->present = 0; + uData->present = 0; + } + else + { + uData->present = 1; + uData->seen = now; } } @@ -1723,8 +1718,7 @@ static CHANSERV_FUNC(cmd_register) channel = AddChannel(argv[1], now, NULL, NULL); cData = register_channel(channel, user->handle_info->handle); - add_channel_user(cData, handle, UL_OWNER, 0, NULL); - scan_handle_presence(channel, handle, NULL); + scan_user_presence(add_channel_user(cData, handle, UL_OWNER, 0, NULL), NULL); cData->modes = chanserv_conf.default_modes; change = mod_chanmode_dup(&cData->modes, 1); change->args[change->argc].mode = MODE_CHANOP; @@ -2163,10 +2157,10 @@ static CHANSERV_FUNC(cmd_adduser) return 0; } - access = user_level_from_name(argv[1], UL_OWNER); + access = user_level_from_name(argv[2], UL_OWNER); if(!access) { - reply("CSMSG_INVALID_ACCESS", argv[1]); + reply("CSMSG_INVALID_ACCESS", argv[2]); return 0; } @@ -2177,7 +2171,7 @@ static CHANSERV_FUNC(cmd_adduser) return 0; } - if(!(handle = modcmd_get_handle_info(user, argv[2]))) + if(!(handle = modcmd_get_handle_info(user, argv[1]))) return 0; if((actee = GetTrueChannelAccess(channel->channel_info, handle))) @@ -2187,7 +2181,7 @@ static CHANSERV_FUNC(cmd_adduser) } actee = add_channel_user(channel->channel_info, handle, access, 0, NULL); - scan_handle_presence(channel, handle, NULL); + scan_user_presence(actee, NULL); reply("CSMSG_ADDED_USER", handle->handle, channel->name, access); return 1; } @@ -5818,7 +5812,9 @@ handle_auth(struct userNode *user, UNUSED_ARG(struct handle_info *old_handle)) { struct chanNode *cn; struct modeNode *mn; - if(IsSuspended(channel->channel) || !(cn = channel->channel->channel)) + if(IsUserSuspended(channel) + || IsSuspended(channel->channel) + || !(cn = channel->channel->channel)) continue; mn = GetUserMode(cn, user); @@ -5895,10 +5891,10 @@ handle_part(struct userNode *user, struct chanNode *channel, UNUSED_ARG(const ch { struct chanData *cData; struct userData *uData; - struct handle_info *handle; cData = channel->channel_info; - if(!cData || IsSuspended(cData) || IsLocal(user)) return; + if(!cData || IsSuspended(cData) || IsLocal(user)) + return; if((cData->flags & CHANNEL_DYNAMIC_LIMIT) && !channel->join_flooded) { @@ -5911,11 +5907,8 @@ handle_part(struct userNode *user, struct chanNode *channel, UNUSED_ARG(const ch } } - if((handle = user->handle_info) && (uData = GetTrueChannelAccess(cData, handle))) - { - uData->seen = now; - scan_handle_presence(channel, handle, user); - } + if((uData = GetTrueChannelAccess(cData, user->handle_info))) + scan_user_presence(uData, user); if(IsHelping(user) && IsSupportHelper(user)) { diff --git a/src/chanserv.help b/src/chanserv.help index ecd9c59..1e9ccd0 100644 --- a/src/chanserv.help +++ b/src/chanserv.help @@ -106,9 +106,9 @@ "ADDBAN" ("/msg $C ADDBAN <#channel> [Reason]", "Adds a ban to the channels permanent ban list, remaining in effect until removed with the DELBAN command. If it exactly matches an existing ban already in the list, the reason will be updated. If the existing ban was a timed ban, it will be extended into a permanent ban.", "$uSee Also:$u bans, delban, mdelban"); -"ADDUSER" ("/msg $C ADDUSER <#channel> ", +"ADDUSER" ("/msg $C ADDUSER <#channel> ", "This command adds someone to the channel user list with the specified access level. (You may only add users to levels less than your own.)", - "The level may be one of $bpeon$b, $bop$b, $bmaster$b, $bcoowner$b or $bowner$b (only network staff may add owners).", + "The level may be one of $bpeon$b, $bop$b, $bmaster$b, $bcoowner$b, $bowner$b, or a number between 1 and 500. Only network staff may add level 500 users (owners).", "$uSee Also:$u deluser, users"); "ADDTIMEDBAN" ("/msg $C ADDTIMEDBAN <#channel> [Reason]", "Adds an automatically expiring ban to the channel ban list. This command behaves in the exact same fashion as ADDBAN with the exception that the bans are automatically removed after the user-supplied duration. If it exactly matches an existing ban already in the list, the reason will be updated. If the existing ban was a timed ban, it will be extended. Timed bans can be removed with the DELBAN command, as with permanent bans.", diff --git a/src/modcmd.c b/src/modcmd.c index 4dc8928..01e392b 100644 --- a/src/modcmd.c +++ b/src/modcmd.c @@ -32,7 +32,7 @@ static struct dict *modules; static struct dict *services; static struct pending_template *pending_templates; static struct module *modcmd_module; -static struct modcmd *bind_command, *help_command; +static struct modcmd *bind_command, *help_command, *version_command; static const struct message_entry msgtab[] = { { "MCMSG_VERSION", "$b"PACKAGE_STRING"$b ("CODENAME"), Built: " __DATE__ ", " __TIME__"." }, { "MCMSG_BARE_FLAG", "Flag %.*s must be preceeded by a + or -." }, @@ -1952,7 +1952,7 @@ modcmd_init(void) { modcmd_register(modcmd_module, "service trigger", cmd_service_trigger, 2, 0, NULL); modcmd_register(modcmd_module, "service remove", cmd_service_remove, 2, 0, NULL); modcmd_register(modcmd_module, "dumpmessages", cmd_dump_messages, 1, 0, "oper_level", "1000", NULL); - modcmd_register(modcmd_module, "version", cmd_version, 1, 0, NULL); + version_command = modcmd_register(modcmd_module, "version", cmd_version, 1, 0, NULL); message_register_table(msgtab); } @@ -2146,21 +2146,25 @@ create_default_binds(void) { continue; if (dict_size(service->commands) > 0) continue; + /* Bind the default modules for this service to it */ for (jj = 0; def_binds[ii].modnames[jj]; ++jj) { if (!(module = module_find(def_binds[ii].modnames[jj]))) continue; service_bind_module(service, module); } - /* Bind the help command to this service */ + + /* Bind the help and version commands to this service */ service_bind_modcmd(service, help_command, help_command->name); + service_bind_modcmd(service, version_command, version_command->name); + /* Now some silly hax.. (aliases that most people want) */ if (!irccasecmp(def_binds[ii].svcname, "ChanServ")) { - 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, "addowner", "*chanserv.adduser", "$1", "owner", NULL); + service_make_alias(service, "addcoowner", "*chanserv.adduser", "$1", "coowner", NULL); + service_make_alias(service, "addmaster", "*chanserv.adduser", "$1", "master", NULL); + service_make_alias(service, "addop", "*chanserv.adduser", "$1", "op", NULL); + service_make_alias(service, "addpeon", "*chanserv.adduser", "$1", "peon", 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);