summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-06-04 16:53:36 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-06-04 16:58:05 +0300
commit3cab1bee6e943c6e6ed6363120b53c33464f3a04 (patch)
tree98b9241b08a83e0798a4dcf9609dcd59f80da2ac /protocols
parentceef3ded6c011efb559b8c155084fb717d9bdc2a (diff)
fixes #1954 (Facebook notifications issue)
Diffstat (limited to 'protocols')
-rw-r--r--protocols/FacebookRM/src/connection.cpp9
-rw-r--r--protocols/FacebookRM/src/main.cpp9
-rw-r--r--protocols/FacebookRM/src/proto.cpp2
-rw-r--r--protocols/FacebookRM/src/proto.h1
-rw-r--r--protocols/FacebookRM/src/stdafx.h1
-rw-r--r--protocols/FacebookRM/src/version.h2
6 files changed, 22 insertions, 2 deletions
diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp
index 4184ca15d5..1378e152e0 100644
--- a/protocols/FacebookRM/src/connection.cpp
+++ b/protocols/FacebookRM/src/connection.cpp
@@ -22,6 +22,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
+static void CALLBACK timerApcFunc(HWND, UINT, UINT_PTR param, DWORD)
+{
+ FacebookProto *ppro = (FacebookProto *)param;
+ if (!ppro->isOffline())
+ ppro->ForkThread(&FacebookProto::ProcessNotifications);
+}
+
void FacebookProto::ChangeStatus(void*)
{
mir_cslock s(signon_lock_);
@@ -131,6 +138,8 @@ void FacebookProto::ChangeStatus(void*)
if (getByte(FACEBOOK_KEY_SET_MIRANDA_STATUS, DEFAULT_SET_MIRANDA_STATUS))
ForkThread(&FacebookProto::SetAwayMsgWorker, nullptr);
+
+ SetTimer(g_hwndHeartbeat, LPARAM(this), 60000, timerApcFunc);
}
else {
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_FAILED, (HANDLE)old_status, m_iStatus);
diff --git a/protocols/FacebookRM/src/main.cpp b/protocols/FacebookRM/src/main.cpp
index e53a72310a..0ce184d4aa 100644
--- a/protocols/FacebookRM/src/main.cpp
+++ b/protocols/FacebookRM/src/main.cpp
@@ -27,6 +27,7 @@ CMPlugin g_plugin;
std::string g_strUserAgent;
DWORD g_mirandaVersion;
bool g_bMessageState;
+HWND g_hwndHeartbeat;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -65,6 +66,8 @@ static int OnModuleLoaded(WPARAM, LPARAM)
int CMPlugin::Load()
{
+ g_hwndHeartbeat = CreateWindowEx(0, L"STATIC", nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr);
+
HookEvent(ME_SYSTEM_MODULELOAD, OnModuleLoaded);
HookEvent(ME_SYSTEM_MODULEUNLOAD, OnModuleLoaded);
HookEvent(ME_SYSTEM_MODULESLOADED, OnModuleLoaded);
@@ -90,3 +93,9 @@ int CMPlugin::Load()
return 0;
}
+
+int CMPlugin::Unload()
+{
+ DestroyWindow(g_hwndHeartbeat);
+ return 0;
+}
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index e99dc8b895..916614a34f 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -28,7 +28,7 @@ FacebookProto::FacebookProto(const char* proto_name, const wchar_t* username) :
{
facy.parent = this;
- update_loop_event = CreateEvent(nullptr, FALSE, FALSE, nullptr);
+ update_loop_event = CreateEventW(nullptr, FALSE, FALSE, nullptr);
// Initialize random seed for this client
facy.random_ = ::time(0) + PtrToUint(&facy);
diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h
index f635e33b83..30f922ab7d 100644
--- a/protocols/FacebookRM/src/proto.h
+++ b/protocols/FacebookRM/src/proto.h
@@ -291,4 +291,5 @@ struct CMPlugin : public ACCPROTOPLUGIN<FacebookProto>
CMPlugin();
int Load() override;
+ int Unload() override;
};
diff --git a/protocols/FacebookRM/src/stdafx.h b/protocols/FacebookRM/src/stdafx.h
index 9077ed184c..3a96f387de 100644
--- a/protocols/FacebookRM/src/stdafx.h
+++ b/protocols/FacebookRM/src/stdafx.h
@@ -82,6 +82,7 @@ class FacebookProto;
extern std::string g_strUserAgent;
extern DWORD g_mirandaVersion;
extern bool g_bMessageState;
+extern HWND g_hwndHeartbeat;
template <typename T>
__inline static void FreeList(const LIST<T> &lst)
diff --git a/protocols/FacebookRM/src/version.h b/protocols/FacebookRM/src/version.h
index d87d864799..959774602e 100644
--- a/protocols/FacebookRM/src/version.h
+++ b/protocols/FacebookRM/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 4
#define __RELEASE_NUM 2
-#define __BUILD_NUM 1
+#define __BUILD_NUM 2
#include <stdver.h>