summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Facebook/src/main.cpp13
-rw-r--r--protocols/JabberG/src/jabber_thread.cpp3
-rw-r--r--protocols/VKontakte/src/vk_history.cpp10
-rw-r--r--protocols/VKontakte/src/vk_messages.cpp3
-rw-r--r--protocols/WhatsApp/src/iq.cpp3
-rw-r--r--protocols/WhatsApp/src/main.cpp10
-rw-r--r--protocols/WhatsApp/src/proto.h2
7 files changed, 7 insertions, 37 deletions
diff --git a/protocols/Facebook/src/main.cpp b/protocols/Facebook/src/main.cpp
index 7d87990901..d256d752d9 100644
--- a/protocols/Facebook/src/main.cpp
+++ b/protocols/Facebook/src/main.cpp
@@ -22,8 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
CMPlugin g_plugin;
-bool g_bMessageState;
-
/////////////////////////////////////////////////////////////////////////////////////////
PLUGININFOEX pluginInfoEx = {
@@ -53,18 +51,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC
/////////////////////////////////////////////////////////////////////////////////////////
// Load
-static int OnModuleLoaded(WPARAM, LPARAM)
-{
- g_bMessageState = ServiceExists(MS_MESSAGESTATE_UPDATE) != 0;
- return 0;
-}
-
int CMPlugin::Load()
{
- HookEvent(ME_SYSTEM_MODULELOAD, OnModuleLoaded);
- HookEvent(ME_SYSTEM_MODULEUNLOAD, OnModuleLoaded);
- HookEvent(ME_SYSTEM_MODULESLOADED, OnModuleLoaded);
-
- // Initialize random generator (used only as fallback in utils)
return 0;
}
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index c1891f1034..cbd8708fbf 100644
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -1231,8 +1231,7 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info)
if (nPacketId != -1)
ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)nPacketId);
- if (g_plugin.bMessageState)
- CallService(MS_MESSAGESTATE_UPDATE, hContact, MRD_TYPE_DELIVERED);
+ db_event_delivered(hContact, 0);
}
if (auto *n = XmlGetChildByTag(node, "displayed", "xmlns", JABBER_FEAT_CHAT_MARKERS))
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp
index 198c75fec4..93a1fcb25f 100644
--- a/protocols/VKontakte/src/vk_history.cpp
+++ b/protocols/VKontakte/src/vk_history.cpp
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
//////////////////////////// History services ///////////////////////////////////////////
-INT_PTR CVkProto::SvcEmptyServerHistory(WPARAM hContact, LPARAM lParam)
+INT_PTR CVkProto::SvcEmptyServerHistory(WPARAM hContact, LPARAM)
{
debugLogA("CVkProto::SvcEmptyServerHistory was called for %s", Clist_GetContactDisplayName(hContact));
@@ -232,6 +232,7 @@ void CVkProto::OnReceiveHistoryMessages(MHttpResponse *reply, AsyncHttpRequest *
const JSONNode &jnFUsers = jnResponse["fwd_users"];
VKMessageID_t iLastMsgId = ReadQSWord(param->hContact, "lastmsgid", -1);
time_t tLastReadMessageTime = 0;
+ MEVENT hDbEvent = 0;
int count = 0;
for (auto it = jnMsgs.rbegin(); it != jnMsgs.rend(); ++it) {
@@ -334,7 +335,7 @@ void CVkProto::OnReceiveHistoryMessages(MHttpResponse *reply, AsyncHttpRequest *
ProtoChainRecvMsg(hContact, dbei);
- MEVENT hDbEvent = db_event_getById(m_szModuleName, strcat(szMid, "_"));
+ hDbEvent = db_event_getById(m_szModuleName, strcat(szMid, "_"));
if (hDbEvent)
db_event_delete(hDbEvent, CDF_FROM_SERVER);
@@ -344,10 +345,9 @@ void CVkProto::OnReceiveHistoryMessages(MHttpResponse *reply, AsyncHttpRequest *
count++;
}
- WriteQSWord(param->hContact, "lastmsgid", iLastMsgId);
+ db_event_delivered(param->hContact, hDbEvent);
- if (g_bMessageState)
- CallService(MS_MESSAGESTATE_UPDATE, param->hContact, MRD_TYPE_DELIVERED);
+ WriteQSWord(param->hContact, "lastmsgid", iLastMsgId);
int once = jnResponse["once"].as_int();
int iRCount = jnResponse["rcount"].as_int();
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp
index b0858978d8..9f3aba3329 100644
--- a/protocols/VKontakte/src/vk_messages.cpp
+++ b/protocols/VKontakte/src/vk_messages.cpp
@@ -615,9 +615,8 @@ void CVkProto::OnReceiveDlgs(MHttpResponse *reply, AsyncHttpRequest *pReq)
bool bIsRead = (jnLastMessage["id"].as_int() <= jnConversation["in_read"].as_int());
if (bIsRead && bIsOut)
- CallService(MS_MESSAGESTATE_UPDATE, hContact, MRD_TYPE_DELIVERED);
+ db_event_delivered(hContact, 0);
}
-
if (m_vkOptions.iSyncHistoryMetod) {
VKMessageID_t iMessageId = jnLastMessage["id"].as_int();
diff --git a/protocols/WhatsApp/src/iq.cpp b/protocols/WhatsApp/src/iq.cpp
index 7430abd44b..bf6b85febc 100644
--- a/protocols/WhatsApp/src/iq.cpp
+++ b/protocols/WhatsApp/src/iq.cpp
@@ -496,9 +496,6 @@ void WhatsAppProto::ProcessReceipt(MCONTACT hContact, const char *msgId, bool bR
if (hEvent == 0)
return;
- if (g_plugin.bHasMessageState)
- CallService(MS_MESSAGESTATE_UPDATE, hContact, bRead ? MRD_TYPE_READ : MRD_TYPE_DELIVERED);
-
if (bRead)
db_event_markRead(hContact, hEvent, true);
}
diff --git a/protocols/WhatsApp/src/main.cpp b/protocols/WhatsApp/src/main.cpp
index 20e8b83868..0bed10775b 100644
--- a/protocols/WhatsApp/src/main.cpp
+++ b/protocols/WhatsApp/src/main.cpp
@@ -39,18 +39,8 @@ CMPlugin::CMPlugin() :
/////////////////////////////////////////////////////////////////////////////////////////
// Load
-static int OnPluginLoaded(WPARAM, LPARAM)
-{
- g_plugin.bHasMessageState = ServiceExists(MS_MESSAGESTATE_UPDATE);
- return 0;
-}
-
int CMPlugin::Load()
{
- HookEvent(ME_SYSTEM_MODULELOAD, OnPluginLoaded);
- HookEvent(ME_SYSTEM_MODULEUNLOAD, OnPluginLoaded);
- OnPluginLoaded(0, 0);
-
// special netlib user for reading avatars, blobs etc via HTTP protocol
NETLIBUSER nlu = {};
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE;
diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h
index a5c7400fa5..7f87fe2f9a 100644
--- a/protocols/WhatsApp/src/proto.h
+++ b/protocols/WhatsApp/src/proto.h
@@ -501,8 +501,6 @@ struct CMPlugin : public ACCPROTOPLUGIN<WhatsAppProto>
HNETLIBCONN hAvatarConn = nullptr;
bool SaveFile(const char *pszUrl, PROTO_AVATAR_INFORMATION &ai);
- bool bHasMessageState = false;
-
CMPlugin();
int Load() override;