From 76e343ab968fb6f194333fb0ec7057eaf621bcd4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 25 Jul 2015 13:19:35 +0000 Subject: an option added to use the remote timestamps for messages (patch by Cassio is well received) git-svn-id: http://svn.miranda-ng.org/main/trunk@14684 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/WhatsApp/src/db.h | 1 + protocols/WhatsApp/src/dialogs.cpp | 4 +++- protocols/WhatsApp/src/messages.cpp | 6 +++++- protocols/WhatsApp/src/proto.cpp | 7 +++++-- protocols/WhatsApp/src/resource.h | 3 ++- protocols/WhatsApp/src/version.h | 2 +- 6 files changed, 17 insertions(+), 6 deletions(-) (limited to 'protocols/WhatsApp/src') diff --git a/protocols/WhatsApp/src/db.h b/protocols/WhatsApp/src/db.h index 16b88099d8..c7f31eb703 100644 --- a/protocols/WhatsApp/src/db.h +++ b/protocols/WhatsApp/src/db.h @@ -15,6 +15,7 @@ #define WHATSAPP_KEY_REG_CODE "RegistrationCode" #define WHATSAPP_KEY_SSL "UseSSL" #define WHATSAPP_KEY_AUTORUNCHATS "AutoRunChats" +#define WHATSAPP_KEY_USE_REMOTE_TIME "UseRemoteTime" #define WHATSAPP_KEY_EVENT_CLIENT_ENABLE "EventClientEnable" #define WHATSAPP_KEY_EVENT_OTHER_ENABLE "EventOtherEnable" diff --git a/protocols/WhatsApp/src/dialogs.cpp b/protocols/WhatsApp/src/dialogs.cpp index 48d476286c..9e8aac45ee 100644 --- a/protocols/WhatsApp/src/dialogs.cpp +++ b/protocols/WhatsApp/src/dialogs.cpp @@ -6,7 +6,7 @@ class COptionsDlg : public CProtoDlgBase { CCtrlEdit m_pw1, m_pw2, m_cc, m_login, m_nick, m_group; - CCtrlCheck m_ssl, m_autorun; + CCtrlCheck m_ssl, m_autorun, m_remoteTime; CCtrlButton m_request, m_register; public: @@ -16,6 +16,7 @@ public: m_pw1(this, IDC_PW), m_pw2(this, IDC_PW2), m_ssl(this, IDC_SSL), + m_remoteTime(this, IDC_REMOTE_TIME), m_nick(this, IDC_NICK), m_group(this, IDC_DEFGROUP), m_login(this, IDC_LOGIN), @@ -24,6 +25,7 @@ public: m_register(this, IDC_BUTTON_REGISTER) { CreateLink(m_ssl, WHATSAPP_KEY_SSL, DBVT_BYTE, false); + CreateLink(m_remoteTime, WHATSAPP_KEY_USE_REMOTE_TIME, DBVT_BYTE, false); CreateLink(m_autorun, WHATSAPP_KEY_AUTORUNCHATS, DBVT_BYTE, true); CreateLink(m_cc, WHATSAPP_KEY_CC, _T("")); diff --git a/protocols/WhatsApp/src/messages.cpp b/protocols/WhatsApp/src/messages.cpp index 452215b90a..837b13ef01 100644 --- a/protocols/WhatsApp/src/messages.cpp +++ b/protocols/WhatsApp/src/messages.cpp @@ -31,7 +31,11 @@ void WhatsAppProto::onMessageForMe(const FMessage &pMsg) PROTORECVEVENT recv = { 0 }; recv.szMessage = const_cast(msg.c_str()); - recv.timestamp = time(NULL); + if (getByte(WHATSAPP_KEY_USE_REMOTE_TIME, 0)) + recv.timestamp = pMsg.timestamp; + else + recv.timestamp = time(NULL); + ProtoChainRecvMsg(hContact, &recv); } diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index cfdea03d58..9f7099ba98 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -319,9 +319,12 @@ bool WhatsAppProto::Register(int state, const string &cc, const string &number, int WhatsAppProto::OnUserInfo(WPARAM, LPARAM hContact) { ptrA jid(getStringA(hContact, WHATSAPP_KEY_ID)); - if (jid && isOnline()) + if (jid && isOnline()) { m_pConnection->sendQueryLastOnline((char*)jid); - + m_pConnection->sendGetPicture((char*)jid, "image"); + m_pConnection->sendPresenceSubscriptionRequest((char*)jid); + } + return 0; } diff --git a/protocols/WhatsApp/src/resource.h b/protocols/WhatsApp/src/resource.h index 7558d8f549..c8f4f9f296 100644 --- a/protocols/WhatsApp/src/resource.h +++ b/protocols/WhatsApp/src/resource.h @@ -28,6 +28,7 @@ #define IDC_INVITE 1015 #define IDC_AUTORUN 1016 #define IDC_DEFGROUP 1017 +#define IDC_REMOTE_TIME 1018 // Next default values for new objects // @@ -35,7 +36,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 106 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1018 +#define _APS_NEXT_CONTROL_VALUE 1019 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/protocols/WhatsApp/src/version.h b/protocols/WhatsApp/src/version.h index 4f8b0884fc..a9cf6d26e6 100644 --- a/protocols/WhatsApp/src/version.h +++ b/protocols/WhatsApp/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 1 #define __RELEASE_NUM 2 -#define __BUILD_NUM 14 +#define __BUILD_NUM 15 #include -- cgit v1.2.3