1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Merge branch 'push'

This commit is contained in:
Tim Düsterhus 2014-09-29 01:38:37 +02:00
commit e694e51354
9 changed files with 19 additions and 21 deletions

View File

@ -27,7 +27,6 @@
if (file_exists('file.tar')) unlink('file.tar'); if (file_exists('file.tar')) unlink('file.tar');
if (file_exists('template.tar')) unlink('template.tar'); if (file_exists('template.tar')) unlink('template.tar');
if (file_exists('acptemplate.tar')) unlink('acptemplate.tar'); if (file_exists('acptemplate.tar')) unlink('acptemplate.tar');
foreach (glob('file/acp/be.bastelstu.chat.nodePush/lib/*.js') as $nodeFile) unlink($nodeFile);
foreach (glob('file/js/*.js') as $jsFile) unlink($jsFile); foreach (glob('file/js/*.js') as $jsFile) unlink($jsFile);
foreach (glob('file/acp/js/*.js') as $jsFile) unlink($jsFile); foreach (glob('file/acp/js/*.js') as $jsFile) unlink($jsFile);
if (file_exists('be.bastelstu.chat.tar')) unlink('be.bastelstu.chat.tar'); if (file_exists('be.bastelstu.chat.tar')) unlink('be.bastelstu.chat.tar');
@ -133,6 +132,5 @@
if (file_exists('file.tar')) unlink('file.tar'); if (file_exists('file.tar')) unlink('file.tar');
if (file_exists('template.tar')) unlink('template.tar'); if (file_exists('template.tar')) unlink('template.tar');
if (file_exists('acptemplate.tar')) unlink('acptemplate.tar'); if (file_exists('acptemplate.tar')) unlink('acptemplate.tar');
foreach (glob('file/acp/be.bastelstu.chat.nodePush/lib/*.js') as $nodeFile) unlink($nodeFile);
foreach (glob('file/js/*.js') as $jsFile) unlink($jsFile); foreach (glob('file/js/*.js') as $jsFile) unlink($jsFile);
foreach (glob('file/acp/js/*.js') as $jsFile) unlink($jsFile); foreach (glob('file/acp/js/*.js') as $jsFile) unlink($jsFile);

View File

