Example #1
0
	virtual EModRet OnUserMsg(CString& sTarget, CString& sMessage) {
		sTarget.TrimLeft("\244");

		if (sMessage.Left(2) == "``") {
			sMessage.LeftChomp(2);
			return CONTINUE;
		}

		MCString::iterator it = FindNV(sTarget.AsLower());

		if (it != EndNV()) {
			CChan* pChan = m_pUser->FindChan(sTarget);
			if (pChan) {
				if (pChan->KeepBuffer())
					pChan->AddBuffer(":\244" + m_pUser->GetIRCNick().GetNickMask() + " PRIVMSG " + sTarget + " :" + sMessage);
				m_pUser->PutUser(":\244" + m_pUser->GetIRCNick().GetNickMask() + " PRIVMSG " + sTarget + " :" + sMessage, NULL, m_pClient);
			}

			CString sMsg = MakeIvec() + sMessage;
			sMsg.Encrypt(it->second);
			sMsg.Base64Encode();
			sMsg = "+OK *" + sMsg;

			PutIRC("PRIVMSG " + sTarget + " :" + sMsg);
			return HALTCORE;
		}

		return CONTINUE;
	}
Example #2
0
 void Authenticate(const CString& sLine) {
     if (m_Mechanisms.GetCurrent().Equals("PLAIN") && sLine.Equals("+")) {
         CString sAuthLine = GetNV("username") + '\0' + GetNV("username") +
                             '\0' + GetNV("password");
         sAuthLine.Base64Encode();
         PutIRC("AUTHENTICATE " + sAuthLine);
     } else {
         /* Send blank authenticate for other mechanisms (like EXTERNAL). */
         PutIRC("AUTHENTICATE +");
     }
 }