diff options
author | George Hazan <ghazan@miranda.im> | 2020-02-05 12:48:18 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-02-05 12:48:18 +0300 |
commit | 716da0a2c8d8907e3b64813d08944148d99d472c (patch) | |
tree | 71e98396ba977e16ee4038fbaa6a4bc9d9697e2a /protocols/Facebook | |
parent | 59667bf72b781dc790ff10ac246e4c23d1d2a494 (diff) |
Facebook: support for sending "Marked read" notifications
Diffstat (limited to 'protocols/Facebook')
-rw-r--r-- | protocols/Facebook/src/proto.cpp | 1 | ||||
-rw-r--r-- | protocols/Facebook/src/proto.h | 1 | ||||
-rw-r--r-- | protocols/Facebook/src/server.cpp | 22 | ||||
-rw-r--r-- | protocols/Facebook/src/version.h | 2 |
4 files changed, 25 insertions, 1 deletions
diff --git a/protocols/Facebook/src/proto.cpp b/protocols/Facebook/src/proto.cpp index dd7ef0903d..6364a3758c 100644 --- a/protocols/Facebook/src/proto.cpp +++ b/protocols/Facebook/src/proto.cpp @@ -109,6 +109,7 @@ FacebookProto::FacebookProto(const char *proto_name, const wchar_t *username) : HookProtoEvent(ME_GC_EVENT, &FacebookProto::GroupchatEventHook); HookProtoEvent(ME_GC_BUILDMENU, &FacebookProto::GroupchatMenuHook); HookProtoEvent(ME_OPT_INITIALISE, &FacebookProto::OnOptionsInit); + HookProtoEvent(ME_DB_EVENT_MARKED_READ, &FacebookProto::OnMarkedRead); // Default group Clist_GroupCreate(0, m_wszDefaultGroup); diff --git a/protocols/Facebook/src/proto.h b/protocols/Facebook/src/proto.h index 051ba352c7..779b92c692 100644 --- a/protocols/Facebook/src/proto.h +++ b/protocols/Facebook/src/proto.h @@ -510,6 +510,7 @@ public: //////////////////////////////////////////////////////////////////////////////////////// // Events + int __cdecl OnMarkedRead(WPARAM, LPARAM); int __cdecl OnOptionsInit(WPARAM, LPARAM); int __cdecl GroupchatMenuHook(WPARAM, LPARAM); diff --git a/protocols/Facebook/src/server.cpp b/protocols/Facebook/src/server.cpp index 81fcdda4f1..9d65b4c3d0 100644 --- a/protocols/Facebook/src/server.cpp +++ b/protocols/Facebook/src/server.cpp @@ -346,6 +346,28 @@ LBL_Begin: ///////////////////////////////////////////////////////////////////////////////////////// +int FacebookProto::OnMarkedRead(WPARAM, LPARAM hDbEvent) +{ + MCONTACT hContact = db_event_getContact(hDbEvent); + if (!hContact) + return 0; + + // filter out only events of my protocol + const char *szProto = Proto_GetBaseAccountName(hContact); + if (mir_strcmp(szProto, m_szModuleName)) + return 0; + + JSONNode root; root << BOOL_PARAM("state", true) << INT_PARAM("syncSeqId", m_sid) << CHAR_PARAM("mark", "read"); + if (isChatRoom(hContact)) + root << CHAR_PARAM("threadFbId", getMStringA(hContact, DBKEY_ID)); + else + root << CHAR_PARAM("otherUserFbId", getMStringA(hContact, DBKEY_ID)); + MqttPublish("/mark_thread", root.write().c_str()); + return 0; +} + +///////////////////////////////////////////////////////////////////////////////////////// + void FacebookProto::OnPublish(const char *topic, const uint8_t *p, size_t cbLen) { FbThriftReader rdr; diff --git a/protocols/Facebook/src/version.h b/protocols/Facebook/src/version.h index b83281a5fe..0b5d8f4732 100644 --- a/protocols/Facebook/src/version.h +++ b/protocols/Facebook/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 1 #define __RELEASE_NUM 0 -#define __BUILD_NUM 1 +#define __BUILD_NUM 2 #include <stdver.h> |