Don't break IRC control characters in some encodings

Fix #577
This commit is contained in:
Alexey Sokolov
2014-12-21 17:09:59 +00:00
parent bd9450b99e
commit 8930fc4d7a
6 changed files with 95 additions and 4 deletions
+2 -2
View File
@@ -82,9 +82,9 @@ protected:
CClient* m_pClient;
};
class CClient : public CZNCSock {
class CClient : public CIRCSocket {
public:
CClient() : CZNCSock() {
CClient() : CIRCSocket() {
m_pUser = NULL;
m_pNetwork = NULL;
m_bGotPass = false;
+2 -1
View File
@@ -30,7 +30,8 @@ class CIRCNetwork;
class CClient;
// !Forward Declarations
class CIRCSock : public CZNCSock {
// TODO: This class needs new name
class CIRCSock : public CIRCSocket {
public:
CIRCSock(CIRCNetwork* pNetwork);
virtual ~CIRCSock();
+33
View File
@@ -220,4 +220,37 @@ protected:
CModule* m_pModule; //!< pointer to the module that this sock instance belongs to
};
/**
* @class CIRCSocket
* @brief Base IRC socket for client<->ZNC, and ZNC<->server
*/
class CIRCSocket : public CZNCSock {
public:
#ifdef HAVE_ICU
/**
* @brief Allow IRC control characters to appear even if protocol encoding explicitly disallows them.
*
* E.g. ISO-2022-JP disallows 0x0F, which in IRC means "reset format",
* so by default it gets replaced with U+FFFD ("replacement character").
* https://code.google.com/p/chromium/issues/detail?id=277062#c3
*
* In case if protocol encoding uses these code points for something else, the encoding takes preference,
* and they are not IRC control characters anymore.
*/
void IcuExtToUCallback(
UConverterToUnicodeArgs* toArgs,
const char* codeUnits,
int32_t length,
UConverterCallbackReason reason,
UErrorCode* err) override;
void IcuExtFromUCallback(
UConverterFromUnicodeArgs* fromArgs,
const UChar* codeUnits,
int32_t length,
UChar32 codePoint,
UConverterCallbackReason reason,
UErrorCode* err) override;
#endif
};
#endif /* SOCKET_H */