summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/AimOscar/src/chat.cpp15
-rw-r--r--protocols/Discord/src/dispatch.cpp12
-rw-r--r--protocols/Discord/src/groupchat.cpp10
-rw-r--r--protocols/Discord/src/guilds.cpp6
-rw-r--r--protocols/Discord/src/server.cpp3
-rw-r--r--protocols/FacebookRM/src/chat.cpp21
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp6
-rw-r--r--protocols/Gadu-Gadu/src/groupchat.cpp33
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp12
-rw-r--r--protocols/IRCG/src/scripting.cpp27
-rw-r--r--protocols/IRCG/src/services.cpp6
-rw-r--r--protocols/IRCG/src/tools.cpp7
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp54
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp16
-rw-r--r--protocols/MRA/src/MraChat.cpp11
-rw-r--r--protocols/MSN/src/msn_chat.cpp50
-rw-r--r--protocols/MinecraftDynmap/src/chat.cpp18
-rw-r--r--protocols/Omegle/src/chat.cpp18
-rw-r--r--protocols/Sametime/src/conference.cpp42
-rw-r--r--protocols/SkypeWeb/src/skype_chatrooms.cpp35
-rw-r--r--protocols/Twitter/src/chat.cpp30
-rw-r--r--protocols/VKontakte/src/vk_chats.cpp19
-rw-r--r--protocols/WhatsApp/src/chat.cpp30
23 files changed, 196 insertions, 285 deletions
diff --git a/protocols/AimOscar/src/chat.cpp b/protocols/AimOscar/src/chat.cpp
index 24df22d77b..7071c9a3da 100644
--- a/protocols/AimOscar/src/chat.cpp
+++ b/protocols/AimOscar/src/chat.cpp
@@ -59,10 +59,8 @@ void CAimProto::chat_event(const char* id, const char* sn, int evt, const wchar_
MCONTACT hContact = contact_from_sn(sn);
wchar_t *nick = hContact ? (wchar_t*)pcli->pfnGetContactDisplayName(hContact, 0) : snt;
- GCDEST gcd = { m_szModuleName, idt, evt };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, idt, evt };
gce.dwFlags = GCEF_ADDTOLOG;
- gce.pDest = &gcd;
gce.ptszNick = nick;
gce.ptszUID = snt;
gce.bIsMe = _stricmp(sn, m_username) == 0;
@@ -84,14 +82,15 @@ int CAimProto::OnGCEvent(WPARAM, LPARAM lParam)
GCHOOK *gch = (GCHOOK*)lParam;
if (!gch) return 1;
- if (mir_strcmp(gch->pDest->pszModule, m_szModuleName)) return 0;
+ if (mir_strcmp(gch->pszModule, m_szModuleName))
+ return 0;
- char *id = mir_u2a(gch->pDest->ptszID);
+ char *id = mir_u2a(gch->ptszID);
chat_list_item* item = find_chat_by_id(id);
+ if (item == NULL)
+ return 0;
- if (item == NULL) return 0;
-
- switch (gch->pDest->iType) {
+ switch (gch->iType) {
case GC_SESSION_TERMINATE:
aim_sendflap(item->hconn, 0x04, 0, NULL, item->seqno);
Netlib_Shutdown(item->hconn);
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp
index 2046ae149d..f9d38405cf 100644
--- a/protocols/Discord/src/dispatch.cpp
+++ b/protocols/Discord/src/dispatch.cpp
@@ -141,8 +141,7 @@ void CDiscordProto::OnCommandChannelUpdated(const JSONNode &pRoot)
CMStringW wszTopic = pRoot["topic"].as_mstring();
Chat_SetStatusbarText(m_szModuleName, pUser->wszUsername, wszTopic);
- GCDEST gcd = { m_szModuleName, pUser->wszUsername, GC_EVENT_TOPIC };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, pUser->wszUsername, GC_EVENT_TOPIC };
gce.ptszText = wszTopic;
gce.time = time(0);
Chat_Event(&gce);
@@ -275,8 +274,7 @@ void CDiscordProto::OnCommandGuildMemberRemoved(const JSONNode &pRoot)
if (pUser.guildId != pGuild->id)
continue;
- GCDEST gcd = { m_szModuleName, pUser.wszUsername, GC_EVENT_PART };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, pUser.wszUsername, GC_EVENT_PART };
gce.time = time(0);
gce.ptszUID = wszUserId;
Chat_Event(&gce);
@@ -311,8 +309,7 @@ void CDiscordProto::OnCommandGuildMemberUpdated(const JSONNode &pRoot)
wszOldNick = ui->pszNick;
}
- GCDEST gcd = { m_szModuleName, pUser.wszUsername, GC_EVENT_NICK };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, pUser.wszUsername, GC_EVENT_NICK };
gce.time = time(0);
gce.ptszUID = wszUserId;
gce.ptszNick = wszOldNick;
@@ -421,8 +418,7 @@ void CDiscordProto::OnCommandMessage(const JSONNode &pRoot)
ParseSpecialChars(si, wszText);
- GCDEST gcd = { m_szModuleName, pUser->wszUsername, GC_EVENT_MESSAGE };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, pUser->wszUsername, GC_EVENT_MESSAGE };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszUID = wszUserId;
gce.ptszText = wszText;
diff --git a/protocols/Discord/src/groupchat.cpp b/protocols/Discord/src/groupchat.cpp
index 729afc84f0..825d8267d2 100644
--- a/protocols/Discord/src/groupchat.cpp
+++ b/protocols/Discord/src/groupchat.cpp
@@ -82,7 +82,7 @@ void CDiscordProto::Chat_SendPrivateMessage(GCHOOK *gch)
return;
setId(hContact, DB_KEY_ID, userId);
- setId(hContact, DB_KEY_CHANNELID, _wtoi64(gch->pDest->ptszID));
+ setId(hContact, DB_KEY_CHANNELID, _wtoi64(gch->ptszID));
setWString(hContact, "Nick", gch->ptszNick);
db_set_b(hContact, "CList", "Hidden", 1);
db_set_dw(hContact, "Ignore", "Mask1", 0);
@@ -94,7 +94,7 @@ void CDiscordProto::Chat_SendPrivateMessage(GCHOOK *gch)
void CDiscordProto::Chat_ProcessLogMenu(GCHOOK *gch)
{
- CDiscordUser *pUser = FindUserByChannel(_wtoi64(gch->pDest->ptszID));
+ CDiscordUser *pUser = FindUserByChannel(_wtoi64(gch->ptszID));
if (pUser == nullptr)
return;
@@ -154,10 +154,10 @@ int CDiscordProto::GroupchatEventHook(WPARAM, LPARAM lParam)
if (gch == nullptr)
return 0;
- if (mir_strcmpi(gch->pDest->pszModule, m_szModuleName))
+ if (mir_strcmpi(gch->pszModule, m_szModuleName))
return 0;
- switch (gch->pDest->iType) {
+ switch (gch->iType) {
case GC_USER_MESSAGE:
if (mir_wstrlen(gch->ptszText) > 0) {
rtrimw(gch->ptszText);
@@ -167,7 +167,7 @@ int CDiscordProto::GroupchatEventHook(WPARAM, LPARAM lParam)
Chat_UnescapeTags(wszText);
JSONNode body; body << WCHAR_PARAM("content", wszText);
- CMStringA szUrl(FORMAT, "/channels/%S/messages", gch->pDest->ptszID);
+ CMStringA szUrl(FORMAT, "/channels/%S/messages", gch->ptszID);
Push(new AsyncHttpRequest(this, REQUEST_POST, szUrl, &CDiscordProto::OnReceiveMessage, &body));
}
}
diff --git a/protocols/Discord/src/guilds.cpp b/protocols/Discord/src/guilds.cpp
index 4b89937cd6..dcc19ad354 100644
--- a/protocols/Discord/src/guilds.cpp
+++ b/protocols/Discord/src/guilds.cpp
@@ -112,8 +112,7 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS
if (!wszTopic.IsEmpty()) {
Chat_SetStatusbarText(m_szModuleName, wszChannelId, wszTopic);
- GCDEST gcd = { m_szModuleName, wszChannelId, GC_EVENT_TOPIC };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, wszChannelId, GC_EVENT_TOPIC };
gce.time = time(0);
gce.ptszText = wszTopic;
Chat_Event(&gce);
@@ -147,8 +146,7 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS
void CDiscordProto::ApplyUsersToChannel(CDiscordGuild *pGuild, const CDiscordUser &pUser)
{
- GCDEST gcd = { m_szModuleName, pUser.wszUsername, GC_EVENT_JOIN };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, pUser.wszUsername, GC_EVENT_JOIN };
gce.time = time(0);
gce.dwFlags = GCEF_SILENT;
diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp
index 60d713d4f2..1d48a3dc04 100644
--- a/protocols/Discord/src/server.cpp
+++ b/protocols/Discord/src/server.cpp
@@ -117,8 +117,7 @@ void CDiscordProto::OnReceiveHistory(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest
else {
ParseSpecialChars(si, wszText);
- GCDEST gcd = { m_szModuleName, pUser->wszUsername, GC_EVENT_MESSAGE };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, pUser->wszUsername, GC_EVENT_MESSAGE };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszUID = wszUserId;
gce.ptszText = wszText;
diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp
index 880077eb7d..966a7a0d76 100644
--- a/protocols/FacebookRM/src/chat.cpp
+++ b/protocols/FacebookRM/src/chat.cpp
@@ -35,8 +35,7 @@ void FacebookProto::UpdateChat(const char *chat_id, const char *id, const char *
ptrW ttext(mir_a2u_cp(smessage.c_str(), CP_UTF8));
ptrW tchat_id(mir_a2u(chat_id));
- GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_MESSAGE };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, tchat_id, GC_EVENT_MESSAGE };
gce.ptszText = ttext;
gce.time = timestamp ? timestamp : ::time(NULL);
if (id != NULL)
@@ -64,19 +63,19 @@ int FacebookProto::OnGCEvent(WPARAM, LPARAM lParam)
{
GCHOOK *hook = reinterpret_cast<GCHOOK*>(lParam);
- if (mir_strcmp(hook->pDest->pszModule, m_szModuleName))
+ if (mir_strcmp(hook->pszModule, m_szModuleName))
return 0;
// Ignore for special chatrooms
- if (!mir_wstrcmp(hook->pDest->ptszID, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM)))
+ if (!mir_wstrcmp(hook->ptszID, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM)))
return 0;
- switch (hook->pDest->iType)
+ switch (hook->iType)
{
case GC_USER_MESSAGE:
{
std::string msg = _T2A(hook->ptszText, CP_UTF8);
- std::string chat_id = _T2A(hook->pDest->ptszID, CP_UTF8);
+ std::string chat_id = _T2A(hook->ptszID, CP_UTF8);
if (isOnline()) {
debugLogA(" > Chat - Outgoing message");
@@ -169,9 +168,7 @@ void FacebookProto::AddChatContact(const char *chat_id, const chatroom_participa
ptrW tnick(mir_a2u_cp(user.nick.c_str(), CP_UTF8));
ptrW tid(mir_a2u(user.user_id.c_str()));
- GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_JOIN };
- GCEVENT gce = { &gcd };
- gce.pDest = &gcd;
+ GCEVENT gce = { m_szModuleName, tchat_id, GC_EVENT_JOIN };
gce.dwFlags = addToLog ? GCEF_ADDTOLOG : 0;
gce.ptszNick = tnick;
gce.ptszUID = tid;
@@ -208,8 +205,7 @@ void FacebookProto::RemoveChatContact(const char *chat_id, const char *id, const
ptrW tnick(mir_a2u_cp(name, CP_UTF8));
ptrW tid(mir_a2u(id));
- GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_PART };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, tchat_id, GC_EVENT_PART };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tnick;
gce.ptszUID = tid;
@@ -418,8 +414,7 @@ void FacebookProto::UpdateNotificationsChatRoom(facebook_notification *notificat
ptrW idT(mir_wstrdup(_A2W(FACEBOOK_NOTIFICATIONS_CHATROOM)));
ptrW messageT(mir_a2u_cp(message.c_str(), CP_UTF8));
- GCDEST gcd = { m_szModuleName, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM), GC_EVENT_MESSAGE };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, _A2W(FACEBOOK_NOTIFICATIONS_CHATROOM), GC_EVENT_MESSAGE };
gce.ptszText = messageT;
gce.time = notification->time ? notification->time : ::time(NULL);
gce.bIsMe = false;
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index b33cab8717..0fb92afbe2 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -828,8 +828,7 @@ retry:
wchar_t id[32];
UIN2IDT(e->event.msg.sender, id);
- GCDEST gcd = { m_szModuleName, chat, GC_EVENT_MESSAGE };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, chat, GC_EVENT_MESSAGE };
time_t t = time(NULL);
gce.ptszUID = id;
wchar_t* messageT = mir_utf8decodeW(e->event.msg.message);
@@ -892,8 +891,7 @@ retry:
wchar_t id[32];
UIN2IDT(getDword(GG_KEY_UIN, 0), id);
- GCDEST gcd = { m_szModuleName, chat, GC_EVENT_MESSAGE };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, chat, GC_EVENT_MESSAGE };
gce.ptszUID = id;
wchar_t* messageT = mir_utf8decodeW(e->event.multilogon_msg.message);
gce.ptszText = messageT;
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp
index 2463ef22ca..f916ee62fd 100644
--- a/protocols/Gadu-Gadu/src/groupchat.cpp
+++ b/protocols/Gadu-Gadu/src/groupchat.cpp
@@ -113,18 +113,17 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam)
// Check if we got our protocol, and fields are set
if (!gch
- || !gch->pDest
- || !gch->pDest->ptszID
- || !gch->pDest->pszModule
- || mir_strcmpi(gch->pDest->pszModule, m_szModuleName)
+ || !gch->ptszID
+ || !gch->pszModule
+ || mir_strcmpi(gch->pszModule, m_szModuleName)
|| !(uin = getDword(GG_KEY_UIN, 0))
- || !(chat = gc_lookup(gch->pDest->ptszID)))
+ || !(chat = gc_lookup(gch->ptszID)))
return 0;
// Window terminated (Miranda exit)
- if (gch->pDest->iType == SESSION_TERMINATE)
+ if (gch->iType == SESSION_TERMINATE)
{
- debugLogW(L"gc_event(): Terminating chat %x, id %s from chat window...", chat, gch->pDest->ptszID);
+ debugLogW(L"gc_event(): Terminating chat %x, id %s from chat window...", chat, gch->ptszID);
// Destroy chat entry
free(chat->recipients);
list_remove(&chats, chat, 1);
@@ -134,7 +133,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam)
MCONTACT hNext = db_find_next(hContact);
DBVARIANT dbv;
if (!getWString(hContact, "ChatRoomID", &dbv)) {
- if (dbv.ptszVal && !mir_wstrcmp(gch->pDest->ptszID, dbv.ptszVal))
+ if (dbv.ptszVal && !mir_wstrcmp(gch->ptszID, dbv.ptszVal))
db_delete_contact(hContact);
db_free(&dbv);
}
@@ -144,13 +143,12 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam)
}
// Message typed / send only if online
- if (isonline() && (gch->pDest->iType == GC_USER_MESSAGE) && gch->ptszText) {
+ if (isonline() && (gch->iType == GC_USER_MESSAGE) && gch->ptszText) {
wchar_t id[32];
UIN2IDT(uin, id);
DBVARIANT dbv;
- GCDEST gcd = { m_szModuleName, gch->pDest->ptszID, GC_EVENT_MESSAGE };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, gch->ptszID, GC_EVENT_MESSAGE };
gce.ptszUID = id;
gce.ptszText = gch->ptszText;
wchar_t* nickT;
@@ -169,7 +167,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam)
gce.time = time(NULL);
gce.bIsMe = 1;
gce.dwFlags = GCEF_ADDTOLOG;
- debugLogW(L"gc_event(): Sending conference message to room %s, \"%s\".", gch->pDest->ptszID, gch->ptszText);
+ debugLogW(L"gc_event(): Sending conference message to room %s, \"%s\".", gch->ptszID, gch->ptszText);
Chat_Event(&gce);
mir_free(nickT);
@@ -181,13 +179,13 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam)
}
// Privmessage selected
- if (gch->pDest->iType == GC_USER_PRIVMESS)
+ if (gch->iType == GC_USER_PRIVMESS)
{
MCONTACT hContact = NULL;
if ((uin = _wtoi(gch->ptszUID)) && (hContact = getcontact(uin, 1, 0, NULL)))
CallService(MS_MSG_SENDMESSAGE, hContact, 0);
}
- debugLogW(L"gc_event(): Unhandled event %d, chat %x, uin %d, text \"%s\".", gch->pDest->iType, chat, uin, gch->ptszText);
+ debugLogW(L"gc_event(): Unhandled event %d, chat %x, uin %d, text \"%s\".", gch->iType, chat, uin, gch->ptszText);
return 0;
}
@@ -316,8 +314,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou
// Add normal group
Chat_AddGroup(m_szModuleName, chat->id, TranslateT("Participants"));
- GCDEST gcd = { m_szModuleName, chat->id, GC_EVENT_JOIN };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, chat->id, GC_EVENT_JOIN };
gce.ptszUID = id;
gce.dwFlags = GCEF_ADDTOLOG;
@@ -603,9 +600,7 @@ int GGPROTO::gc_changenick(MCONTACT hContact, wchar_t *ptszNick)
wchar_t id[32];
UIN2IDT(uin, id);
- GCDEST gcd = { m_szModuleName, chat->id, GC_EVENT_NICK };
- GCEVENT gce = { &gcd };
- gce.pDest = &gcd;
+ GCEVENT gce = { m_szModuleName, chat->id, GC_EVENT_NICK };
gce.ptszUID = id;
gce.ptszText = ptszNick;
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index df1316ec8b..a7d5974d56 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -1297,13 +1297,12 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg)
while (PrefixToStatus(sTemp[0]) != pwszNormal)
sTemp.Delete(0, 1);
- GCDEST gcd = { m_szModuleName, sID, GC_EVENT_JOIN };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, sID, GC_EVENT_JOIN };
gce.ptszUID = sTemp;
gce.ptszNick = sTemp;
gce.ptszStatus = sStat;
- BOOL bIsMe = (!mir_wstrcmpi(gce.ptszNick, m_info.sNick)) ? TRUE : FALSE;
- if (bIsMe) {
+ gce.bIsMe = (!mir_wstrcmpi(gce.ptszNick, m_info.sNick)) ? TRUE : FALSE;
+ if (gce.bIsMe) {
char BitNr = -1;
switch (sTemp2[0]) {
case '+': BitNr = 0; break;
@@ -1317,10 +1316,11 @@ bool CIrcProto::OnIrc_ENDNAMES(const CIrcMessage* pmsg)
else
btOwnMode = 0;
}
- gce.bIsMe = bIsMe;
- gce.time = bIsMe ? time(0) : 0;
+ gce.time = gce.bIsMe ? time(0) : 0;
Chat_Event(&gce);
+
DoEvent(GC_EVENT_SETCONTACTSTATUS, sChanName, sTemp, NULL, NULL, NULL, ID_STATUS_ONLINE, FALSE, FALSE);
+
// fix for networks like freshirc where they allow more than one prefix
if (PrefixToStatus(sTemp2[0]) != pwszNormal) {
sTemp2.Delete(0, 1);
diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp
index e4ef002172..d510422a84 100644
--- a/protocols/IRCG/src/scripting.cpp
+++ b/protocols/IRCG/src/scripting.cpp
@@ -59,9 +59,8 @@ static void __stdcall OnHook(void * pi)
GCHOOK* gch = (GCHOOK*)pi;
free(gch->ptszUID);
free(gch->ptszText);
- free((void*)gch->pDest->ptszID);
- free((void*)gch->pDest->pszModule);
- delete gch->pDest;
+ free((void*)gch->ptszID);
+ free((void*)gch->pszModule);
delete gch;
}
@@ -78,28 +77,28 @@ INT_PTR __cdecl CIrcProto::Scripting_InsertGuiOut(WPARAM, LPARAM lParam)
if (m_scriptingEnabled && gch) {
GCHOOK* gchook = new GCHOOK;
- gchook->pDest = new GCDEST;
-
gchook->dwData = gch->dwData;
- gchook->pDest->iType = gch->pDest->iType;
+ gchook->iType = gch->iType;
if (gch->ptszText)
gchook->ptszText = wcsdup(gch->ptszText);
- else gchook->ptszText = NULL;
+ else
+ gchook->ptszText = NULL;
if (gch->ptszUID)
gchook->ptszUID = wcsdup(gch->ptszUID);
else
gchook->ptszUID = NULL;
- if (gch->pDest->ptszID) {
- CMStringW S = MakeWndID(gch->pDest->ptszID);
- gchook->pDest->ptszID = wcsdup(S.c_str());
+ if (gch->ptszID) {
+ CMStringW S = MakeWndID(gch->ptszID);
+ gchook->ptszID = wcsdup(S.c_str());
}
- else gchook->pDest->ptszID = NULL;
+ else gchook->ptszID = NULL;
- if (gch->pDest->pszModule)
- gchook->pDest->pszModule = _strdup(gch->pDest->pszModule);
- else gchook->pDest->pszModule = NULL;
+ if (gch->pszModule)
+ gchook->pszModule = _strdup(gch->pszModule);
+ else
+ gchook->pszModule = NULL;
mir_forkthread(GuiOutThread, gchook);
return 0;
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp
index df95b79dbc..144b98f9bb 100644
--- a/protocols/IRCG/src/services.cpp
+++ b/protocols/IRCG/src/services.cpp
@@ -473,13 +473,13 @@ int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam)
// handle the hook
if (gch) {
- if (!mir_strcmpi(gch->pDest->pszModule, m_szModuleName)) {
- wchar_t *p1 = mir_wstrdup(gch->pDest->ptszID);
+ if (!mir_strcmpi(gch->pszModule, m_szModuleName)) {
+ wchar_t *p1 = mir_wstrdup(gch->ptszID);
wchar_t *p2 = wcsstr(p1, L" - ");
if (p2)
*p2 = '\0';
- switch (gch->pDest->iType) {
+ switch (gch->iType) {
case GC_SESSION_TERMINATE:
FreeWindowItemData(p1, (CHANNELINFO*)gch->dwData);
break;
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp
index 3efe9a248e..2ae539db46 100644
--- a/protocols/IRCG/src/tools.cpp
+++ b/protocols/IRCG/src/tools.cpp
@@ -380,7 +380,6 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t*
const wchar_t* pszText, const wchar_t* pszStatus, const wchar_t* pszUserInfo,
DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe, time_t timestamp)
{
- GCDEST gcd = { m_szModuleName, NULL, iEvent };
CMStringW sID;
CMStringW sText;
@@ -390,16 +389,16 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t* pszWindow, const wchar_t*
if (pszText)
sText = DoColorCodes(pszText, FALSE, TRUE);
+ GCEVENT gce = { m_szModuleName, NULL, iEvent };
if (pszWindow) {
if (mir_wstrcmpi(pszWindow, SERVERWINDOW))
sID = pszWindow + (CMStringW)L" - " + m_info.sNetwork;
else
sID = pszWindow;
- gcd.ptszID = (wchar_t*)sID.c_str();
+ gce.ptszID = (wchar_t*)sID.c_str();
}
- else gcd.ptszID = NULL;
+ else gce.ptszID = NULL;
- GCEVENT gce = { &gcd };
gce.ptszStatus = pszStatus;
gce.dwFlags = (bAddToLog) ? GCEF_ADDTOLOG : 0;
gce.ptszNick = pszNick;
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index 7958016283..dc92fabb9b 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -229,8 +229,7 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus
if (!buf.IsEmpty()) {
buf.Replace(L"%", L"%%");
- GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_INFORMATION };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, item->jid, GC_EVENT_INFORMATION };
gce.ptszNick = user->m_tszResourceName;
gce.ptszUID = user->m_tszResourceName;
gce.ptszText = buf;
@@ -256,8 +255,7 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t
if (myNick == nullptr)
myNick = JabberNickFromJID(m_szJabberJID);
- GCDEST gcd = { m_szModuleName, item->jid };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, item->jid };
gce.ptszNick = nick;
gce.ptszUID = resource;
if (jid != nullptr)
@@ -268,11 +266,12 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t
gce.time = time(0);
}
- switch (gcd.iType = action) {
+ switch (gce.iType = action) {
case GC_EVENT_PART: break;
case GC_EVENT_KICK:
gce.ptszStatus = TranslateT("Moderator");
break;
+
default:
mir_cslock lck(m_csLists);
for (int i = 0; i < item->arResources.getCount(); i++) {
@@ -281,7 +280,7 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t
if (action != GC_EVENT_JOIN) {
switch (action) {
case 0:
- gcd.iType = GC_EVENT_ADDSTATUS;
+ gce.iType = GC_EVENT_ADDSTATUS;
case GC_EVENT_REMOVESTATUS:
gce.dwFlags &= ~GCEF_ADDTOLOG;
}
@@ -303,10 +302,10 @@ void CJabberProto::GcLogUpdateMemberStatus(JABBER_LIST_ITEM *item, const wchar_t
flags += GC_SSE_ONLINE;
Chat_SetStatusEx(m_szModuleName, item->jid, flags, nick);
+ gce.iType = GC_EVENT_SETCONTACTSTATUS;
gce.ptszText = nick;
gce.ptszUID = resource;
gce.dwItemData = statusToSet;
- gcd.iType = GC_EVENT_SETCONTACTSTATUS;
Chat_Event(&gce);
}
}
@@ -1220,66 +1219,65 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g
switch (gch->dwData) {
case IDM_LST_PARTICIPANT:
- ppro->AdminGet(gch->pDest->ptszID, JABBER_FEAT_MUC_ADMIN, L"role", L"participant", &CJabberProto::OnIqResultMucGetVoiceList);
+ ppro->AdminGet(gch->ptszID, JABBER_FEAT_MUC_ADMIN, L"role", L"participant", &CJabberProto::OnIqResultMucGetVoiceList);
break;
case IDM_LST_MEMBER:
- ppro->AdminGet(gch->pDest->ptszID, JABBER_FEAT_MUC_ADMIN, L"affiliation", L"member", &CJabberProto::OnIqResultMucGetMemberList);
+ ppro->AdminGet(gch->ptszID, JABBER_FEAT_MUC_ADMIN, L"affiliation", L"member", &CJabberProto::OnIqResultMucGetMemberList);
break;
case IDM_LST_MODERATOR:
- ppro->AdminGet(gch->pDest->ptszID, JABBER_FEAT_MUC_ADMIN, L"role", L"moderator", &CJabberProto::OnIqResultMucGetModeratorList);
+ ppro->AdminGet(gch->ptszID, JABBER_FEAT_MUC_ADMIN, L"role", L"moderator", &CJabberProto::OnIqResultMucGetModeratorList);
break;
case IDM_LST_BAN:
- ppro->AdminGet(gch->pDest->ptszID, JABBER_FEAT_MUC_ADMIN, L"affiliation", L"outcast", &CJabberProto::OnIqResultMucGetBanList);
+ ppro->AdminGet(gch->ptszID, JABBER_FEAT_MUC_ADMIN, L"affiliation", L"outcast", &CJabberProto::OnIqResultMucGetBanList);
break;
case IDM_LST_ADMIN:
- ppro->AdminGet(gch->pDest->ptszID, JABBER_FEAT_MUC_ADMIN, L"affiliation", L"admin", &CJabberProto::OnIqResultMucGetAdminList);
+ ppro->AdminGet(gch->ptszID, JABBER_FEAT_MUC_ADMIN, L"affiliation", L"admin", &CJabberProto::OnIqResultMucGetAdminList);
break;
case IDM_LST_OWNER:
- ppro->AdminGet(gch->pDest->ptszID, JABBER_FEAT_MUC_ADMIN, L"affiliation", L"owner", &CJabberProto::OnIqResultMucGetOwnerList);
+ ppro->AdminGet(gch->ptszID, JABBER_FEAT_MUC_ADMIN, L"affiliation", L"owner", &CJabberProto::OnIqResultMucGetOwnerList);
break;
case IDM_TOPIC:
- szTitle.Format(TranslateT("Set topic for %s"), gch->pDest->ptszID);
+ szTitle.Format(TranslateT("Set topic for %s"), gch->ptszID);
szBuffer = item->getTemp()->m_tszStatusMessage;
szBuffer.Replace(L"\n", L"\r\n");
if (ppro->EnterString(szBuffer, szTitle, ESF_RICHEDIT, "gcTopic_"))
ppro->m_ThreadInfo->send(
- XmlNode(L"message") << XATTR(L"to", gch->pDest->ptszID) << XATTR(L"type", L"groupchat")
- << XCHILD(L"subject", szBuffer));
+ XmlNode(L"message") << XATTR(L"to", gch->ptszID) << XATTR(L"type", L"groupchat") << XCHILD(L"subject", szBuffer));
break;
case IDM_NICK:
- szTitle.Format(TranslateT("Change nickname in %s"), gch->pDest->ptszID);
+ szTitle.Format(TranslateT("Change nickname in %s"), gch->ptszID);
if (item->nick)
szBuffer = item->nick;
if (ppro->EnterString(szBuffer, szTitle, ESF_COMBO, "gcNick_")) {
- if (ppro->ListGetItemPtr(LIST_CHATROOM, gch->pDest->ptszID) != nullptr) {
+ if (ppro->ListGetItemPtr(LIST_CHATROOM, gch->ptszID) != nullptr) {
wchar_t text[1024];
- mir_snwprintf(text, L"%s/%s", gch->pDest->ptszID, szBuffer.c_str());
+ mir_snwprintf(text, L"%s/%s", gch->ptszID, szBuffer.c_str());
ppro->SendPresenceTo(ppro->m_iStatus == ID_STATUS_INVISIBLE ? ID_STATUS_ONLINE : ppro->m_iStatus, text, nullptr);
}
}
break;
case IDM_INVITE:
- (new CGroupchatInviteDlg(ppro, gch->pDest->ptszID))->Show();
+ (new CGroupchatInviteDlg(ppro, gch->ptszID))->Show();
break;
case IDM_CONFIG:
ppro->m_ThreadInfo->send(
- XmlNodeIq(ppro->AddIQ(&CJabberProto::OnIqResultGetMuc, JABBER_IQ_TYPE_GET, gch->pDest->ptszID))
+ XmlNodeIq(ppro->AddIQ(&CJabberProto::OnIqResultGetMuc, JABBER_IQ_TYPE_GET, gch->ptszID))
<< XQUERY(JABBER_FEAT_MUC_OWNER));
break;
case IDM_BOOKMARKS:
- item = ppro->ListGetItemPtr(LIST_BOOKMARK, gch->pDest->ptszID);
+ item = ppro->ListGetItemPtr(LIST_BOOKMARK, gch->ptszID);
if (item == nullptr) {
- item = ppro->ListGetItemPtr(LIST_CHATROOM, gch->pDest->ptszID);
+ item = ppro->ListGetItemPtr(LIST_CHATROOM, gch->ptszID);
if (item != nullptr) {
item->type = L"conference";
MCONTACT hContact = ppro->HContactFromJID(item->jid);
@@ -1290,10 +1288,10 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g
break;
case IDM_DESTROY:
- szTitle.Format(TranslateT("Reason to destroy %s"), gch->pDest->ptszID);
+ szTitle.Format(TranslateT("Reason to destroy %s"), gch->ptszID);
if (ppro->EnterString(szBuffer, szTitle, ESF_MULTILINE, "gcReason_"))
ppro->m_ThreadInfo->send(
- XmlNodeIq(L"set", ppro->SerialNext(), gch->pDest->ptszID) << XQUERY(JABBER_FEAT_MUC_OWNER)
+ XmlNodeIq(L"set", ppro->SerialNext(), gch->ptszID) << XQUERY(JABBER_FEAT_MUC_OWNER)
<< XCHILD(L"destroy") << XCHILD(L"reason", szBuffer));
// fall through
@@ -1368,14 +1366,14 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam)
if (gch == nullptr)
return 0;
- if (mir_strcmpi(gch->pDest->pszModule, m_szModuleName))
+ if (mir_strcmpi(gch->pszModule, m_szModuleName))
return 0;
- JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, gch->pDest->ptszID);
+ JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, gch->ptszID);
if (item == nullptr)
return 0;
- switch (gch->pDest->iType) {
+ switch (gch->iType) {
case GC_USER_MESSAGE:
if (gch->ptszText && mir_wstrlen(gch->ptszText) > 0) {
rtrimw(gch->ptszText);
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index 00904b34ea..879b9bca10 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -797,8 +797,7 @@ void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM *item, const wchar_t *
Chat_ChangeUserId(m_szModuleName, item->jid, oldNick, newNick);
- GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_NICK };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, item->jid, GC_EVENT_NICK };
if (jid != nullptr)
gce.ptszUserInfo = jid;
gce.time = time(0);
@@ -1033,7 +1032,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
if (!mir_wstrcmp(type, L"error"))
return;
- GCDEST gcd = { m_szModuleName, item->jid, 0 };
+ GCEVENT gce = { m_szModuleName, item->jid, 0 };
const wchar_t *msgText = nullptr;
@@ -1046,7 +1045,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
if (msgText == nullptr || msgText[0] == '\0')
return;
- gcd.iType = GC_EVENT_TOPIC;
+ gce.iType = GC_EVENT_TOPIC;
if (resource == nullptr && (m = XmlGetChild(node, "body")) != nullptr) {
const wchar_t *tmpnick = XmlGetText(m);
@@ -1075,12 +1074,12 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
return;
if (resource == nullptr)
- gcd.iType = GC_EVENT_INFORMATION;
+ gce.iType = GC_EVENT_INFORMATION;
else if (wcsncmp(msgText, L"/me ", 4) == 0 && mir_wstrlen(msgText) > 4) {
msgText += 4;
- gcd.iType = GC_EVENT_ACTION;
+ gce.iType = GC_EVENT_ACTION;
}
- else gcd.iType = GC_EVENT_MESSAGE;
+ else gce.iType = GC_EVENT_MESSAGE;
}
GcInit(item);
@@ -1107,7 +1106,6 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
tszText.Replace(L"%", L"%%");
tszText += imgLink;
- GCEVENT gce = { &gcd };
gce.ptszUID = resource;
gce.ptszNick = nick;
gce.time = msgTime;
@@ -1124,7 +1122,7 @@ void CJabberProto::GroupchatProcessMessage(HXML node)
item->bChatActive = 2;
- if (gcd.iType == GC_EVENT_TOPIC)
+ if (gce.iType == GC_EVENT_TOPIC)
Chat_SetStatusbarText(m_szModuleName, item->jid, tszText);
}
diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp
index de0a69c52b..69e663239f 100644
--- a/protocols/MRA/src/MraChat.cpp
+++ b/protocols/MRA/src/MraChat.cpp
@@ -64,13 +64,12 @@ INT_PTR CMraProto::MraChatSessionEventSendByHandle(MCONTACT hContactChatSession,
CMStringW wszID, wszUID, wszNick;
- GCDEST gcd = { m_szModuleName, 0, iType };
+ GCEVENT gce = { m_szModuleName, 0, iType };
if (hContactChatSession) {
mraGetStringW(hContactChatSession, "e-mail", wszID);
- gcd.ptszID = (LPWSTR)wszID.c_str();
+ gce.ptszID = wszID.c_str();
}
- GCEVENT gce = { &gcd };
gce.dwFlags = dwFlags;
gce.ptszUID = wszUID;
gce.ptszStatus = lpwszStatus;
@@ -167,11 +166,11 @@ int CMraProto::MraChatGcEventHook(WPARAM, LPARAM lParam)
if (bChatExists) {
GCHOOK* gch = (GCHOOK*)lParam;
- if (!_stricmp(gch->pDest->pszModule, m_szModuleName)) {
- switch (gch->pDest->iType) {
+ if (!_stricmp(gch->pszModule, m_szModuleName)) {
+ switch (gch->iType) {
case GC_USER_MESSAGE:
if (gch->ptszText && mir_wstrlen(gch->ptszText)) {
- CMStringA szEmail = gch->pDest->ptszID;
+ CMStringA szEmail = gch->ptszID;
MCONTACT hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, NULL);
BOOL bSlowSend = getByte("SlowSend", MRA_DEFAULT_SLOW_SEND);
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp
index d6983751a5..b971c362e2 100644
--- a/protocols/MSN/src/msn_chat.cpp
+++ b/protocols/MSN/src/msn_chat.cpp
@@ -135,7 +135,7 @@ void CMsnProto::MSN_KillChatSession(const wchar_t* id)
void CMsnProto::MSN_Kickuser(GCHOOK *gch)
{
- GCThreadData *thread = MSN_GetThreadByChatId(gch->pDest->ptszID);
+ GCThreadData *thread = MSN_GetThreadByChatId(gch->ptszID);
msnNsThread->sendPacketPayload("DEL", "MSGR\\THREAD",
"<thread><id>%d:%s</id><members><member><mri>%s</mri></member></members></thread>",
thread->netId, thread->szEmail, _T2A(gch->ptszUID));
@@ -143,7 +143,7 @@ void CMsnProto::MSN_Kickuser(GCHOOK *gch)
void CMsnProto::MSN_Promoteuser(GCHOOK *gch, const char *pszRole)
{
- GCThreadData *thread = MSN_GetThreadByChatId(gch->pDest->ptszID);
+ GCThreadData *thread = MSN_GetThreadByChatId(gch->ptszID);
msnNsThread->sendPacketPayload("PUT", "MSGR\\THREAD",
"<thread><id>%d:%s</id><members><member><mri>%s</mri><role>%s</role></member></members></thread>",
thread->netId, thread->szEmail, _T2A(gch->ptszUID), pszRole);
@@ -163,8 +163,7 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID
{
if (!mir_strcmp(xmli->name, "topicupdate")) {
ezxml_t initiator = ezxml_child(xmli, "initiator");
- GCDEST gcd = { m_szModuleName, mChatID, GC_EVENT_TOPIC};
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, mChatID, GC_EVENT_TOPIC };
gce.dwFlags = GCEF_ADDTOLOG;
gce.time = MsnTSToUnixtime(ezxml_txt(ezxml_child(xmli, "eventtime")));
gce.ptszUID = initiator ? mir_a2u(initiator->txt) : NULL;
@@ -177,25 +176,24 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID
}
else if (ezxml_t target = ezxml_child(xmli, "target")) {
MCONTACT hContInitiator = NULL;
- GCDEST gcd = { m_szModuleName, mChatID, 0};
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, mChatID, 0 };
gce.dwFlags = GCEF_ADDTOLOG;
if (!mir_strcmp(xmli->name, "deletemember")) {
- gcd.iType = GC_EVENT_PART;
+ gce.iType = GC_EVENT_PART;
if (ezxml_t initiator = ezxml_child(xmli, "initiator")) {
if (mir_strcmp(initiator->txt, target->txt)) {
hContInitiator = MSN_HContactFromEmail(initiator->txt);
gce.ptszStatus = GetContactNameT(hContInitiator);
- gcd.iType = GC_EVENT_KICK;
+ gce.iType = GC_EVENT_KICK;
}
}
}
else if (!mir_strcmp(xmli->name, "addmember")) {
- gcd.iType = GC_EVENT_JOIN;
+ gce.iType = GC_EVENT_JOIN;
}
else if (!mir_strcmp(xmli->name, "roleupdate")) {
- gcd.iType = GC_EVENT_ADDSTATUS;
+ gce.iType = GC_EVENT_ADDSTATUS;
if (ezxml_t initiator = ezxml_child(xmli, "initiator")) {
hContInitiator = MSN_HContactFromEmail(initiator->txt);
gce.ptszText= GetContactNameT(hContInitiator);
@@ -203,12 +201,12 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID
gce.ptszStatus = L"admin";
}
- if (gcd.iType) {
+ if (gce.iType) {
gce.time = MsnTSToUnixtime(ezxml_txt(ezxml_child(xmli, "eventtime")));
const char *pszTarget = NULL;
while (target) {
- switch (gcd.iType) {
+ switch (gce.iType) {
case GC_EVENT_JOIN:
gce.ptszStatus = MSN_GCGetRole(MSN_GetThreadByChatId(mChatID), target->txt);
// ..fall through.. //
@@ -218,7 +216,7 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID
break;
case GC_EVENT_ADDSTATUS:
case GC_EVENT_REMOVESTATUS:
- gcd.iType = mir_strcmp(ezxml_txt(ezxml_child(target, "role")), "admin") == 0 ? GC_EVENT_ADDSTATUS : GC_EVENT_REMOVESTATUS;
+ gce.iType = mir_strcmp(ezxml_txt(ezxml_child(target, "role")), "admin") == 0 ? GC_EVENT_ADDSTATUS : GC_EVENT_REMOVESTATUS;
pszTarget = ezxml_txt(ezxml_child(target, "id"));
break;
}
@@ -230,7 +228,7 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const wchar_t *mChatID
gce.ptszNick = GetContactNameT(hContTarget);
Chat_Event(&gce);
mir_free((wchar_t*)gce.ptszUID);
- if ((gcd.iType == GC_EVENT_PART || gcd.iType == GC_EVENT_KICK) && gce.bIsMe) {
+ if ((gce.iType == GC_EVENT_PART || gce.iType == GC_EVENT_KICK) && gce.bIsMe) {
Chat_Control(m_szModuleName, mChatID, SESSION_OFFLINE);
break;
}
@@ -263,8 +261,7 @@ void CMsnProto::MSN_GCRefreshThreadsInfo(void)
void CMsnProto::MSN_GCAddMessage(wchar_t *mChatID, MCONTACT hContact, char *email, time_t ts, bool sentMsg, char *msgBody)
{
- GCDEST gcd = { m_szModuleName, mChatID, GC_EVENT_MESSAGE };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, mChatID, GC_EVENT_MESSAGE };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszUID = mir_a2u(email);
gce.ptszNick = GetContactNameT(hContact);
@@ -457,12 +454,12 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
if (!gch)
return 1;
- if (_stricmp(gch->pDest->pszModule, m_szModuleName)) return 0;
+ if (_stricmp(gch->pszModule, m_szModuleName)) return 0;
- switch (gch->pDest->iType) {
+ switch (gch->iType) {
case GC_SESSION_TERMINATE:
{
- GCThreadData* thread = MSN_GetThreadByChatId(gch->pDest->ptszID);
+ GCThreadData* thread = MSN_GetThreadByChatId(gch->ptszID);
if (thread != NULL) {
m_arGCThreads.remove(thread);
for (int i = 0; i < thread->mJoinedContacts.getCount(); i++)
@@ -474,7 +471,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
case GC_USER_MESSAGE:
if (gch->ptszText && gch->ptszText[0]) {
- GCThreadData* thread = MSN_GetThreadByChatId(gch->pDest->ptszID);
+ GCThreadData* thread = MSN_GetThreadByChatId(gch->ptszID);
if (thread) {
wchar_t* pszMsg = Chat_UnescapeTags(NEWWSTR_ALLOCA(gch->ptszText));
rtrimw(pszMsg); // remove the ending linebreak
@@ -483,8 +480,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
DBVARIANT dbv;
int bError = getWString("Nick", &dbv);
- GCDEST gcd = { m_szModuleName, gch->pDest->ptszID, GC_EVENT_MESSAGE };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, gch->ptszID, GC_EVENT_MESSAGE };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = bError ? L"" : dbv.ptszVal;
gce.ptszUID = mir_a2u(MyOptions.szEmail);
@@ -502,7 +498,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
case GC_USER_CHANMGR:
DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
- LPARAM(new InviteChatParam(gch->pDest->ptszID, NULL, this)));
+ LPARAM(new InviteChatParam(gch->ptszID, NULL, this)));
break;
case GC_USER_PRIVMESS:
@@ -513,11 +509,11 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
switch (gch->dwData) {
case 10:
DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
- LPARAM(new InviteChatParam(gch->pDest->ptszID, NULL, this)));
+ LPARAM(new InviteChatParam(gch->ptszID, NULL, this)));
break;
case 20:
- MSN_KillChatSession(gch->pDest->ptszID);
+ MSN_KillChatSession(gch->ptszID);
break;
}
break;
@@ -537,11 +533,11 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
break;
case 110:
- MSN_KillChatSession(gch->pDest->ptszID);
+ MSN_KillChatSession(gch->ptszID);
break;
case 40:
- const wchar_t *pszRole = MSN_GCGetRole(MSN_GetThreadByChatId(gch->pDest->ptszID), _T2A(gch->ptszUID));
+ const wchar_t *pszRole = MSN_GCGetRole(MSN_GetThreadByChatId(gch->ptszID), _T2A(gch->ptszUID));
MSN_Promoteuser(gch, (pszRole && !mir_wstrcmp(pszRole, L"admin")) ? "user" : "admin");
break;
}
diff --git a/protocols/MinecraftDynmap/src/chat.cpp b/protocols/MinecraftDynmap/src/chat.cpp
index 9da4b85703..cbaf735acf 100644
--- a/protocols/MinecraftDynmap/src/chat.cpp
+++ b/protocols/MinecraftDynmap/src/chat.cpp
@@ -30,13 +30,12 @@ void MinecraftDynmapProto::UpdateChat(const char *name, const char *message, con
ptrW tmessage(mir_a2u_cp(smessage.c_str(), CP_UTF8));
ptrW tname(mir_a2u_cp(name, CP_UTF8));
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_MESSAGE };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_MESSAGE };
gce.time = timestamp;
gce.ptszText = tmessage;
if (tname == NULL) {
- gcd.iType = GC_EVENT_INFORMATION;
+ gce.iType = GC_EVENT_INFORMATION;
tname = mir_wstrdup(TranslateT("Server"));
gce.bIsMe = false;
}
@@ -54,10 +53,10 @@ int MinecraftDynmapProto::OnChatEvent(WPARAM, LPARAM lParam)
{
GCHOOK *hook = reinterpret_cast<GCHOOK*>(lParam);
- if(strcmp(hook->pDest->pszModule,m_szModuleName))
+ if(strcmp(hook->pszModule,m_szModuleName))
return 0;
- switch(hook->pDest->iType)
+ switch(hook->iType)
{
case GC_USER_MESSAGE:
{
@@ -90,8 +89,7 @@ void MinecraftDynmapProto::AddChatContact(const char *name)
{
ptrW tname(mir_a2u_cp(name, CP_UTF8));
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
gce.time = DWORD(time(0));
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tname;
@@ -110,8 +108,7 @@ void MinecraftDynmapProto::DeleteChatContact(const char *name)
{
ptrW tname(mir_a2u_cp(name, CP_UTF8));
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_PART };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_PART };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tname;
gce.ptszUID = gce.ptszNick;
@@ -146,8 +143,7 @@ void MinecraftDynmapProto::SetTopic(const char *topic)
{
ptrW ttopic(mir_a2u_cp(topic, CP_UTF8));
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_TOPIC };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_TOPIC };
gce.time = ::time(NULL);
gce.ptszText = ttopic;
diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp
index eb6c613875..4967e06727 100644
--- a/protocols/Omegle/src/chat.cpp
+++ b/protocols/Omegle/src/chat.cpp
@@ -27,13 +27,12 @@ void OmegleProto::UpdateChat(const wchar_t *name, const wchar_t *message, bool a
std::wstring smessage = message;
utils::text::treplace_all(&smessage, L"%", L"%%");
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_MESSAGE };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_MESSAGE };
gce.time = ::time(NULL);
gce.ptszText = smessage.c_str();
if (name == NULL) {
- gcd.iType = GC_EVENT_INFORMATION;
+ gce.iType = GC_EVENT_INFORMATION;
name = TranslateT("Server");
gce.bIsMe = false;
}
@@ -51,10 +50,10 @@ int OmegleProto::OnChatEvent(WPARAM, LPARAM lParam)
{
GCHOOK *hook = reinterpret_cast<GCHOOK*>(lParam);
- if (mir_strcmp(hook->pDest->pszModule, m_szModuleName))
+ if (mir_strcmp(hook->pszModule, m_szModuleName))
return 0;
- switch (hook->pDest->iType)
+ switch (hook->iType)
{
case GC_USER_MESSAGE:
{
@@ -228,8 +227,7 @@ Chat_Event(WINDOW_CLEARLOG,&gce);
void OmegleProto::AddChatContact(const wchar_t *name)
{
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
gce.time = DWORD(time(0));
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = name;
@@ -250,8 +248,7 @@ void OmegleProto::AddChatContact(const wchar_t *name)
void OmegleProto::DeleteChatContact(const wchar_t *name)
{
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_PART };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_PART };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = name;
gce.ptszUID = gce.ptszNick;
@@ -287,8 +284,7 @@ INT_PTR OmegleProto::OnJoinChat(WPARAM, LPARAM suppress)
void OmegleProto::SetTopic(const wchar_t *topic)
{
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_TOPIC };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_TOPIC };
gce.time = ::time(NULL);
if (topic == NULL)
diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp
index 04af2e7372..6a517c6a94 100644
--- a/protocols/Sametime/src/conference.cpp
+++ b/protocols/Sametime/src/conference.cpp
@@ -118,8 +118,7 @@ void mwServiceConf_conf_opened(mwConference* conf, GList* members)
Chat_AddGroup(proto->m_szModuleName, tszConfId, TranslateT("Normal"));
// add users
- GCDEST gcd = { proto->m_szModuleName, tszConfId, GC_EVENT_JOIN };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { proto->m_szModuleName, tszConfId, GC_EVENT_JOIN };
GList *user = members;
for (;user; user=user->next) {
@@ -180,11 +179,7 @@ void mwServiceConf_on_peer_joined(mwConference* conf, mwLoginInfo *user)
ptrW tszUserId(mir_utf8decodeW(user->login_id));
// add user
- GCDEST gcd = { proto->m_szModuleName };
- gcd.ptszID = tszConfId;
- gcd.iType = GC_EVENT_JOIN;
-
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { proto->m_szModuleName, tszConfId, GC_EVENT_JOIN };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tszUserName;
gce.ptszUID = tszUserId;
@@ -209,11 +204,7 @@ void mwServiceConf_on_peer_parted(mwConference* conf, mwLoginInfo* user)
ptrW tszUserId(mir_utf8decodeW(user->login_id));
// remove user
- GCDEST gcd = { proto->m_szModuleName };
- gcd.ptszID = tszConfId;
- gcd.iType = GC_EVENT_PART;
-
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { proto->m_szModuleName, tszConfId, GC_EVENT_PART };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tszUserName;
gce.ptszUID = tszUserId;
@@ -228,29 +219,18 @@ void mwServiceConf_on_text(mwConference* conf, mwLoginInfo* user, const char* wh
CSametimeProto* proto = getProtoFromMwConference(conf);
proto->debugLogW(L"mwServiceConf_on_text() start");
- wchar_t* tszConfId = mir_utf8decodeW(mwConference_getName(conf));
-
- GCDEST gcd = { proto->m_szModuleName };
- gcd.ptszID = tszConfId;
- gcd.iType = GC_EVENT_MESSAGE;
+ ptrW textT(mir_utf8decodeW(what));
+ ptrW tszConfId(mir_utf8decodeW(mwConference_getName(conf)));
+ ptrW tszUserId(mir_utf8decodeW(user->login_id));
+ ptrW tszUserName(mir_utf8decodeW(user->user_name));
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { proto->m_szModuleName, tszConfId, GC_EVENT_MESSAGE };
gce.dwFlags = GCEF_ADDTOLOG;
-
- wchar_t* textT = mir_utf8decodeW(what);
- wchar_t* tszUserName = mir_utf8decodeW(user->user_name);
- wchar_t* tszUserId = mir_utf8decodeW(user->login_id);
gce.ptszText = textT;
gce.ptszNick = tszUserName;
gce.ptszUID = tszUserId;
gce.time = (DWORD)time(0);
-
Chat_Event(&gce);
-
- mir_free(textT);
- mir_free(tszUserName);
- mir_free(tszUserId);
- mir_free(tszConfId);
}
/** typing notification */
@@ -295,13 +275,13 @@ int CSametimeProto::GcEventHook(WPARAM wParam, LPARAM lParam) {
GCHOOK* gch = (GCHOOK*)lParam;
- if (strcmp(gch->pDest->pszModule, m_szModuleName) != 0) return 0;
+ if (strcmp(gch->pszModule, m_szModuleName) != 0) return 0;
GList *conferences = mwServiceConference_getConferences(service_conference);
for (GList *conf = conferences;conf;conf = conf->next) {
wchar_t* tszConfId = mir_utf8decodeW(mwConference_getName((mwConference*)conf->data));
- if (mir_wstrcmp(gch->pDest->ptszID, tszConfId) == 0) {
- switch(gch->pDest->iType) {
+ if (mir_wstrcmp(gch->ptszID, tszConfId) == 0) {
+ switch(gch->iType) {
case GC_USER_MESSAGE:
{
debugLogW(L"CSametimeProto::GcEventHook() GC_USER_MESSAGE");
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp
index 223b3880cc..85ffc6a5dc 100644
--- a/protocols/SkypeWeb/src/skype_chatrooms.cpp
+++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp
@@ -107,14 +107,14 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam)
if (!gch)
return 1;
- if (mir_strcmp(gch->pDest->pszModule, m_szModuleName) != 0)
+ if (mir_strcmp(gch->pszModule, m_szModuleName) != 0)
return 0;
- _T2A chat_id(gch->pDest->ptszID);
+ _T2A chat_id(gch->ptszID);
- switch (gch->pDest->iType) {
+ switch (gch->iType) {
case GC_USER_MESSAGE:
- OnSendChatMessage(gch->pDest->ptszID, gch->ptszText);
+ OnSendChatMessage(gch->ptszID, gch->ptszText);
break;
case GC_USER_PRIVMESS:
@@ -208,9 +208,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam)
if (!mir_wstrcmp(tnick_old, tnick_new))
break; // New nick is same, do nothing
- GCDEST gcd = { m_szModuleName, gch->pDest->ptszID, GC_EVENT_NICK };
- GCEVENT gce = { &gcd };
-
+ GCEVENT gce = { m_szModuleName, gch->ptszID, GC_EVENT_NICK };
gce.ptszNick = tnick_old;
gce.bIsMe = IsMe(user_id);
gce.ptszUID = gch->ptszUID;
@@ -360,13 +358,11 @@ void CSkypeProto::OnChatEvent(const JSONNode &node)
CMStringA initiator = ParseUrl(xinitiator, "8:");
CMStringA id = ParseUrl(xId, "8:");
-
- GCDEST gcd = { m_szModuleName, _A2T(szConversationName), !mir_strcmpi(xRole, "Admin") ? GC_EVENT_ADDSTATUS : GC_EVENT_REMOVESTATUS };
- GCEVENT gce = { &gcd };
ptrW tszId(mir_a2u(id));
ptrW tszRole(mir_a2u(xRole));
ptrW tszInitiator(mir_a2u(initiator));
- gce.pDest = &gcd;
+
+ GCEVENT gce = { m_szModuleName, _A2T(szConversationName), !mir_strcmpi(xRole, "Admin") ? GC_EVENT_ADDSTATUS : GC_EVENT_REMOVESTATUS };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tszId;
gce.ptszUID = tszId;
@@ -399,11 +395,9 @@ void CSkypeProto::OnSendChatMessage(const wchar_t *chat_id, const wchar_t * tszM
void CSkypeProto::AddMessageToChat(const wchar_t *chat_id, const wchar_t *from, const char *content, bool isAction, int emoteOffset, time_t timestamp, bool isLoading)
{
- GCDEST gcd = { m_szModuleName, chat_id, isAction ? GC_EVENT_ACTION : GC_EVENT_MESSAGE };
- GCEVENT gce = { &gcd };
-
ptrW tnick(GetChatContactNick(_T2A(chat_id), _T2A(from), _T2A(from)));
+ GCEVENT gce = { m_szModuleName, chat_id, isAction ? GC_EVENT_ACTION : GC_EVENT_MESSAGE };
gce.bIsMe = IsMe(_T2A(from));
gce.ptszNick = tnick;
gce.time = timestamp;
@@ -418,7 +412,8 @@ void CSkypeProto::AddMessageToChat(const wchar_t *chat_id, const wchar_t *from,
}
else gce.ptszText = &(tszText.GetBuffer())[emoteOffset];
- if (isLoading) gce.dwFlags = GCEF_NOTNOTIFY;
+ if (isLoading)
+ gce.dwFlags |= GCEF_NOTNOTIFY;
Chat_Event(&gce);
}
@@ -464,8 +459,7 @@ void CSkypeProto::ChangeChatTopic(const char *chat_id, const char *topic, const
ptrW tname(mir_a2u(initiator));
ptrW ttopic(mir_utf8decodeW(topic));
- GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_TOPIC };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, tchat_id, GC_EVENT_TOPIC };
gce.ptszUID = tname;
gce.ptszNick = tname;
gce.ptszText = ttopic;
@@ -530,9 +524,7 @@ void CSkypeProto::AddChatContact(const wchar_t *tchat_id, const char *id, const
ptrW tnick(GetChatContactNick(_T2A(tchat_id), id, name));
ptrW tid(mir_a2u(id));
- GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_JOIN };
- GCEVENT gce = { &gcd };
- gce.pDest = &gcd;
+ GCEVENT gce = { m_szModuleName, tchat_id, GC_EVENT_JOIN };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszNick = tnick;
gce.ptszUID = tid;
@@ -552,8 +544,7 @@ void CSkypeProto::RemoveChatContact(const wchar_t *tchat_id, const char *id, con
ptrW tinitiator(GetChatContactNick(_T2A(tchat_id), initiator, initiator));
ptrW tid(mir_a2u(id));
- GCDEST gcd = { m_szModuleName, tchat_id, isKick ? GC_EVENT_KICK : GC_EVENT_PART };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, tchat_id, isKick ? GC_EVENT_KICK : GC_EVENT_PART };
if (isKick) {
gce.ptszUID = tid;
gce.ptszNick = tnick;
diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp
index 491ab50848..b323d0dbfc 100644
--- a/protocols/Twitter/src/chat.cpp
+++ b/protocols/Twitter/src/chat.cpp
@@ -24,9 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void TwitterProto::UpdateChat(const twitter_user &update)
{
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_MESSAGE };
- GCEVENT gce = { &gcd };
- gce.pDest = &gcd;
+ GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_MESSAGE };
gce.bIsMe = (update.username == twit_.get_username());
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszUID = mir_a2u(update.username.c_str());
@@ -59,10 +57,10 @@ void TwitterProto::UpdateChat(const twitter_user &update)
int TwitterProto::OnChatOutgoing(WPARAM, LPARAM lParam)
{
GCHOOK *hook = reinterpret_cast<GCHOOK*>(lParam);
- if (mir_strcmp(hook->pDest->pszModule, m_szModuleName))
+ if (mir_strcmp(hook->pszModule, m_szModuleName))
return 0;
- switch (hook->pDest->iType) {
+ switch (hook->iType) {
case GC_USER_MESSAGE:
debugLogW(L"**Chat - Outgoing message: %s", hook->ptszText);
{
@@ -90,28 +88,26 @@ int TwitterProto::OnChatOutgoing(WPARAM, LPARAM lParam)
// TODO: remove nick?
void TwitterProto::AddChatContact(const char *name, const char *nick)
{
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
- GCEVENT gce = { &gcd };
+ ptrW wszId(mir_a2u(name));
+ ptrW wszNick(mir_a2u(nick ? nick : name));
+
+ GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_JOIN };
gce.time = DWORD(time(0));
- gce.ptszNick = mir_a2u(nick ? nick : name);
- gce.ptszUID = mir_a2u(name);
+ gce.ptszNick = wszNick;
+ gce.ptszUID = wszId;
gce.ptszStatus = L"Normal";
Chat_Event(&gce);
-
- mir_free(const_cast<wchar_t*>(gce.ptszNick));
- mir_free(const_cast<wchar_t*>(gce.ptszUID));
}
void TwitterProto::DeleteChatContact(const char *name)
{
- GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_PART };
- GCEVENT gce = { &gcd };
+ ptrW wszId(mir_a2u(name));
+
+ GCEVENT gce = { m_szModuleName, m_tszUserName, GC_EVENT_PART };
gce.time = DWORD(time(0));
- gce.ptszNick = mir_a2u(name);
+ gce.ptszNick = wszId;
gce.ptszUID = gce.ptszNick;
Chat_Event(&gce);
-
- mir_free(const_cast<wchar_t*>(gce.ptszNick));
}
INT_PTR TwitterProto::OnJoinChat(WPARAM, LPARAM suppress)
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp
index 43eb705527..253856cd97 100644
--- a/protocols/VKontakte/src/vk_chats.cpp
+++ b/protocols/VKontakte/src/vk_chats.cpp
@@ -163,8 +163,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
cu->m_bUnknown = false;
if (bNew) {
- GCDEST gcd = { m_szModuleName, cc->m_wszId, GC_EVENT_JOIN };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, cc->m_wszId, GC_EVENT_JOIN };
gce.bIsMe = uid == m_myUserId;
gce.ptszUID = wszId;
gce.ptszNick = wszNick;
@@ -182,8 +181,7 @@ void CVkProto::OnReceiveChatInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe
wchar_t wszId[20];
_itow(cu.m_uid, wszId, 10);
- GCDEST gcd = { m_szModuleName, cc->m_wszId, GC_EVENT_PART };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, cc->m_wszId, GC_EVENT_PART };
gce.ptszUID = wszId;
gce.dwFlags = GCEF_NOTNOTIFY;
gce.time = time(nullptr);
@@ -397,8 +395,7 @@ void CVkProto::AppendChatMessage(CVkChatInfo *cc, int uid, int msgTime, LPCWSTR
wchar_t wszId[20];
_itow(uid, wszId, 10);
- GCDEST gcd = { m_szModuleName, cc->m_wszId, bIsAction ? GC_EVENT_ACTION : GC_EVENT_MESSAGE };
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, cc->m_wszId, bIsAction ? GC_EVENT_ACTION : GC_EVENT_MESSAGE };
gce.bIsMe = (uid == m_myUserId);
gce.ptszUID = wszId;
gce.time = msgTime;
@@ -441,14 +438,14 @@ int CVkProto::OnChatEvent(WPARAM, LPARAM lParam)
if (gch == nullptr)
return 0;
- if (mir_strcmpi(gch->pDest->pszModule, m_szModuleName))
+ if (mir_strcmpi(gch->pszModule, m_szModuleName))
return 0;
- CVkChatInfo *cc = GetChatById(gch->pDest->ptszID);
+ CVkChatInfo *cc = GetChatById(gch->ptszID);
if (cc == nullptr)
return 0;
- switch (gch->pDest->iType) {
+ switch (gch->iType) {
case GC_USER_MESSAGE:
if (IsOnline() && mir_wstrlen(gch->ptszText) > 0) {
ptrW pwszBuf(mir_wstrdup(gch->ptszText));
@@ -730,12 +727,10 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch)
if (wszNewNick.IsEmpty() || wszNewNick == cu->m_wszNick)
break;
- GCDEST gcd = { m_szModuleName, cc->m_wszId, GC_EVENT_NICK };
- GCEVENT gce = { &gcd };
-
wchar_t wszId[20];
_itow(cu->m_uid, wszId, 10);
+ GCEVENT gce = { m_szModuleName, cc->m_wszId, GC_EVENT_NICK };
gce.ptszNick = mir_wstrdup(cu->m_wszNick);
gce.bIsMe = (cu->m_uid == m_myUserId);
gce.ptszUID = wszId;
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp
index 38f4878f7d..3fc47cb8f9 100644
--- a/protocols/WhatsApp/src/chat.cpp
+++ b/protocols/WhatsApp/src/chat.cpp
@@ -40,15 +40,15 @@ INT_PTR __cdecl WhatsAppProto::OnCreateGroup(WPARAM, LPARAM)
int WhatsAppProto::onGroupChatEvent(WPARAM, LPARAM lParam)
{
GCHOOK *gch = (GCHOOK*)lParam;
- if (mir_strcmp(gch->pDest->pszModule, m_szModuleName))
+ if (mir_strcmp(gch->pszModule, m_szModuleName))
return 0;
- std::string chat_id(T2Utf(gch->pDest->ptszID));
+ std::string chat_id(T2Utf(gch->ptszID));
WAChatInfo *pInfo = SafeGetChat(chat_id);
if (pInfo == NULL)
return 0;
- switch (gch->pDest->iType) {
+ switch (gch->iType) {
case GC_USER_LOGMENU:
ChatLogMenuHook(pInfo, gch);
break;
@@ -379,9 +379,7 @@ void WhatsAppProto::onGroupMessage(const FMessage &pMsg)
ptrW tszUID(str2t(pMsg.remote_resource));
ptrW tszNick(GetChatUserNick(pMsg.remote_resource));
- GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_MESSAGE };
-
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, pInfo->tszJid, GC_EVENT_MESSAGE };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszUID = tszUID;
gce.ptszNick = tszNick;
@@ -408,9 +406,7 @@ void WhatsAppProto::onGroupNewSubject(const std::string &gjid, const std::string
ptrW tszUID(str2t(author));
ptrW tszNick(GetChatUserNick(author));
- GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_TOPIC };
-
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, pInfo->tszJid, GC_EVENT_TOPIC };
gce.dwFlags = GCEF_ADDTOLOG + ((ts == 0) ? GCEF_NOTNOTIFY : 0);
gce.ptszUID = tszUID;
gce.ptszNick = tszNick;
@@ -430,9 +426,7 @@ void WhatsAppProto::onGroupAddUser(const std::string &gjid, const std::string &u
ptrW tszUID(str2t(ujid));
ptrW tszNick(GetChatUserNick(ujid));
- GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_JOIN };
-
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, pInfo->tszJid, GC_EVENT_JOIN };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszUID = tszUID;
gce.ptszNick = tszNick;
@@ -449,9 +443,7 @@ void WhatsAppProto::onGroupRemoveUser(const std::string &gjid, const std::string
ptrW tszUID(str2t(ujid));
ptrW tszNick(GetChatUserNick(ujid));
- GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_PART };
-
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, pInfo->tszJid, GC_EVENT_PART };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszUID = tszUID;
gce.ptszNick = tszNick;
@@ -486,9 +478,7 @@ void WhatsAppProto::onGetParticipants(const std::string &gjid, const std::vector
ptrW ujid(str2t(curr)), nick(GetChatUserNick(curr));
bool bIsOwner = !mir_wstrcmp(ujid, pInfo->tszOwner);
- GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_JOIN };
-
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, pInfo->tszJid, GC_EVENT_JOIN };
gce.ptszNick = nick;
gce.ptszUID = utils::removeA(ujid);
gce.ptszStatus = (bIsOwner) ? L"Owners" : L"Members";
@@ -519,9 +509,7 @@ void WhatsAppProto::onGroupMessageReceived(const FMessage &msg)
ptrW tszUID(str2t(m_szJid));
ptrW tszNick(str2t(m_szNick));
- GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_MESSAGE };
-
- GCEVENT gce = { &gcd };
+ GCEVENT gce = { m_szModuleName, pInfo->tszJid, GC_EVENT_MESSAGE };
gce.dwFlags = GCEF_ADDTOLOG;
gce.ptszUID = tszUID;
gce.ptszNick = tszNick;