mirror of
https://github.com/znc/znc.git
synced 2026-08-07 17:33:34 +02:00
Add support for character encodings
Previous commit added support of it to Csocket. When encoding is specified, core will convert incoming messages to UTF-8, and outgoing messages from UTF-8. When no encoding is specified, it will do nothing to bytes, like before. This is to be changed somewhere in future, to have UTF-8 on wire by default too. When encoding's name starts with *, incoming messages will be treated as UTF-8, if it is already correct UTF-8. Otherwise, it's converted. Fix #151 Fix #366
This commit is contained in:
@@ -141,12 +141,14 @@ public:
|
||||
const CString& GetIdent(const bool bAllowDefault = true) const;
|
||||
const CString& GetRealName() const;
|
||||
const CString& GetBindHost() const;
|
||||
const CString& GetEncoding() const;
|
||||
|
||||
void SetNick(const CString& s);
|
||||
void SetAltNick(const CString& s);
|
||||
void SetIdent(const CString& s);
|
||||
void SetRealName(const CString& s);
|
||||
void SetBindHost(const CString& s);
|
||||
void SetEncoding(const CString& s);
|
||||
|
||||
double GetFloodRate() const { return m_fFloodRate; }
|
||||
unsigned short int GetFloodBurst() const { return m_uFloodBurst; }
|
||||
@@ -167,6 +169,7 @@ protected:
|
||||
CString m_sIdent;
|
||||
CString m_sRealName;
|
||||
CString m_sBindHost;
|
||||
CString m_sEncoding;
|
||||
|
||||
CModules* m_pModules;
|
||||
|
||||
|
||||
@@ -30,6 +30,11 @@ public:
|
||||
~CZNCSock() {}
|
||||
|
||||
virtual int ConvertAddress(const struct sockaddr_storage * pAddr, socklen_t iAddrLen, CS_STRING & sIP, u_short * piPort);
|
||||
|
||||
#ifndef HAVE_ICU
|
||||
// Don't fail to compile when ICU is not enabled
|
||||
void SetEncoding(const CString&) {}
|
||||
#endif
|
||||
};
|
||||
|
||||
enum EAddrType {
|
||||
|
||||
@@ -120,6 +120,7 @@ public:
|
||||
void SetDenySetBindHost(bool b);
|
||||
bool SetStatusPrefix(const CString& s);
|
||||
void SetDefaultChanModes(const CString& s);
|
||||
void SetClientEncoding(const CString& s);
|
||||
void SetQuitMsg(const CString& s);
|
||||
bool AddCTCPReply(const CString& sCTCP, const CString& sReply);
|
||||
bool DelCTCPReply(const CString& sCTCP);
|
||||
@@ -153,6 +154,7 @@ public:
|
||||
const CString& GetPassSalt() const;
|
||||
const std::set<CString>& GetAllowedHosts() const;
|
||||
const CString& GetTimestampFormat() const;
|
||||
const CString& GetClientEncoding() const;
|
||||
bool GetTimestampAppend() const;
|
||||
bool GetTimestampPrepend() const;
|
||||
|
||||
@@ -192,6 +194,7 @@ protected:
|
||||
CString m_sPassSalt;
|
||||
CString m_sStatusPrefix;
|
||||
CString m_sDefaultChanModes;
|
||||
CString m_sClientEncoding;
|
||||
|
||||
CString m_sQuitMsg;
|
||||
MCString m_mssCTCPReplies;
|
||||
|
||||
Reference in New Issue
Block a user