From 52c57ef89cc24bdb8c70908f544ae86fd87db129 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 28 Jan 2015 16:30:05 +0000 Subject: - 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 --- protocols/WhatsApp/src/WhatsAPI++/FMessage.cpp | 44 +++----------------------- 1 file changed, 4 insertions(+), 40 deletions(-) (limited to 'protocols/WhatsApp/src/WhatsAPI++/FMessage.cpp') 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 (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) -- cgit v1.2.3