Changed return value from bool to EModRet on most hooks

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@306 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
prozacx
2005-05-15 08:27:27 +00:00
parent e8dee7aa5b
commit 44d38ec4c9
8 changed files with 239 additions and 303 deletions
+9 -6
View File
@@ -20,6 +20,9 @@
*
*
* $Log$
* Revision 1.13 2005/05/15 08:27:27 prozacx
* Changed return value from bool to EModRet on most hooks
*
* Revision 1.12 2005/05/08 06:42:01 prozacx
* Moved CUtils::ToString() into CString class
*
@@ -349,28 +352,28 @@ public:
m_sReason = "";
}
virtual bool OnPrivMsg(const CNick& Nick, CString& sMessage)
virtual EModRet OnPrivMsg(const CNick& Nick, CString& sMessage)
{
if ( m_bIsAway )
AddMessage( time( NULL ), Nick, sMessage );
return( false );
return( CONTINUE );
}
virtual bool OnUserNotice(const CString& sTarget, CString& sMessage)
virtual EModRet OnUserNotice(const CString& sTarget, CString& sMessage)
{
Ping();
if( m_bIsAway )
Back();
return( false );
return( CONTINUE );
}
virtual bool OnUserMsg(const CString& sTarget, CString& sMessage)
virtual EModRet OnUserMsg(const CString& sTarget, CString& sMessage)
{
Ping();
if( m_bIsAway )
Back();
return( false );
return( CONTINUE );
}
time_t GetTimeStamp() const { return( m_iLastSentData ); }
+4 -4
View File
@@ -13,14 +13,14 @@ public:
return "View all of the raw traffic.";
}
virtual bool OnRaw(CString& sLine) {
virtual EModRet OnRaw(CString& sLine) {
PutModule("IRC -> [" + sLine + "]");
return false;
return CONTINUE;
}
virtual bool OnUserRaw(CString& sLine) {
virtual EModRet OnUserRaw(CString& sLine) {
PutModule("YOU -> [" + sLine + "]");
return false;
return CONTINUE;
}
};
+31 -29
View File
@@ -74,14 +74,14 @@ public:
PutModule("* " + OpNick.GetNick() + " sets mode: " + sModes + " " + sArgs + " (" + Channel.GetName() + ")");
}
virtual bool OnRaw(CString& sLine) {
virtual EModRet OnRaw(CString& sLine) {
// PutModule("OnRaw() [" + sLine + "]");
return false;
return CONTINUE;
}
virtual bool OnUserRaw(CString& sLine) {
virtual EModRet OnUserRaw(CString& sLine) {
// PutModule("UserRaw() [" + sLine + "]");
return false;
return CONTINUE;
}
virtual void OnKick(const CNick& OpNick, const CString& sKickedNick, const CChan& Channel, const CString& sMessage) {
@@ -104,82 +104,84 @@ public:
PutModule("* " + OldNick.GetNick() + " is now known as " + sNewNick);
}
virtual bool OnUserCTCPReply(const CNick& Nick, CString& sMessage) {
virtual EModRet OnUserCTCPReply(const CNick& Nick, CString& sMessage) {
PutModule("[" + Nick.GetNick() + "] userctcpreply [" + sMessage + "]");
sMessage = "\037" + sMessage + "\037";
return false;
return CONTINUE;
}
virtual bool OnCTCPReply(const CNick& Nick, CString& sMessage) {
virtual EModRet OnCTCPReply(const CNick& Nick, CString& sMessage) {
PutModule("[" + Nick.GetNick() + "] ctcpreply [" + sMessage + "]");
return false;
return CONTINUE;
}
virtual bool OnUserCTCP(const CString& sTarget, CString& sMessage) {
virtual EModRet OnUserCTCP(const CString& sTarget, CString& sMessage) {
PutModule("[" + sTarget + "] userctcp [" + sMessage + "]");
return false;
return CONTINUE;
}
virtual bool OnPrivCTCP(const CNick& Nick, CString& sMessage) {
virtual EModRet OnPrivCTCP(const CNick& Nick, CString& sMessage) {
PutModule("[" + Nick.GetNick() + "] privctcp [" + sMessage + "]");
sMessage = "\002" + sMessage + "\002";
return false;
return CONTINUE;
}
virtual bool OnChanCTCP(const CNick& Nick, const CChan& Channel, CString& sMessage) {
virtual EModRet OnChanCTCP(const CNick& Nick, const CChan& Channel, CString& sMessage) {
PutModule("[" + Nick.GetNick() + "] chanctcp [" + sMessage + "] to [" + Channel.GetName() + "]");
sMessage = "\00311,5 " + sMessage + " \003";
return false;
return CONTINUE;
}
virtual bool OnUserNotice(const CString& sTarget, CString& sMessage) {
virtual EModRet OnUserNotice(const CString& sTarget, CString& sMessage) {
PutModule("[" + sTarget + "] usernotice [" + sMessage + "]");
sMessage = "\037" + sMessage + "\037";
return false;
return CONTINUE;
}
virtual bool OnPrivNotice(const CNick& Nick, CString& sMessage) {
virtual EModRet OnPrivNotice(const CNick& Nick, CString& sMessage) {
PutModule("[" + Nick.GetNick() + "] privnotice [" + sMessage + "]");
sMessage = "\002" + sMessage + "\002";
return false;
return CONTINUE;
}
virtual bool OnChanNotice(const CNick& Nick, const CChan& Channel, CString& sMessage) {
virtual EModRet OnChanNotice(const CNick& Nick, const CChan& Channel, CString& sMessage) {
PutModule("[" + Nick.GetNick() + "] channotice [" + sMessage + "] to [" + Channel.GetName() + "]");
sMessage = "\00311,5 " + sMessage + " \003";
return false;
return CONTINUE;
}
virtual bool OnUserMsg(const CString& sTarget, CString& sMessage) {
virtual EModRet OnUserMsg(const CString& sTarget, CString& sMessage) {
PutModule("[" + sTarget + "] usermsg [" + sMessage + "]");
sMessage = "\0034" + sMessage + "\003";
return false;
return CONTINUE;
}
virtual bool OnPrivMsg(const CNick& Nick, CString& sMessage) {
virtual EModRet OnPrivMsg(const CNick& Nick, CString& sMessage) {
PutModule("[" + Nick.GetNick() + "] privmsg [" + sMessage + "]");
sMessage = "\002" + sMessage + "\002";
return false;
return CONTINUE;
}
virtual bool OnChanMsg(const CNick& Nick, const CChan& Channel, CString& sMessage) {
virtual EModRet OnChanMsg(const CNick& Nick, const CChan& Channel, CString& sMessage) {
if (sMessage == "!ping") {
PutIRC("PRIVMSG " + Channel.GetName() + " :PONG?");
}
sMessage = "x " + sMessage + " x";
return false;
PutModule(sMessage);
return HALTCORE;
}
virtual void OnModCommand(const CString& sCommand) {
@@ -188,13 +190,13 @@ public:
}
}
virtual bool OnStatusCommand(const CString& sCommand) {
virtual EModRet OnStatusCommand(const CString& sCommand) {
if (strcasecmp(sCommand.c_str(), "SAMPLE") == 0) {
PutModule("Hi, I'm your friendly sample module.");
return true;
return HALT;
}
return false;
return CONTINUE;
}
};
+14 -11
View File
@@ -16,6 +16,9 @@
* Author: imaginos <imaginos@imaginos.net>
*
* $Log$
* Revision 1.13 2005/05/15 08:27:27 prozacx
* Changed return value from bool to EModRet on most hooks
*
* Revision 1.12 2005/05/08 06:42:02 prozacx
* Moved CUtils::ToString() into CString class
*
@@ -213,22 +216,22 @@ public:
return ( "Secure cross platform (:P) chat system" );
}
virtual bool OnUserRaw( CString & sLine )
virtual EModRet OnUserRaw( CString & sLine )
{
if ( strncasecmp( sLine.c_str(), "schat ", 6 ) == 0 )
{
OnModCommand( "chat " + sLine.substr( 6, CString::npos ) );
return( true );
return( HALT );
} else if ( strcasecmp( sLine.c_str(), "schat" ) == 0 )
{
PutModule( "SChat User Area ..." );
OnModCommand( "help" );
return( true );
return( HALT );
}
return( false );
return( CONTINUE );
}
virtual void OnModCommand( const CString& sCommand )
{
@@ -423,7 +426,7 @@ public:
PutModule( "Unknown command [" + sCom + "] [" + sArgs + "]" );
}
virtual bool OnPrivCTCP( const CNick& Nick, CString& sMessage )
virtual EModRet OnPrivCTCP( const CNick& Nick, CString& sMessage )
{
if ( strncasecmp( sMessage.c_str(), "DCC SCHAT ", 10 ) == 0 )
{
@@ -441,11 +444,11 @@ public:
CRemMarkerJob *p = new CRemMarkerJob( this, 60, 1, "Remove (s)" + Nick.GetNick(), "Removes this nicks entry for waiting DCC." );
p->SetNick( "(s)" + Nick.GetNick() );
AddTimer( p );
return( true );
return( HALT );
}
}
return( false );
return( CONTINUE );
}
void AcceptSDCC( const CString & sNick, u_long iIP, u_short iPort )
@@ -457,7 +460,7 @@ public:
m_pManager->Connect( CUtils::GetIP( iIP ), iPort, sSockName, 60, true, m_pUser->GetLocalIP(), p );
RemTimer( "Remove " + sNick ); // delete any associated timer to this nick
}
virtual bool OnUserMsg( const CString& sTarget, CString& sMessage )
virtual EModRet OnUserMsg( const CString& sTarget, CString& sMessage )
{
if ( strncmp( sTarget.c_str(), "(s)", 3 ) == 0 )
{
@@ -474,15 +477,15 @@ public:
AcceptSDCC( sTarget, it->second.first, it->second.second );
m_siiWaitingChats.erase( it );
return( true );
return( HALT );
}
PutModule( "No such SCHAT to [" + sTarget + "]" );
} else
p->Write( sMessage + "\n" );
return( true );
return( HALT );
}
return( false );
return( CONTINUE );
}
virtual void RemoveMarker( const CString & sNick )
+6 -6
View File
@@ -154,25 +154,25 @@ public:
}
}
virtual bool OnStatusCommand(const CString& sCommand) {
virtual EModRet OnStatusCommand(const CString& sCommand) {
if (strcasecmp(sCommand.c_str(), "SHELL") == 0) {
PutShell("-- ZNC Shell Service --");
return true;
return HALT;
}
return false;
return CONTINUE;
}
virtual bool OnDCCUserSend(const CNick& RemoteNick, unsigned long uLongIP, unsigned short uPort, const CString& sFile, unsigned long uFileSize) {
virtual EModRet OnDCCUserSend(const CNick& RemoteNick, unsigned long uLongIP, unsigned short uPort, const CString& sFile, unsigned long uFileSize) {
if (strcasecmp(RemoteNick.GetNick().c_str(), CString(GetModNick()).c_str()) == 0) {
CString sLocalFile = CUtils::ChangeDir(m_sPath, sFile, m_pUser->GetHomePath());
m_pUser->GetFile(m_pUser->GetCurNick(), CUtils::GetIP(uLongIP), uPort, sLocalFile, uFileSize, GetModName());
return true;
return HALT;
}
return false;
return CONTINUE;
}
void PutShell(const CString& sLine) {
+17 -17
View File
@@ -177,13 +177,13 @@ public:
m_Buffer.Clear();
}
virtual bool OnUserRaw(CString& sLine) {
virtual EModRet OnUserRaw(CString& sLine) {
if (strncasecmp(sLine.c_str(), "WATCH ", 6) == 0) {
Watch(sLine.Token(1), sLine.Token(2), sLine.Token(3, true), true);
return true;
return HALT;
}
return false;
return CONTINUE;
}
virtual void OnKick(const CNick& OpNick, const CString& sKickedNick, const CChan& Channel, const CString& sMessage) {
@@ -206,39 +206,39 @@ public:
Process(OldNick, "* " + OldNick.GetNick() + " is now known as " + sNewNick, "");
}
virtual bool OnCTCPReply(const CNick& Nick, CString& sMessage) {
virtual EModRet OnCTCPReply(const CNick& Nick, CString& sMessage) {
Process(Nick, "* CTCP: " + Nick.GetNick() + " reply [" + sMessage + "]", "priv");
return false;
return CONTINUE;
}
virtual bool OnPrivCTCP(const CNick& Nick, CString& sMessage) {
virtual EModRet OnPrivCTCP(const CNick& Nick, CString& sMessage) {
Process(Nick, "* CTCP: " + Nick.GetNick() + " [" + sMessage + "]", "priv");
return false;
return CONTINUE;
}
virtual bool OnChanCTCP(const CNick& Nick, const CChan& Channel, CString& sMessage) {
virtual EModRet OnChanCTCP(const CNick& Nick, const CChan& Channel, CString& sMessage) {
Process(Nick, "* CTCP: " + Nick.GetNick() + " [" + sMessage + "] to [" + Channel.GetName() + "]", Channel.GetName());
return false;
return CONTINUE;
}
virtual bool OnPrivNotice(const CNick& Nick, CString& sMessage) {
virtual EModRet OnPrivNotice(const CNick& Nick, CString& sMessage) {
Process(Nick, "-" + Nick.GetNick() + "- " + sMessage, "priv");
return false;
return CONTINUE;
}
virtual bool OnChanNotice(const CNick& Nick, const CChan& Channel, CString& sMessage) {
virtual EModRet OnChanNotice(const CNick& Nick, const CChan& Channel, CString& sMessage) {
Process(Nick, "-" + Nick.GetNick() + ":" + Channel.GetName() + "- " + sMessage, Channel.GetName());
return false;
return CONTINUE;
}
virtual bool OnPrivMsg(const CNick& Nick, CString& sMessage) {
virtual EModRet OnPrivMsg(const CNick& Nick, CString& sMessage) {
Process(Nick, "<" + Nick.GetNick() + "> " + sMessage, "priv");
return false;
return CONTINUE;
}
virtual bool OnChanMsg(const CNick& Nick, const CChan& Channel, CString& sMessage) {
virtual EModRet OnChanMsg(const CNick& Nick, const CChan& Channel, CString& sMessage) {
Process(Nick, "<" + Nick.GetNick() + ":" + Channel.GetName() + "> " + sMessage, Channel.GetName());
return false;
return CONTINUE;
}
virtual void OnModCommand(const CString& sCommand) {