mirror of
https://github.com/znc/znc.git
synced 2026-07-06 01:41:12 +02:00
Call modules for /MODE done by not-in-channel nicks
When ChanServ ops someone in a channel without joining first, znc didn't call modules for this event, because it couldn't figure out a CNick* instance to use Instead, the module hooks are now executed with a temporary CNick instance which is created by CIRCSock anyway. Big thanks to Robby for reporting this and helping me test it! Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
@@ -220,12 +220,20 @@ void CChan::OnWho(const CString& sNick, const CString& sIdent, const CString& sH
|
||||
}
|
||||
}
|
||||
|
||||
void CChan::ModeChange(const CString& sModes, const CString& sOpNick) {
|
||||
void CChan::ModeChange(const CString& sModes, const CNick* pOpNick) {
|
||||
CString sModeArg = sModes.Token(0);
|
||||
CString sArgs = sModes.Token(1, true);
|
||||
bool bAdd = true;
|
||||
|
||||
CNick* pOpNick = FindNick(sOpNick);
|
||||
/* Try to find a CNick* from this channel so that pOpNick->HasPerm()
|
||||
* works as expected. */
|
||||
if (pOpNick) {
|
||||
CNick* OpNick = FindNick(pOpNick->GetNick());
|
||||
/* If nothing was found, use the original pOpNick, else use the
|
||||
* CNick* from FindNick() */
|
||||
if (OpNick)
|
||||
pOpNick = OpNick;
|
||||
}
|
||||
|
||||
if (pOpNick) {
|
||||
MODULECALL(OnRawMode(*pOpNick, *this, sModeArg, sArgs), m_pUser, NULL, NOTHING);
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
|
||||
// Modes
|
||||
void SetModes(const CString& s);
|
||||
void ModeChange(const CString& sModes, const CString& sNick = "");
|
||||
void ModeChange(const CString& sModes, const CNick* OpNick = NULL);
|
||||
bool AddMode(unsigned char uMode, const CString& sArg);
|
||||
bool RemMode(unsigned char uMode);
|
||||
CString GetModeString() const;
|
||||
|
||||
+1
-1
@@ -500,7 +500,7 @@ void CIRCSock::ReadLine(const CString& sData) {
|
||||
|
||||
CChan* pChan = m_pUser->FindChan(sTarget);
|
||||
if (pChan) {
|
||||
pChan->ModeChange(sModes, Nick.GetNick());
|
||||
pChan->ModeChange(sModes, &Nick);
|
||||
|
||||
if (pChan->IsDetached()) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user