From 45bf5f51cc788cb8f19e1b8fcd5b8818dc7a2e00 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 25 Feb 2019 21:02:11 +0300 Subject: GCEVENT::GCEF_UTF8 - flag for direct communication with utf8-encoded chat events (UTF16LE by default) --- include/m_chat.h | 19 ++++++++++--------- include/m_core.h | 16 ++++++++++++---- 2 files changed, 22 insertions(+), 13 deletions(-) (limited to 'include') diff --git a/include/m_chat.h b/include/m_chat.h index 6701507374..cd290c04e4 100644 --- a/include/m_chat.h +++ b/include/m_chat.h @@ -347,18 +347,19 @@ EXTERN_C MIR_APP_DLL(struct SESSION_INFO*) Chat_NewSession( #define GCEF_ADDTOLOG 0x0001 // force adding to log #define GCEF_SILENT 0x0002 // never add to log #define GCEF_NOTNOTIFY 0x0004 +#define GCEF_UTF8 0x0008 struct GCEVENT { - LPCSTR pszModule; // Name of the protocol (same as you registered with) - LPCTSTR ptszID; // Unique identifier of the session, or NULL to broadcast to all sessions as specified above - int iType; // Use GC_EVENT_* as defined above. Only one event per service call. - - LPCTSTR ptszText; // - LPCTSTR ptszNick; // - LPCTSTR ptszUID; // - LPCTSTR ptszStatus; // - LPCTSTR ptszUserInfo; // + LPCSTR pszModule; // Name of the protocol (same as you registered with) + MAllCStrings pszID; // Unique identifier of the session, or NULL to broadcast to all sessions as specified above + int iType; // Use GC_EVENT_* as defined above. Only one event per service call. + + MAllCStrings pszText; // + MAllCStrings pszNick; // + MAllCStrings pszUID; // + MAllCStrings pszStatus; // + MAllCStrings pszUserInfo; // BOOL bIsMe; // Is this event from the Miranda user? DWORD dwFlags; // event flags: GCEF_* diff --git a/include/m_core.h b/include/m_core.h index b75cd0c700..610a04ff7e 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -428,15 +428,23 @@ __forceinline char* lrtrimp(char *str) { return ltrimp(rtrim(str)); }; /////////////////////////////////////////////////////////////////////////////// // text conversion functions -typedef union { +union MAllStrings +{ char *a; // utf8 or ansi strings wchar_t *w; // strings of WCHARs -} MAllStrings; +}; -typedef union { +union MAllCStrings +{ + const char *a; // utf8 or ansi strings + const wchar_t *w; // strings of WCHARs +}; + +union MAllStringArray +{ char **a; // array of utf8 or ansi strings wchar_t **w; // array of strings of WCHARs -} MAllStringArray; +}; MIR_CORE_DLL(wchar_t*) mir_a2u_cp(const char* src, int codepage); MIR_CORE_DLL(wchar_t*) mir_a2u(const char* src); -- cgit v1.2.3