Download:
child 42:76ef29f4711c
parent 40:066e4cb38adb
41:260f3df482df
Anton Shestakov <av6@dwimlabs.net>, Thu, 24 Mar 2016 20:17:04 +0800
index: improve onPresence() - default presence type is 'available', not 'online' - return early on all standard types that aren't currently handled - set default show and priority based on presence type - use status message in log - don't show status changes for contact type 'self'

9 файлов изменено, 99 вставок(+), 76 удалений(-) [+]
coffee/contacts.coffee file | annotate | diff | comparison | revisions
coffee/index.coffee file | annotate | diff | comparison | revisions
coffee/tram.coffee file | annotate | diff | comparison | revisions
js/contacts.js file | annotate | diff | comparison | revisions
js/contacts.js.map file | annotate | diff | comparison | revisions
js/index.js file | annotate | diff | comparison | revisions
js/index.js.map file | annotate | diff | comparison | revisions
js/tram.js file | annotate | diff | comparison | revisions
js/tram.js.map file | annotate | diff | comparison | revisions
--- a/coffee/contacts.coffee Wed Mar 23 16:59:04 2016 +0800
+++ b/coffee/contacts.coffee Thu Mar 24 20:17:04 2016 +0800
@@ -2,6 +2,7 @@
idAttribute: 'jid'
defaults:
presence: 'unavailable'
+ show: 'offline'
initialize: ->
@on 'add change:avatar', ->
@@ -63,7 +64,7 @@
tagName: 'li'
className: 'contact'
template: $('#contact-template').html()
- colors: Tram.colors.presence
+ colors: Tram.colors.show
initialize: ->
@$el.attr('data-jid', @model.get('jid'))
--- a/coffee/index.coffee Wed Mar 23 16:59:04 2016 +0800
+++ b/coffee/index.coffee Thu Mar 24 20:17:04 2016 +0800
@@ -124,48 +124,55 @@
onPresence = (stanza) ->
- from = stanza.getAttribute('from')
- type = stanza.getAttribute('type') ? 'online'
- if type is 'subscribe'
- console.warn('not handling <presence type="subscribe">', stanza)
- return true
+ type = stanza.getAttribute('type') ? 'available'
+
+ switch type
+ when 'subscribe', 'subscribed', 'unsubscribe', 'unsubscribed'
+ console.warn("""not handling <presence type="#{ type }">""", stanza)
+ return true
- if type is 'subscribed'
- console.warn('not handling <presence type="subscribed">', stanza)
- return true
+ when 'error'
+ console.error('got <presence type="error">', stanza)
+ return true
- if type is 'error'
- console.error('got <presence type="error">', stanza)
- return true
+ from = stanza.getAttribute('from')
+ contact = getContact(from)
- delay = stanza.getElementsByTagName('delay')[0]
- stamp = if delay then new Date(delay.getAttribute('stamp')) else new Date()
-
- priority = stanza.getElementsByTagName('priority')[0]
- priority = if priority then getText(priority) else '0'
+ show = getText(stanza.getElementsByTagName('show')[0])
+ status = getText(stanza.getElementsByTagName('status')[0])
+ priority = getText(stanza.getElementsByTagName('priority')[0])
- show = stanza.getElementsByTagName('show')[0]
- show = if show then getText(show) else undefined
+ switch type
+ when 'available'
+ show ?= 'online'
+ priority ?= '0'
- s = stanza.getElementsByTagName('status')[0]
- s = if s then getText(s) else undefined
+ when 'unavailable'
+ show = 'offline'
+ priority = '0'
- contact = getContact(from)
contact.set
presence: type
show: show
- status: s
+ status: status
+ priority: priority
+
+ if type in ['available', 'unavailable'] and contact.get('type') isnt 'self'
+ delay = stanza.getElementsByTagName('delay')[0]
+ stamp = if delay? then new Date(delay.getAttribute('stamp')) else new Date()
- messages.add
- id: stanza.getAttribute('id')
- type: 'presence'
- cls: 'presence'
- from: from
- stamp: stamp
- contact: contact
- show: show
- priority: priority
- text: 'is now ' + (show ? type)
+ messages.add
+ id: stanza.getAttribute('id')
+ type: 'presence'
+ cls: 'presence'
+ from: from
+ stamp: stamp
+ contact: contact
+ presence: type
+ show: show
+ status: status
+ priority: priority
+ text: status ? "is now #{ show }"
return true
--- a/coffee/tram.coffee Wed Mar 23 16:59:04 2016 +0800
+++ b/coffee/tram.coffee Thu Mar 24 20:17:04 2016 +0800
@@ -8,11 +8,11 @@
domain: location.hostname
colors:
- presence:
+ show:
online: '#5cb85c'
away: '#f0ad4e'
xa: '#d9534f'
- unavailable: '#777'
+ offline: '#777'
default: '#337ab7'
avatar: [
'#f75782',
--- a/js/contacts.js Wed Mar 23 16:59:04 2016 +0800
+++ b/js/contacts.js Thu Mar 24 20:17:04 2016 +0800
@@ -13,7 +13,8 @@
Contact.prototype.idAttribute = 'jid';
Contact.prototype.defaults = {
- presence: 'unavailable'
+ presence: 'unavailable',
+ show: 'offline'
};
Contact.prototype.initialize = function() {
@@ -126,7 +127,7 @@
ContactView.prototype.template = $('#contact-template').html();
- ContactView.prototype.colors = Tram.colors.presence;
+ ContactView.prototype.colors = Tram.colors.show;
ContactView.prototype.initialize = function() {
this.$el.attr('data-jid', this.model.get('jid'));
--- a/js/contacts.js.map Wed Mar 23 16:59:04 2016 +0800
+++ b/js/contacts.js.map Thu Mar 24 20:17:04 2016 +0800
@@ -6,5 +6,5 @@
"coffee/contacts.coffee"
],
"names": [],
- "mappings": ";AAAA;AAAA,MAAA;;;EAAM,IAAI,CAAC;;;;;;;sBACT,WAAA,GAAa;;sBACb,QAAA,GACE;MAAA,QAAA,EAAU,aAAV;;;sBAEF,UAAA,GAAY,SAAA;MACV,IAAC,CAAA,EAAD,CAAI,mBAAJ,EAAyB,SAAA;AACvB,YAAA;QAAA,MAAA,GAAS,IAAC,CAAA,GAAD,CAAK,QAAL;QACT,sBAAG,MAAM,CAAE,cAAR,sBAAiB,MAAM,CAAE,cAA5B;iBACE,IAAC,CAAA,GAAD,CAAK,UAAL,EAAiB,OAAA,GAAS,MAAM,CAAC,IAAhB,GAAsB,UAAtB,GAAiC,MAAM,CAAC,IAAzD,EADF;SAAA,MAAA;iBAGE,IAAC,CAAA,KAAD,CAAO,UAAP,EAHF;;MAFuB,CAAzB;MAOA,IAAC,CAAA,EAAD,CAAI,iDAAJ,EAAuD,SAAA;eACrD,IAAC,CAAA,GAAD,CAAK,UAAL,EAAiB,IAAC,CAAA,GAAD,CAAK,UAAL,CAAA,IAAoB,IAAC,CAAA,GAAD,CAAK,UAAL,CAApB,IAAwC,IAAC,CAAA,GAAD,CAAK,MAAL,CAAzD;MADqD,CAAvD;aAGA,IAAC,CAAA,EAAD,CAAI,iCAAJ,EAAuC,SAAA;eACrC,IAAC,CAAA,GAAD,CAAK,OAAL,EAAiB,IAAC,CAAA,GAAD,CAAK,MAAL,CAAH,GA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8B,IAAC,CAAA,KAA/B;aACA,IAAC,CAAA,QAAD,CAAU,IAAC,CAAA,UAAX,EAAuB,MAAvB,EAA+B,IAAC,CAAA,MAAhC;IAFU;;0BAIZ,KAAA,GAAO,SAAC,KAAD,EAAQ,UAAR;AACL,UAAA;MAAA,EAAA,GAAK,UAAU,CAAC,OAAX,CAAmB,KAAnB;MACL,KAAK,CAAC,IAAN,GAAiB,IAAA,IAAI,CAAC,WAAL,CAAiB;QAAA,KAAA,EAAO,KAAP;OAAjB;MACjB,EAAA,GAAK,KAAK,CAAC,IAAI,CAAC,MAAX,CAAA,CAAmB,CAAC;MACzB,IAAG,EAAA,KAAM,CAAT;eACE,IAAC,CAAA,GAAG,CAAC,OAAL,CAAa,EAAb,EADF;OAAA,MAAA;eAGE,IAAC,CAAA,GAAG,CAAC,QAAL,CAAA,CAAe,CAAC,EAAhB,CAAmB,EAAA,GAAK,CAAxB,CAA0B,CAAC,KAA3B,CAAiC,EAAjC,EAHF;;IAJK;;0BASP,MAAA,GAAQ,SAAC,UAAD,EAAa,OAAb;MACN,IAAG,CAAI,OAAO,CAAC,GAAf;eACE,UAAU,CAAC,IAAX,CAAgB,CAAA,SAAA,KAAA;iBAAA,SAAC,KAAD;YACd,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAf,CAAA;mBACA,KAAC,CAAA,GAAG,CAAC,MAAL,CAAY,KAAK,CAAC,IAAI,CAAC,EAAvB;UAFc;QAAA,CAAA,CAAA,CAAA,IAAA,CAAhB,EADF;;IADM;;;;KAdqB,QAAQ,CAAC;AA5FxC"
}
\ No newline at end of file
--- a/js/index.js Wed Mar 23 16:59:04 2016 +0800
+++ b/js/index.js Thu Mar 24 20:17:04 2016 +0800
@@ -160,46 +160,60 @@
};
onPresence = function(stanza) {
- var contact, delay, from, priority, ref, s, show, stamp, type;
- from = stanza.getAttribute('from');
- type = (ref = stanza.getAttribute('type')) != null ? ref : 'online';
- if (type === 'subscribe') {
- console.warn('not handling <presence type="subscribe">', stanza);
- return true;
- }
- if (type === 'subscribed') {
- console.warn('not handling <presence type="subscribed">', stanza);
- return true;
+ var contact, delay, from, priority, ref, show, stamp, status, type;
+ type = (ref = stanza.getAttribute('type')) != null ? ref : 'available';
+ switch (type) {
+ case 'subscribe':
+ case 'subscribed':
+ case 'unsubscribe':
+ case 'unsubscribed':
+ console.warn("not handling <presence type=\"" + type + "\">", stanza);
+ return true;
+ case 'error':
+ console.error('got <presence type="error">', stanza);
+ return true;
}
- if (type === 'error') {
- console.error('got <presence type="error">', stanza);
- return true;
+ from = stanza.getAttribute('from');
+ contact = getContact(from);
+ show = getText(stanza.getElementsByTagName('show')[0]);
+ status = getText(stanza.getElementsByTagName('status')[0]);
+ priority = getText(stanza.getElementsByTagName('priority')[0]);
+ switch (type) {
+ case 'available':
+ if (show == null) {
+ show = 'online';
+ }
+ if (priority == null) {
+ priority = '0';
+ }
+ break;
+ case 'unavailable':
+ show = 'offline';
+ priority = '0';
}
- delay = stanza.getElementsByTagName('delay')[0];
- stamp = delay ? new Date(delay.getAttribute('stamp')) : new Date();
- priority = stanza.getElementsByTagName('priority')[0];
- priority = priority ? getText(priority) : '0';
- show = stanza.getElementsByTagName('show')[0];
- show = show ? getText(show) : void 0;
- s = stanza.getElementsByTagName('status')[0];
- s = s ? getText(s) : void 0;
- contact = getContact(from);
contact.set({
presence: type,
show: show,
- status: s
+ status: status,
+ priority: priority
});
- messages.add({
- id: stanza.getAttribute('id'),
- type: 'presence',
- cls: 'presence',
- from: from,
- stamp: stamp,
- contact: contact,
- show: show,
- priority: priority,
- text: 'is now ' + (show != null ? show : type)
- });
+ if ((type === 'available' || type === 'unavailable') && contact.get('type') !== 'self') {
+ delay = stanza.getElementsByTagName('delay')[0];
+ stamp = delay != null ? new Date(delay.getAttribute('stamp')) : new Date();
+ messages.add({
+ id: stanza.getAttribute('id'),
+ type: 'presence',
+ cls: 'presence',
+ from: from,
+ stamp: stamp,
+ contact: contact,
+ presence: type,
+ show: show,
+ status: status,
+ priority: priority,
+ text: status != null ? status : "is now " + show
+ });
+ }
return true;
};
--- a/js/index.js.map Wed Mar 23 16:59:04 2016 +0800
+++ b/js/index.js.map Thu Mar 24 20:17:04 2016 +0800
@@ -6,5 +6,5 @@
"coffee/index.coffee"
],
"names": [],
- "mappings": ";AAAA;AAAA,MAAA;;EAAA,OAAO,CAAC,YAAR,CAAqB,cAArB,EAAqC,qBAArC;;;IAGA,MAAM,CAAC,WAAgB,IAAA,IAAI,CAAC,QAAL,CAAA;;;;IACvB,MAAM,CAAC,cAAmB,IAAA,IAAI,CAAC,WAAL,CAAiB;MAAA,EAAA,EAAI,CAAA,CAAE,uBAAF,CAAJ;MAAgC,UAAA,EAAY,QAA5C;KAAjB;;;;IAC1B,MAAM,CAAC,WAAgB,IAAA,IAAI,CAAC,QAAL,CAAA;;;;IACvB,MAAM,CAAC,SAAc,IAAA,IAAI,CAAC,MAAL,CAAY;MAAA,EAAA,EAAI,CAAA,CAAE,kBAAF,CAAJ;MAA2B,UAAA,EAAY,QAAvC;KAAZ;;;EAGrB,WAAA,GAAc,SAAA;IACZ,CAAC,CAAC,IAAI,CAAC,UAAP,CAAkB,UAAlB,EAA8B,IAA9B,EAAoC,UAApC;IACA,CAAC,CAAC,IAAI,CAAC,UAAP,CAAkB,eAAlB,EAAmC,OAAO,CAAC,EAAE,CAAC,YAA9C,EAA4D,UAA5D;IACA,CAAC,CAAC,IAAI,CAAC,UAAP,CAAkB,YAAlB,EAAgC,OAAO,CAAC,EAAE,CAAC,OAA3C,EAAoD,IAApD,EAA0D,KAA1D;IAEA,CAAC,CAAC,IAAI,CAAC,IAAP,CAAY,KAAA,CAAA,CAAO,CAAC,CAAR,CAAU,UAAV,CAAqB,CAAC,CAAtB,CAAwB,GAAxB,CAA4B,CAAC,EAA7B,CAAA,CAAiC,CAAC,CAAlC,CAAoC,QAApC,CAA6C,CAAC,CAA9C,CAAgD,QAAhD,CAAyD,CAAC,IAA1D,CAAA,CAAZ;WAEA,UAAA,CA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B,CAAC,EAArB,CAAwB,OAAxB,EAAiC,SAAC,CAAD;AAC/B,QAAA;IAAA,CAAC,CAAC,cAAF,CAAA;IACA,EAAA,GAAK;IACL,IAAI,CAAC,UAAU,CAAC,UAAhB,CAA2B,CAAA,CAAE,sBAAF,CAA3B;IACA,EAAA,IAAM,IAAI,CAAC,UAAU,CAAC,gBAAhB,CAAiC,CAAA,CAAE,WAAF,CAAjC,EAAiD,IAAjD;IACN,EAAA,IAAM,IAAI,CAAC,UAAU,CAAC,gBAAhB,CAAiC,CAAA,CAAE,WAAF,CAAjC;IACN,IAAG,EAAH;aACE,CAAC,CAAC,OAAF,CAAU,CAAA,CAAE,WAAF,CAAc,CAAC,GAAf,CAAA,CAAoB,CAAC,IAArB,CAAA,CAAV,EAAuC,CAAA,CAAE,WAAF,CAAc,CAAC,GAAf,CAAA,CAAvC,EADF;;EAN+B,CAAjC;;EAUA,MAAM,CAAC,WAAP,CAAmB,SAAA;WACjB,CAAA,CAAE,gBAAF,CAAmB,CAAC,IAApB,CAAyB,SAAA;AACvB,UAAA;MAAA,KAAA,GAAQ,CAAA,CAAE,IAAF;aACR,KAAK,CAAC,IAAN,CAAW,MAAA,CAAO,KAAK,CAAC,IAAN,CAAW,UAAX,CAAP,CAA8B,CAAC,OAA/B,CAAA,CAAX;IAFuB,CAAzB;EADiB,CAAnB,EAIE,EAAA,GAAK,IAJP;AAhPA"
}
\ No newline at end of file
--- a/js/tram.js Wed Mar 23 16:59:04 2016 +0800
+++ b/js/tram.js Thu Mar 24 20:17:04 2016 +0800
@@ -10,11 +10,11 @@
domain: location.hostname
},
colors: {
- presence: {
+ show: {
online: '#5cb85c',
away: '#f0ad4e',
xa: '#d9534f',
- unavailable: '#777',
+ offline: '#777',
"default": '#337ab7'
},
avatar: ['#f75782', '#d27b2b', '#a5902b', '#759d2b', '#2da46b', '#2fa196', '#319db4', '#4292f4', '#c16af4', '#f545cd']
--- a/js/tram.js.map Wed Mar 23 16:59:04 2016 +0800
+++ b/js/tram.js.map Thu Mar 24 20:17:04 2016 +0800
@@ -6,5 +6,5 @@
"coffee/tram.coffee"
],
"names": [],
- "mappings": ";AAAA;EAAA,MAAM,CAAC,IAAP,GACE;IAAA,IAAA,EACE;MAAA,MAAA,EAAQ,SAAR;MACA,OAAA,EAAS,KADT;KADF;IAIA,MAAA,EACE;MAAA,IAAA,EAAM,QAAQ,CAAC,IAAf;MACA,MAAA,EAAQ,QAAQ,CAAC,QADjB;KALF;IAQA,MAAA,EACE;MAAA,QAAA,EACE;QAAA,MAAA,EAAQ,SAAR;QACA,IAAA,EAAM,SADN;QAEA,EAAA,EAAI,SAFJ;QAGA,WAAA,EAAa,MAHb;QAIA,SAAA,EAAS,SAJT;OADF;MAMA,MAAA,EAAQ,CACN,SADM,EAEN,SAFM,EAGN,SAHM,EAIN,SAJM,EAKN,SALM,EAMN,SANM,EAON,SAPM,EAQN,SARM,EASN,SATM,EAUN,SAVM,CANR;KATF;;AADF"
+ "mappings": ";AAAA;EAAA,MAAM,CAAC,IAAP,GACE;IAAA,IAAA,EACE;MAAA,MAAA,EAAQ,SAAR;MACA,OAAA,EAAS,KADT;KADF;IAIA,MAAA,EACE;MAAA,IAAA,EAAM,QAAQ,CAAC,IAAf;MACA,MAAA,EAAQ,QAAQ,CAAC,QADjB;KALF;IAQA,MAAA,EACE;MAAA,IAAA,EACE;QAAA,MAAA,EAAQ,SAAR;QACA,IAAA,EAAM,SADN;QAEA,EAAA,EAAI,SAFJ;QAGA,OAAA,EAAS,MAHT;QAIA,SAAA,EAAS,SAJT;OADF;MAMA,MAAA,EAAQ,CACN,SADM,EAEN,SAFM,EAGN,SAHM,EAIN,SAJM,EAKN,SALM,EAMN,SANM,EAON,SAPM,EAQN,SARM,EASN,SATM,EAUN,SAVM,CANR;KATF;;AADF"
}
\ No newline at end of file