mirror of
https://github.com/znc/znc.git
synced 2026-08-02 15:03:16 +02:00
@@ -149,6 +149,9 @@ AC_ARG_ENABLE( [poll],
|
||||
AS_HELP_STRING([--disable-poll], [use select() instead of poll()]),
|
||||
[POLL="$enableval"],
|
||||
[POLL="yes"])
|
||||
AC_ARG_ENABLE([add-networks],
|
||||
AS_HELP_STRING([--enable-add-networks], [allow non-admins to add networks]),
|
||||
[ if test x"$enableval" = "xyes" ; then appendCXX "-DENABLE_ADD_NETWORK" ; fi ])
|
||||
|
||||
if test "$DEBUG" != "no"; then
|
||||
appendCXX -ggdb3
|
||||
|
||||
@@ -571,6 +571,13 @@ class CAdminMod : public CModule {
|
||||
}
|
||||
|
||||
void AddNetwork(const CString& sLine) {
|
||||
#ifndef ENABLE_ADD_NETWORK
|
||||
if (!m_pUser->IsAdmin()) {
|
||||
PutModule("Permission denied");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
CString sUser = sLine.Token(1);
|
||||
CString sNetwork = sLine.Token(2);
|
||||
CUser *pUser = m_pUser;
|
||||
|
||||
@@ -700,6 +700,13 @@ public:
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#ifndef ENABLE_ADD_NETWORK
|
||||
if (!spSession->IsAdmin()) {
|
||||
WebSock.PrintErrorPage("Permission denied");
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
Tmpl["Action"] = "addnetwork";
|
||||
Tmpl["Title"] = "Add Network for User [" + pUser->GetUserName() + "]";
|
||||
Tmpl["IRCConnectEnabled"] = "true";
|
||||
|
||||
@@ -641,7 +641,19 @@ void CClient::AcceptLogin(CUser& User) {
|
||||
PutStatusNotice("If you want to choose another network, use /znc JumpNetwork <network>, or connect to ZNC with username " + m_pUser->GetUserName() + "/<network> (instead of just " + m_pUser->GetUserName() + ")");
|
||||
}
|
||||
} else {
|
||||
#ifndef ENABLE_ADD_NETWORK
|
||||
if (!m_pUser->IsAdmin()) {
|
||||
/* Since this user cannot add his own network,
|
||||
* lets make them a default network */
|
||||
m_pNetwork = m_pUser->AddNetwork("default");
|
||||
} else {
|
||||
#endif
|
||||
|
||||
PutStatusNotice("You have no networks configured. Use /znc AddNetwork <network> to add one.");
|
||||
|
||||
#ifndef ENABLE_ADD_NETWORK
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
SetNetwork(m_pNetwork, false);
|
||||
|
||||
@@ -429,6 +429,13 @@ void CClient::UserCommand(CString& sLine) {
|
||||
PutStatus("Total: " + CString(vChans.size()) + " - Joined: " + CString(uNumJoined) +
|
||||
" - Detached: " + CString(uNumDetached) + " - Disabled: " + CString(uNumDisabled));
|
||||
} else if (sCommand.Equals("ADDNETWORK")) {
|
||||
#ifndef ENABLE_ADD_NETWORK
|
||||
if (!m_pUser->IsAdmin()) {
|
||||
PutStatus("Permission denied");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
CString sNetwork = sLine.Token(1);
|
||||
|
||||
if (sNetwork.empty()) {
|
||||
|
||||
Reference in New Issue
Block a user