Commit fe03940f authored by Guillermo Bonvehí's avatar Guillermo Bonvehí

Fix issue #305, show=online presence sent

setStatusMessage was modified to send the presence using
sendPresence method which skips show tag when type is 'online'
Added getStatus helper method
parent 65b1898f
......@@ -4250,7 +4250,7 @@
this.XMPPStatus = Backbone.Model.extend({
initialize: function () {
this.set({
'status' : this.get('status') || 'online'
'status' : this.getStatus()
});
this.on('change', $.proxy(function (item) {
if (this.get('fullname') === undefined) {
......@@ -4270,12 +4270,14 @@
}, this));
},
sendPresence: function (type) {
if (type === undefined) {
sendPresence: function (type, status_message) {
if (typeof type === 'undefined') {
type = this.get('status') || 'online';
}
var status_message = this.get('status_message'),
presence;
if (typeof status_message === 'undefined') {
status_message = this.get('status_message');
}
var presence;
// Most of these presence types are actually not explicitly sent,
// but I add all of them here fore reference and future proofing.
if ((type === 'unavailable') ||
......@@ -4309,8 +4311,12 @@
this.save({'status': value});
},
getStatus: function() {
return this.get('status') || 'online';
},
setStatusMessage: function (status_message) {
converse.connection.send($pres().c('show').t(this.get('status')).up().c('status').t(status_message));
this.sendPresence(this.getStatus(), status_message);
this.save({'status_message': status_message});
if (this.xhr_custom_status) {
$.ajax({
......
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