示例#1
0
	bool OnLoad(const CString& sArgs, CString& sMessage) override {
		CString sReasonArg;

		// Load AwayWait
		CString sFirstArg = sArgs.Token(0);
		if (sFirstArg.Equals("-notimer")) {
			SetAwayWait(0);
			sReasonArg = sArgs.Token(1, true);
		} else if (sFirstArg.Equals("-timer")) {
			SetAwayWait(sArgs.Token(1).ToUInt());
			sReasonArg = sArgs.Token(2, true);
		} else {
			CString sAwayWait = GetNV("awaywait");
			if (!sAwayWait.empty())
				SetAwayWait(sAwayWait.ToUInt(), false);
			sReasonArg = sArgs;
		}

		// Load Reason
		if (!sReasonArg.empty()) {
			SetReason(sReasonArg);
		} else {
			CString sSavedReason = GetNV("reason");
			if (!sSavedReason.empty())
				SetReason(sSavedReason, false);
		}

		// Set away on load, required if loaded via webadmin
		if (GetNetwork()->IsIRCConnected() && !GetNetwork()->IsUserAttached())
			SetAway(false);

		return true;
	}
示例#2
0
	virtual bool OnLoad(const CString& sArgs, CString& sMessage) {
		CString sReasonArg;

		// Load AwayWait
		CString sFirstArg = sArgs.Token(0);
		if (sFirstArg.Equals("-notimer")) {
			SetAwayWait(0);
			sReasonArg = sArgs.Token(1, true);
		} else if (sFirstArg.Equals("-timer")) {
			SetAwayWait(sArgs.Token(1).ToUInt());
			sReasonArg = sArgs.Token(2, true);
		} else {
			CString sAwayWait = GetNV("awaywait");
			if (!sAwayWait.empty())
				SetAwayWait(sAwayWait.ToUInt(), false);
			sReasonArg = sArgs;
		}

		// Load Reason
		if (!sReasonArg.empty()) {
			SetReason(sReasonArg);
		} else {
			CString sSavedReason = GetNV("reason");
			if (!sSavedReason.empty())
				SetReason(sSavedReason, false);
		}

		return true;
	}
示例#3
0
	virtual void OnModCommand(const CString& sLine) {
		CString sCommand = sLine.Token(0);

		if (sCommand.Equals("help")) {
			CTable Table;
			Table.AddColumn("Command");
			Table.AddColumn("Description");
			Table.AddRow();
			Table.SetCell("Command", "Reason [<text>]");
			Table.SetCell("Description", "Prints and optionally sets the away reason.");
			Table.AddRow();
			Table.SetCell("Command", "Timer");
			Table.SetCell("Description", "Prints the current time to wait before setting you away.");
			Table.AddRow();
			Table.SetCell("Command", "SetTimer <time>");
			Table.SetCell("Description", "Sets the time to wait before setting you away (in seconds).");
			Table.AddRow();
			Table.SetCell("Command", "DisableTimer");
			Table.SetCell("Description", "Disables the wait time before setting you away.");
			PutModule(Table);

			PutModule("In the away reason, %s will be replaced with the time you were set away.");

		} else if (sCommand.Equals("reason")) {
			CString sReason = sLine.Token(1, true);

			if (!sReason.empty()) {
				SetReason(sReason);
				PutModule("Away reason set");
			} else {
				PutModule("Away reason: " + m_sReason);
				PutModule("Current away reason would be: " + ExpandReason());
			}

		} else if (sCommand.Equals("timer")) {
			PutModule("Current timer setting: "
					+ CString(m_iAwayWait) + " seconds");

		} else if (sCommand.Equals("settimer")) {
			SetAwayWait(sLine.Token(1).ToUInt());

			if (m_iAwayWait == 0)
				PutModule("Timer disabled");
			else
				PutModule("Timer set to "
						+ CString(m_iAwayWait) + " seconds");

		} else if (sCommand.Equals("disabletimer")) {
			SetAwayWait(0);
			PutModule("Timer disabled");

		} else {
			PutModule("Unknown command. Try 'help'.");
		}
	}
示例#4
0
	void OnSetTimerCommand(const CString& sLine) {
		SetAwayWait(sLine.Token(1).ToUInt());

		if (m_iAwayWait == 0)
			PutModule("Timer disabled");
		else
			PutModule("Timer set to "
					+ CString(m_iAwayWait) + " seconds");
	}
示例#5
0
    void OnSetTimerCommand(const CString& sLine) {
        SetAwayWait(sLine.Token(1).ToUInt());

        if (m_iAwayWait == 0)
            PutModule(t_s("Timer disabled"));
        else
            PutModule(t_p("Timer set to 1 second", "Timer set to: {1} seconds",
                          m_iAwayWait)(m_iAwayWait));
    }
示例#6
0
	void OnDisableTimerCommand(const CString& sLine) {
		SetAwayWait(0);
		PutModule("Timer disabled");
	}