Commit fb8e2cde authored by JC Brand's avatar JC Brand

Roster item 'ask' property is always 'subscribe' for subscription requests

* '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
parent 4b905406
......@@ -14,6 +14,7 @@ Changelog
* Add support for smileys [jcbrand]
* Simplified boilerplate markup [jcbrand]
* New configuration settings, ``xhr_custom_status_url`` and ``xhr_user_search_url`` [jcbrand]
* #81 'ask' property for roster items is always 'subscribe' [jcbrand]
0.6.6 (2013-10-16)
------------------
......
......@@ -2485,10 +2485,10 @@
this.$el.addClass(item.get('chat_status'));
if (ask === 'subscribe') {
if ((ask === 'subscribe') && (subscription == 'none')) {
this.$el.addClass('pending-xmpp-contact');
this.$el.html(this.pending_template(item.toJSON()));
} else if (ask === 'request') {
} else if ((ask === 'subscribe') && (subscription == 'from')) {
this.$el.addClass('requesting-xmpp-contact');
this.$el.html(this.request_template(item.toJSON()));
converse.controlboxtoggle.showControlBox();
......@@ -2709,8 +2709,8 @@
$.proxy(function (jid, fullname, img, img_type, url) {
this.add({
jid: bare_jid,
subscription: 'none',
ask: 'request',
subscription: 'from',
ask: 'subscribe',
fullname: fullname,
image: img,
image_type: img_type,
......@@ -2723,7 +2723,13 @@
converse.log("Error while retrieving vcard");
// XXX: Should vcard_updated be set here as
// well?
this.add({jid: bare_jid, subscription: 'none', ask: 'request', fullname: jid, is_last: true});
this.add({
jid: bare_jid,
subscription: 'from',
ask: 'subscribe',
fullname: jid,
is_last: true
});
}, this)
);
} else {
......@@ -2887,10 +2893,10 @@
subscription = item.get('subscription'),
crit = {order:'asc'};
if (ask === 'subscribe') {
if ((ask === 'subscribe') && (subscription == 'none')) {
$pending_contacts.after(view.render().el);
$pending_contacts.after($pending_contacts.siblings('dd.pending-xmpp-contact').tsort(crit));
} else if (ask === 'request') {
} else if ((ask === 'subscribe') && (subscription == 'from')) {
$contact_requests.after(view.render().el);
$contact_requests.after($contact_requests.siblings('dd.requesting-xmpp-contact').tsort(crit));
} else if (subscription === 'both' || subscription === 'to') {
......
......@@ -321,8 +321,8 @@
for (i=0; i<mock.req_names.length; i++) {
this.roster.create({
jid: mock.req_names[i].replace(/ /g,'.').toLowerCase() + '@localhost',
subscription: 'none',
ask: 'request',
subscription: 'from',
ask: 'subscribe',
fullname: mock.req_names[i],
is_last: i===(mock.req_names.length-1)
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment