Default to not trimming users on vacation.
authorMichael Poole <mdpoole@troilus.org>
Fri, 23 Dec 2005 03:11:09 +0000 (03:11 +0000)
committerMichael Poole <mdpoole@troilus.org>
Fri, 23 Dec 2005 03:11:09 +0000 (03:11 +0000)
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
src/chanserv.c
src/chanserv.help

index 641f68161bd50e4264037fa8a539105353f079a7..cda419f452f65c4a7a373a5103decc6e19a52245 100644 (file)
--- 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 <mdpoole@troilus.org>     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 <mdpoole@troilus.org>     patch-34
 
     Summary:
index b5966e17853b292f802746c6fd7d6a843983ca78..c0401d327b372f87031a7ed57e75cac026ef7308 100644 (file)
@@ -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
index 45f9e1de5432f309137b8987ccb1840abca41cbe..44a7937bfac36c01df5da5323710087e9d033a0f 100644 (file)
         "$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> <target> <duration>",
+"TRIM" ("/msg $C TRIM <#channel> <target> <duration> [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> <mask|nick>",
         "Unbans the specified nick or hostmask. If a nick is given, $b$C$b determines what hostmask(s) to unban.",