Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message Delivery Receipts not working because of the message "type" attribute #1353

Closed
catalincic opened this issue Nov 27, 2018 · 1 comment

Comments

@catalincic
Copy link

commented Nov 27, 2018

Hi, it's the first issue I open so please understand if I do not follow the exact guidelines.

While testing the new Message Delivery Receipts feature you have merged into master recently (few days ago), I have noticed that there is a minor and strange bug which makes the delivery receipts not working.

Cause: The message handler registered in converse-chatboxes.js at line 627 is filtering the stanzas by their type=chat attribute. Code:

registerMessageHandler () {
                _converse.connection.addHandler((stanza) => {
                    this.onMessage(stanza);
                    return true;
                }, null, 'message', 'chat'); // << This line here
               ....
            },

But the delivery receipt stanza sending code does not add the type=chat attribute to the message stanza, hence making the message handler miss the delivery receipts.

sendReceiptStanza (to_jid, id) {
                const receipt_stanza = $msg({
                    'from': _converse.connection.jid,
                    'id': _converse.connection.getUniqueId(),
                    'to': to_jid,

                   // This is not in the code but should be added; or change the message handler
                    'type': 'chat' 
                }).c('received', {'xmlns': Strophe.NS.RECEIPTS, 'id': id}).up();
                _converse.api.send(receipt_stanza);
            },

As far as I can tell, it is indeed a bug - maybe I have missed something, but while testing delivery receipts, I noticed they were not working and the cause was this attribute missing. Checking the XEP-0184 specs, I do not see any type=chat attribute in the guidelines, so probably the message handler needs to be changed instead of adding that attribute. I would happily do it, but I am afraid I do not have the required experience with this to make sure the code changes will work properly.

@catalincic catalincic changed the title Message Delivery Receipts not being sent because of message "type" attribute Message Delivery Receipts not working because of the message "type" attribute Nov 27, 2018

@jcbrand

This comment has been minimized.

Copy link
Member

commented Nov 28, 2018

Thanks @catalincic, your bug report is quite clear and detailed.

Maybe @ChaosKid42 wants to take a look, otherwise I'll do so later in the month.

I think the solution is to update registerMessageHandler so that the 'chat' type requirement is dropped, then in the handler which callsed this.onMessage, we should check whether the type is 'chat' or whether we received a receipt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.