Merge pull request #71 from schoentoon/master

A few new nickserv commands, little annoyance fix and a new hook
This commit is contained in:
Uli Schlachter
2011-09-25 01:20:14 -07:00
5 changed files with 39 additions and 3 deletions

View File

@@ -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);
}
}

View File

@@ -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; }
@@ -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)); }

View File

@@ -552,6 +552,10 @@ public:
* @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.
@@ -1046,6 +1050,7 @@ public:
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);

View File

@@ -72,6 +72,15 @@ public:
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)
{

View File

@@ -43,9 +43,27 @@ public:
} 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)