From 051e1f81d80bbdb0c7d7a62c037d8dbf12bc0926 Mon Sep 17 00:00:00 2001 From: kroimon Date: Mon, 29 Sep 2008 13:33:15 +0000 Subject: [PATCH] Enhanced the /znc command to optionally accept commands. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1228 726aef4b-f618-498e-8847-2d620e286838 --- Client.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Client.cpp b/Client.cpp index fafdda8d..cb945b88 100644 --- a/Client.cpp +++ b/Client.cpp @@ -145,7 +145,29 @@ void CClient::ReadLine(const CString& sData) { } if (sCommand.CaseCmp("ZNC") == 0) { - PutStatus("Hello. How may I help you?"); + CString sTarget = sLine.Token(1); + CString sModCommand; + + if (sTarget.TrimPrefix(m_pUser->GetStatusPrefix())) { + sModCommand = sLine.Token(2, true); + } else { + sTarget = "status"; + sModCommand = sLine.Token(1, true); + } + + if (sTarget.CaseCmp("status") == 0) { + if (sModCommand.empty()) + PutStatus("Hello. How may I help you?"); + else + UserCommand(sModCommand); + } else { +#ifdef _MODULES + if (sModCommand.empty()) + CALLMOD(sTarget, this, m_pUser, PutModule("Hello. How may I help you?")) + else + CALLMOD(sTarget, this, m_pUser, OnModCommand(sModCommand)) +#endif + } return; } else if (sCommand.CaseCmp("DETACH") == 0) { CString sChan = sLine.Token(1);