Closed Bug 955039 Opened 10 years ago Closed 10 years ago

<presence type="subscribe"/> stanzas are ignored when the JID is already in the roster

Categories

(Chat Core :: XMPP, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: florian, Assigned: florian)

References

Details

(Whiteboard: [1.2-wanted])

Attachments

(1 file, 1 obsolete file)

*** Original post on bio 1609 at 2012-07-26 13:42:00 UTC ***

Example of ignored stanza:
<presence xmlns="jabber:client" from="f.queze@jabber.org" to="instantbird@jabber.org" type="subscribe"/>

This is because of this code in xmpp.jsm:
729   onPresenceStanza: function(aStanza) {
730     let from = aStanza.attributes["from"];

733     let jid = this._normalizeJID(from);
734     if (jid in this._buddies)
735       this._buddies[jid].onPresenceStanza(aStanza);
736     else if (jid in this._mucs) {

749     else if (aStanza.attributes["type"] == "subscribe") {
... code showing an authorization request.

This stanza would pass the test at line 749, but has already been misdirected to the buddy at lines 734-735.
*** Original post on bio 1609 at 2012-07-26 13:46:03 UTC ***

This is more useful for Thunderbird than Instantbird as the problem doesn't matter on Gtalk where the servers add the subscription in the other direction automatically.
Blocks: 955019
Whiteboard: [1.2-wanted]
Attached patch Patch (obsolete) — Splinter Review
*** Original post on bio 1609 as attmnt 1760 at 2012-07-27 15:01:00 UTC ***

I just moved the code around, following my findings of comment 0.
Attachment #8353521 - Flags: review?(clokep)
Assignee: nobody → florian
*** Original post on bio 1609 as attmnt 1761 at 2012-07-27 15:47:00 UTC ***

This removes a line of dead code in _onRosterItem and avoids entering buddy.onPresenceStanza for presence stanza of types "unsubscribe", "unsubscribed" or "subscribed" as the code there seemed to do nothing useful.
Attachment #8353522 - Flags: review?(clokep)
Comment on attachment 8353522 [details] [diff] [review]
Alternative patch

*** Original change on bio 1609 attmnt 1761 at 2012-07-27 16:02:27 UTC ***

I think this one makes the code a bit cleaner.
Attachment #8353522 - Flags: review?(clokep) → review+
Comment on attachment 8353521 [details] [diff] [review]
Patch

*** Original change on bio 1609 attmnt 1760 at 2012-07-27 16:04:06 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8353521 - Flags: review?(clokep)
Comment on attachment 8353521 [details] [diff] [review]
Patch

*** Original change on bio 1609 attmnt 1760 at 2012-07-27 16:04:56 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8353521 - Attachment is obsolete: true
*** Original post on bio 1609 at 2012-07-31 10:46:11 UTC ***

https://hg.instantbird.org/instantbird/rev/88e2e977cc95
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.2
You need to log in before you can comment on or make changes to this bug.