@ -446,25 +446,25 @@ Initialize the `PeriodicalExecuter`s
pe.refreshRoomList = new WCF.PeriodicalExecuter refreshRoomList, 60e3 pe.refreshRoomList = new WCF.PeriodicalExecuter refreshRoomList, 60e3
pe.getMessages = new WCF.PeriodicalExecuter getMessages, v.config.reloadTime * 1e3 pe.getMessages = new WCF.PeriodicalExecuter getMessages, v.config.reloadTime * 1e3
Initialize the [**nodePush**](https://github.com/wbbaddons/nodePush) integration of **Tims Chat**. Once Initialize the [**Push**](https://github.com/wbbaddons/Push) integration of **Tims Chat**. Once
the browser is connected to **nodePush** periodic message loading will be disabled and **Tims Chat** will the browser is connected to **Push** periodic message loading will be disabled and **Tims Chat** will
load messages if the appropriate event arrives. load messages if the appropriate event arrives.
do -> do ->
be.bastelstu.wcf.nodePush.onConnect -> be.bastelstu.wcf.push.onConnect ->
console.log 'Disabling periodic loading' console.log 'Disabling periodic loading'
do pe.getMessages.stop do pe.getMessages.stop
be.bastelstu.wcf.nodePush.onDisconnect -> be.bastelstu.wcf.push.onDisconnect ->
console.log 'Enabling periodic loading' console.log 'Enabling periodic loading'
do getMessages do getMessages
do pe.getMessages.resume do pe.getMessages.resume
be.bastelstu.wcf.nodePush.onMessage 'be.bastelstu.chat.newMessage', getMessages be.bastelstu.wcf.push.onMessage 'be.bastelstu.chat.newMessage', getMessages
be.bastelstu.wcf.nodePush.onMessage 'be.bastelstu.wcf.nodePush.tick60', getMessages be.bastelstu.wcf.push.onMessage 'be.bastelstu.wcf.push.tick60', getMessages
be.bastelstu.wcf.nodePush.onMessage 'be.bastelstu.chat.roomChange', refreshRoomList be.bastelstu.wcf.push.onMessage 'be.bastelstu.chat.roomChange', refreshRoomList
be.bastelstu.wcf.nodePush.onMessage 'be.bastelstu.chat.join', refreshRoomList be.bastelstu.wcf.push.onMessage 'be.bastelstu.chat.join', refreshRoomList
be.bastelstu.wcf.nodePush.onMessage 'be.bastelstu.chat.leave', refreshRoomList be.bastelstu.wcf.push.onMessage 'be.bastelstu.chat.leave', refreshRoomList
Switch to fullscreen mode on mobile devices Switch to fullscreen mode on mobile devices

View File

@ -34,7 +34,7 @@ public static function deleteAll(array $objectIDs = array()) {
* Notify the Push-Server. * Notify the Push-Server.
*/ */
public static function create(array $parameters = array()) { public static function create(array $parameters = array()) {
\wcf\system\nodePush\NodePushHandler::getInstance()->sendMessage('be.bastelstu.chat.newMessage'); \wcf\system\push\PushHandler::getInstance()->sendMessage('be.bastelstu.chat.newMessage');
return parent::create($parameters); return parent::create($parameters);
} }

View File

@ -217,7 +217,7 @@ public function getUsers() {
* @return \wcf\data\user\UserList * @return \wcf\data\user\UserList
*/ */
public static function getDeadUsers() { public static function getDeadUsers() {
if (\wcf\system\nodePush\NodePushHandler::getInstance()->isEnabled()) { if (\wcf\system\push\PushHandler::getInstance()->isEnabled()) {
$time = TIME_NOW - 180; $time = TIME_NOW - 180;
} }
else { else {

View File

@ -251,7 +251,7 @@ public function join() {
\wcf\system\user\activity\point\UserActivityPointHandler::getInstance()->fireEvent('be.bastelstu.chat.activityPointEvent.join', $result, WCF::getUser()->userID); \wcf\system\user\activity\point\UserActivityPointHandler::getInstance()->fireEvent('be.bastelstu.chat.activityPointEvent.join', $result, WCF::getUser()->userID);
// send push message about join // send push message about join
\wcf\system\nodePush\NodePushHandler::getInstance()->sendMessage('be.bastelstu.chat.join'); \wcf\system\push\PushHandler::getInstance()->sendMessage('be.bastelstu.chat.join');
$messages = array(); $messages = array();
foreach ($newestMessages as $message) $messages[] = $message->jsonify(true); foreach ($newestMessages as $message) $messages[] = $message->jsonify(true);
@ -318,7 +318,7 @@ public function leave() {
'chatRoomID' => null 'chatRoomID' => null
)); ));
\wcf\system\nodePush\NodePushHandler::getInstance()->sendMessage('be.bastelstu.chat.leave'); \wcf\system\push\PushHandler::getInstance()->sendMessage('be.bastelstu.chat.leave');
} }
/** /**

View File

@ -61,6 +61,6 @@ public static function deleteAll(array $objectIDs = array()) {
public static function resetCache() { public static function resetCache() {
\chat\system\cache\builder\RoomCacheBuilder::getInstance()->reset(); \chat\system\cache\builder\RoomCacheBuilder::getInstance()->reset();
\chat\system\cache\builder\PermissionCacheBuilder::getInstance()->reset(); \chat\system\cache\builder\PermissionCacheBuilder::getInstance()->reset();
\wcf\system\nodePush\NodePushHandler::getInstance()->sendDeferredMessage('be.bastelstu.chat.roomChange'); \wcf\system\push\PushHandler::getInstance()->sendDeferredMessage('be.bastelstu.chat.roomChange');
} }
} }

View File

@ -19,7 +19,7 @@
<requiredpackages> <requiredpackages>
<requiredpackage minversion="2.0.7">com.woltlab.wcf</requiredpackage> <requiredpackage minversion="2.0.7">com.woltlab.wcf</requiredpackage>
<requiredpackage file="requirements/be.bastelstu.max.wcf.jCounter.tar" minversion="1.0.0 Beta 4">be.bastelstu.max.wcf.jCounter</requiredpackage> <requiredpackage file="requirements/be.bastelstu.max.wcf.jCounter.tar" minversion="1.0.0 Beta 4">be.bastelstu.max.wcf.jCounter</requiredpackage>
<requiredpackage file="requirements/be.bastelstu.wcf.nodePush.tar" minversion="1.0.0 Beta 1">be.bastelstu.wcf.nodePush</requiredpackage> <requiredpackage file="requirements/be.bastelstu.wcf.push.tar" minversion="1.0.0">be.bastelstu.wcf.push</requiredpackage>
</requiredpackages> </requiredpackages>
<instructions type="install"> <instructions type="install">

View File

@ -238,8 +238,8 @@
} }
}); });
be.bastelstu.wcf.nodePush.onMessage('be.bastelstu.chat.join', $.proxy(proxy.sendRequest, proxy)); be.bastelstu.wcf.push.onMessage('be.bastelstu.chat.join', $.proxy(proxy.sendRequest, proxy));
be.bastelstu.wcf.nodePush.onMessage('be.bastelstu.chat.leave', $.proxy(proxy.sendRequest, proxy)); be.bastelstu.wcf.push.onMessage('be.bastelstu.chat.leave', $.proxy(proxy.sendRequest, proxy));
})(jQuery, this); })(jQuery, this);
//]]> //]]>
</script> </script>

View File

@ -31,8 +31,8 @@
} }
}); });
be.bastelstu.wcf.nodePush.onMessage('be.bastelstu.chat.join', $.proxy(proxy.sendRequest, proxy)); be.bastelstu.wcf.push.onMessage('be.bastelstu.chat.join', $.proxy(proxy.sendRequest, proxy));
be.bastelstu.wcf.nodePush.onMessage('be.bastelstu.chat.leave', $.proxy(proxy.sendRequest, proxy)); be.bastelstu.wcf.push.onMessage('be.bastelstu.chat.leave', $.proxy(proxy.sendRequest, proxy));
})(jQuery, this); })(jQuery, this);
//]]> //]]>
</script> </script>