Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improve the handling of module load messages

Instead of doing ugly stuff to shorten the "Loaded Module [foo]" message, we now
just always generate the shorter version of that message. The code paths which
didn't do this shortening now prepend that message themselves.

The result is that every message looks the same as it did before, but the code
for generating these is a little nicer.

Signed-off-by: Uli Schlachter <psychon@znc.in>
  • Loading branch information...
commit f0bf7134ecad70caf332cb2864dd3107991f90d7 1 parent 2003465
@psychon psychon authored
View
6 ClientCommand.cpp
@@ -731,10 +731,8 @@ void CClient::UserCommand(CString& sLine) {
b = m_pUser->GetModules().LoadModule(sMod, sArgs, m_pUser, sModRet);
}
- if (!b) {
- PutStatus(sModRet);
- return;
- }
+ if (b)
+ sModRet = "Loaded module [" + sMod + "] " + sModRet;
PutStatus(sModRet);
return;
View
5 Modules.cpp
@@ -886,10 +886,9 @@ bool CModules::LoadModule(const CString& sModule, const CString& sArgs, CUser* p
}
if (!sRetMsg.empty()) {
- sRetMsg = "Loaded module [" + sModule + "] [" + sRetMsg + "] [" + sModPath + "]";
- } else {
- sRetMsg = "Loaded module [" + sModule + "] [" + sModPath + "]";
+ sRetMsg += "[" + sRetMsg + "] ";
}
+ sRetMsg += "[" + sModPath + "]";
return true;
}
View
5 User.cpp
@@ -307,11 +307,6 @@ bool CUser::ParseConfig(CConfig* pConfig, CString& sError) {
bool bModRet = GetModules().LoadModule(sModName, sArgs, this, sModRet);
- // If the module was loaded, sModRet contains
- // "Loaded Module [name] ..." and we strip away this beginning.
- if (bModRet)
- sModRet = sModRet.Token(1, true, sModName + "] ");
-
CUtils::PrintStatus(bModRet, sModRet);
if (!bModRet) {
sError = sModRet;
View
4 modules/modperl/startup.pl
@@ -139,9 +139,9 @@ sub LoadModule {
return ($ZNC::Perl_LoadError, "Module [$modname] aborted.");
}
if ($x) {
- return ($ZNC::Perl_Loaded, "Loaded module [$modname] [$x] [$modpath]");
+ return ($ZNC::Perl_Loaded, "[$x] [$modpath]");
}
- return ($ZNC::Perl_Loaded, "Loaded module [$modname] [$modpath]")
+ return ($ZNC::Perl_Loaded, "[$modpath]")
}
sub GetModInfo {
View
4 modules/modpython/znc.py
@@ -288,9 +288,9 @@ def load_module(modname, args, user, retmsg, modpython):
if loaded:
if retmsg.s == '':
- retmsg.s = "Loaded module [{0}] [{1}]".format(modname, pymodule.__file__)
+ retmsg.s = "[{0}]".format(pymodule.__file__)
else:
- retmsg.s = "Loaded module [{0}] [{2}] [{1}]".format(modname, pymodule.__file__, retmsg.s)
+ retmsg.s = "[{1}] [{0}]".format(pymodule.__file__, retmsg.s)
return 2
print(retmsg.s)
View
14 znc.cpp
@@ -1065,11 +1065,6 @@ bool CZNC::DoRehash(CString& sError)
bool bModRet = GetModules().LoadModule(sModName, sArgs, NULL, sModRet);
- // If the module was loaded, sModRet contains
- // "Loaded Module [name] ..." and we strip away this beginning.
- if (bModRet)
- sModRet = sModRet.Token(1, true, sModName + "] ");
-
CUtils::PrintStatus(bModRet, sModRet);
if (!bModRet) {
sError = sModRet;
@@ -1080,11 +1075,6 @@ bool CZNC::DoRehash(CString& sError)
bool bModRet = GetModules().ReloadModule(sModName, sArgs, NULL, sModRet);
- // If the module was loaded, sModRet contains
- // "Loaded Module [name] ..." and we strip away this beginning.
- if (bModRet)
- sModRet = sModRet.Token(1, true, sModName + "] ");
-
CUtils::PrintStatus(bModRet, sModRet);
if (!bModRet) {
sError = sModRet;
@@ -1107,10 +1097,6 @@ bool CZNC::DoRehash(CString& sError)
CString sModRet;
bool bModRet = GetModules().LoadModule("identfile", "", NULL, sModRet);
- if (bModRet) {
- sModRet = sModRet.Token(1, true, "identfile] ");
- }
-
CUtils::PrintStatus(bModRet, sModRet);
if (!bModRet) {
sError = sModRet;
Please sign in to comment.
Something went wrong with that request. Please try again.