Skip to content

Commit

Permalink
Implement blue double check for single target sent messages.
Browse files Browse the repository at this point in the history
Doesn't report back when one received message has been read
and doesn't work for groups.
  • Loading branch information
agamez committed Nov 24, 2014
1 parent a7b31af commit 265e763
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/yappari-application/Gui/chatimageitem.cpp
Expand Up @@ -226,6 +226,8 @@ void ChatImageItem::setTimestamp(FMessage message)
}
else if (message.status == FMessage::ReceivedByTarget)
html.append(DOUBLECHECK);
else if (message.status == FMessage::ReadByTarget)
html.append(DOUBLEBLUECHECK);
else if (message.status == FMessage::Played)
{
html.append(VOICEPLAYED);
Expand Down
2 changes: 2 additions & 0 deletions src/yappari-application/Gui/chattextitem.cpp
Expand Up @@ -125,6 +125,8 @@ QString ChatTextItem::createHTML()
html.append(CHECK);
else if (message.status == FMessage::ReceivedByTarget)
html.append(DOUBLECHECK);
else if (message.status == FMessage::ReadByTarget)
html.append(DOUBLEBLUECHECK);
else
html.append(GRAYCHECK);
}
Expand Down
11 changes: 10 additions & 1 deletion src/yappari-application/Whatsapp/connection.cpp
Expand Up @@ -555,13 +555,22 @@ void Connection::parseMessageInitialTagAlreadyChecked(ProtocolTreeNode& messageN
{
message.status = (receipt_type == "played")
? FMessage::Played
: FMessage::ReceivedByTarget;
/* Whatsapp server sends the same "received" message twice:
once when received by the target and the second one when
it has been read (or at least displayed by the app) */
: (message.status == FMessage::ReceivedByTarget)
? FMessage::ReadByTarget
: FMessage::ReceivedByTarget;
msgType = (from == "s.us") ? Unknown : MessageStatusUpdate;

// Remove it from the store if it's not a voice message
// Or if it's a voice message already played
if ((message.live && receipt_type == "played") || !message.live)
store.remove(k);

// But restore it if still waiting for ReadByTarget
if (message.status == FMessage::ReceivedByTarget)
store.put(message);
}
if (receipt_type == "delivered" || receipt_type == "played" ||
receipt_type.isEmpty())
Expand Down
1 change: 1 addition & 0 deletions src/yappari-application/Whatsapp/fmessage.h
Expand Up @@ -46,6 +46,7 @@ class FMessage
SentByClient,
ReceivedByServer,
ReceivedByTarget,
ReadByTarget,
NeverSent,
ServerBounce,
Played
Expand Down
1 change: 1 addition & 0 deletions src/yappari-application/globalconstants.h
Expand Up @@ -224,6 +224,7 @@
#define GRAYCHECK "<img src=\"/usr/share/yappari/icons/17x13/yappari-graycheck.png\" />"
#define CHECK "<img src=\"/usr/share/yappari/icons/17x13/yappari-greencheck.png\" />"
#define DOUBLECHECK "<img src=\"/usr/share/yappari/icons/17x13/yappari-greendoublecheck.png\" />"
#define DOUBLEBLUECHECK "<img src=\"/usr/share/yappari/icons/17x13/yappari-bluedoublecheck.png\" />"
#define UPLOADING "<img src=\"/usr/share/yappari/icons/17x13/yappari-uploading.png\" />"

// Extensions
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 265e763

Please sign in to comment.