From 5120e215ae486c88e07c766f1423b1551124944d Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Fri, 23 Dec 2005 03:11:09 +0000 Subject: [PATCH] Default to not trimming users on vacation. chanserv.c (cmd_trim_users): New argument to indicate whether users on vacation should be included. (cmd_trim): Parse an extra option to control that argument. chanserv.help: Document this change. git-archimport-id: srvx@srvx.net--2005-srvx/srvx--devo--1.3--patch-35 --- ChangeLog | 17 +++++++++++++++++ src/chanserv.c | 14 +++++++++----- src/chanserv.help | 3 ++- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 641f681..cda419f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,23 @@ # arch-tag: automatic-ChangeLog--srvx@srvx.net--2005-srvx/srvx--devo--1.3 # +2005-12-23 03:11:09 GMT Michael Poole patch-35 + + Summary: + Default to not trimming users on vacation. + Revision: + srvx--devo--1.3--patch-35 + + chanserv.c (cmd_trim_users): New argument to indicate whether users on + vacation should be included. + (cmd_trim): Parse an extra option to control that argument. + + chanserv.help: Document this change. + + modified files: + ChangeLog src/chanserv.c src/chanserv.help + + 2005-12-23 03:06:55 GMT Michael Poole patch-34 Summary: diff --git a/src/chanserv.c b/src/chanserv.c index b5966e1..c0401d3 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -2439,7 +2439,7 @@ cmd_trim_bans(struct userNode *user, struct chanNode *channel, unsigned long dur } static int -cmd_trim_users(struct userNode *user, struct chanNode *channel, unsigned short min_access, unsigned short max_access, unsigned long duration) +cmd_trim_users(struct userNode *user, struct chanNode *channel, unsigned short min_access, unsigned short max_access, unsigned long duration, int vacation) { struct userData *actor, *uData, *next; char interval[INTERVALLEN]; @@ -2465,7 +2465,9 @@ cmd_trim_users(struct userNode *user, struct chanNode *channel, unsigned short m { next = uData->next; - if((uData->seen > limit) || uData->present) + if((uData->seen > limit) + || uData->present + || (HANDLE_FLAGGED(uData->handle, FROZEN) && !vacation)) continue; if(((uData->access >= min_access) && (uData->access <= max_access)) @@ -2489,9 +2491,11 @@ static CHANSERV_FUNC(cmd_trim) { unsigned long duration; unsigned short min_level, max_level; + int vacation; REQUIRE_PARAMS(3); + vacation = argc > 3 && !strcmp(argv[3], "vacation"); duration = ParseInterval(argv[2]); if(duration < 60) { @@ -2506,17 +2510,17 @@ static CHANSERV_FUNC(cmd_trim) } else if(!irccasecmp(argv[1], "users")) { - cmd_trim_users(user, channel, 0, 0, duration); + cmd_trim_users(user, channel, 0, 0, duration, vacation); return 1; } else if(parse_level_range(&min_level, &max_level, argv[1])) { - cmd_trim_users(user, channel, min_level, max_level, duration); + cmd_trim_users(user, channel, min_level, max_level, duration, vacation); return 1; } else if((min_level = user_level_from_name(argv[1], UL_OWNER))) { - cmd_trim_users(user, channel, min_level, min_level, duration); + cmd_trim_users(user, channel, min_level, min_level, duration, vacation); return 1; } else diff --git a/src/chanserv.help b/src/chanserv.help index 45f9e1d..44a7937 100644 --- a/src/chanserv.help +++ b/src/chanserv.help @@ -412,8 +412,9 @@ "$uSee Also:$u unsuspend, deluser"); "TOPIC" ("/msg $C TOPIC <#channel> [topic]", "Sets the current topic for the specified channel. If no topic is specified, then set the current topic to the default topic."); -"TRIM" ("/msg $C TRIM <#channel> ", +"TRIM" ("/msg $C TRIM <#channel> [vacation]", "The trim command removes target objects inactive for more than a certain duration from a channel. The target must be a channel access level, a range of access levels (for example, \"300-399\"), \"users\" or \"bans\". The duration argument specifies the amount of time the target has been inactive for to be removed.", + "If the vacation argument is given for the users target, users who are on vacation will be trimmed. By default they are skipped.", "$uSee Also:$u durations"); "UNBAN" ("/msg $C UNBAN <#channel> ", "Unbans the specified nick or hostmask. If a nick is given, $b$C$b determines what hostmask(s) to unban.", -- 2.20.1