예제 #1
0
파일: ignore.cpp 프로젝트: Xe/dotfiles
	CIgnore(const CString& sHostMask, const CString& sType) {
		CNick Nick;
		Nick.Parse(sHostMask);

		m_sHostMask = ((Nick.GetNick().empty()) ? "*" : Nick.GetNick());

		m_sHostMask += "!";
		m_sHostMask += (Nick.GetIdent().empty()) ? "*" : Nick.GetIdent();

		m_sHostMask += "@";
		m_sHostMask += (Nick.GetHost().empty()) ? "*" : Nick.GetHost();

		m_sType = sType;
	}
예제 #2
0
파일: q.cpp 프로젝트: Adam-/znc
 EModRet OnInvite(const CNick& Nick, const CString& sChan) override {
     if (!Nick.NickEquals("Q") ||
         !Nick.GetHost().Equals("CServe.quakenet.org"))
         return CONTINUE;
     if (m_bJoinOnInvite) GetNetwork()->AddChan(sChan, false);
     return CONTINUE;
 }
예제 #3
0
파일: Nick.cpp 프로젝트: jimloco/znc
void CNick::Clone(const CNick& SourceNick) {
	SetNick(SourceNick.GetNick());
	SetIdent(SourceNick.GetIdent());
	SetHost(SourceNick.GetHost());

	m_sChanPerms = SourceNick.m_sChanPerms;
	m_pNetwork = SourceNick.m_pNetwork;
}
예제 #4
0
파일: log.cpp 프로젝트: Adam-/znc
void CLogMod::OnQuit(const CNick& Nick, const CString& sMessage,
                     const vector<CChan*>& vChans) {
    if (!HasNV("quits") || GetNV("quits").ToBool()) {
        for (CChan* pChan : vChans)
            PutLog("*** Quits: " + Nick.GetNick() + " (" + Nick.GetIdent() +
                       "@" + Nick.GetHost() + ") (" + sMessage + ")",
                   *pChan);
    }
}
예제 #5
0
파일: IRCSock.cpp 프로젝트: fnordcordia/znc
// #124: OnChanMsg(): nick doesn't have perms
static void FixupChanNick(CNick& Nick, CChan* pChan) {
    // A channel nick has up-to-date channel perms, but might be
    // lacking (usernames-in-host) the associated ident & host.
    // An incoming message, on the other hand, has normally a full
    // nick!ident@host prefix. Sync the two so that channel nicks
    // get the potentially missing piece of info and module hooks
    // get the perms.
    CNick* pChanNick = pChan->FindNick(Nick.GetNick());
    if (pChanNick) {
        if (!Nick.GetIdent().empty()) {
            pChanNick->SetIdent(Nick.GetIdent());
        }
        if (!Nick.GetHost().empty()) {
            pChanNick->SetHost(Nick.GetHost());
        }
        Nick.Clone(*pChanNick);
    }
}
예제 #6
0
 void HandleMessage(CNick& Nick, const CString& sMessage)
 {
     if (!m_sAuth.empty()
             && Nick.GetNick().CaseCmp("Q") == 0
             && Nick.GetHost().CaseCmp("CServe.quakenet.org")  == 0
             && sMessage.find("AUTH") != CString::npos
             && sMessage.find("authenticate") != CString::npos) {
         PutIRC("PRIVMSG [email protected] :auth " + m_sAuth);
     }
 }
예제 #7
0
파일: modtcl.cpp 프로젝트: FooBarWidget/znc
	virtual void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage) {
		CString sOpNick = TclEscape(CString(OpNick.GetNick()));
		CString sNick = TclEscape(sKickedNick);
		CString sOpHost = TclEscape(CString(OpNick.GetIdent() + "@" + OpNick.GetHost()));

		CString sCommand = "Binds::ProcessKick {" + sOpNick + "} {" + sOpHost + "} - {" + Channel.GetName() + "} {" + sNick + "} {" + sMessage + "}";
		i = Tcl_Eval(interp, sCommand.c_str());
		if (i != TCL_OK) {
			PutModule(Tcl_GetStringResult(interp));
		}
	}
