/// <summary> /// Adds a new command to the Q command queue /// </summary> /// <param name="command">The command to add</param> public void Push(QCommand command) { foreach (QCommand other in commands) if (command.IsSame(other)) return; commands.Enqueue(command); Update(); }
/// <summary> /// Updates the Q command list /// </summary> void Update() { if (current == null && commands.Count != 0) { current = commands.Dequeue(); current.OnExecute(); Irc.SendPrivateMessage(current.Command, "Q", false, false); } if (OnUpdate != null) OnUpdate.Invoke(); }
/// <summary> /// Handles a response from Q /// </summary> /// <param name="text">The text of the response by Q</param> public void OnResponse(string text) { if (current == null) Program.Log("Unexpected response from Q: " + text); else { if (!current.OnResponse(text)) { current.RaiseFinished(); current = null; Update(); } } }
/// <summary> /// Checks if this command is the same as some other command /// </summary> /// <param name="other">The other command to check</param> /// <returns>True if this command is the same</returns> public virtual bool IsSame(QCommand other) { return Command == other.Command; }
public PendingUnban(QCommand condition, string mask) { this.mask = mask; condition.OnFinished += new QCommand.OnFinishedDelegate(ExecuteIfTrue); }
public PendingSetEnforcer(QCommand condition, string mask, BanEnforcement enforcer) { this.mask = mask; this.enforcer = enforcer; condition.OnFinished += new QCommand.OnFinishedDelegate(ExecuteIfTrue); }
public void Add(QCommand command) { total++; count++; command.OnFinished += new QCommand.OnFinishedDelegate(Decrement); }