mirror of
https://github.com/znc/znc.git
synced 2026-08-05 00:13:22 +02:00
Merge commit 'refs/pull/665/head' of github.com:znc/znc
This commit is contained in:
@@ -51,7 +51,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual EModRet OnLoginAttempt(CSmartPtr<CAuthBase> Auth) {
|
||||
virtual EModRet OnLoginAttempt(std::shared_ptr<CAuthBase> Auth) {
|
||||
if (IsBlocked(Auth->GetUsername())) {
|
||||
Auth->RefuseLogin(MESSAGE);
|
||||
return HALT;
|
||||
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
return pair.second;
|
||||
}
|
||||
|
||||
virtual EModRet OnLoginAttempt(CSmartPtr<CAuthBase> Auth) {
|
||||
virtual EModRet OnLoginAttempt(std::shared_ptr<CAuthBase> Auth) {
|
||||
const CString sUser = Auth->GetUsername();
|
||||
Csock *pSock = Auth->GetSocket();
|
||||
CUser *pUser = CZNC::Get().FindUser(sUser);
|
||||
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual EModRet OnLoginAttempt(CSmartPtr<CAuthBase> Auth) {
|
||||
virtual EModRet OnLoginAttempt(std::shared_ptr<CAuthBase> Auth) {
|
||||
const CString& sUsername = Auth->GetUsername();
|
||||
const CString& sPassword = Auth->GetPassword();
|
||||
CUser *pUser(CZNC::Get().FindUser(sUsername));
|
||||
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
Add(sRemoteIP, 1);
|
||||
}
|
||||
|
||||
virtual EModRet OnLoginAttempt(CSmartPtr<CAuthBase> Auth) {
|
||||
virtual EModRet OnLoginAttempt(std::shared_ptr<CAuthBase> Auth) {
|
||||
// e.g. webadmin ends up here
|
||||
const CString& sRemoteIP = Auth->GetRemoteIP();
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class CIMAPAuthMod;
|
||||
|
||||
class CIMAPSock : public CSocket {
|
||||
public:
|
||||
CIMAPSock(CIMAPAuthMod* pModule, CSmartPtr<CAuthBase> Auth)
|
||||
CIMAPSock(CIMAPAuthMod* pModule, std::shared_ptr<CAuthBase> Auth)
|
||||
: CSocket((CModule*) pModule), m_spAuth(Auth) {
|
||||
m_pIMAPMod = pModule;
|
||||
m_bSentReply = false;
|
||||
@@ -39,10 +39,10 @@ public:
|
||||
virtual void ReadLine(const CString& sLine);
|
||||
private:
|
||||
protected:
|
||||
CIMAPAuthMod* m_pIMAPMod;
|
||||
bool m_bSentLogin;
|
||||
bool m_bSentReply;
|
||||
CSmartPtr<CAuthBase> m_spAuth;
|
||||
CIMAPAuthMod* m_pIMAPMod;
|
||||
bool m_bSentLogin;
|
||||
bool m_bSentReply;
|
||||
std::shared_ptr<CAuthBase> m_spAuth;
|
||||
};
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual EModRet OnLoginAttempt(CSmartPtr<CAuthBase> Auth) {
|
||||
virtual EModRet OnLoginAttempt(std::shared_ptr<CAuthBase> Auth) {
|
||||
CUser* pUser = CZNC::Get().FindUser(Auth->GetUsername());
|
||||
|
||||
if (!pUser) { // @todo Will want to do some sort of && !m_bAllowCreate in the future
|
||||
|
||||
@@ -242,7 +242,7 @@ typedef std::vector<std::pair<CString, CString> > VPair;
|
||||
|
||||
%inline %{
|
||||
TWebSubPage _CreateWebSubPage(const CString& sName, const CString& sTitle, const VPair& vParams, unsigned int uFlags) {
|
||||
return new CWebSubPage(sName, sTitle, vParams, uFlags);
|
||||
return std::make_shared<CWebSubPage>(sName, sTitle, vParams, uFlags);
|
||||
}
|
||||
%}
|
||||
|
||||
|
||||
@@ -292,7 +292,7 @@ while (<$in>) {
|
||||
say $out "Py_BuildValue(\"l\", (long int)$a->{var});";
|
||||
}
|
||||
}
|
||||
when (/^CSmartPtr/) {
|
||||
when (/^std::shared_ptr/) {
|
||||
say $out "SWIG_NewInstanceObj(new $a->{type}($a->{var}), SWIG_TypeQuery(\"$a->{type}*\"), SWIG_POINTER_OWN);";
|
||||
}
|
||||
when (/\*$/) {
|
||||
|
||||
@@ -78,4 +78,4 @@ EModRet OnModuleUnloading(CModule* pModule, bool& bSuccess, CString& sRetMsg)
|
||||
EModRet OnGetModInfo(CModInfo& ModInfo, const CString& sModule, bool& bSuccess, CString& sRetMsg)
|
||||
void OnGetAvailableMods(std::set<CModInfo>& ssMods, CModInfo::EModuleType eType)
|
||||
void OnClientCapLs(CClient* pClient, SCString& ssCaps)
|
||||
EModRet OnLoginAttempt(CSmartPtr<CAuthBase> Auth)
|
||||
EModRet OnLoginAttempt(std::shared_ptr<CAuthBase> Auth)
|
||||
|
||||
@@ -58,6 +58,7 @@ using std::allocator;
|
||||
%include <std_list.i>
|
||||
%include <std_set.i>
|
||||
%include <std_deque.i>
|
||||
%include <std_shared_ptr.i>
|
||||
|
||||
%include "modpython/cstring.i"
|
||||
%template(_stringlist) std::list<CString>;
|
||||
@@ -129,8 +130,8 @@ class MCString : public std::map<CString, CString> {};
|
||||
%include "../include/znc/defines.h"
|
||||
%include "../include/znc/Utils.h"
|
||||
%include "../include/znc/Threads.h"
|
||||
%template(PAuthBase) CSmartPtr<CAuthBase>;
|
||||
%template(WebSession) CSmartPtr<CWebSession>;
|
||||
%template(PAuthBase) std::shared_ptr<CAuthBase>;
|
||||
%template(WebSession) std::shared_ptr<CWebSession>;
|
||||
%include "../include/znc/Config.h"
|
||||
%include "../include/znc/Csocket.h"
|
||||
%template(ZNCSocketManager) TSocketManager<CZNCSock>;
|
||||
@@ -308,7 +309,7 @@ typedef std::vector<std::pair<CString, CString> > VPair;
|
||||
|
||||
%inline %{
|
||||
TWebSubPage CreateWebSubPage_(const CString& sName, const CString& sTitle, const VPair& vParams, unsigned int uFlags) {
|
||||
return new CWebSubPage(sName, sTitle, vParams, uFlags);
|
||||
return std::make_shared<CWebSubPage>(sName, sTitle, vParams, uFlags);
|
||||
}
|
||||
%}
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
bool& bSuccess, CString& sRetMsg);
|
||||
virtual void OnGetAvailableMods(std::set<CModInfo>& ssMods, CModInfo::EModuleType eType);
|
||||
virtual void OnClientCapLs(CClient* pClient, SCString& ssCaps);
|
||||
virtual EModRet OnLoginAttempt(CSmartPtr<CAuthBase> Auth);
|
||||
virtual EModRet OnLoginAttempt(std::shared_ptr<CAuthBase> Auth);
|
||||
};
|
||||
|
||||
static inline CPyModule* AsPyModule(CModule* p) {
|
||||
|
||||
+10
-10
@@ -76,10 +76,10 @@ public:
|
||||
MODCONSTRUCTOR(CWebAdminMod) {
|
||||
VPair vParams;
|
||||
vParams.push_back(make_pair("user", ""));
|
||||
AddSubPage(new CWebSubPage("settings", "Global Settings", CWebSubPage::F_ADMIN));
|
||||
AddSubPage(new CWebSubPage("edituser", "Your Settings", vParams));
|
||||
AddSubPage(new CWebSubPage("traffic", "Traffic Info", CWebSubPage::F_ADMIN));
|
||||
AddSubPage(new CWebSubPage("listusers", "Manage Users", CWebSubPage::F_ADMIN));
|
||||
AddSubPage(std::make_shared<CWebSubPage>("settings", "Global Settings", CWebSubPage::F_ADMIN));
|
||||
AddSubPage(std::make_shared<CWebSubPage>("edituser", "Your Settings", vParams));
|
||||
AddSubPage(std::make_shared<CWebSubPage>("traffic", "Traffic Info", CWebSubPage::F_ADMIN));
|
||||
AddSubPage(std::make_shared<CWebSubPage>("listusers", "Manage Users", CWebSubPage::F_ADMIN));
|
||||
}
|
||||
|
||||
virtual ~CWebAdminMod() {
|
||||
@@ -164,7 +164,7 @@ public:
|
||||
}
|
||||
|
||||
CUser* GetNewUser(CWebSock& WebSock, CUser* pUser) {
|
||||
CSmartPtr<CWebSession> spSession = WebSock.GetSession();
|
||||
std::shared_ptr<CWebSession> spSession = WebSock.GetSession();
|
||||
CString sUsername = WebSock.GetParam("newuser");
|
||||
|
||||
if (sUsername.empty()) {
|
||||
@@ -402,7 +402,7 @@ public:
|
||||
|
||||
virtual CString GetWebMenuTitle() { return "webadmin"; }
|
||||
virtual bool OnWebRequest(CWebSock& WebSock, const CString& sPageName, CTemplate& Tmpl) {
|
||||
CSmartPtr<CWebSession> spSession = WebSock.GetSession();
|
||||
std::shared_ptr<CWebSession> spSession = WebSock.GetSession();
|
||||
|
||||
if (sPageName == "settings") {
|
||||
// Admin Check
|
||||
@@ -597,7 +597,7 @@ public:
|
||||
}
|
||||
|
||||
bool ChanPage(CWebSock& WebSock, CTemplate& Tmpl, CIRCNetwork* pNetwork, CChan* pChan = NULL) {
|
||||
CSmartPtr<CWebSession> spSession = WebSock.GetSession();
|
||||
std::shared_ptr<CWebSession> spSession = WebSock.GetSession();
|
||||
Tmpl.SetFile("add_edit_chan.tmpl");
|
||||
CUser* pUser = pNetwork->GetUser();
|
||||
|
||||
@@ -733,7 +733,7 @@ public:
|
||||
}
|
||||
|
||||
bool NetworkPage(CWebSock& WebSock, CTemplate& Tmpl, CUser* pUser, CIRCNetwork* pNetwork = NULL) {
|
||||
CSmartPtr<CWebSession> spSession = WebSock.GetSession();
|
||||
std::shared_ptr<CWebSession> spSession = WebSock.GetSession();
|
||||
Tmpl.SetFile("add_edit_network.tmpl");
|
||||
|
||||
if (!WebSock.GetParam("submitted").ToUInt()) {
|
||||
@@ -1092,7 +1092,7 @@ public:
|
||||
}
|
||||
|
||||
bool UserPage(CWebSock& WebSock, CTemplate& Tmpl, CUser* pUser = NULL) {
|
||||
CSmartPtr<CWebSession> spSession = WebSock.GetSession();
|
||||
std::shared_ptr<CWebSession> spSession = WebSock.GetSession();
|
||||
Tmpl.SetFile("add_edit_user.tmpl");
|
||||
|
||||
if (!WebSock.GetParam("submitted").ToUInt()) {
|
||||
@@ -1399,7 +1399,7 @@ public:
|
||||
}
|
||||
|
||||
bool ListUsersPage(CWebSock& WebSock, CTemplate& Tmpl) {
|
||||
CSmartPtr<CWebSession> spSession = WebSock.GetSession();
|
||||
std::shared_ptr<CWebSession> spSession = WebSock.GetSession();
|
||||
const map<CString,CUser*>& msUsers = CZNC::Get().GetUserMap();
|
||||
Tmpl["Title"] = "Manage Users";
|
||||
Tmpl["Action"] = "listusers";
|
||||
|
||||
Reference in New Issue
Block a user