示例#1
0
文件: q.cpp 项目: ZachBeta/znc
	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;
			}
		}
	}
示例#2
0
void CHpsAsyncLogThread::OnReConnWarn(const string &strReConnIp)
{
	SS_XLOG(XLOG_DEBUG, "CHpsAsyncLogThread::%s\n", __FUNCTION__);
	SAsyncLogReConnWarnMsg *pMsg = new SAsyncLogReConnWarnMsg;
	pMsg->strReConnIp = strReConnIp;
	PutQ(pMsg);
}
示例#3
0
void CHpsAsyncLogThread::OnReportSosStatus(const SSosStatusData &sosStatus)
{
	SAsyncLogSosStatusMsg *pMsg = new SAsyncLogSosStatusMsg;
	pMsg->sSosStatus = sosStatus;
	
	PutQ(pMsg);
}
示例#4
0
void CHpsAsyncLogThread::OnReportNoHttpResNum(int nThreadIndex, unsigned int nCurrentNoResNum)
{
	SAsyncLogReportNoHttpResNumMsg *pMsg = new SAsyncLogReportNoHttpResNumMsg;
	pMsg->nThreadIndex = nThreadIndex;
	pMsg->dwAvenueRequestNum = nCurrentNoResNum;
	
	PutQ(pMsg);
}
示例#5
0
文件: q.cpp 项目: ZachBeta/znc
	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);
		}
	}
示例#6
0
文件: q.cpp 项目: ZachBeta/znc
	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");
	}
示例#7
0
void CHpsAsyncLogThread::OnStop()
{
	SAsyncLogStopMsg *pMsg = new SAsyncLogStopMsg;
	PutQ(pMsg);
}
示例#8
0
文件: q.cpp 项目: ZachBeta/znc
	void WhoAmI() {
		m_bRequestedWhoami = true;
		PutQ("WHOAMI");
	}