mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Add /msg *status UpdateMod[ule] which reloads an user module on all users
This command allows admins to really reload a module when they have updated it. Because the dynamic linker does not really reload a shared object until all handles to this object where dlclose()'d, this new command is necessary. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1418 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -746,6 +746,25 @@ void CClient::UserCommand(const CString& sLine) {
|
||||
PutStatus("Unable to unload [" + sMod + "] Modules are not enabled.");
|
||||
#endif
|
||||
return;
|
||||
} else if ((sCommand.Equals("UPDATEMOD") || sCommand.Equals("UPDATEMODULE")) && pUser->IsAdmin() ) {
|
||||
#ifndef _MODULES
|
||||
PutStatus("Modules are not enabled.");
|
||||
#else
|
||||
CString sMod = sLine.Token(1);
|
||||
|
||||
if (m_pUser->DenyLoadMod() || !m_pUser->IsAdmin()) {
|
||||
PutStatus("Unable to reload [" + sMod + "] Access Denied.");
|
||||
return;
|
||||
}
|
||||
|
||||
PutStatus("Reloading [" + sMod + "] on all users...");
|
||||
if (CUser::UpdateModule(sMod)) {
|
||||
PutStatus("Done");
|
||||
} else {
|
||||
PutStatus("Done, but there were errors, some users no longer have ["
|
||||
+ sMod + "] loaded");
|
||||
}
|
||||
#endif
|
||||
} else if (sCommand.Equals("ADDVHOST") && m_pUser->IsAdmin()) {
|
||||
CString sVHost = sLine.Token(1);
|
||||
|
||||
@@ -1114,6 +1133,13 @@ void CClient::HelpUser() {
|
||||
Table.SetCell("Command", "ReloadMod");
|
||||
Table.SetCell("Arguments", "<module>");
|
||||
Table.SetCell("Description", "Reload a module");
|
||||
|
||||
if (m_pUser->IsAdmin()) {
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "UpdateMod");
|
||||
Table.SetCell("Arguments", "<module>");
|
||||
Table.SetCell("Description", "Reload a module on all users");
|
||||
}
|
||||
}
|
||||
|
||||
Table.AddRow();
|
||||
|
||||
Reference in New Issue
Block a user