Partly undo psychon's last commit in favor of just removing all the

setter methods. Suggested by psychon himself.
The second and more important part of this patch adds an optional
web_only/irc_only token to the Listen config setting. Using this,
you can make Listen ports listen for IRC or Web/HTTP connections
only (or for both if you don't add any of the _only tokens).
Examples:
Listen = irc_only 3000
Listen4 = web_only +3001
Listen6 = ::1 6000
and so on.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1973 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
cflakes
2010-05-09 18:55:13 +00:00
parent f6716d08c7
commit 6bc45bf80f
3 changed files with 33 additions and 56 deletions
+8 -16
View File
@@ -21,38 +21,30 @@ public:
ACCEPT_IRC,
ACCEPT_HTTP,
ACCEPT_ALL
} AcceptType;
} EAcceptType;
CListener(unsigned short uPort, const CString& sBindHost, bool bSSL, EAddrType eAddr) {
CListener(unsigned short uPort, const CString& sBindHost, bool bSSL, EAddrType eAddr, EAcceptType eAccept = ACCEPT_ALL) {
m_uPort = uPort;
m_sBindHost = sBindHost;
m_bSSL = bSSL;
m_eAddr = eAddr;
m_pListener = NULL;
m_eAcceptType = ACCEPT_ALL;
m_eAcceptType = eAccept;
}
~CListener();
// Setters
void SetSSL(bool b);
void SetAddrType(EAddrType eAddr);
void SetPort(unsigned short u);
void SetBindHost(const CString& s);
void SetRealListener(CRealListener* p);
void SetAcceptType(AcceptType a);
// !Setters
// Getters
bool IsSSL() const { return m_bSSL; }
EAddrType GetAddrType() const { return m_eAddr; }
unsigned short GetPort() const { return m_uPort; }
const CString& GetBindHost() const { return m_sBindHost; }
CRealListener* GetRealListener() const { return m_pListener; }
AcceptType GetAcceptType() const { return m_eAcceptType; }
EAcceptType GetAcceptType() const { return m_eAcceptType; }
// !Getters
bool Listen();
void ResetRealListener();
private:
protected:
@@ -61,7 +53,7 @@ protected:
unsigned short m_uPort;
CString m_sBindHost;
CRealListener* m_pListener;
AcceptType m_eAcceptType;
EAcceptType m_eAcceptType;
};
class CRealListener : public CZNCSock {
@@ -79,12 +71,12 @@ private:
class CIncomingConnection : public CZNCSock {
public:
CIncomingConnection(const CString& sHostname, unsigned short uPort, CListener::AcceptType eAcceptType);
CIncomingConnection(const CString& sHostname, unsigned short uPort, CListener::EAcceptType eAcceptType);
virtual ~CIncomingConnection() {}
virtual void ReadLine(const CString& sData);
private:
CListener::AcceptType m_eAcceptType;
CListener::EAcceptType m_eAcceptType;
};
#endif // !_LISTENER_H