void HandleNeed(const CChan& Channel, const CString& sPerms) { MCString::iterator it = m_msChanModes.find(Channel.GetName()); if (it == m_msChanModes.end()) return; CString sModes = it->second; bool bMaster = (sModes.find("m") != CString::npos) || (sModes.find("n") != CString::npos); if (sPerms.find("o") != CString::npos) { bool bOp = (sModes.find("o") != CString::npos); bool bAutoOp = (sModes.find("a") != CString::npos); if (bMaster || bOp) { if (!bAutoOp) { PutModule("RequestPerms: Requesting op on " + Channel.GetName()); PutQ("OP " + Channel.GetName()); } return; } } if (sPerms.find("v") != CString::npos) { bool bVoice = (sModes.find("v") != CString::npos); bool bAutoVoice = (sModes.find("g") != CString::npos); if (bMaster || bVoice) { if (!bAutoVoice) { PutModule("RequestPerms: Requesting voice on " + Channel.GetName()); PutQ("VOICE " + Channel.GetName()); } return; } } }
void CHpsAsyncLogThread::OnReConnWarn(const string &strReConnIp) { SS_XLOG(XLOG_DEBUG, "CHpsAsyncLogThread::%s\n", __FUNCTION__); SAsyncLogReConnWarnMsg *pMsg = new SAsyncLogReConnWarnMsg; pMsg->strReConnIp = strReConnIp; PutQ(pMsg); }
void CHpsAsyncLogThread::OnReportSosStatus(const SSosStatusData &sosStatus) { SAsyncLogSosStatusMsg *pMsg = new SAsyncLogSosStatusMsg; pMsg->sSosStatus = sosStatus; PutQ(pMsg); }
void CHpsAsyncLogThread::OnReportNoHttpResNum(int nThreadIndex, unsigned int nCurrentNoResNum) { SAsyncLogReportNoHttpResNumMsg *pMsg = new SAsyncLogReportNoHttpResNumMsg; pMsg->nThreadIndex = nThreadIndex; pMsg->dwAvenueRequestNum = nCurrentNoResNum; PutQ(pMsg); }
void Auth(const CString& sUsername = "", const CString& sPassword = "") { if (m_bAuthed) return; if (!sUsername.empty()) SetUsername(sUsername); if (!sPassword.empty()) SetPassword(sPassword); if (m_sUsername.empty() || m_sPassword.empty()) { PutModule("You have to set a username and password to use this module! See 'help' for details."); return; } if (m_bUseChallenge) { PutModule("Auth: Requesting CHALLENGE..."); m_bRequestedChallenge = true; PutQ("CHALLENGE"); } else { PutModule("Auth: Sending AUTH request..."); PutQ("AUTH " + m_sUsername + " " + m_sPassword); } }
void ChallengeAuth(CString sChallenge) { if (m_bAuthed) return; CString sUsername = m_sUsername.AsLower() .Replace_n("[", "{") .Replace_n("]", "}") .Replace_n("\\", "|"); CString sPasswordHash = m_sPassword.Left(10).MD5(); CString sKey = CString(sUsername + ":" + sPasswordHash).MD5(); CString sResponse = HMAC_MD5(sKey, sChallenge); PutModule("Auth: Received challenge, sending CHALLENGEAUTH request..."); PutQ("CHALLENGEAUTH " + m_sUsername + " " + sResponse + " HMAC-MD5"); }
void CHpsAsyncLogThread::OnStop() { SAsyncLogStopMsg *pMsg = new SAsyncLogStopMsg; PutQ(pMsg); }
void WhoAmI() { m_bRequestedWhoami = true; PutQ("WHOAMI"); }