Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: znc/znc
base: 71636d2
...
head fork: znc/znc
compare: 7a754f4
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
Commits on Oct 20, 2011
@kylef kylef antiidle: Don't SIGABRT when receiving a line with less than 2 words
This was introduced in 232d261 which
tries to split a line by spaces and then tries splitted[1] and
splitted[2] which will cause a SIGABRT if the line isn't actually that
long.

This also uses the 4th argument to the 301 line to determine if this
message is because we sent a message to ourselfs. Previously the 3rd
option was used, which is always our own nick. This was resulting in any
301 line being halted.
8cce595
@kylef kylef Pass the nick who send an invite with the OnInvite hook e11d338
Commits on Oct 21, 2011
@kylef kylef Make the OnInvite hook return EModRet so we can ignore invites b8c2da9
@kylef kylef Its .co.uk not .co.u in the authors list 7a754f4
View
2  AUTHORS
@@ -7,7 +7,7 @@ SilverLeo
kroimon <znc@kroimon.de>
flakes
Alexey "DarthGandalf" Sokolov (http://asokolov.co.cc/)
-Kyle Fuller <inbox@kylefuller.co.u>
+Kyle Fuller <inbox@kylefuller.co.uk>
These people, in no particular order, have helped develop ZNC, for example by
sending in patches, writing new modules or finding significant bugs:
View
6 include/znc/Modules.h
@@ -553,9 +553,11 @@ class CModule {
*/
virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage);
/** Called when user is invited into a channel
+ * @param Nick The nick who invited you.
* @param sChan The channel the user got invited into
+ * @return See CModule::EModRet.
*/
- virtual void OnInvite(const CString& sChan);
+ virtual EModRet OnInvite(const CNick& Nick, const CString& sChan);
/** Called before a channel buffer is played back to a client.
* @param Chan The channel which will be played back.
@@ -1050,7 +1052,7 @@ class CModules : public vector<CModule*> {
bool OnKick(const CNick& Nick, const CString& sOpNick, CChan& Channel, const CString& sMessage);
bool OnJoin(const CNick& Nick, CChan& Channel);
bool OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage);
- bool OnInvite(const CString& sChan);
+ bool OnInvite(const CNick& Nick, const CString& sChan);
bool OnChanBufferStarting(CChan& Chan, CClient& Client);
bool OnChanBufferEnding(CChan& Chan, CClient& Client);
View
13 modules/extra/antiidle.cpp
@@ -72,12 +72,15 @@ class CAntiIdle : public CModule
return CONTINUE;
}
- virtual EModRet OnRaw(CString &sLine)
- {
- VCString splitted;
- sLine.Split(" ",splitted);
- if(splitted[1] == "301" && splitted[2].TrimPrefix_n(":").Equals(m_pNetwork->GetIRCNick().GetNick()))
+ virtual EModRet OnRaw(CString &sLine) {
+ /* If we send a message to ourselfs while we are away, this
+ * will result in the server sending a 301 which we shouldn't
+ * forward to the client */
+
+ if (sLine.Token(1).Equals("301") && sLine.Token(3).Equals(m_pNetwork->GetIRCNick().GetNick())) {
return HALT;
+ }
+
return CONTINUE;
}
View
10 modules/sample.cpp
@@ -119,6 +119,16 @@ class CSampleMod : public CModule {
PutModule("* Parts: " + Nick.GetNick() + " (" + Nick.GetIdent() + "!" + Nick.GetHost() + ")");
}
+ virtual EModRet OnInvite(const CNick& Nick, const CString& sChan) {
+ if (sChan.Equals("#test")) {
+ PutModule(Nick.GetNick() + " invited us to " + sChan + ", ignoring invites to " + sChan);
+ return HALT;
+ }
+
+ PutModule(Nick.GetNick() + " invited us to " + sChan);
+ return CONTINUE;
+ }
+
virtual void OnNick(const CNick& OldNick, const CString& sNewNick, const vector<CChan*>& vChans) {
PutModule("* " + OldNick.GetNick() + " is now known as " + sNewNick);
}
View
2  src/IRCSock.cpp
@@ -712,7 +712,7 @@ void CIRCSock::ReadLine(const CString& sData) {
// Don't forward any CAP stuff to the client
return;
} else if (sCmd.Equals("INVITE")) {
- NETWORKMODULECALL(OnInvite(sLine.Token(3).TrimPrefix_n(":")), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING);
+ NETWORKMODULECALL(OnInvite(Nick, sLine.Token(3).TrimPrefix_n(":")), m_pNetwork->GetUser(), m_pNetwork, NULL, return);
}
}
View
4 src/Modules.cpp
@@ -513,7 +513,7 @@ void CModule::OnNick(const CNick& Nick, const CString& sNewNick, const vector<CC
void CModule::OnKick(const CNick& Nick, const CString& sKickedNick, CChan& Channel, const CString& sMessage) {}
void CModule::OnJoin(const CNick& Nick, CChan& Channel) {}
void CModule::OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) {}
-void CModule::OnInvite(const CString& sChan) {}
+CModule::EModRet CModule::OnInvite(const CNick& Nick, const CString& sChan) { return CONTINUE; }
CModule::EModRet CModule::OnChanBufferStarting(CChan& Chan, CClient& Client) { return CONTINUE; }
CModule::EModRet CModule::OnChanBufferEnding(CChan& Chan, CClient& Client) { return CONTINUE; }
@@ -686,7 +686,7 @@ bool CModules::OnNick(const CNick& Nick, const CString& sNewNick, const vector<C
bool CModules::OnKick(const CNick& Nick, const CString& sKickedNick, CChan& Channel, const CString& sMessage) { MODUNLOADCHK(OnKick(Nick, sKickedNick, Channel, sMessage)); return false; }
bool CModules::OnJoin(const CNick& Nick, CChan& Channel) { MODUNLOADCHK(OnJoin(Nick, Channel)); return false; }
bool CModules::OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) { MODUNLOADCHK(OnPart(Nick, Channel, sMessage)); return false; }
-bool CModules::OnInvite(const CString& sChan) { MODUNLOADCHK(OnInvite(sChan)); return false; }
+bool CModules::OnInvite(const CNick& Nick, const CString& sChan) { MODHALTCHK(OnInvite(Nick, sChan)); }
bool CModules::OnChanBufferStarting(CChan& Chan, CClient& Client) { MODHALTCHK(OnChanBufferStarting(Chan, Client)); }
bool CModules::OnChanBufferEnding(CChan& Chan, CClient& Client) { MODHALTCHK(OnChanBufferEnding(Chan, Client)); }
bool CModules::OnChanBufferPlayLine(CChan& Chan, CClient& Client, CString& sLine) { MODHALTCHK(OnChanBufferPlayLine(Chan, Client, sLine)); }

No commit comments for this range

Something went wrong with that request. Please try again.