summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-03-02 17:26:52 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-03-02 17:26:52 +0000
commit98d1364fe37597a79535f4982bf93b66acd8286d (patch)
tree45324c4f4a56236141de79c83a4a51e964133919 /protocols
parent20cc2883a8790563b18e7ba2985b6e92b27073af (diff)
- fix for writing LastSeen information;
- fix for receiving error 404 on long contact lists; - iq:last query moved to the UserInfo dialog opening; - version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@12301 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/WhatsApp/src/contacts.cpp14
-rw-r--r--protocols/WhatsApp/src/proto.cpp10
-rw-r--r--protocols/WhatsApp/src/proto.h1
-rw-r--r--protocols/WhatsApp/src/version.h2
4 files changed, 19 insertions, 8 deletions
diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp
index d68e3b42b5..abdfeea923 100644
--- a/protocols/WhatsApp/src/contacts.cpp
+++ b/protocols/WhatsApp/src/contacts.cpp
@@ -90,11 +90,11 @@ void WhatsAppProto::ProcessBuddyList(void*)
{
// m_pConnection->setFlush(false);
- for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- ptrA jid(getStringA(hContact, WHATSAPP_KEY_ID));
- if (jid)
- m_pConnection->sendQueryLastOnline((char*)jid);
- }
+ // for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+ // ptrA jid(getStringA(hContact, WHATSAPP_KEY_ID));
+ // if (jid)
+ // m_pConnection->sendQueryLastOnline((char*)jid);
+ // }
// m_pConnection->setFlush(true);
@@ -123,7 +123,7 @@ void WhatsAppProto::onAvailable(const std::string &paramString, bool paramBoolea
void WhatsAppProto::onLastSeen(const std::string &paramString1, int paramInt, const string &paramString2)
{
MCONTACT hContact = AddToContactList(paramString1);
- setDword(hContact, WHATSAPP_KEY_LAST_SEEN, paramInt);
+ setDword(hContact, WHATSAPP_KEY_LAST_SEEN, time(NULL) - paramInt);
UpdateStatusMsg(hContact);
}
@@ -134,7 +134,7 @@ void WhatsAppProto::UpdateStatusMsg(MCONTACT hContact)
int lastSeen = getDword(hContact, WHATSAPP_KEY_LAST_SEEN, -1);
if (lastSeen != -1) {
- time_t ts = time(NULL) - lastSeen;
+ time_t ts = lastSeen;
TCHAR stzLastSeen[MAX_PATH];
_tcsftime(stzLastSeen, SIZEOF(stzLastSeen), TranslateT("Last seen on %x at %X"), localtime(&ts));
ss << stzLastSeen;
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp
index f5870bd588..f41519a172 100644
--- a/protocols/WhatsApp/src/proto.cpp
+++ b/protocols/WhatsApp/src/proto.cpp
@@ -75,6 +75,7 @@ int WhatsAppProto::OnEvent(PROTOEVENTTYPE evType, WPARAM wParam, LPARAM lParam)
HookProtoEvent(ME_GC_EVENT, &WhatsAppProto::onGroupChatEvent);
HookProtoEvent(ME_GC_BUILDMENU, &WhatsAppProto::OnChatMenu);
+ HookProtoEvent(ME_USERINFO_INITIALISE, &WhatsAppProto::OnUserInfo);
}
return TRUE;
}
@@ -349,6 +350,15 @@ int WhatsAppProto::OnOptionsInit(WPARAM wParam, LPARAM lParam)
return 0;
}
+int WhatsAppProto::OnUserInfo(WPARAM, LPARAM hContact)
+{
+ ptrA jid(getStringA(hContact, WHATSAPP_KEY_ID));
+ if (jid && isOnline())
+ m_pConnection->sendQueryLastOnline((char*)jid);
+
+ return 0;
+}
+
void WhatsAppProto::RequestFriendship(MCONTACT hContact)
{
if (hContact == NULL || isOffline())
diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h
index 224527e800..e3e47e5ba1 100644
--- a/protocols/WhatsApp/src/proto.h
+++ b/protocols/WhatsApp/src/proto.h
@@ -91,6 +91,7 @@ public:
// Events ////////////////////////////////////////////////////////////////////////////
int __cdecl OnOptionsInit(WPARAM, LPARAM);
+ int __cdecl OnUserInfo(WPARAM, LPARAM);
int __cdecl OnBuildStatusMenu(WPARAM, LPARAM);
// Worker Threads ////////////////////////////////////////////////////////////////////
diff --git a/protocols/WhatsApp/src/version.h b/protocols/WhatsApp/src/version.h
index 68c9bb15df..eec0da9fe0 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 10
+#define __BUILD_NUM 11
#include <stdver.h>