From be1918c1b2986ddb387cd593deddf120f9e61874 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 26 Nov 2018 14:41:11 +0300 Subject: fix for chat structures declaration --- include/m_chat.h | 2 +- include/m_chat_int.h | 8 ++++++++ plugins/RecentContacts/src/stdafx.h | 2 -- plugins/Scriver/src/stdafx.h | 1 + plugins/TabSRMM/src/msgs.h | 2 -- plugins/TabSRMM/src/stdafx.h | 2 ++ protocols/Discord/src/guilds.cpp | 8 ++++---- protocols/Discord/src/stdafx.h | 2 -- protocols/JabberG/src/jabber_chat.cpp | 2 +- protocols/MRA/src/MraOfflineMsg.cpp | 2 +- protocols/MRA/src/Mra_functions.cpp | 2 +- protocols/SkypeWeb/src/stdafx.h | 2 -- protocols/VKontakte/src/vk_chats.cpp | 2 +- src/core/stdmsg/src/stdafx.h | 1 + src/mir_app/src/chat.h | 4 ---- src/mir_app/src/chat_manager.cpp | 2 +- src/mir_app/src/chat_svc.cpp | 2 +- 17 files changed, 23 insertions(+), 23 deletions(-) diff --git a/include/m_chat.h b/include/m_chat.h index 978e1e1860..6547a7a788 100644 --- a/include/m_chat.h +++ b/include/m_chat.h @@ -166,7 +166,7 @@ EXTERN_C MIR_APP_DLL(int) Chat_Register(const GCREGISTER*); #define GCW_PRIVMESS 3 // NOT SUPPORTED YET! the session is a 1 to 1 session, but with additional // support for adding more users etc. ex "MSN session". -EXTERN_C MIR_APP_DLL(struct GCSessionInfoBase*) Chat_NewSession( +EXTERN_C MIR_APP_DLL(struct SESSION_INFO*) Chat_NewSession( int iType, // Use one of the GCW_* flags above to set the type of session const char *pszModule, // The name of the protocol owning the session (the same as pszModule when you register) const wchar_t *ptszID, // The unique identifier for the session. diff --git a/include/m_chat_int.h b/include/m_chat_int.h index 0eb552f93a..69106dcba0 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -253,6 +253,14 @@ struct GlobalLogSettingsBase ///////////////////////////////////////////////////////////////////////////////////////// +#ifndef SRMM_OWN_STRUCTURES +struct LOGSTREAMDATA : public GCLogStreamDataBase {}; +struct SESSION_INFO : public GCSessionInfoBase {}; +struct MODULEINFO : public GCModuleInfoBase {}; +#endif + +///////////////////////////////////////////////////////////////////////////////////////// + #define FONTMODE_USE 1 #define FONTMODE_SKIP 2 #define FONTMODE_ALTER 3 diff --git a/plugins/RecentContacts/src/stdafx.h b/plugins/RecentContacts/src/stdafx.h index 6408a5c727..1f9f020b49 100644 --- a/plugins/RecentContacts/src/stdafx.h +++ b/plugins/RecentContacts/src/stdafx.h @@ -28,8 +28,6 @@ using namespace std; -struct SESSION_INFO : public GCSessionInfoBase {}; - void wSetData(char **Data, const char *Value); void wfree(char **Data); diff --git a/plugins/Scriver/src/stdafx.h b/plugins/Scriver/src/stdafx.h index f5190599b1..7a023eaeab 100644 --- a/plugins/Scriver/src/stdafx.h +++ b/plugins/Scriver/src/stdafx.h @@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define SRMM_COMMONHEADERS_H #define COMPILE_MULTIMON_STUBS +#define SRMM_OWN_STRUCTURES #include #include diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 88a4f7c7b4..d3dda2defc 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -237,8 +237,6 @@ struct TContainerData } }; -struct SESSION_INFO; - class CTabBaseDlg : public CSrmmBaseDialog { typedef CSrmmBaseDialog CSuper; diff --git a/plugins/TabSRMM/src/stdafx.h b/plugins/TabSRMM/src/stdafx.h index 3b6f56b58f..61819c989c 100644 --- a/plugins/TabSRMM/src/stdafx.h +++ b/plugins/TabSRMM/src/stdafx.h @@ -26,6 +26,8 @@ // // global include file, used to build the precompiled header. +#define SRMM_OWN_STRUCTURES + #include #include #include diff --git a/protocols/Discord/src/guilds.cpp b/protocols/Discord/src/guilds.cpp index 31ce370f8d..cdaf29de05 100644 --- a/protocols/Discord/src/guilds.cpp +++ b/protocols/Discord/src/guilds.cpp @@ -71,7 +71,7 @@ void CDiscordProto::ProcessRole(CDiscordGuild *guild, const JSONNode &role) static void sttSetGroupName(MCONTACT hContact, const wchar_t *pwszGroupName) { ptrW wszOldName(db_get_wsa(hContact, "CList", "Group")); - if (wszOldName == nullptr) + if (wszOldName == nullptr || !mir_wstrcmpi(wszOldName, TranslateT("Chat rooms"))) db_set_ws(hContact, "CList", "Group", pwszGroupName); } @@ -80,13 +80,13 @@ void CDiscordProto::BatchChatCreate(void *param) CDiscordGuild *pGuild = (CDiscordGuild*)param; for (auto &it : pGuild->arChannels) - if (!it->bIsPrivate) + if (!it->bIsPrivate && !it->bIsGroup) CreateChat(pGuild, it); } void CDiscordProto::CreateChat(CDiscordGuild *pGuild, CDiscordUser *pUser) { - GCSessionInfoBase *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, pUser->wszUsername, pUser->wszChannelName); + SESSION_INFO *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, pUser->wszUsername, pUser->wszChannelName); si->pParent = pGuild->pParentSi; pUser->hContact = si->hContact; @@ -129,7 +129,7 @@ void CDiscordProto::ProcessGuild(const JSONNode &p) pGuild->wszName = p["name"].as_mstring(); pGuild->groupId = Clist_GroupCreate(Clist_GroupExists(m_wszDefaultGroup), pGuild->wszName); - GCSessionInfoBase *si = Chat_NewSession(GCW_SERVER, m_szModuleName, pGuild->wszName, pGuild->wszName, pGuild); + SESSION_INFO *si = Chat_NewSession(GCW_SERVER, m_szModuleName, pGuild->wszName, pGuild->wszName, pGuild); pGuild->pParentSi = (SESSION_INFO*)si; pGuild->hContact = si->hContact; setId(si->hContact, DB_KEY_CHANNELID, guildId); diff --git a/protocols/Discord/src/stdafx.h b/protocols/Discord/src/stdafx.h index 70bef09fe2..ccbd587d74 100644 --- a/protocols/Discord/src/stdafx.h +++ b/protocols/Discord/src/stdafx.h @@ -65,5 +65,3 @@ CMStringW PrepareMessageText(const JSONNode &pRoot); int StrToStatus(const CMStringW &str); time_t StringToDate(const CMStringW &str); int SerialNext(void); - -struct SESSION_INFO : public GCSessionInfoBase {}; diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 8869d206db..f873fcbde7 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -128,7 +128,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) it.translate(); ptrW szNick(JabberNickFromJID(item->jid)); - GCSessionInfoBase *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, item->jid, szNick); + SESSION_INFO *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, item->jid, szNick); if (si != nullptr) { item->hContact = si->hContact; diff --git a/protocols/MRA/src/MraOfflineMsg.cpp b/protocols/MRA/src/MraOfflineMsg.cpp index 1495f6d2a2..4c2b621c92 100644 --- a/protocols/MRA/src/MraOfflineMsg.cpp +++ b/protocols/MRA/src/MraOfflineMsg.cpp @@ -141,7 +141,7 @@ static DWORD PlainText2message(const CMStringA &szContentType, const CMStringA & size_t dwTextSize; ptrA lpszText((LPSTR)mir_base64_decode(szBody, &dwTextSize)); if (lpszText) { - plpsText = CMStringA(lpszText, dwTextSize); + plpsText = CMStringA(lpszText, (int)dwTextSize); if (pdwFlags) { (*pdwFlags) |= MESSAGE_FLAG_v1p16; // set unicode flag if not exist (*pdwFlags) &= ~MESSAGE_FLAG_CP1251; // reset ansi flag if exist diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index da212ffd72..39c95922d4 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -526,7 +526,7 @@ MCONTACT CMraProto::MraHContactFromEmail(const CMStringA &szEmail, BOOL bAddIfNe //not already there: add if (IsEMailChatAgent(szEmail)) { CMStringW wszEMail = szEmail; - GCSessionInfoBase *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, wszEMail, wszEMail); + SESSION_INFO *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, wszEMail, wszEMail); if (si != nullptr) { bool bChatAdded = (si->hContact != NULL); if (bChatAdded == FALSE) diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h index a9e15f715c..2be5607f21 100644 --- a/protocols/SkypeWeb/src/stdafx.h +++ b/protocols/SkypeWeb/src/stdafx.h @@ -60,8 +60,6 @@ struct CSkypeProto; extern char g_szMirVer[]; extern HANDLE g_hCallEvent; -struct SESSION_INFO : public GCSessionInfoBase {}; - #define SKYPE_ENDPOINTS_HOST "client-s.gateway.messenger.live.com" struct LoginInfo diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index bb6f1ce870..370a6bc312 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -60,7 +60,7 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) sid.Format(L"%S_%d", m_szModuleName, id); c->m_wszId = mir_wstrdup(sid); - GCSessionInfoBase *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, sid, wszTitle); + SESSION_INFO *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, sid, wszTitle); if (si == nullptr) return nullptr; diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index 67c98ec5f5..f06ef0ad4c 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma once #define WIN32_LEAN_AND_MEAN +#define SRMM_OWN_STRUCTURES #include #include diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h index ea86c7cea7..c86cc9b16f 100644 --- a/src/mir_app/src/chat.h +++ b/src/mir_app/src/chat.h @@ -28,10 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void Srmm_CreateToolbarIcons(HWND hwndDlg, int flags); void Srmm_ProcessToolbarHotkey(MCONTACT hContact, INT_PTR iButtonFrom, HWND hwndDlg); -struct MODULEINFO : public GCModuleInfoBase {}; -struct LOGSTREAMDATA : public GCLogStreamDataBase {}; -struct SESSION_INFO : public GCSessionInfoBase {}; - class CChatRoomDlg : public CSrmmBaseDialog { CChatRoomDlg(); // just to suppress compiler's warnings, never implemented diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index f51d1f2811..2c2569ccaa 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -987,7 +987,7 @@ MIR_APP_DLL(CHAT_MANAGER*) Chat_CustomizeApi(const CHAT_MANAGER_INITDATA *pInit) for (auto &p : g_arSessions) { SESSION_INFO *p1 = (SESSION_INFO*)realloc(p, pInit->cbSession); - memset(PBYTE(p1) + sizeof(GCSessionInfoBase), 0, pInit->cbSession - sizeof(GCSessionInfoBase)); + memset(PBYTE(p1) + sizeof(SESSION_INFO), 0, pInit->cbSession - sizeof(SESSION_INFO)); if (p1 != p) { // realloc could change a pointer, reinsert a structure g_arSessions.remove(p); g_arSessions.insert(p1); diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp index daaab3b654..7e76a5f41f 100644 --- a/src/mir_app/src/chat_svc.cpp +++ b/src/mir_app/src/chat_svc.cpp @@ -180,7 +180,7 @@ MIR_APP_DLL(int) Chat_Register(const GCREGISTER *gcr) ///////////////////////////////////////////////////////////////////////////////////////// // starts new chat session -EXTERN_C MIR_APP_DLL(GCSessionInfoBase*) Chat_NewSession( +EXTERN_C MIR_APP_DLL(SESSION_INFO*) Chat_NewSession( int iType, // Use one of the GCW_* flags above to set the type of session const char *pszModule, // The name of the protocol owning the session (the same as pszModule when you register) const wchar_t *ptszID, // The unique identifier for the session. -- cgit v1.2.3