mirror of
https://github.com/moparisthebest/kaiwa
synced 2025-01-13 06:38:09 -05:00
Update human-model, fix idle from sticking
This commit is contained in:
parent
4c3d3fee3e
commit
adda6d7547
@ -45,6 +45,7 @@ module.exports = {
|
|||||||
app.storage.profiles.get(config.jid, function (err, res) {
|
app.storage.profiles.get(config.jid, function (err, res) {
|
||||||
if (res) {
|
if (res) {
|
||||||
profile = res;
|
profile = res;
|
||||||
|
profile.jid = {full: config.jid, bare: config.jid};
|
||||||
config.rosterVer = res.rosterVer;
|
config.rosterVer = res.rosterVer;
|
||||||
}
|
}
|
||||||
cb();
|
cb();
|
||||||
|
@ -28,27 +28,27 @@ module.exports = HumanModel.define({
|
|||||||
type: 'contact',
|
type: 'contact',
|
||||||
props: {
|
props: {
|
||||||
id: ['string', true, false],
|
id: ['string', true, false],
|
||||||
avatarID: ['string', true, ''],
|
avatarID: ['string', false, ''],
|
||||||
groups: ['array', true, []],
|
groups: ['array', false, []],
|
||||||
inRoster: ['bool', true, false],
|
inRoster: ['bool', true, false],
|
||||||
jid: ['string', true],
|
jid: ['string', true],
|
||||||
name: ['string', true, ''],
|
name: ['string', false, ''],
|
||||||
owner: ['string', true, ''],
|
owner: ['string', true, ''],
|
||||||
storageId: ['string', true, ''],
|
storageId: ['string', true, ''],
|
||||||
subscription: ['string', true, 'none']
|
subscription: ['string', false, 'none']
|
||||||
},
|
},
|
||||||
session: {
|
session: {
|
||||||
activeContact: ['bool', true, false],
|
activeContact: ['bool', false, false],
|
||||||
avatar: 'string',
|
avatar: 'string',
|
||||||
avatarSource: 'string',
|
avatarSource: 'string',
|
||||||
lastInteraction: 'date',
|
lastInteraction: 'date',
|
||||||
lastSentMessage: 'object',
|
lastSentMessage: 'object',
|
||||||
lockedResource: 'string',
|
lockedResource: 'string',
|
||||||
offlineStatus: ['string', true, ''],
|
offlineStatus: ['string', false, ''],
|
||||||
topResource: 'string',
|
topResource: 'string',
|
||||||
unreadCount: ['number', true, 0],
|
unreadCount: ['number', false, 0],
|
||||||
_forceUpdate: ['number', true, 0],
|
_forceUpdate: ['number', false, 0],
|
||||||
onCall: ['boolean', true, false],
|
onCall: ['boolean', false, false],
|
||||||
stream: 'object'
|
stream: 'object'
|
||||||
},
|
},
|
||||||
derived: {
|
derived: {
|
||||||
@ -147,7 +147,7 @@ module.exports = HumanModel.define({
|
|||||||
idle: {
|
idle: {
|
||||||
deps: ['idleSince'],
|
deps: ['idleSince'],
|
||||||
fn: function () {
|
fn: function () {
|
||||||
return !!this.idleSince;
|
return this.idleSince && !isNaN(this.idleSince.valueOf());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
chatState: {
|
chatState: {
|
||||||
|
@ -37,11 +37,11 @@ module.exports = HumanModel.define({
|
|||||||
nick: 'string'
|
nick: 'string'
|
||||||
},
|
},
|
||||||
session: {
|
session: {
|
||||||
avatar: ['string', true, ''],
|
avatar: 'string',
|
||||||
connected: ['bool', true, false],
|
connected: ['bool', false, false],
|
||||||
shouldAskForAlertsPermission: ['bool', true, false],
|
shouldAskForAlertsPermission: ['bool', false, false],
|
||||||
hasFocus: ['bool', true, false],
|
hasFocus: ['bool', false, false],
|
||||||
_activeContact: ['string', true, ''],
|
_activeContact: 'string',
|
||||||
stream: 'object'
|
stream: 'object'
|
||||||
},
|
},
|
||||||
collections: {
|
collections: {
|
||||||
@ -74,8 +74,8 @@ module.exports = HumanModel.define({
|
|||||||
if (curr) {
|
if (curr) {
|
||||||
curr.activeContact = true;
|
curr.activeContact = true;
|
||||||
curr.unreadCount = 0;
|
curr.unreadCount = 0;
|
||||||
|
this._activeContact = curr.id;
|
||||||
}
|
}
|
||||||
this._activeContact = jid;
|
|
||||||
},
|
},
|
||||||
setAvatar: function (id, type, source) {
|
setAvatar: function (id, type, source) {
|
||||||
var self = this;
|
var self = this;
|
||||||
@ -91,6 +91,9 @@ module.exports = HumanModel.define({
|
|||||||
if (this.isMe(jid)) {
|
if (this.isMe(jid)) {
|
||||||
jid = alt || jid;
|
jid = alt || jid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!jid) return;
|
||||||
|
|
||||||
return this.contacts.get(jid.bare) ||
|
return this.contacts.get(jid.bare) ||
|
||||||
this.mucs.get(jid.bare) ||
|
this.mucs.get(jid.bare) ||
|
||||||
this.calls.findWhere('jid', jid);
|
this.calls.findWhere('jid', jid);
|
||||||
@ -142,7 +145,7 @@ module.exports = HumanModel.define({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
isMe: function (jid) {
|
isMe: function (jid) {
|
||||||
return jid.bare === this.jid.bare;
|
return jid && (jid.bare === this.jid.bare);
|
||||||
},
|
},
|
||||||
updateIdlePresence: function () {
|
updateIdlePresence: function () {
|
||||||
var update = {
|
var update = {
|
||||||
|
@ -15,17 +15,17 @@ var Message = module.exports = HumanModel.define({
|
|||||||
},
|
},
|
||||||
type: 'message',
|
type: 'message',
|
||||||
props: {
|
props: {
|
||||||
mid: ['string', true],
|
mid: 'string',
|
||||||
owner: 'string',
|
owner: 'string',
|
||||||
to: ['object', true],
|
to: 'object',
|
||||||
from: ['object', true],
|
from: 'object',
|
||||||
body: ['string', true, ''],
|
body: 'string',
|
||||||
type: ['string', true, 'normal'],
|
type: ['string', false, 'normal'],
|
||||||
acked: ['bool', true, false],
|
acked: ['bool', false, false],
|
||||||
requestReceipt: ['boo', true, false],
|
requestReceipt: ['bool', false, false],
|
||||||
receipt: ['bool', true, false],
|
receipt: ['bool', false, false],
|
||||||
archivedId: ['string', true, ''],
|
archivedId: 'string',
|
||||||
oobURIs: ['array', false, []]
|
oobURIs: 'array'
|
||||||
},
|
},
|
||||||
derived: {
|
derived: {
|
||||||
mine: {
|
mine: {
|
||||||
|
@ -19,18 +19,18 @@ module.exports = HumanModel.define({
|
|||||||
},
|
},
|
||||||
type: 'muc',
|
type: 'muc',
|
||||||
props: {
|
props: {
|
||||||
id: ['string', true, false],
|
id: ['string', true],
|
||||||
name: 'string',
|
name: 'string',
|
||||||
autoJoin: ['bool', true, false],
|
autoJoin: ['bool', false, false],
|
||||||
nick: 'string',
|
nick: 'string',
|
||||||
jid: 'object'
|
jid: 'object'
|
||||||
},
|
},
|
||||||
session: {
|
session: {
|
||||||
subject: 'string',
|
subject: 'string',
|
||||||
activeContact: ['bool', true, false],
|
activeContact: ['bool', false, false],
|
||||||
lastInteraction: 'data',
|
lastInteraction: 'date',
|
||||||
lastSentMessage: 'object',
|
lastSentMessage: 'object',
|
||||||
unreadCount: ['number', true, 0],
|
unreadCount: ['number', false, 0],
|
||||||
joined: ['bool', true, false]
|
joined: ['bool', true, false]
|
||||||
},
|
},
|
||||||
derived: {
|
derived: {
|
||||||
|
@ -9,11 +9,11 @@ module.exports = HumanModel.define({
|
|||||||
type: 'resource',
|
type: 'resource',
|
||||||
session: {
|
session: {
|
||||||
id: ['string', true],
|
id: ['string', true],
|
||||||
status: ['string', true, ''],
|
status: 'string',
|
||||||
show: ['string', true, ''],
|
show: 'string',
|
||||||
priority: ['number', true, 0],
|
priority: ['number', false, 0],
|
||||||
chatState: ['string', true, 'gone'],
|
chatState: ['string', false, 'gone'],
|
||||||
idleSince: ['date', false, undefined],
|
idleSince: 'date',
|
||||||
discoInfo: 'object',
|
discoInfo: 'object',
|
||||||
timezoneOffset: 'number'
|
timezoneOffset: 'number'
|
||||||
},
|
},
|
||||||
@ -27,7 +27,7 @@ module.exports = HumanModel.define({
|
|||||||
idle: {
|
idle: {
|
||||||
deps: ['idleSince'],
|
deps: ['idleSince'],
|
||||||
fn: function () {
|
fn: function () {
|
||||||
return !!this.idleSince;
|
return this.idleSince && !isNaN(this.idleSince.valueOf());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
supportsReceipts: {
|
supportsReceipts: {
|
||||||
|
@ -26,16 +26,16 @@ module.exports = HumanModel.define({
|
|||||||
this.markActive();
|
this.markActive();
|
||||||
},
|
},
|
||||||
session: {
|
session: {
|
||||||
focused: ['bool', true, true],
|
focused: ['bool', false, true],
|
||||||
active: ['bool', true, false],
|
active: ['bool', false, false],
|
||||||
connected: ['bool', true, false],
|
connected: ['bool', false, false],
|
||||||
hasConnected: ['bool', true, false],
|
hasConnected: ['bool', false, false],
|
||||||
idleTimeout: ['number', true, 600000],
|
idleTimeout: ['number', false, 600000],
|
||||||
idleSince: 'date',
|
idleSince: 'date',
|
||||||
allowAlerts: ['bool', true, false],
|
allowAlerts: ['bool', false, false],
|
||||||
badge: ['string', true, ''],
|
badge: 'string',
|
||||||
pageTitle: ['string', true, ''],
|
pageTitle: 'string',
|
||||||
hasActiveCall: ['boolean', true, false]
|
hasActiveCall: ['boolean', false, false]
|
||||||
},
|
},
|
||||||
derived: {
|
derived: {
|
||||||
title: {
|
title: {
|
||||||
|
@ -159,7 +159,7 @@ module.exports = BasePage.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
message = {
|
message = {
|
||||||
to: this.model.lockedResource || this.model.jid,
|
to: client.JID(this.model.lockedResource || this.model.jid),
|
||||||
type: 'chat',
|
type: 'chat',
|
||||||
body: val,
|
body: val,
|
||||||
requestReceipt: true,
|
requestReceipt: true,
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"getconfig": "0.0.5",
|
"getconfig": "0.0.5",
|
||||||
"getusermedia": "0.2.1",
|
"getusermedia": "0.2.1",
|
||||||
"helmet": "0.1.0",
|
"helmet": "0.1.0",
|
||||||
"human-model": "1.4.0",
|
"human-model": "2.6.0",
|
||||||
"human-view": "1.2.0",
|
"human-view": "1.2.0",
|
||||||
"jade": "0.35.0",
|
"jade": "0.35.0",
|
||||||
"moonboots": "1.0.0",
|
"moonboots": "1.0.0",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
CACHE MANIFEST
|
CACHE MANIFEST
|
||||||
# 0.0.3 1388920243107
|
# 0.0.3 1388923898053
|
||||||
|
|
||||||
CACHE:
|
CACHE:
|
||||||
/app.js
|
/app.js
|
||||||
|
Loading…
Reference in New Issue
Block a user