Skip to content

Commit

Permalink
Merge pull request #71 from schoentoon/master
Browse files Browse the repository at this point in the history
A few new nickserv commands, little annoyance fix and a new hook
  • Loading branch information
psychon committed Sep 25, 2011
2 parents 2dcb3ef + 23acbe4 commit 0acf0de
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 3 deletions.
2 changes: 2 additions & 0 deletions IRCSock.cpp
Expand Up @@ -711,6 +711,8 @@ 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);
}
}

Expand Down
2 changes: 2 additions & 0 deletions Modules.cpp
Expand Up @@ -513,6 +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::OnChanBufferStarting(CChan& Chan, CClient& Client) { return CONTINUE; }
CModule::EModRet CModule::OnChanBufferEnding(CChan& Chan, CClient& Client) { return CONTINUE; }
Expand Down Expand Up @@ -685,6 +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::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)); }
Expand Down
5 changes: 5 additions & 0 deletions Modules.h
Expand Up @@ -552,6 +552,10 @@ class CModule {
* @param sMessage The part message.
*/
virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage);
/** Called when user is invited into a channel
* @param sChan The channel the user got invited into
*/
virtual void OnInvite(const CString& sChan);

/** Called before a channel buffer is played back to a client.
* @param Chan The channel which will be played back.
Expand Down Expand Up @@ -1046,6 +1050,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 OnChanBufferStarting(CChan& Chan, CClient& Client);
bool OnChanBufferEnding(CChan& Chan, CClient& Client);
Expand Down
9 changes: 9 additions & 0 deletions modules/extra/antiidle.cpp
Expand Up @@ -72,6 +72,15 @@ class CAntiIdle : public CModule
return CONTINUE;
}

virtual EModRet OnRaw(CString &sLine)
{
VCString splitted;
sLine.Split(" ",splitted);
if(splitted[1] == "301" && splitted[2].Equals(m_pNetwork->GetIRCNick().GetNick()))
return HALT;
return CONTINUE;
}

private:
void SetInterval(int i)
{
Expand Down
24 changes: 21 additions & 3 deletions modules/nickserv.cpp
Expand Up @@ -43,9 +43,27 @@ class CNickServ : public CModule
} else if (sCmdName == "clear") {
m_sPass = "";
DelNV("Password");
} else {
PutModule("Commands: set <password>, clear");
}
} else if (sCmdName == "ghost") {
if(sCommand.Token(1).empty()) {
PutModule("Syntax: ghost <nickname>");
} else {
PutIRC("PRIVMSG NickServ :GHOST " + sCommand.Token(1) + " " + m_sPass);
}
} else if (sCmdName == "group") {
CString sConfNick = m_pUser->GetNick();
PutIRC("PRIVMSG NickServ :GROUP " + sConfNick + " " + m_sPass);
} else if (sCmdName == "recover") {
if(sCommand.Token(1).empty())
PutModule("Syntax: recover <nickname>");
else
PutIRC("PRIVMSG NickServ :RECOVER " + sCommand.Token(1) + " " + m_sPass);
} else if (sCmdName == "release") {
if(sCommand.Token(1).empty())
PutModule("Syntax: release <nickname>");
else
PutIRC("PRIVMSG NickServ :RELEASE " + sCommand.Token(1) + " " + m_sPass);
} else
PutModule("Commands: set <password>, clear, ghost <nickname>, group, release <nickname>, recover <nickname>");
}

void HandleMessage(CNick& Nick, const CString& sMessage)
Expand Down

0 comments on commit 0acf0de

Please sign in to comment.