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; }
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; }
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'."); } }
void OnReasonCommand(const CString& sLine) { 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()); } }
/** * * Method Name: ParseByeReport * * * Inputs: unsigned char *puchReportBuffer - Buffer containing the Bye Report * * Outputs: None * * Returns: unsigned long * * Description: Extracts the contents of an Bye report using the buffer * passed in by the caller. * * Usage Notes: The header of the RTCP Report shall be parsed by delegating * to the base class. * * */ unsigned long CByeReport::ParseByeReport(unsigned char *puchReportBuffer) { unsigned char *puchPayloadBuffer = puchReportBuffer; // Check whether the RTCP Header has been correctly // formed (Version, etc...). if(!ParseRTCPHeader(puchReportBuffer)) return(GetReportLength()); // Good header. Let's bump the payload pointer and continue. puchPayloadBuffer += GetHeaderLength(); // Let's store the CSRCs from the Bye Report unsigned long ulCSRCCount = GetReportCount() ? GetReportCount() - 1 : 0; SetCSRC((ssrc_t *)puchPayloadBuffer, ulCSRCCount, TRUE); puchPayloadBuffer += (sizeof(ssrc_t) * ulCSRCCount); // Let's determine whether there is an optional Reason field associated // with this Bye Report. We can surmise this through comparing the // packet length to what we've already processed if(puchPayloadBuffer - puchReportBuffer < (long)GetReportLength()) { uint32_t ulReasonLength = (uint32_t)*puchPayloadBuffer++; SetReason(puchPayloadBuffer, ulReasonLength); puchPayloadBuffer += ulReasonLength; } // Let's process any padding that might be present to align the // payload on a 32 bit boundary. if(GetPadding()) puchPayloadBuffer += ExtractPadding(puchPayloadBuffer); return(puchPayloadBuffer - puchReportBuffer); }
ceefit_init_spec EXCEPTION::EXCEPTION(const wchar_t* aReason) { SetReason(aReason); }
ceefit_init_spec EXCEPTION::EXCEPTION(const STRING& aReason) { SetReason(aReason); }