1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-11-16 06:15:08 -05:00
kaiwa/clientapp/models/call.js

31 lines
837 B
JavaScript
Raw Normal View History

/*global app, me, client*/
"use strict";
var _ = require('underscore');
var HumanModel = require('human-model');
var logger = require('andlog');
module.exports = HumanModel.define({
type: 'call',
initialize: function (attrs) {
this.contact.onCall = true;
// temporary, this won't stay here
2014-12-10 05:25:19 -05:00
app.navigate('/chat/' + encodeURIComponent(this.contact.jid));
},
session: {
2013-10-15 19:21:22 -04:00
contact: 'object',
jingleSession: 'object',
state: ['string', true, 'inactive'],
multiUser: ['boolean', true, false]
},
end: function (reasonForEnding) {
var reason = reasonForEnding || 'success';
this.contact.onCall = false;
if (this.jingleSession) {
2013-10-16 16:13:29 -04:00
this.jingleSession.end(reasonForEnding);
}
this.collection.remove(this);
}
});