예제 #8
0
파일: modtcl.cpp 프로젝트: FooBarWidget/znc
	virtual EModRet OnPrivMsg(CNick& Nick, CString& sMessage) {
		CString sMes = TclEscape(sMessage);
		CString sNick = TclEscape(CString(Nick.GetNick()));
		CString sHost = TclEscape(CString(Nick.GetIdent() + "@" + Nick.GetHost()));

		CString sCommand = "Binds::ProcessMsgm {" + sNick + "} {" + sHost + "} - {" + sMes + "}";
		i = Tcl_Eval(interp, sCommand.c_str());
		if (i != TCL_OK) {
			PutModule(Tcl_GetStringResult(interp));
		}
		return CONTINUE;
	}
예제 #9
0
파일: modtcl.cpp 프로젝트: EpicnessTwo/znc
	EModRet OnChanMsg(CNick& Nick, CChan& Channel, CString& sMessage) override {
		CString sMes = TclEscape(sMessage);
		CString sNick = TclEscape(CString(Nick.GetNick()));
		CString sHost = TclEscape(CString(Nick.GetIdent() + "@" + Nick.GetHost()));
		CString sChannel = TclEscape(CString(Channel.GetName()));

		CString sCommand = "Binds::ProcessPubm {" + sNick + "} {" + sHost + "} - {" + sChannel + "} {" + sMes + "}";
		i = Tcl_Eval(interp, sCommand.c_str());
		if (i != TCL_OK) {
			PutModule(Tcl_GetStringResult(interp));
		}
		return CONTINUE;
	}
예제 #10
0
파일: modtcl.cpp 프로젝트: FooBarWidget/znc
	virtual void OnNick(const CNick& OldNick, const CString& sNewNick, const vector<CChan*>& vChans) {
		CString sOldNick = TclEscape(CString(OldNick.GetNick()));
		CString sNewNickTmp = TclEscape(sNewNick);
		CString sHost = TclEscape(CString(OldNick.GetIdent() + "@" + OldNick.GetHost()));

		CString sCommand;
		// Nick change is triggered for each common chan so that binds can be chan specific
		unsigned int nLength = vChans.size();
		for (unsigned int n = 0; n < nLength; n++) {
			sCommand = "Binds::ProcessNick {" + sOldNick + "} {" + sHost + "} - {" + vChans[n]->GetName() + "} {" + sNewNickTmp + "}";
			i = Tcl_Eval(interp, sCommand.c_str());
			if (i != TCL_OK) {
				PutModule(Tcl_GetStringResult(interp));
			}
		}
	}
