예제 #1
0
        static bool ThrottleActive(ITriggerMsg msg, SourceEntry entry)
        {
            if (entry.Triggers.ThrottleActive)
            {
                msg.SendNotice("Sorry, currently ignoring trigger calls from {0}. Time remaining: {1}",
                               msg.ReturnTo, entry.Triggers.TimeLeft);
                return(true);
            }

            // Lock on output checks.
            lock (entry.Output)
            {
                // Refrain from doing any trigger work when output is being throttled anyways. This is not 100% safe,
                // since some trigger calls might not output to originating channel/user (ReturnTo), but is worth it to
                // protect against abuse.
                if (entry.Output.ThrottleActive)
                {
                    // Only attempt to send if source (ReturnTo) of this trigger call isn't the nick, since that would
                    // mean its subject to the active throttle which we just checked.
                    if (msg.ReturnTo != msg.Nick)
                    {
                        msg.SendNotice("Sorry, currently staying silent in {0}. Time remaining: {1}",
                                       msg.ReturnTo, entry.Output.TimeLeft);
                    }

                    return(true);
                }
            }

            return(false);
        }
예제 #2
0
 static void EmitDescriptions(TimerDescription[] descs, ITriggerMsg msg)
 {
     msg.SendNotice("Your currently running timers:");
     foreach (var desc in descs)
     {
         EmitDescription(desc, msg);
     }
     msg.SendNotice(" -----");
 }
예제 #3
0
 public void Enable(ITriggerMsg e)
 {
     if (manager.EnableNick(e.Channel, e.Nick))
     {
         e.SendNotice("Re-enabling URL-Titling for you.");
     }
 }
예제 #4
0
 static void EmitDescription(TimerDescription desc, ITriggerMsg msg)
 {
     msg.SendNotice("[{0}] {1} :: {2} ({3})",
                    desc.Index, desc.Message, desc.Duration.Str(), desc.Remaining.Str());
 }
예제 #5
0
 public void Disable(ITriggerMsg e)
 {
     manager.DisableNick(e.Channel, e.Nick);
     e.SendNotice("Disabling URL-Titling for you. (In {0})", e.Channel);
 }