summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/WhatsAPI++/FMessage.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-01-28 16:30:05 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-01-28 16:30:05 +0000
commit52c57ef89cc24bdb8c70908f544ae86fd87db129 (patch)
treebbbeb2b8ffa4109a50bae561c2e00aad9e565068 /protocols/WhatsApp/src/WhatsAPI++/FMessage.cpp
parentf546c968c4ee1add671e8b6545d52dece95cd3f5 (diff)
- statusbar icon added to notify user that a message was read;
- FMessage own numbering removed as atavism; - WAConnection::msg_id followed FMessage::id on its road to hell - WhatsAppProto::GetSerial() added as the only method that increments message numbers git-svn-id: http://svn.miranda-ng.org/main/trunk@11941 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp/src/WhatsAPI++/FMessage.cpp')
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/FMessage.cpp44
1 files changed, 4 insertions, 40 deletions
diff --git a/protocols/WhatsApp/src/WhatsAPI++/FMessage.cpp b/protocols/WhatsApp/src/WhatsAPI++/FMessage.cpp
index a684d1e3e3..e3c3367b04 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/FMessage.cpp
+++ b/protocols/WhatsApp/src/WhatsAPI++/FMessage.cpp
@@ -9,15 +9,9 @@
#include "utilities.h"
-//SDL_mutex* FMessage::generating_lock = SDL_CreateMutex();
-IMutex* FMessage::generating_lock = NULL;
-int FMessage::generating_id = 0;
-std::string FMessage::generating_header = Utilities::intToStr(static_cast<int> (time(NULL))).append("-");
-
-
-FMessage::FMessage()
+FMessage::FMessage() :
+ key("", false, "")
{
- this->key = NULL;
this->timestamp = 0;
this->media_wa_type = 0;
this->longitude = 0;
@@ -29,15 +23,9 @@ FMessage::FMessage()
this->data = "";
}
-FMessage::FMessage(const std::string& remote_jid, bool from_me, const std::string& data)
+FMessage::FMessage(const std::string &remote_jid, bool from_me, const std::string &id) :
+ key(remote_jid, from_me, id)
{
- Key* local_key;
- FMessage::generating_lock->lock();
- FMessage::generating_id++;
- local_key = new Key(remote_jid, from_me, generating_header + Utilities::intToStr(generating_id));
- this->key = local_key;
- FMessage::generating_lock->unlock();
- this->data = data;
this->timestamp = time(NULL);
this->media_wa_type = 0;
this->longitude = 0;
@@ -48,28 +36,6 @@ FMessage::FMessage(const std::string& remote_jid, bool from_me, const std::strin
this->media_url = "";
}
-std::string FMessage::nextKeyIdNumber()
-{
- int id = 0;
- FMessage::generating_lock->lock();
- id = (FMessage::generating_id++);
- FMessage::generating_lock->unlock();
- return generating_header + (Utilities::intToStr(id));
-}
-
-FMessage::FMessage(Key* key)
-{
- this->key = key;
- this->timestamp = 0;
- this->media_wa_type = 0;
- this->longitude = 0;
- this->latitude = 0;
- this->media_duration_seconds = 0;
- this->media_size = 0;
- this->media_name = "";
- this->media_url = "";
-}
-
std::string FMessage::getMessage_WA_Type_StrValue(unsigned char type)
{
switch (type) {
@@ -94,8 +60,6 @@ std::string FMessage::getMessage_WA_Type_StrValue(unsigned char type)
FMessage::~FMessage()
{
- if (this->key != NULL)
- delete key;
}
Key::Key(const std::string& remote_jid, bool from_me, const std::string& id)