From 68f119cb70d7047c20910ea6db33c3bc94149a75 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 26 Apr 2020 15:19:01 +0300 Subject: Chat api: - function Chat_GetDefaultEventDescr() added not to translate the same strings in 5 different places; - function CHAT_INTERFACE::CreateNick added to process nick name creation for group chats; - unused variable LOGINFO::dwFlags removed; - variable LOGINFO::bSimple added for events without possible formatting; - bunch of duplicate code remoed; --- include/m_chat.h | 12 ++++++------ include/m_chat_int.h | 11 ++++++++--- include/m_srmm_int.h | 1 + 3 files changed, 15 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/m_chat.h b/include/m_chat.h index d3b91c1e3d..446124f1b2 100644 --- a/include/m_chat.h +++ b/include/m_chat.h @@ -351,9 +351,9 @@ EXTERN_C MIR_APP_DLL(struct SESSION_INFO*) Chat_NewSession( struct GCEVENT { - LPCSTR pszModule; // Name of the protocol (same as you registered with) + 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. + int iType; // Use GC_EVENT_* as defined above. Only one event per service call. MAllCStrings pszText; // MAllCStrings pszNick; // @@ -361,11 +361,11 @@ struct GCEVENT MAllCStrings pszStatus; // MAllCStrings pszUserInfo; // - BOOL bIsMe; // Is this event from the Miranda user? - DWORD dwFlags; // event flags: GCEF_* + BOOL bIsMe; // Is this event from the Miranda user? + DWORD dwFlags; // event flags: GCEF_* - INT_PTR dwItemData; // User specified data. - DWORD time; // Timestamp of the event + INT_PTR dwItemData; // User specified data. + DWORD time; // Timestamp of the event }; EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT*); diff --git a/include/m_chat_int.h b/include/m_chat_int.h index 68de22ce03..24f368caf4 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -121,11 +121,11 @@ struct LOGINFO wchar_t *ptszUID; wchar_t *ptszStatus; wchar_t *ptszUserInfo; - BOOL bIsMe; - BOOL bIsHighlighted; + bool bIsMe; + bool bIsHighlighted; + bool bSimple; time_t time; int iType; - DWORD dwFlags; LOGINFO *next, *prev; }; @@ -334,6 +334,7 @@ struct CHAT_MANAGER void (*ReloadSettings)(void); int (*DoRtfToTags)(CMStringW &pszText, int iNumColors, COLORREF *pColors); + void (*CreateNick)(const SESSION_INFO *si, const LOGINFO *lin, CMStringW &dest); int logPixelSY, logPixelSX; char *szActiveWndModule; @@ -397,4 +398,8 @@ EXTERN_C MIR_APP_DLL(BOOL) Chat_DoEventHook(SESSION_INFO *si, int iType, const U // calculates width or height of a string EXTERN_C MIR_APP_DLL(int) Chat_GetTextPixelSize(const wchar_t *pszText, HFONT hFont, bool bWidth); +// creates a default description of a groupchat event +// returns true if lin->ptszText is already utilized, you need to add it manually then otherwise +EXTERN_C MIR_APP_DLL(bool) Chat_GetDefaultEventDescr(const SESSION_INFO *si, const LOGINFO *lin, CMStringW &res); + #endif // M_CHAT_INT_H__ diff --git a/include/m_srmm_int.h b/include/m_srmm_int.h index d81426d63b..8c95a761fa 100644 --- a/include/m_srmm_int.h +++ b/include/m_srmm_int.h @@ -248,6 +248,7 @@ public: virtual LRESULT WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam); __forceinline bool isChat() const { return m_si != nullptr; } + __forceinline SESSION_INFO *getChat() const { return m_si; } __forceinline CSrmmLogWindow *log() const { return m_pLog; } __inline void *operator new(size_t size) { return calloc(1, size); } -- cgit v1.2.3