diff options
author | George Hazan <ghazan@miranda.im> | 2018-11-26 15:23:19 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-11-26 15:23:19 +0300 |
commit | da1b2a070c113222cbbad31b18ab704c7d1301b2 (patch) | |
tree | 841092328c9c7fb35c3454627296862a956f5d5c /protocols | |
parent | be1918c1b2986ddb387cd593deddf120f9e61874 (diff) |
Chat_AddGroup - simplified prototype
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Discord/src/dispatch.cpp | 2 | ||||
-rw-r--r-- | protocols/Discord/src/groupchat.cpp | 6 | ||||
-rw-r--r-- | protocols/Discord/src/guilds.cpp | 4 | ||||
-rw-r--r-- | protocols/Discord/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/FacebookRM/src/chat.cpp | 12 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/groupchat.cpp | 7 | ||||
-rw-r--r-- | protocols/IRCG/src/commandmonitor.cpp | 17 | ||||
-rw-r--r-- | protocols/IRCG/src/irclib.cpp | 2 | ||||
-rw-r--r-- | protocols/IRCG/src/ircproto.cpp | 2 | ||||
-rw-r--r-- | protocols/IRCG/src/ircproto.h | 3 | ||||
-rw-r--r-- | protocols/IRCG/src/services.cpp | 26 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_chat.cpp | 2 | ||||
-rw-r--r-- | protocols/MRA/src/MraChat.cpp | 5 | ||||
-rw-r--r-- | protocols/MSN/src/msn_chat.cpp | 7 | ||||
-rw-r--r-- | protocols/MinecraftDynmap/src/chat.cpp | 9 | ||||
-rw-r--r-- | protocols/Omegle/src/chat.cpp | 9 | ||||
-rw-r--r-- | protocols/Sametime/src/conference.cpp | 6 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 8 | ||||
-rw-r--r-- | protocols/Twitter/src/chat.cpp | 7 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_chats.cpp | 2 |
20 files changed, 75 insertions, 63 deletions
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp index 13687a4b5f..90457116c4 100644 --- a/protocols/Discord/src/dispatch.cpp +++ b/protocols/Discord/src/dispatch.cpp @@ -300,7 +300,7 @@ void CDiscordProto::OnCommandRoleDeleted(const JSONNode &pRoot) SESSION_INFO *si = g_chatApi.SM_FindSession(it->wszUsername, m_szModuleName); if (si != nullptr) { g_chatApi.TM_RemoveAll(&si->pStatuses); - BuildStatusList(pGuild, it->wszUsername); + BuildStatusList(pGuild, si); } } } diff --git a/protocols/Discord/src/groupchat.cpp b/protocols/Discord/src/groupchat.cpp index cc26dbb162..41351dee88 100644 --- a/protocols/Discord/src/groupchat.cpp +++ b/protocols/Discord/src/groupchat.cpp @@ -25,12 +25,12 @@ enum { ///////////////////////////////////////////////////////////////////////////////////////// -void CDiscordProto::BuildStatusList(const CDiscordGuild *pGuild, const CMStringW &wszChannelId) +void CDiscordProto::BuildStatusList(const CDiscordGuild *pGuild, SESSION_INFO *si) { - Chat_AddGroup(m_szModuleName, wszChannelId, L"@owner"); + Chat_AddGroup(si, L"@owner"); for (auto &it : pGuild->arRoles) - Chat_AddGroup(m_szModuleName, wszChannelId, it->wszName); + Chat_AddGroup(si, it->wszName); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/Discord/src/guilds.cpp b/protocols/Discord/src/guilds.cpp index cdaf29de05..639937b4c3 100644 --- a/protocols/Discord/src/guilds.cpp +++ b/protocols/Discord/src/guilds.cpp @@ -99,7 +99,7 @@ void CDiscordProto::CreateChat(CDiscordGuild *pGuild, CDiscordUser *pUser) else sttSetGroupName(pUser->hContact, Clist_GroupGetName(pGuild->groupId)); } - BuildStatusList(pGuild, pUser->wszUsername); + BuildStatusList(pGuild, si); Chat_Control(m_szModuleName, pUser->wszUsername, m_bHideGroupchats ? WINDOW_HIDDEN : SESSION_INITDONE); Chat_Control(m_szModuleName, pUser->wszUsername, SESSION_ONLINE); @@ -140,7 +140,7 @@ void CDiscordProto::ProcessGuild(const JSONNode &p) const JSONNode &roles = p["roles"]; for (auto itr = roles.begin(); itr != roles.end(); ++itr) ProcessRole(pGuild, *itr); - BuildStatusList(pGuild, pGuild->wszName); + BuildStatusList(pGuild, si); for (auto &it : pGuild->arChatUsers) AddGuildUser(pGuild, *it); diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h index 9f42b4ad58..4d51cdc161 100644 --- a/protocols/Discord/src/proto.h +++ b/protocols/Discord/src/proto.h @@ -251,7 +251,7 @@ class CDiscordProto : public PROTO<CDiscordProto> void Chat_SendPrivateMessage(GCHOOK *gch); void Chat_ProcessLogMenu(GCHOOK *gch); - void BuildStatusList(const CDiscordGuild *pGuild, const CMStringW &wszChannelId); + void BuildStatusList(const CDiscordGuild *pGuild, SESSION_INFO *si); void CreateChat(CDiscordGuild *pGuild, CDiscordUser *pUser); void ParseSpecialChars(SESSION_INFO *si, CMStringW &str); diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp index 54d6309dfe..f44f9e93f3 100644 --- a/protocols/FacebookRM/src/chat.cpp +++ b/protocols/FacebookRM/src/chat.cpp @@ -245,13 +245,15 @@ void FacebookProto::AddChat(const char *id, const wchar_t *tname) ptrW tid(mir_a2u(id)); // Create the group chat session - Chat_NewSession(GCW_PRIVMESS, m_szModuleName, tid, tname); + SESSION_INFO *si = Chat_NewSession(GCW_PRIVMESS, m_szModuleName, tid, tname); + if (!si) + return; // Send setting events - Chat_AddGroup(m_szModuleName, tid, TranslateT("Myself")); - Chat_AddGroup(m_szModuleName, tid, TranslateT("Friend")); - Chat_AddGroup(m_szModuleName, tid, TranslateT("User")); - Chat_AddGroup(m_szModuleName, tid, TranslateT("Former")); + Chat_AddGroup(si, TranslateT("Myself")); + Chat_AddGroup(si, TranslateT("Friend")); + Chat_AddGroup(si, TranslateT("User")); + Chat_AddGroup(si, TranslateT("Former")); // Finish initialization bool hideChats = getBool(FACEBOOK_KEY_HIDE_CHATS, DEFAULT_HIDE_CHATS); diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 609bc68b9f..aab963f4e9 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -320,11 +320,14 @@ wchar_t* GaduProto::gc_getchat(uin_t sender, uin_t *recipients, int recipients_c // Create new room
CMStringW wszTitle(L"#"); wszTitle.Append(sender ? senderName : TranslateT("Conference"));
- Chat_NewSession(GCW_CHATROOM, m_szModuleName, chat->id, wszTitle, chat);
+ SESSION_INFO *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, chat->id, wszTitle, chat);
+ if (!si)
+ return nullptr;
+
Chat_SetStatusbarText(m_szModuleName, chat->id, status);
// Add normal group
- Chat_AddGroup(m_szModuleName, chat->id, TranslateT("Participants"));
+ Chat_AddGroup(si, TranslateT("Participants"));
wchar_t id[32];
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index 08a2839c37..fcc1da7901 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -1272,16 +1272,17 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage *pmsg) CMStringW sID = MakeWndID(sChanName);
BYTE btOwnMode = 0;
- if (Chat_NewSession(GCW_CHATROOM, m_szModuleName, sID, sChanName)) {
+ SESSION_INFO *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, sID, sChanName);
+ if (si) {
PostIrcMessage(L"/MODE %s", sChanName);
// register the statuses
- Chat_AddGroup(m_szModuleName, sID, TranslateT("Owner"));
- Chat_AddGroup(m_szModuleName, sID, TranslateT("Admin"));
- Chat_AddGroup(m_szModuleName, sID, TranslateT("Op"));
- Chat_AddGroup(m_szModuleName, sID, TranslateT("Halfop"));
- Chat_AddGroup(m_szModuleName, sID, TranslateT("Voice"));
- Chat_AddGroup(m_szModuleName, sID, TranslateT("Normal"));
+ Chat_AddGroup(si, TranslateT("Owner"));
+ Chat_AddGroup(si, TranslateT("Admin"));
+ Chat_AddGroup(si, TranslateT("Op"));
+ Chat_AddGroup(si, TranslateT("Halfop"));
+ Chat_AddGroup(si, TranslateT("Voice"));
+ Chat_AddGroup(si, TranslateT("Normal"));
{
int k = 0;
CMStringW sTemp = GetWord(sNamesList, k);
@@ -2376,7 +2377,7 @@ bool CIrcProto::DoOnConnect(const CIrcMessage*) }
}
- Chat_AddGroup(m_szModuleName, SERVERWINDOW, TranslateT("Normal"));
+ Chat_AddGroup(m_pServer, TranslateT("Normal"));
Chat_Control(m_szModuleName, SERVERWINDOW, SESSION_ONLINE);
CallFunctionAsync(sttMainThrdOnConnect, this);
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index 04b26ec02f..3dd16b0769 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -201,7 +201,7 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info) con = Netlib_OpenConnection(m_hNetlibUser, &ncon); if (con == nullptr) { wchar_t szTemp[300]; - mir_snwprintf(szTemp, L"%c5%s %c%s%c (%S: %u).", irc::COLOR, TranslateT("Failed to connect to"), irc::BOLD, si.sNetwork.c_str(), irc::BOLD, si.sServer.c_str(), si.iPort); + mir_snwprintf(szTemp, L"%c5%s %c%s%c (%S: %u).", irc::COLOR, TranslateT("Failed to connect to"), irc::BOLD, m_sessionInfo.sNetwork.c_str(), irc::BOLD, m_sessionInfo.sServer.c_str(), m_sessionInfo.iPort); DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, nullptr, szTemp, nullptr, nullptr, NULL, true, false); return false; } diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 380984a4f9..7335225248 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -205,7 +205,7 @@ void CIrcProto::OnModulesLoaded() HookProtoEvent(ME_GC_EVENT, &CIrcProto::GCEventHook);
HookProtoEvent(ME_GC_BUILDMENU, &CIrcProto::GCMenuHook);
- Chat_NewSession(GCW_SERVER, m_szModuleName, SERVERWINDOW, _A2T(m_network));
+ m_pServer = Chat_NewSession(GCW_SERVER, m_szModuleName, SERVERWINDOW, _A2T(m_network));
if (m_useServer && !m_hideServerWindow)
Chat_Control(m_szModuleName, SERVERWINDOW, WINDOW_VISIBLE);
diff --git a/protocols/IRCG/src/ircproto.h b/protocols/IRCG/src/ircproto.h index 559a919a34..6f28678664 100644 --- a/protocols/IRCG/src/ircproto.h +++ b/protocols/IRCG/src/ircproto.h @@ -170,7 +170,8 @@ struct CIrcProto : public PROTO<CIrcProto> CMStringW m_statusMessage; int m_iTempCheckTime; - CIrcSessionInfo si; + CIrcSessionInfo m_sessionInfo; + SESSION_INFO *m_pServer; int m_portCount; DWORD m_bConnectRequested; diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 7d622ca3a0..fe3908b465 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -945,7 +945,7 @@ void __cdecl CIrcProto::ConnectServerThread(void*) Sleep(100);
{
mir_cslock lock(m_csSession);
- Connect(si);
+ Connect(m_sessionInfo);
}
if (IsConnected()) {
if (m_mySpecifiedHost[0])
@@ -977,17 +977,17 @@ void __cdecl CIrcProto::DisconnectServerThread(void*) void CIrcProto::ConnectToServer(void)
{
m_portCount = atoi(m_portStart);
- si.sServer = GetWord(m_serverName, 0);
- si.iPort = m_portCount;
- si.sNick = m_nick;
- si.sUserID = m_userID;
- si.sFullName = m_name;
- si.sPassword = m_password;
- si.bIdentServer = ((m_ident) ? (true) : (false));
- si.iIdentServerPort = _wtoi(m_identPort);
- si.sIdentServerType = m_identSystem;
- si.m_iSSL = m_iSSL;
- si.sNetwork = m_network;
+ m_sessionInfo.sServer = GetWord(m_serverName, 0);
+ m_sessionInfo.iPort = m_portCount;
+ m_sessionInfo.sNick = m_nick;
+ m_sessionInfo.sUserID = m_userID;
+ m_sessionInfo.sFullName = m_name;
+ m_sessionInfo.sPassword = m_password;
+ m_sessionInfo.bIdentServer = ((m_ident) ? (true) : (false));
+ m_sessionInfo.iIdentServerPort = _wtoi(m_identPort);
+ m_sessionInfo.sIdentServerType = m_identSystem;
+ m_sessionInfo.m_iSSL = m_iSSL;
+ m_sessionInfo.sNetwork = m_network;
bPerformDone = false;
bTempDisableCheck = false;
@@ -1004,7 +1004,7 @@ void CIrcProto::ConnectToServer(void) InterlockedIncrement((long *)&m_bConnectRequested);
wchar_t szTemp[300];
- mir_snwprintf(szTemp, L"\033%s %c%s%c (%S: %u)", TranslateT("Connecting to"), irc::BOLD, si.sNetwork.c_str(), irc::BOLD, si.sServer.c_str(), si.iPort);
+ mir_snwprintf(szTemp, L"\033%s %c%s%c (%S: %u)", TranslateT("Connecting to"), irc::BOLD, m_sessionInfo.sNetwork.c_str(), irc::BOLD, m_sessionInfo.sServer.c_str(), m_sessionInfo.iPort);
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, nullptr, szTemp, nullptr, nullptr, NULL, true, false);
}
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index f873fcbde7..1e2079c0ae 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -161,7 +161,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) item->bChatActive = true;
for (int i = _countof(sttStatuses) - 1; i >= 0; i--)
- Chat_AddGroup(m_szModuleName, item->jid, TranslateW(sttStatuses[i]));
+ Chat_AddGroup(si, TranslateW(sttStatuses[i]));
Chat_Control(m_szModuleName, item->jid, (item->bAutoJoin && m_bAutoJoinHidden) ? WINDOW_HIDDEN : SESSION_INITDONE);
Chat_Control(m_szModuleName, item->jid, SESSION_ONLINE);
diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp index 49d172e9bb..938441ee00 100644 --- a/protocols/MRA/src/MraChat.cpp +++ b/protocols/MRA/src/MraChat.cpp @@ -28,11 +28,12 @@ INT_PTR CMraProto::MraChatSessionNew(MCONTACT hContact) CMStringW wszEMail;
mraGetStringW(hContact, "e-mail", wszEMail);
- if (Chat_NewSession(GCW_CHATROOM, m_szModuleName, wszEMail, Clist_GetContactDisplayName(hContact), (void*)hContact))
+ SESSION_INFO *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, wszEMail, Clist_GetContactDisplayName(hContact), (void*)hContact);
+ if (si == nullptr)
return 1;
for (auto &it : lpwszStatuses)
- Chat_AddGroup(m_szModuleName, wszEMail, TranslateW(it));
+ Chat_AddGroup(si, TranslateW(it));
Chat_Control(m_szModuleName, wszEMail, SESSION_INITDONE);
Chat_Control(m_szModuleName, wszEMail, SESSION_ONLINE);
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index 7405e4a4b3..200cdc4b27 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -58,10 +58,13 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p wcsncpy(szName, _A2T(pszTopic), _countof(szName));
else mir_snwprintf(szName, L"%s %s%d",
m_tszUserName, TranslateT("Chat #"), m_chatID);
- Chat_NewSession(GCW_CHATROOM, m_szModuleName, info->mChatID, szName);
+
+ SESSION_INFO *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, info->mChatID, szName);
+ if (!si)
+ return 1;
for (auto &it : m_ptszRoles)
- Chat_AddGroup(m_szModuleName, info->mChatID, TranslateW(it));
+ Chat_AddGroup(si, TranslateW(it));
Chat_Control(m_szModuleName, info->mChatID, SESSION_INITDONE);
Chat_Control(m_szModuleName, info->mChatID, SESSION_ONLINE);
diff --git a/protocols/MinecraftDynmap/src/chat.cpp b/protocols/MinecraftDynmap/src/chat.cpp index 0027ba3e44..50be132450 100644 --- a/protocols/MinecraftDynmap/src/chat.cpp +++ b/protocols/MinecraftDynmap/src/chat.cpp @@ -123,14 +123,13 @@ INT_PTR MinecraftDynmapProto::OnJoinChat(WPARAM,LPARAM suppress) ptrW tszTitle(mir_a2u_cp(m_title.c_str(), CP_UTF8)); // Create the group chat session - Chat_NewSession(GCW_PRIVMESS, m_szModuleName, m_tszUserName, tszTitle); - - if (m_iStatus == ID_STATUS_OFFLINE) + SESSION_INFO *si = Chat_NewSession(GCW_PRIVMESS, m_szModuleName, m_tszUserName, tszTitle); + if (!si || m_iStatus == ID_STATUS_OFFLINE) return 0; // Create a group - Chat_AddGroup(m_szModuleName, m_tszUserName, TranslateT("Admin")); - Chat_AddGroup(m_szModuleName, m_tszUserName, TranslateT("Normal")); + Chat_AddGroup(si, TranslateT("Admin")); + Chat_AddGroup(si, TranslateT("Normal")); // Note: Initialization will finish up in SetChatStatus, called separately if (!suppress) diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp index 3c47ff23dd..5919ab285c 100644 --- a/protocols/Omegle/src/chat.cpp +++ b/protocols/Omegle/src/chat.cpp @@ -242,14 +242,13 @@ void OmegleProto::DeleteChatContact(const wchar_t *name) INT_PTR OmegleProto::OnJoinChat(WPARAM, LPARAM suppress)
{
// Create the group chat session
- Chat_NewSession(GCW_PRIVMESS, m_szModuleName, m_tszUserName, m_tszUserName);
-
- if (m_iStatus == ID_STATUS_OFFLINE)
+ SESSION_INFO *si = Chat_NewSession(GCW_PRIVMESS, m_szModuleName, m_tszUserName, m_tszUserName);
+ if (!si || m_iStatus == ID_STATUS_OFFLINE)
return 0;
// Create a group
- Chat_AddGroup(m_szModuleName, m_tszUserName, TranslateT("Admin"));
- Chat_AddGroup(m_szModuleName, m_tszUserName, TranslateT("Normal"));
+ Chat_AddGroup(si, TranslateT("Admin"));
+ Chat_AddGroup(si, TranslateT("Normal"));
SetTopic();
diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp index baf277cbf1..c08924a9a6 100644 --- a/protocols/Sametime/src/conference.cpp +++ b/protocols/Sametime/src/conference.cpp @@ -112,10 +112,12 @@ void mwServiceConf_conf_opened(mwConference* conf, GList* members) ptrW tszConfTitle(mir_utf8decodeW(mwConference_getTitle(conf)));
// create new chat session
- Chat_NewSession(GCW_CHATROOM, proto->m_szModuleName, tszConfId, tszConfTitle);
+ SESSION_INFO *si = Chat_NewSession(GCW_CHATROOM, proto->m_szModuleName, tszConfId, tszConfTitle);
+ if (!si)
+ return;
// add a group
- Chat_AddGroup(proto->m_szModuleName, tszConfId, TranslateT("Normal"));
+ Chat_AddGroup(si, TranslateT("Normal"));
// add users
GCEVENT gce = { proto->m_szModuleName, tszConfId, GC_EVENT_JOIN };
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 83b851aa5f..042984d39e 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -41,11 +41,13 @@ MCONTACT CSkypeProto::FindChatRoom(const char *chatname) void CSkypeProto::StartChatRoom(const wchar_t *tid, const wchar_t *tname)
{
// Create the group chat session
- Chat_NewSession(GCW_CHATROOM, m_szModuleName, tid, tname);
+ SESSION_INFO *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, tid, tname);
+ if (!si)
+ return;
// Create a user statuses
- Chat_AddGroup(m_szModuleName, tid, TranslateT("Admin"));
- Chat_AddGroup(m_szModuleName, tid, TranslateT("User"));
+ Chat_AddGroup(si, TranslateT("Admin"));
+ Chat_AddGroup(si, TranslateT("User"));
// Finish initialization
Chat_Control(m_szModuleName, tid, (getBool("HideChats", 1) ? WINDOW_HIDDEN : SESSION_INITDONE));
diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp index 6ff50e7b28..230aafc8ed 100644 --- a/protocols/Twitter/src/chat.cpp +++ b/protocols/Twitter/src/chat.cpp @@ -113,13 +113,12 @@ void TwitterProto::DeleteChatContact(const char *name) INT_PTR TwitterProto::OnJoinChat(WPARAM, LPARAM suppress)
{
// ***** Create the group chat session
- Chat_NewSession(GCW_CHATROOM, m_szModuleName, m_tszUserName, m_tszUserName);
-
- if (m_iStatus != ID_STATUS_ONLINE)
+ SESSION_INFO *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, m_tszUserName, m_tszUserName);
+ if (!si || m_iStatus != ID_STATUS_ONLINE)
return 0;
// ***** Create a group
- Chat_AddGroup(m_szModuleName, m_tszUserName, TranslateT("Normal"));
+ Chat_AddGroup(si, TranslateT("Normal"));
// ***** Hook events
HookProtoEvent(ME_GC_EVENT, &TwitterProto::OnChatOutgoing);
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 370a6bc312..46c990b205 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -69,7 +69,7 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) m_chats.insert(c);
for (int i = _countof(sttStatuses) - 1; i >= 0; i--)
- Chat_AddGroup(m_szModuleName, sid, TranslateW(sttStatuses[i]));
+ Chat_AddGroup(si, TranslateW(sttStatuses[i]));
setDword(si->hContact, "vk_chat_id", id);
|