예제 #11
0
파일: log.cpp 프로젝트: GDXN/znc
void CLogMod::OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage)
{
    PutLog("*** Parts: " + Nick.GetNick() + " (" + Nick.GetIdent() + "@" + Nick.GetHost() + ") (" + sMessage + ")", Channel);
}
예제 #12
0
파일: log.cpp 프로젝트: GDXN/znc
void CLogMod::OnJoin(const CNick& Nick, CChan& Channel)
{
    PutLog("*** Joins: " + Nick.GetNick() + " (" + Nick.GetIdent() + "@" + Nick.GetHost() + ")", Channel);
}
예제 #13
0
파일: log.cpp 프로젝트: GDXN/znc
void CLogMod::OnQuit(const CNick& Nick, const CString& sMessage, const vector<CChan*>& vChans)
{
    for (std::vector<CChan*>::const_iterator pChan = vChans.begin(); pChan != vChans.end(); ++pChan)
        PutLog("*** Quits: " + Nick.GetNick() + " (" + Nick.GetIdent() + "@" + Nick.GetHost() + ") (" + sMessage + ")", **pChan);
}
예제 #14
0
파일: q.cpp 프로젝트: Adam-/znc
    EModRet HandleMessage(const CNick& Nick, CString sMessage) {
        if (!Nick.NickEquals("Q") ||
            !Nick.GetHost().Equals("CServe.quakenet.org"))
            return CONTINUE;

        sMessage.Trim();

#if Q_DEBUG_COMMUNICATION
        PutModule("[ZNC <-- Q] " + sMessage);
#endif

        // WHOAMI
        if (sMessage.find("WHOAMI is only available to authed users") !=
            CString::npos) {
            m_bAuthed = false;
            Auth();
            m_bCatchResponse = m_bRequestedWhoami;
        } else if (sMessage.find("Information for user") != CString::npos) {
            m_bAuthed = true;
            m_msChanModes.clear();
            m_bCatchResponse = m_bRequestedWhoami;
            m_bRequestedWhoami = true;
        } else if (m_bRequestedWhoami && sMessage.WildCmp("#*")) {
            CString sChannel = sMessage.Token(0);
            CString sFlags = sMessage.Token(1, true).Trim_n().TrimLeft_n("+");
            m_msChanModes[sChannel] = sFlags;
        } else if (m_bRequestedWhoami && m_bCatchResponse &&
                   (sMessage.Equals("End of list.") ||
                    sMessage.Equals(
                        "account, or HELLO to create an account."))) {
            m_bRequestedWhoami = m_bCatchResponse = false;
            return HALT;
        }

        // AUTH
        else if (sMessage.Equals("Username or password incorrect.")) {
            m_bAuthed = false;
            PutModule("Auth failed: " + sMessage);
            return HALT;
        } else if (sMessage.WildCmp("You are now logged in as *.")) {
            m_bAuthed = true;
            PutModule("Auth successful: " + sMessage);
            WhoAmI();
            return HALT;
        } else if (m_bRequestedChallenge &&
                   sMessage.Token(0).Equals("CHALLENGE")) {
            m_bRequestedChallenge = false;
            if (sMessage.find("not available once you have authed") !=
                CString::npos) {
                m_bAuthed = true;
            } else {
                if (sMessage.find("HMAC-SHA-256") != CString::npos) {
                    ChallengeAuth(sMessage.Token(1));
                } else {
                    PutModule(
                        "Auth failed: Q does not support HMAC-SHA-256 for "
                        "CHALLENGEAUTH, falling back to standard AUTH.");
                    SetUseChallenge(false);
                    Auth();
                }
            }
            return HALT;
        }

        // prevent buffering of Q's responses
        return !m_bCatchResponse && GetUser()->IsUserAttached() ? CONTINUE
                                                                : HALT;
    }
예제 #15
0
파일: sample.cpp 프로젝트: FooBarWidget/znc
	virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) {
		PutModule("* Parts: " + Nick.GetNick() + " (" + Nick.GetIdent() + "!" + Nick.GetHost() + ")");
	}
예제 #16
0
파일: sample.cpp 프로젝트: FooBarWidget/znc
	virtual void OnJoin(const CNick& Nick, CChan& Channel) {
		PutModule("* Joins: " + Nick.GetNick() + " (" + Nick.GetIdent() + "!" + Nick.GetHost() + ")");
	}
예제 #17
0
파일: sample.cpp 프로젝트: FooBarWidget/znc
	virtual void OnQuit(const CNick& Nick, const CString& sMessage, const vector<CChan*>& vChans) {
		PutModule("* Quits: " + Nick.GetNick() + " (" + Nick.GetIdent() + "!" + Nick.GetHost() + ") (" + sMessage + ")");
	}
예제 #18
0
파일: log.cpp 프로젝트: Adam-/znc
void CLogMod::OnJoin(const CNick& Nick, CChan& Channel) {
    if (!HasNV("joins") || GetNV("joins").ToBool())
        PutLog("*** Joins: " + Nick.GetNick() + " (" + Nick.GetIdent() + "@" +
                   Nick.GetHost() + ")",
               Channel);
}