* Differentiate between adding new roster items and rendering existing ones.
* Also, only sort pending and requesting contacts once they've all been added
(similar to what was already being done with existing contacts)
Instead of differentiating between trimmed chats and minimized chats, the two
are now combined into the same thing.
This commit contains some initial work, but functionality is still impaired.
Some of the tests were failing because they didn't expect the controlbox to be
returned from localStorage.
It's too long ago that I've looked at this branch for me to say whether this is
a legitimate bug or not.
Will have to investigate further.
- use the same method for both normal and OTR messages
- fix /me actions for OTR messages
- rename messaging methods to minimize ambiguity
Conflicts:
converse.js
tests/utils.js
Did more investigation with regards to subscription requests.
As far as I can tell, roster updates will only show ask='request' for 'pending
out' requests.
For 'pending in' requests (what converse.js calls requesting contacts), roster
updates are not used and instead a presence stanza with type 'subscribe' is
used.
This makes sense. When sending a presence with type 'subscribe', we need a way
to keep track of our outgoing subscriptions. The XMPP server helps us do this by
adding a user to our roster with ask='request' and subscription='none'.
When our contact receives our presence with type 'subscribe', they have the
information they need. If they go offline and online again, the XMPP server
will resend the presence with type 'subscribe'. So a roster item is not needed.
In convere.js's internal representation of the roster (via the RosterItems backbone
object) we need to add roster items for 'pending in' contacts so that we can
render them and we need to know whether they are 'pending in' or 'pending out'.
We already know they're 'pending out' when ask='subscribe' and
subscription='none'. For 'pending in', since these roster items are only stored
locally and not on the XMPP server (because 'pending in' requests are handled
via <presence> stanzas and not the roster) we add a special attribute
'requesting'.
* 'pending' state is denoted by subscription='none', ask='subscribe'
* 'requesting' state is denoted by subscription='from', ask='subscribe'
Reference: http://xmpp.org/rfcs/rfc3921.html#int
I'm not yet 100% sure with regards to the 'requesting' state, I can't find
anything about it in the above mentioned reference, but apparantly that's what
prosody's roster response looks like (e.g. <item jid='XYZ' ask='subscribe'
subscription='from'/> ).
With ejabberd I haven't yet received such a roster response and contact
requests are always handled via presence stanzas.
updates #81
Use id 'conversejs' instead of 'chatpanel'.
The controlbox toggle is now generated via a backbone view, you don't need to
manually include it in your markup.
When using show_only_online_users, roster item DOM elements are removed from
the DOM if their status changed from 'online' to something else.
When their status changed to 'online' again, they were re-added.
Their views (RosterItemView) instances however didn't listen to events anymore.
Calling delegateEvents on the view after calling $.remove() fixed this.
Users without roster contacts didn't have XMPPStatus.initStatus called and
therefore had a default status of offline.
Fixed this by setting the status to online from the start. The fetch command
will get the true status from localStorage (if available).
Made sure that the rest of converse's onConnected code is called in the
callback from fetch (so that we know the user's status is correct).
Updated and fixed tests.