have presence callback in presenceObserver
authorCornelius Weiß <c.weiss@metaways.de>
Wed, 19 Jul 2017 13:01:20 +0000 (15:01 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 19 Jul 2017 14:18:14 +0000 (16:18 +0200)
Change-Id: I7808f3594044a5eec6842205ebf56ede30ebfec6
Reviewed-on: http://gerrit.tine20.com/customers/5256
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/js/PresenceObserver.js
tine20/Tinebase/js/tineInit.js

index 8fe2303..2532592 100644 (file)
@@ -33,10 +33,15 @@ Tine.Tinebase.PresenceObserver.prototype = {
     /**
      * @cfg {Function} callback to be called when absence is detected
      */
-    callback: Ext.emptyFn,
+    absenceCallback: Ext.emptyFn,
 
     /**
-     * @cfg {Object} scope to the callback is called in
+     * @cfg {Function} callback to be called each time presence is detected
+     */
+    presenceCallback: Ext.emptyFn,
+
+    /**
+     * @cfg {Object} scope to the callbacks are called in
      */
     scope: window,
 
@@ -74,12 +79,12 @@ Tine.Tinebase.PresenceObserver.prototype = {
 
         if (lastPresence + this.maxAbsenseTime * 60000 < nowTS) {
             Tine.log.info('Tine.Tinebase.PresenceObserver.checkPresence no presence detected for ' + this.maxAbsenseTime + ' minutes');
-            // this.fireEvent('absence', lastPresence, this);
-            this.callback.call(this.scope, lastPresence, this);
+            this.absenceCallback.call(this.scope, lastPresence, this);
         } else {
             var nextCheck = this.maxAbsenseTime * 60000 - (nowTS - lastPresence);
             Tine.log.debug('Tine.Tinebase.PresenceObserver.checkPresence next presence check at ' + now.add(Date.MILLI, nextCheck));
             this.checkTask.delay(nextCheck);
+            this.absenceCallback.call(this.scope, nextCheck, this);
         }
     },
 
index 37b5a9b..7b9b314 100644 (file)
@@ -271,7 +271,7 @@ Tine.Tinebase.tineInit = {
             var sessionLifeTime = Tine.Tinebase.registry.get('sessionLifeTime') || 86400,
                 presenceObserver = new Tine.Tinebase.PresenceObserver({
                     maxAbsenseTime: sessionLifeTime / 60,
-                    callback: function(lastPresence, po) {
+                    absenceCallback: function(lastPresence, po) {
                         Tine.Tinebase.MainMenu.prototype._doLogout()
                     }
                 });