summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-07-25 13:19:35 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-07-25 13:19:35 +0000
commit76e343ab968fb6f194333fb0ec7057eaf621bcd4 (patch)
treed26a6621db55ef37a33347b157dd228474a9089e
parentdae9bc184b44c2b0c70b7996f202d6a7fa2dd4a4 (diff)
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
-rw-r--r--protocols/WhatsApp/res/whatsapp.rc34
-rw-r--r--protocols/WhatsApp/src/db.h1
-rw-r--r--protocols/WhatsApp/src/dialogs.cpp4
-rw-r--r--protocols/WhatsApp/src/messages.cpp6
-rw-r--r--protocols/WhatsApp/src/proto.cpp7
-rw-r--r--protocols/WhatsApp/src/resource.h3
-rw-r--r--protocols/WhatsApp/src/version.h2
7 files changed, 35 insertions, 22 deletions
diff --git a/protocols/WhatsApp/res/whatsapp.rc b/protocols/WhatsApp/res/whatsapp.rc
index a9b0473003..77d59786c9 100644
--- a/protocols/WhatsApp/res/whatsapp.rc
+++ b/protocols/WhatsApp/res/whatsapp.rc
@@ -81,14 +81,15 @@ BEGIN
LTEXT "Default group:",IDC_STATIC,4,37,55,10
EDITTEXT IDC_DEFGROUP,60,36,124,12,ES_AUTOHSCROLL
CONTROL "Use SSL connection (port 443)",IDC_SSL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,52,180,10
- CONTROL "Automatically open group chats",IDC_AUTORUN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,64,180,10
- GROUPBOX "Registration",IDC_STATIC,4,80,184,48
- LTEXT "SMS code",IDC_STATIC,8,93,47,10
- EDITTEXT IDC_PW,64,92,20,12,ES_AUTOHSCROLL | ES_NUMBER
- CTEXT "-",IDC_STATIC,86,93,8,10
- EDITTEXT IDC_PW2,96,92,20,12,ES_AUTOHSCROLL | ES_NUMBER
- PUSHBUTTON "Request code",IDC_BUTTON_REQUEST_CODE,12,108,80,14
- PUSHBUTTON "Register code",IDC_BUTTON_REGISTER,100,108,80,14
+ CONTROL "Use remote message timestamps", IDC_REMOTE_TIME, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 4, 64, 180, 10
+ CONTROL "Automatically open group chats",IDC_AUTORUN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,76,180,10
+ GROUPBOX "Registration",IDC_STATIC,4,92,184,48
+ LTEXT "SMS code",IDC_STATIC,8,105,47,10
+ EDITTEXT IDC_PW,64,104,20,12,ES_AUTOHSCROLL | ES_NUMBER
+ CTEXT "-",IDC_STATIC,86,105,8,10
+ EDITTEXT IDC_PW2,96,104,20,12,ES_AUTOHSCROLL | ES_NUMBER
+ PUSHBUTTON "Request code",IDC_BUTTON_REQUEST_CODE,12,120,80,14
+ PUSHBUTTON "Register code",IDC_BUTTON_REGISTER,100,120,80,14
END
IDD_OPTIONS DIALOGEX 0, 0, 188, 164
@@ -105,14 +106,15 @@ BEGIN
LTEXT "Default group:",IDC_STATIC,4,57,55,10
EDITTEXT IDC_DEFGROUP,60,56,124,12,ES_AUTOHSCROLL
CONTROL "Use SSL connection (port 443)",IDC_SSL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,72,180,10
- CONTROL "Automatically open group chats",IDC_AUTORUN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,84,180,10
- GROUPBOX "Registration",IDC_STATIC,4,100,184,48
- LTEXT "SMS code",IDC_STATIC,8,113,47,10
- EDITTEXT IDC_PW,64,112,20,12,ES_AUTOHSCROLL | ES_NUMBER
- CTEXT "-",IDC_STATIC,86,113,8,10
- EDITTEXT IDC_PW2,96,112,20,12,ES_AUTOHSCROLL | ES_NUMBER
- PUSHBUTTON "Request code",IDC_BUTTON_REQUEST_CODE,12,128,80,14
- PUSHBUTTON "Register code",IDC_BUTTON_REGISTER,100,128,80,14
+ CONTROL "Use remote message timestamps", IDC_REMOTE_TIME, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 4, 84, 180, 10
+ CONTROL "Automatically open group chats",IDC_AUTORUN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,96,180,10
+ GROUPBOX "Registration",IDC_STATIC,4,112,184,48
+ LTEXT "SMS code",IDC_STATIC,8,125,47,10
+ EDITTEXT IDC_PW,64,124,20,12,ES_AUTOHSCROLL | ES_NUMBER
+ CTEXT "-",IDC_STATIC,86,125,8,10
+ EDITTEXT IDC_PW2,96,124,20,12,ES_AUTOHSCROLL | ES_NUMBER
+ PUSHBUTTON "Request code",IDC_BUTTON_REQUEST_CODE,12,140,80,14
+ PUSHBUTTON "Register code",IDC_BUTTON_REGISTER,100,140,80,14
END
IDD_GROUPCHAT_INVITE DIALOGEX 0, 0, 215, 170
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<WhatsAppProto>
{
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<char*>(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 <stdver.h>