Bug 45755

Summary: Inconsistent ordering of pendingMessageRemoved
Product: Telepathy Reporter: David Edmundson <kde>
Component: tp-qtAssignee: Dario Freddi <drf54321>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard: r+
i915 platform: i915 features:
Attachments: Patch for issue.

Description David Edmundson 2012-02-07 16:19:39 UTC
Assuming we have one message in the messageQueue

If we call forget() TpQt emits pendingMessagesRemoved after it deletes it from the queue, so messageQueue.size() is 0.

If we call acknowledge and removed in another client TpQt emits pendingMessagesRemoved before it deletes it from the queue, so messageQueue.size() is 1. (in  TextChannel::Private::processMessageQueue())

From a personal POV it makes a lot more sense to me to delete it from the message queue first, in all my use cases of this signal it's used to update any notification of unread messages, on receipt of this signal I end up call messageQueue.size() which gives me +1 of what the message size will be by the time this signal finishes.

Given the signal is called pendingMessageRemoved (emphasis on it being a past tense) I would have expected the removal to have already taken place.
Comment 1 David Edmundson 2012-02-21 15:51:11 UTC
Created attachment 57428 [details] [review]
Patch for issue.

Emit pendingMessagesRemoved after the pending message has actually been removed.
Comment 2 Dario Freddi 2012-03-13 03:44:52 UTC
Under review
Comment 3 Dario Freddi 2012-03-13 05:59:50 UTC
Approved
Comment 4 Dario Freddi 2012-03-13 06:31:48 UTC
Committed as 5b2c18f732b512e539a3bf69c21420d719a20e0a, will be released in 0.9.1, thanks for your patch :)

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.