From 17bc3ba4fde7a4757a1db5949f21d694a274d664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sat, 19 Jan 2013 20:36:40 +0100 Subject: [PATCH 01/31] Port Chat to application (first parts) --- acloptions.xml | 18 +-- acpMenu.xml | 18 +-- acptemplate/chatRoomAdd.tpl | 4 +- acptemplate/chatRoomList.tpl | 23 ++-- build.php | 16 +-- cronjob.xml | 2 +- eventListener.xml | 2 +- ...tall.php => be.bastelstu.chat.install.php} | 4 +- .../.gitignore | 0 .../README.md | 0 .../bin/run.sh | 0 .../lib/server.coffee | 6 +- .../package.json | 4 +- ...pdate.php => be.bastelstu.chat.update.php} | 4 +- .../be.bastelstu.wcf.chat.nodePush/config.js | 3 - file/acp/global.php | 15 +++ file/acp/index.php | 9 ++ file/global.php | 12 ++ file/icon/chat.svg | 4 +- file/icon/chatColored.svg | 4 +- file/index.php | 9 ++ file/js/be.bastelstu.WCF.Chat.Log.coffee | 9 +- file/js/be.bastelstu.WCF.Chat.coffee | 24 ++-- ...ddForm.class.php => RoomAddForm.class.php} | 18 +-- ...tForm.class.php => RoomEditForm.class.php} | 34 ++--- ...tPage.class.php => RoomListPage.class.php} | 14 +- ...Action.class.php => LeaveAction.class.php} | 24 ++-- .../Message.class.php} | 24 ++-- .../MessageAction.class.php} | 12 +- .../MessageEditor.class.php} | 16 +-- .../MessageList.class.php} | 28 ++-- .../Room.class.php} | 46 +++---- .../RoomAction.class.php} | 22 ++-- .../RoomEditor.class.php} | 22 ++-- .../RoomList.class.php} | 10 +- .../Suspension.class.php} | 30 ++--- .../SuspensionAction.class.php} | 12 +- .../SuspensionEditor.class.php} | 10 +- file/lib/form/ChatForm.class.php | 40 +++--- file/lib/page/ChatMessagePage.class.php | 28 ++-- file/lib/page/ChatPage.class.php | 50 ++++---- ...Page.class.php => CopyrightPage.class.php} | 8 +- ...hatLogPage.class.php => LogPage.class.php} | 22 ++-- ...tPage.class.php => RoomListPage.class.php} | 23 ++-- file/lib/system/ChatCore.class.php | 23 ++++ ...s.php => PermissionCacheBuilder.class.php} | 10 +- ...r.class.php => RoomCacheBuilder.class.php} | 10 +- .../chat/command/AbstractCommand.class.php | 4 +- .../AbstractRestrictedCommand.class.php | 4 +- .../chat/command/CommandHandler.class.php | 4 +- .../system/chat/command/ICommand.class.php | 4 +- .../chat/command/IRestrictedCommand.class.php | 4 +- .../chat/command/NotFoundException.class.php | 4 +- .../command/UserNotFoundException.class.php | 4 +- .../command/commands/AwayCommand.class.php | 6 +- .../command/commands/BanCommand.class.php | 4 +- .../command/commands/ColorCommand.class.php | 6 +- .../command/commands/FreeCommand.class.php | 4 +- .../command/commands/InfoCommand.class.php | 4 +- .../chat/command/commands/MeCommand.class.php | 4 +- .../command/commands/MuteCommand.class.php | 4 +- .../command/commands/PlainCommand.class.php | 4 +- .../command/commands/RestoreCommand.class.php | 4 +- .../commands/TemproomCommand.class.php | 8 +- .../command/commands/WhereCommand.class.php | 4 +- .../command/commands/WhisperCommand.class.php | 4 +- ...job.class.php => CleanupCronjob.class.php} | 26 ++-- ...ass.php => RouteHandlerListener.class.php} | 8 +- .../page/ChatPageMenuItemProvider.class.php | 12 +- .../option/TimeIntervalOptionType.class.php | 10 +- .../PermissionHandler.class.php} | 28 ++-- file/lib/util/ChatUtil.class.php | 20 +-- install.sql | 36 +++--- language/de.xml | 121 +++++++++--------- objectType.xml | 6 +- package.xml | 8 +- pagemenu.xml | 6 +- template/chat.tpl | 34 ++--- template/chatJavascriptInclude.tpl | 6 +- template/chatNavigationInclude.tpl | 2 +- template/chatSidebar.tpl | 4 +- userGroupOption.xml | 16 +-- 82 files changed, 609 insertions(+), 544 deletions(-) rename file/acp/{be.bastelstu.wcf.chat.install.php => be.bastelstu.chat.install.php} (91%) rename file/acp/{be.bastelstu.wcf.chat.nodePush => be.bastelstu.chat.nodePush}/.gitignore (100%) rename file/acp/{be.bastelstu.wcf.chat.nodePush => be.bastelstu.chat.nodePush}/README.md (100%) rename file/acp/{be.bastelstu.wcf.chat.nodePush => be.bastelstu.chat.nodePush}/bin/run.sh (100%) mode change 100755 => 100644 rename file/acp/{be.bastelstu.wcf.chat.nodePush => be.bastelstu.chat.nodePush}/lib/server.coffee (93%) rename file/acp/{be.bastelstu.wcf.chat.nodePush => be.bastelstu.chat.nodePush}/package.json (78%) rename file/acp/{be.bastelstu.wcf.chat.update.php => be.bastelstu.chat.update.php} (95%) delete mode 100644 file/acp/be.bastelstu.wcf.chat.nodePush/config.js create mode 100644 file/acp/global.php create mode 100644 file/acp/index.php create mode 100644 file/global.php create mode 100644 file/index.php rename file/lib/acp/form/{ChatRoomAddForm.class.php => RoomAddForm.class.php} (83%) rename file/lib/acp/form/{ChatRoomEditForm.class.php => RoomEditForm.class.php} (64%) rename file/lib/acp/page/{ChatRoomListPage.class.php => RoomListPage.class.php} (66%) rename file/lib/action/{ChatLeaveAction.class.php => LeaveAction.class.php} (77%) rename file/lib/data/{chat/message/ChatMessage.class.php => message/Message.class.php} (88%) mode change 100755 => 100644 rename file/lib/data/{chat/message/ChatMessageAction.class.php => message/MessageAction.class.php} (75%) rename file/lib/data/{chat/message/ChatMessageEditor.class.php => message/MessageEditor.class.php} (52%) rename file/lib/data/{chat/message/ChatMessageList.class.php => message/MessageList.class.php} (67%) rename file/lib/data/{chat/room/ChatRoom.class.php => room/Room.class.php} (71%) rename file/lib/data/{chat/room/ChatRoomAction.class.php => room/RoomAction.class.php} (82%) rename file/lib/data/{chat/room/ChatRoomEditor.class.php => room/RoomEditor.class.php} (64%) rename file/lib/data/{chat/room/ChatRoomList.class.php => room/RoomList.class.php} (58%) rename file/lib/data/{chat/suspension/ChatSuspension.class.php => suspension/Suspension.class.php} (66%) rename file/lib/data/{chat/suspension/ChatSuspensionAction.class.php => suspension/SuspensionAction.class.php} (74%) rename file/lib/data/{chat/suspension/ChatSuspensionEditor.class.php => suspension/SuspensionEditor.class.php} (64%) rename file/lib/page/{ChatCopyrightPage.class.php => CopyrightPage.class.php} (97%) rename file/lib/page/{ChatLogPage.class.php => LogPage.class.php} (78%) rename file/lib/page/{ChatRefreshRoomListPage.class.php => RoomListPage.class.php} (82%) create mode 100644 file/lib/system/ChatCore.class.php rename file/lib/system/cache/builder/{ChatPermissionCacheBuilder.class.php => PermissionCacheBuilder.class.php} (88%) rename file/lib/system/cache/builder/{ChatRoomCacheBuilder.class.php => RoomCacheBuilder.class.php} (68%) rename file/lib/system/cronjob/{ChatCleanupCronjob.class.php => CleanupCronjob.class.php} (57%) rename file/lib/system/event/listener/{ChatRouteListener.class.php => RouteHandlerListener.class.php} (80%) rename file/lib/system/{chat/permission/ChatPermissionHandler.class.php => permission/PermissionHandler.class.php} (78%) diff --git a/acloptions.xml b/acloptions.xml index 67043b1..279c997 100644 --- a/acloptions.xml +++ b/acloptions.xml @@ -3,42 +3,42 @@ - be.bastelstu.wcf.chat.room + be.bastelstu.chat.room - be.bastelstu.wcf.chat.room + be.bastelstu.chat.room diff --git a/acpMenu.xml b/acpMenu.xml index 972b93f..8b6a0cc 100644 --- a/acpMenu.xml +++ b/acpMenu.xml @@ -1,21 +1,21 @@ - + wcf.acp.menu.link.community - - - wcf.acp.menu.link.chat - admin.content.chat.canEditRoom,admin.content.chat.canDeleteRoom + + + chat.acp.menu.link.chat + admin.chat.canEditRoom,admin.chat.canDeleteRoom 1 - - - wcf.acp.menu.link.chat - admin.content.chat.canAddRoom + + + chat.acp.menu.link.chat + admin.chat.canAddRoom 2 diff --git a/acptemplate/chatRoomAdd.tpl b/acptemplate/chatRoomAdd.tpl index 86be9ee..52dc34e 100644 --- a/acptemplate/chatRoomAdd.tpl +++ b/acptemplate/chatRoomAdd.tpl @@ -32,12 +32,12 @@ -
+
{lang}wcf.acp.chat.room.data{/lang} diff --git a/acptemplate/chatRoomList.tpl b/acptemplate/chatRoomList.tpl index 9e2b02b..15e4f0c 100644 --- a/acptemplate/chatRoomList.tpl +++ b/acptemplate/chatRoomList.tpl @@ -1,10 +1,10 @@ -{include file='header' pageTitle='wcf.acp.chat.room.list'} +{include file='header' pageTitle='chat.acp.room.list'} @@ -16,12 +16,10 @@
- {pages print=true assign=pagesLinks controller="ChatRoomList" link="pageNo=%d"} - - {if $__wcf->session->getPermission('admin.content.chat.canAddRoom')} + {if $__wcf->session->getPermission('admin.chat.canAddRoom')} {/if} @@ -33,18 +31,18 @@ {foreach from=$objects item=chatRoom}
  • - {if $__wcf->session->getPermission('admin.content.chat.canEditRoom')} - {$chatRoom->title|language} + {if $__wcf->session->getPermission('admin.chat.canEditRoom')} + {$chatRoom->title|language} {else} {$chatRoom->title|language} {/if} {if $__wcf->session->getPermission('admin.content.chat.canEditRoom')} - + {/if} {if $__wcf->session->getPermission('admin.content.chat.canDeleteRoom')} - + {/if} @@ -58,8 +56,7 @@
  • {hascontentelse} -

    {lang}wcf.acp.chat.room.noneAvailable{/lang}

    +

    {lang}chat.acp.room.noneAvailable{/lang}

    {/hascontent} - {include file='footer'} diff --git a/build.php b/build.php index 1b4c90b..495b030 100755 --- a/build.php +++ b/build.php @@ -5,9 +5,9 @@ * Builds the Chat * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat */ $packageXML = file_get_contents('package.xml'); preg_match('/(.*?)<\/version>/', $packageXML, $matches); @@ -26,10 +26,10 @@ if (file_exists('file.tar')) unlink('file.tar'); if (file_exists('template.tar')) unlink('template.tar'); if (file_exists('acptemplate.tar')) unlink('acptemplate.tar'); - foreach (glob('file/acp/be.bastelstu.wcf.chat.nodePush/lib/*.js') as $nodeFile) unlink($nodeFile); + 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/style/*.css') as $cssFile) unlink($cssFile); - if (file_exists('be.bastelstu.wcf.chat.tar')) unlink('be.bastelstu.wcf.chat.tar'); + if (file_exists('be.bastelstu.chat.tar')) unlink('be.bastelstu.chat.tar'); echo <<\d{4}-\d{2}-\d{2}~', ''.date('Y-m-d').'', file_get_contents('package.xml'))); - passthru('tar cvf be.bastelstu.wcf.chat.tar * --exclude=*.old --exclude=file --exclude=template --exclude=acptemplate --exclude=build.php', $code); + passthru('tar cvf be.bastelstu.chat.tar * --exclude=*.old --exclude=file --exclude=template --exclude=acptemplate --exclude=build.php', $code); if (file_exists('package.xml.old')) { file_put_contents('package.xml', file_get_contents('package.xml.old')); unlink('package.xml.old'); @@ -125,6 +125,6 @@ if (file_exists('file.tar')) unlink('file.tar'); if (file_exists('template.tar')) unlink('template.tar'); if (file_exists('acptemplate.tar')) unlink('acptemplate.tar'); -foreach (glob('file/acp/be.bastelstu.wcf.chat.nodePush/lib/*.js') as $nodeFile) unlink($nodeFile); +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/style/*.css') as $cssFile) unlink($cssFile); diff --git a/cronjob.xml b/cronjob.xml index 9384a61..e4e10a6 100644 --- a/cronjob.xml +++ b/cronjob.xml @@ -2,7 +2,7 @@ - wcf\system\cronjob\ChatCleanupCronjob + chat\system\cronjob\CleanupCronjob Cleans up Tims Chat */15 * diff --git a/eventListener.xml b/eventListener.xml index 612b7d8..af67274 100644 --- a/eventListener.xml +++ b/eventListener.xml @@ -6,7 +6,7 @@ didInit user 0 - wcf\system\event\listener\ChatRouteListener + chat\system\event\listener\RouteHandlerListener \ No newline at end of file diff --git a/file/acp/be.bastelstu.wcf.chat.install.php b/file/acp/be.bastelstu.chat.install.php similarity index 91% rename from file/acp/be.bastelstu.wcf.chat.install.php rename to file/acp/be.bastelstu.chat.install.php index 01cd57a..56f88d1 100644 --- a/file/acp/be.bastelstu.wcf.chat.install.php +++ b/file/acp/be.bastelstu.chat.install.php @@ -5,9 +5,9 @@ * Handles installation of Tims Chat. * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat */ // @codingStandardsIgnoreFile final class Install { diff --git a/file/acp/be.bastelstu.wcf.chat.nodePush/.gitignore b/file/acp/be.bastelstu.chat.nodePush/.gitignore similarity index 100% rename from file/acp/be.bastelstu.wcf.chat.nodePush/.gitignore rename to file/acp/be.bastelstu.chat.nodePush/.gitignore diff --git a/file/acp/be.bastelstu.wcf.chat.nodePush/README.md b/file/acp/be.bastelstu.chat.nodePush/README.md similarity index 100% rename from file/acp/be.bastelstu.wcf.chat.nodePush/README.md rename to file/acp/be.bastelstu.chat.nodePush/README.md diff --git a/file/acp/be.bastelstu.wcf.chat.nodePush/bin/run.sh b/file/acp/be.bastelstu.chat.nodePush/bin/run.sh old mode 100755 new mode 100644 similarity index 100% rename from file/acp/be.bastelstu.wcf.chat.nodePush/bin/run.sh rename to file/acp/be.bastelstu.chat.nodePush/bin/run.sh diff --git a/file/acp/be.bastelstu.wcf.chat.nodePush/lib/server.coffee b/file/acp/be.bastelstu.chat.nodePush/lib/server.coffee similarity index 93% rename from file/acp/be.bastelstu.wcf.chat.nodePush/lib/server.coffee rename to file/acp/be.bastelstu.chat.nodePush/lib/server.coffee index d628c28..5a3cb00 100644 --- a/file/acp/be.bastelstu.wcf.chat.nodePush/lib/server.coffee +++ b/file/acp/be.bastelstu.chat.nodePush/lib/server.coffee @@ -2,9 +2,9 @@ # node.js Pushserver for Tims Chat. # # @author Tim Düsterhus -# @copyright 2010-2012 Tim Düsterhus +# @copyright 2010-2013 Tim Düsterhus # @license Creative Commons Attribution-NonCommercial-ShareAlike -# @package be.bastelstu.wcf.chat +# @package be.bastelstu.chat # @subpackage nodePush ### process.title = 'nodePush - Tims Chat' @@ -16,7 +16,7 @@ fs = require 'fs' config = require('../config.js') log = (message) -> - console.log '[be.bastelstu.wcf.chat.nodePush] '+message + console.log '[be.bastelstu.chat.nodePush] '+message class Server constructor: () -> diff --git a/file/acp/be.bastelstu.wcf.chat.nodePush/package.json b/file/acp/be.bastelstu.chat.nodePush/package.json similarity index 78% rename from file/acp/be.bastelstu.wcf.chat.nodePush/package.json rename to file/acp/be.bastelstu.chat.nodePush/package.json index 74171a6..8c8fae0 100644 --- a/file/acp/be.bastelstu.wcf.chat.nodePush/package.json +++ b/file/acp/be.bastelstu.chat.nodePush/package.json @@ -1,9 +1,9 @@ { - "name" : "be.bastelstu.wcf.chat.nodePush", + "name" : "be.bastelstu.chat.nodePush", "description" : "node.js-Pushing for Tims Chat", "homepage" : "https://github.com/wbbaddons/Tims-Chat", "keywords" : ["chat"], - "author" : "Tim Düsterhus ", + "author" : "Tim Düsterhus ", "contributors" : [ ], "dependencies" : { diff --git a/file/acp/be.bastelstu.wcf.chat.update.php b/file/acp/be.bastelstu.chat.update.php similarity index 95% rename from file/acp/be.bastelstu.wcf.chat.update.php rename to file/acp/be.bastelstu.chat.update.php index 07aa687..ced5b0e 100644 --- a/file/acp/be.bastelstu.wcf.chat.update.php +++ b/file/acp/be.bastelstu.chat.update.php @@ -5,9 +5,9 @@ * Handles updates of Tims Chat. * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat */ // @codingStandardsIgnoreFile final class Update { diff --git a/file/acp/be.bastelstu.wcf.chat.nodePush/config.js b/file/acp/be.bastelstu.wcf.chat.nodePush/config.js deleted file mode 100644 index b139533..0000000 --- a/file/acp/be.bastelstu.wcf.chat.nodePush/config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - port: 9001 -} diff --git a/file/acp/global.php b/file/acp/global.php new file mode 100644 index 0000000..95f4a02 --- /dev/null +++ b/file/acp/global.php @@ -0,0 +1,15 @@ + + * @package be.bastelstu.chat + */ +// define paths +define('RELATIVE_CHAT_DIR', '../'); + +// include config +require_once(dirname(dirname(__FILE__)).'/config.inc.php'); + +// include WCF +require_once(RELATIVE_WCF_DIR.'acp/global.php'); diff --git a/file/acp/index.php b/file/acp/index.php new file mode 100644 index 0000000..1a2e81c --- /dev/null +++ b/file/acp/index.php @@ -0,0 +1,9 @@ + + * @package be.bastelstu.chat + */ +require_once(__DIR__.'/global.php'); +wcf\system\request\RequestHandler::getInstance()->handle('chat', true); diff --git a/file/global.php b/file/global.php new file mode 100644 index 0000000..1e70c69 --- /dev/null +++ b/file/global.php @@ -0,0 +1,12 @@ + + * @package be.bastelstu.chat + */ +// include config +require_once(__DIR__.'/config.inc.php'); + +// include wcf +require_once(RELATIVE_WCF_DIR.'global.php'); diff --git a/file/icon/chat.svg b/file/icon/chat.svg index d9fd61b..6c6cd6f 100644 --- a/file/icon/chat.svg +++ b/file/icon/chat.svg @@ -2,9 +2,9 @@ Chat diff --git a/file/icon/chatColored.svg b/file/icon/chatColored.svg index ceaa23b..0d2d425 100644 --- a/file/icon/chatColored.svg +++ b/file/icon/chatColored.svg @@ -2,9 +2,9 @@ Chat diff --git a/file/index.php b/file/index.php new file mode 100644 index 0000000..f15d397 --- /dev/null +++ b/file/index.php @@ -0,0 +1,9 @@ + + * @package be.bastelstu.chat + */ +require_once(__DIR__.'/global.php'); +wcf\system\request\RequestHandler::getInstance()->handle('chat'); diff --git a/file/js/be.bastelstu.WCF.Chat.Log.coffee b/file/js/be.bastelstu.WCF.Chat.Log.coffee index 1515b58..13d77e6 100644 --- a/file/js/be.bastelstu.WCF.Chat.Log.coffee +++ b/file/js/be.bastelstu.WCF.Chat.Log.coffee @@ -2,13 +2,13 @@ # be.bastelstu.WCF.Chat.Log # # @author Tim Düsterhus -# @copyright 2010-2012 Tim Düsterhus +# @copyright 2010-2013 Tim Düsterhus # @license Creative Commons Attribution-NonCommercial-ShareAlike -# @package be.bastelstu.wcf.chat +# @package be.bastelstu.chat ### (($, window) -> - be.bastelstu.WCF.Chat.Log = be.bastelstu.WCF.Chat.extend + be.bastelstu.WCF.Chat.Log = be.bastelstu.Chat.extend init: (@chat) -> handleMessages: (messages) -> # Insert the messages @@ -27,7 +27,8 @@ if !$.wcfIsset 'timsChatLogDialog' container = $ '
    ' $('#content').append container - + + # TODO: Proper path $('#timsChatLogDialog').load 'http://127.0.0.1/wbb/wbb4/index.php/Chat/Log/1-Hauptchat/', () -> WCF.showDialog 'timsChatLogDialog', title: 'Log' diff --git a/file/js/be.bastelstu.WCF.Chat.coffee b/file/js/be.bastelstu.WCF.Chat.coffee index a9796f4..b5c1023 100644 --- a/file/js/be.bastelstu.WCF.Chat.coffee +++ b/file/js/be.bastelstu.WCF.Chat.coffee @@ -2,9 +2,9 @@ # be.bastelstu.WCF.Chat # # @author Tim Düsterhus -# @copyright 2010-2012 Tim Düsterhus +# @copyright 2010-2013 Tim Düsterhus # @license Creative Commons Attribution-NonCommercial-ShareAlike -# @package be.bastelstu.wcf.chat +# @package be.bastelstu.chat ### window.console ?= @@ -15,18 +15,17 @@ window.console ?= (($, window, _console) -> window.be ?= {} be.bastelstu ?= {} - be.bastelstu.WCF ?= {} console = log: (message) -> - _console.log '[be.bastelstu.WCF.Chat] '+message + _console.log '[be.bastelstu.Chat] '+message warn: (message) -> - _console.warn '[be.bastelstu.WCF.Chat] '+message + _console.warn '[be.bastelstu.Chat] '+message error: (message) -> - _console.error '[be.bastelstu.WCF.Chat] '+message + _console.error '[be.bastelstu.Chat] '+message - be.bastelstu.WCF.Chat = Class.extend + be.bastelstu.Chat = Class.extend # Tims Chat stops loading when this reaches zero # TODO: We need an explosion animation shields: 3 @@ -413,9 +412,10 @@ window.console ?= menu = $ '
      ' #menu.addClass 'timsChatUserMenu' menu.addClass 'dropdownMenu' - menu.append $ '
    • ' + WCF.Language.get('wcf.chat.query') + '
    • ' - menu.append $ '
    • ' + WCF.Language.get('wcf.chat.kick') + '
    • ' - menu.append $ '
    • ' + WCF.Language.get('wcf.chat.ban') + '
    • ' + menu.append $ '
    • ' + WCF.Language.get('chat.query') + '
    • ' + menu.append $ '
    • ' + WCF.Language.get('chat.kick') + '
    • ' + menu.append $ '
    • ' + WCF.Language.get('chat.ban') + '
    • ' + # TODO: SID and co menu.append $ '
    • ' + WCF.Language.get('wcf.chat.profile') + '
    • ' @events.userMenu.fire user, menu li.append menu @@ -485,8 +485,8 @@ window.console ?= # Desktop Notifications if typeof window.webkitNotifications isnt 'undefined' if window.webkitNotifications.checkPermission() is 0 - title = WCF.Language.get 'wcf.chat.notify.title' - icon = WCF.Icon.get 'be.bastelstu.wcf.chat.chat' + title = WCF.Language.get 'chat.notify.title' + icon = WCF.Icon.get 'be.bastelstu.chat.chat' content = message.username + message.separator + (if message.separator is ' ' then '' else ' ') + message.message notification = window.webkitNotifications.createNotification icon, title, content notification.show() diff --git a/file/lib/acp/form/ChatRoomAddForm.class.php b/file/lib/acp/form/RoomAddForm.class.php similarity index 83% rename from file/lib/acp/form/ChatRoomAddForm.class.php rename to file/lib/acp/form/RoomAddForm.class.php index cfb3c02..9948670 100644 --- a/file/lib/acp/form/ChatRoomAddForm.class.php +++ b/file/lib/acp/form/RoomAddForm.class.php @@ -8,21 +8,21 @@ * Shows the chatroom add form. * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage acp.form */ -class ChatRoomAddForm extends \wcf\form\AbstractForm { +class RoomAddForm extends \wcf\form\AbstractForm { /** * @see \wcf\acp\page\AbstractPage::$activeMenuItem */ - public $activeMenuItem = 'wcf.acp.menu.link.chat.room.add'; + public $activeMenuItem = 'chat.acp.menu.link.room.add'; /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.content.chat.canAddRoom'); + public $neededPermissions = array('admin.chat.canAddRoom'); /** * Title of the room @@ -42,7 +42,7 @@ class ChatRoomAddForm extends \wcf\form\AbstractForm { * @see \wcf\page\AbstractPage::__construct() */ public function __run() { - $this->objectTypeID = \wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.wcf.chat.room'); + $this->objectTypeID = \wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.chat.room'); parent::__run(); } @@ -98,7 +98,7 @@ public function save() { $roomID = $returnValues['returnValues']->roomID; if (!I18nHandler::getInstance()->isPlainValue('title')) { - I18nHandler::getInstance()->save('title', 'wcf.chat.room.title'.$roomID, 'wcf.chat.room', \wcf\util\ChatUtil::getPackageID()); + I18nHandler::getInstance()->save('title', 'chat.room.title'.$roomID, 'chat.room', \chat\util\ChatUtil::getPackageID()); // update title $chatRoomEditor->update(array( @@ -107,11 +107,11 @@ public function save() { } if (!I18nHandler::getInstance()->isPlainValue('topic')) { - I18nHandler::getInstance()->save('topic', 'wcf.chat.room.topic'.$roomID, 'wcf.chat.room', \wcf\util\ChatUtil::getPackageID()); + I18nHandler::getInstance()->save('topic', 'chat.room.topic'.$roomID, 'chat.room', \chat\util\ChatUtil::getPackageID()); // update topic $chatRoomEditor->update(array( - 'topic' => 'wcf.chat.room.topic'.$roomID + 'topic' => 'chat.room.topic'.$roomID )); } diff --git a/file/lib/acp/form/ChatRoomEditForm.class.php b/file/lib/acp/form/RoomEditForm.class.php similarity index 64% rename from file/lib/acp/form/ChatRoomEditForm.class.php rename to file/lib/acp/form/RoomEditForm.class.php index 3f4fdad..e38ad42 100644 --- a/file/lib/acp/form/ChatRoomEditForm.class.php +++ b/file/lib/acp/form/RoomEditForm.class.php @@ -7,26 +7,26 @@ * Shows the chatroom edit form. * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage acp.form */ -class ChatRoomEditForm extends ChatRoomAddForm { +class RoomEditForm extends RoomAddForm { /** * @see \wcf\page\AbstractPage::$templateName */ - public $templateName = 'chatRoomAdd'; + public $templateName = 'roomAdd'; /** * @see \wcf\acp\form\ACPForm::$activeMenuItem */ - public $activeMenuItem = 'wcf.acp.menu.link.chat.room.list'; + public $activeMenuItem = 'wcf.acp.menu.link.room.list'; /** * @see \wcf\page\AbstractPage::$neededPermissions */ - public $neededPermissions = array('admin.content.chat.canEditRoom'); + public $neededPermissions = array('admin.chat.canEditRoom'); /** * room id @@ -38,7 +38,7 @@ class ChatRoomEditForm extends ChatRoomAddForm { /** * room object * - * @var \wcf\data\chat\room\ChatRoom + * @var \chat\data\room\Room */ public $roomObj = null; @@ -49,7 +49,7 @@ public function readParameters() { parent::readParameters(); if (isset($_REQUEST['id'])) $this->roomID = intval($_REQUEST['id']); - $this->roomObj = new \wcf\data\chat\room\ChatRoom($this->roomID); + $this->roomObj = new \chat\data\room\Room($this->roomID); if (!$this->roomObj->roomID) { throw new \wcf\system\exception\IllegalLinkException(); } @@ -59,31 +59,31 @@ public function readParameters() { * @see \wcf\form\IForm::save() */ public function save() { - ACPForm::save(); + \wcf\form\AbstractForm::save(); - $this->title = 'wcf.chat.room.title'.$this->roomObj->roomID; + $this->title = 'chat.room.title'.$this->roomObj->roomID; if (I18nHandler::getInstance()->isPlainValue('title')) { I18nHandler::getInstance()->remove($this->title); $this->title = I18nHandler::getInstance()->getValue('title'); } else { - I18nHandler::getInstance()->save('title', $this->title, 'wcf.chat.room', \wcf\util\ChatUtil::getPackageID()); + I18nHandler::getInstance()->save('title', $this->title, 'chat.room', \chat\util\ChatUtil::getPackageID()); } - $this->topic = 'wcf.chat.room.topic'.$this->roomObj->roomID; + $this->topic = 'chat.room.topic'.$this->roomObj->roomID; if (I18nHandler::getInstance()->isPlainValue('topic')) { I18nHandler::getInstance()->remove($this->topic); $this->topic = I18nHandler::getInstance()->getValue('topic'); } else { - I18nHandler::getInstance()->save('topic', $this->topic, 'wcf.chat.room', \wcf\util\ChatUtil::getPackageID()); + I18nHandler::getInstance()->save('topic', $this->topic, 'chat.room', \chat\util\ChatUtil::getPackageID()); } \wcf\system\acl\ACLHandler::getInstance()->save($this->roomID, $this->objectTypeID); - \wcf\system\chat\permission\ChatPermissionHandler::clearCache(); + \chat\system\permission\PermissionHandler::clearCache(); // update room - $this->objectAction = new \wcf\data\chat\room\ChatRoomAction(array($this->roomID), 'update', array('data' => array( + $this->objectAction = new \chat\data\room\RoomAction(array($this->roomID), 'update', array('data' => array( 'title' => $this->title, 'topic' => $this->topic ))); @@ -104,8 +104,8 @@ public function readData() { parent::readData(); if (!count($_POST)) { - I18nHandler::getInstance()->setOptions('title', \wcf\util\ChatUtil::getPackageID(), $this->roomObj->title, 'wcf.chat.room.title\d+'); - I18nHandler::getInstance()->setOptions('topic', \wcf\util\ChatUtil::getPackageID(), $this->roomObj->topic, 'wcf.chat.room.topic\d+'); + I18nHandler::getInstance()->setOptions('title', \chat\util\ChatUtil::getPackageID(), $this->roomObj->title, 'chat.room.title\d+'); + I18nHandler::getInstance()->setOptions('topic', \chat\util\ChatUtil::getPackageID(), $this->roomObj->topic, 'chat.room.topic\d+'); $this->title = $this->roomObj->title; $this->topic = $this->roomObj->topic; diff --git a/file/lib/acp/page/ChatRoomListPage.class.php b/file/lib/acp/page/RoomListPage.class.php similarity index 66% rename from file/lib/acp/page/ChatRoomListPage.class.php rename to file/lib/acp/page/RoomListPage.class.php index a5ca3bd..ba79297 100644 --- a/file/lib/acp/page/ChatRoomListPage.class.php +++ b/file/lib/acp/page/RoomListPage.class.php @@ -5,29 +5,29 @@ * Lists available chatrooms. * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage acp.page */ -class ChatRoomListPage extends \wcf\page\MultipleLinkPage { +class RoomListPage extends \wcf\page\MultipleLinkPage { /** * @see \wcf\page\AbstractPage::$activeMenuItem */ - public $activeMenuItem = 'wcf.acp.menu.link.chat.room.list'; + public $activeMenuItem = 'chat.acp.menu.link.room.list'; /** * @see \wcf\page\AbstractPage::$neededPermissions */ public $neededPermissions = array( - 'admin.content.chat.canEditRoom', - 'admin.content.chat.canDeleteRoom' + 'admin.chat.canEditRoom', + 'admin.chat.canDeleteRoom' ); /** * @see \wcf\page\MultipleLinkPage::$objectListClassName */ - public $objectListClassName = '\wcf\data\chat\room\ChatRoomList'; + public $objectListClassName = '\chat\data\room\RoomList'; /** * @see \wcf\page\MultipleLinkPage::$sortField diff --git a/file/lib/action/ChatLeaveAction.class.php b/file/lib/action/LeaveAction.class.php similarity index 77% rename from file/lib/action/ChatLeaveAction.class.php rename to file/lib/action/LeaveAction.class.php index bf30688..778f1e3 100644 --- a/file/lib/action/ChatLeaveAction.class.php +++ b/file/lib/action/LeaveAction.class.php @@ -1,6 +1,6 @@ - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage action */ -class ChatLeaveAction extends AbstractAction { +class LeaveAction extends \wcf\action\AbstractAction { /** * @see wcf\action\AbstractAction::$loginRequired */ @@ -32,7 +32,7 @@ class ChatLeaveAction extends AbstractAction { /** * The current room. * - * @var \wcf\data\chat\room\ChatRoom + * @var \chat\data\room\Room */ public $room = null; @@ -66,24 +66,24 @@ public function __run() { public function execute() { parent::execute(); - $this->userData['roomID'] = \wcf\util\ChatUtil::readUserData('roomID'); + $this->userData['roomID'] = \chat\util\ChatUtil::readUserData('roomID'); - $cache = chat\room\ChatRoom::getCache(); + $cache = data\room\Room::getCache(); if (!isset($cache[$this->userData['roomID']])) throw new IllegalLinkException(); $this->room = $cache[$this->userData['roomID']]; if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException(); if (CHAT_DISPLAY_JOIN_LEAVE) { - $this->userData['color'] = \wcf\util\ChatUtil::readUserData('color'); + $this->userData['color'] = \chat\util\ChatUtil::readUserData('color'); // leave message - $messageAction = new chat\message\ChatMessageAction(array(), 'create', array( + $messageAction = new data\message\MessageAction(array(), 'create', array( 'data' => array( 'roomID' => $this->room->roomID, 'sender' => WCF::getUser()->userID, 'username' => WCF::getUser()->username, 'time' => TIME_NOW, - 'type' => chat\message\ChatMessage::TYPE_LEAVE, + 'type' => data\message\Message::TYPE_LEAVE, 'message' => '', 'color1' => $this->userData['color'][1], 'color2' => $this->userData['color'][2] @@ -93,7 +93,7 @@ public function execute() { } // set current room to null - \wcf\util\ChatUtil::writeUserData(array('roomID' => null)); + \chat\util\ChatUtil::writeUserData(array('roomID' => null)); $this->executed(); header("HTTP/1.0 204 No Content"); diff --git a/file/lib/data/chat/message/ChatMessage.class.php b/file/lib/data/message/Message.class.php old mode 100755 new mode 100644 similarity index 88% rename from file/lib/data/chat/message/ChatMessage.class.php rename to file/lib/data/message/Message.class.php index 728e894..63df870 --- a/file/lib/data/chat/message/ChatMessage.class.php +++ b/file/lib/data/message/Message.class.php @@ -1,5 +1,5 @@ - * @package be.bastelstu.wcf.chat - * @subpackage data.chat.message + * @package be.bastelstu.chat + * @subpackage data.message */ -class ChatMessage extends \wcf\data\DatabaseObject { +class Message extends \wcf\data\DatabaseObject { /** * @see \wcf\data\DatabaseObject::$databaseTableName */ - protected static $databaseTableName = 'chat_message'; + protected static $databaseTableName = 'message'; /** * @see \wcf\data\DatabaseObject::$databaseTableIndexName @@ -45,7 +45,7 @@ class ChatMessage extends \wcf\data\DatabaseObject { protected static $users = array(); /** - * @see \wcf\data\chat\message\ChatMessage::getFormattedMessage() + * @see \chat\data\\message\Message::getFormattedMessage() */ public function __toString() { return $this->getFormattedMessage(); @@ -65,11 +65,11 @@ public function getFormattedMessage($outputType = 'text/html') { case self::TYPE_LEAVE: case self::TYPE_BACK: case self::TYPE_AWAY: - $message = WCF::getLanguage()->getDynamicVariable('wcf.chat.message.'.$this->type, unserialize($message) ?: array()); + $message = WCF::getLanguage()->getDynamicVariable('chat.message.'.$this->type, unserialize($message) ?: array()); break; case self::TYPE_MODERATE: $message = unserialize($message); - $message = WCF::getLanguage()->getDynamicVariable('wcf.chat.message.'.$this->type.'.'.$message['type'], $message ?: array()); + $message = WCF::getLanguage()->getDynamicVariable('chat.message.'.$this->type.'.'.$message['type'], $message ?: array()); $message = self::replaceUserLink($message, $outputType); break; case self::TYPE_WHISPER: @@ -110,11 +110,11 @@ public function getFormattedMessage($outputType = 'text/html') { */ public function getUsername($colored = false) { $username = $this->username; - if ($this->type == self::TYPE_INFORMATION) return WCF::getLanguage()->get('wcf.chat.information'); - if ($this->type == self::TYPE_ERROR) return WCF::getLanguage()->get('wcf.chat.error'); + if ($this->type == self::TYPE_INFORMATION) return WCF::getLanguage()->get('chat.general.information'); + if ($this->type == self::TYPE_ERROR) return WCF::getLanguage()->get('chat.general.error'); if ($colored) { - $username = \wcf\util\ChatUtil::gradient($username, $this->color1, $this->color2); + $username = \chat\util\ChatUtil::gradient($username, $this->color1, $this->color2); } if ($this->type == self::TYPE_WHISPER) { diff --git a/file/lib/data/chat/message/ChatMessageAction.class.php b/file/lib/data/message/MessageAction.class.php similarity index 75% rename from file/lib/data/chat/message/ChatMessageAction.class.php rename to file/lib/data/message/MessageAction.class.php index b077463..7f918ce 100644 --- a/file/lib/data/chat/message/ChatMessageAction.class.php +++ b/file/lib/data/message/MessageAction.class.php @@ -1,20 +1,20 @@ - * @package be.bastelstu.wcf.chat - * @subpackage data.chat.message + * @package be.bastelstu.chat + * @subpackage chat.message */ -class ChatMessageAction extends \wcf\data\AbstractDatabaseObjectAction { +class MessageAction extends \wcf\data\AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$className */ - protected $className = '\wcf\data\chat\message\ChatMessageEditor'; + protected $className = '\chat\data\message\MessageEditor'; /** * Removes old messages. diff --git a/file/lib/data/chat/message/ChatMessageEditor.class.php b/file/lib/data/message/MessageEditor.class.php similarity index 52% rename from file/lib/data/chat/message/ChatMessageEditor.class.php rename to file/lib/data/message/MessageEditor.class.php index 8d84bbd..7fae0cf 100644 --- a/file/lib/data/chat/message/ChatMessageEditor.class.php +++ b/file/lib/data/message/MessageEditor.class.php @@ -1,28 +1,28 @@ - * @package be.bastelstu.wcf.chat - * @subpackage data.chat.message + * @package be.bastelstu.chat + * @subpackage chat.message */ -class ChatMessageEditor extends \wcf\data\DatabaseObjectEditor { +class MessageEditor extends \wcf\data\DatabaseObjectEditor { /** * @see \wcf\data\DatabaseObjectDecorator::$baseClass */ - protected static $baseClass = '\wcf\data\chat\message\ChatMessage'; + protected static $baseClass = '\chat\data\message\Message'; /** * Notify the Push-Server. */ public static function create(array $parameters = array()) { try { - if (\wcf\util\ChatUtil::nodePushRunning()) { - $sock = stream_socket_client('unix://'.WCF_DIR.'acp/be.bastelstu.wcf.chat.nodePush/data.sock', $errno, $errstr, 1); + if (\chat\util\ChatUtil::nodePushRunning()) { + $sock = stream_socket_client('unix://'.CHAT_DIR.'acp/be.bastelstu.chat.nodePush/data.sock', $errno, $errstr, 1); fclose($sock); } } diff --git a/file/lib/data/chat/message/ChatMessageList.class.php b/file/lib/data/message/MessageList.class.php similarity index 67% rename from file/lib/data/chat/message/ChatMessageList.class.php rename to file/lib/data/message/MessageList.class.php index 94c718b..ec4fed8 100644 --- a/file/lib/data/chat/message/ChatMessageList.class.php +++ b/file/lib/data/message/MessageList.class.php @@ -1,29 +1,29 @@ - * @package be.bastelstu.wcf.chat - * @subpackage data.chat.room + * @package be.bastelstu.chat + * @subpackage chat.room */ -class ChatMessageList extends \wcf\data\DatabaseObjectList { +class MessageList extends \wcf\data\DatabaseObjectList { /** * @see \wcf\data\DatabaseObjectList::$className */ - public $className = 'wcf\data\chat\message\ChatMessage'; + public $className = 'chat\data\message\Message'; /** * Reads the newest messages for the given room. * - * @param \wcf\data\chat\room\ChatRoom $room - * @param integer $number - * @return array<\wcf\data\chat\message\ChatMessage> + * @param \chat\data\room\Room $room + * @param integer $number + * @return array<\chat\data\message\Message> */ - public static function getNewestMessages(\wcf\data\chat\room\ChatRoom $room, $number = CHAT_LASTMESSAGES) { + public static function getNewestMessages(\chat\data\room\Room $room, $number = CHAT_LASTMESSAGES) { $messageList = new static(); $messageList->sqlOrderBy = "chat_message.messageID DESC"; $messageList->sqlLimit = $number; @@ -42,11 +42,11 @@ public static function getNewestMessages(\wcf\data\chat\room\ChatRoom $room, $nu /** * Reads the messages since the given message-id for the given room. * - * @param \wcf\data\chat\room\ChatRoom $room - * @param integer $since - * @return array<\wcf\data\chat\message\ChatMessage> + * @param \chat\data\room\Room $room + * @param integer $since + * @return array<\chat\data\message\Message> */ - public static function getMessagesSince(\wcf\data\chat\room\ChatRoom $room, $since) { + public static function getMessagesSince(\chat\data\room\Room $room, $since) { $messageList = new static(); $messageList->sqlOrderBy = "chat_message.messageID ASC"; $messageList->getConditionBuilder()->add('chat_message.messageID > ?', array($since)); diff --git a/file/lib/data/chat/room/ChatRoom.class.php b/file/lib/data/room/Room.class.php similarity index 71% rename from file/lib/data/chat/room/ChatRoom.class.php rename to file/lib/data/room/Room.class.php index de42c30..91ff38f 100644 --- a/file/lib/data/chat/room/ChatRoom.class.php +++ b/file/lib/data/room/Room.class.php @@ -1,6 +1,6 @@ - * @package be.bastelstu.wcf.chat - * @subpackage data.chat.room + * @package be.bastelstu.chat + * @subpackage data.room */ -class ChatRoom extends \wcf\data\DatabaseObject implements \wcf\system\request\IRouteController { +class Room extends \wcf\data\DatabaseObject implements \wcf\system\request\IRouteController { /** * @see \wcf\data\DatabaseObject::$databaseTableName */ - protected static $databaseTableName = 'chat_room'; + protected static $databaseTableName = 'room'; /** * @see \wcf\data\DatabaseObject::$databaseTableIndexName @@ -47,20 +47,20 @@ public function __toString() { public function canEnter(\wcf\data\user\User $user = null) { if ($user === null) $user = WCF::getUser(); - $ph = new \wcf\system\chat\permission\ChatPermissionHandler($user); - $suspensions = ChatSuspension::getSuspensionsForUser($user); + $ph = new \chat\system\permission\PermissionHandler($user); + $suspensions = Suspension::getSuspensionsForUser($user); $canEnter = $ph->getPermission($this, 'user.canEnter'); // room suspension - if ($canEnter && isset($suspensions[$this->roomID][ChatSuspension::TYPE_BAN])) { - if ($suspensions[$this->roomID][ChatSuspension::TYPE_BAN]['time'] > TIME_NOW) { + if ($canEnter && isset($suspensions[$this->roomID][Suspension::TYPE_BAN])) { + if ($suspensions[$this->roomID][Suspension::TYPE_BAN]['time'] > TIME_NOW) { $canEnter = false; } } // global suspension - if ($canEnter && isset($suspensions[null][ChatSuspension::TYPE_BAN])) { - if ($suspensions[null][ChatSuspension::TYPE_BAN]['time'] > TIME_NOW) { + if ($canEnter && isset($suspensions[null][Suspension::TYPE_BAN])) { + if ($suspensions[null][Suspension::TYPE_BAN]['time'] > TIME_NOW) { $canEnter = false; } } @@ -77,20 +77,20 @@ public function canEnter(\wcf\data\user\User $user = null) { public function canWrite(\wcf\data\user\User $user = null) { if ($user === null) $user = WCF::getUser(); - $ph = new \wcf\system\chat\permission\ChatPermissionHandler($user); - $suspensions = ChatSuspension::getSuspensionsForUser($user); + $ph = new \chat\system\permission\PermissionHandler($user); + $suspensions = Suspension::getSuspensionsForUser($user); $canWrite = $ph->getPermission($this, 'user.canWrite'); // room suspension - if ($canWrite && isset($suspensions[$this->roomID][ChatSuspension::TYPE_MUTE])) { - if ($suspensions[$this->roomID][ChatSuspension::TYPE_MUTE]['time'] > TIME_NOW) { + if ($canWrite && isset($suspensions[$this->roomID][Suspension::TYPE_MUTE])) { + if ($suspensions[$this->roomID][Suspension::TYPE_MUTE]['time'] > TIME_NOW) { $canWrite = false; } } // global suspension - if ($canWrite && isset($suspensions[null][ChatSuspension::TYPE_MUTE])) { - if ($suspensions[null][ChatSuspension::TYPE_MUTE]['time'] > TIME_NOW) { + if ($canWrite && isset($suspensions[null][Suspension::TYPE_MUTE])) { + if ($suspensions[null][Suspension::TYPE_MUTE]['time'] > TIME_NOW) { $canWrite = false; } } @@ -123,11 +123,11 @@ public function countUsers() { public static function getCache() { if (self::$cache === null) { CacheHandler::getInstance()->addResource( - 'chatrooms', - WCF_DIR.'cache/cache.chatrooms.php', - '\wcf\system\cache\builder\ChatRoomCacheBuilder' + 'chatRooms', + CHAT_DIR.'cache/cache.rooms.php', + '\chat\system\cache\builder\RoomCacheBuilder' ); - self::$cache = CacheHandler::getInstance()->get('chatrooms'); + self::$cache = CacheHandler::getInstance()->get('chatRooms'); } return self::$cache; diff --git a/file/lib/data/chat/room/ChatRoomAction.class.php b/file/lib/data/room/RoomAction.class.php similarity index 82% rename from file/lib/data/chat/room/ChatRoomAction.class.php rename to file/lib/data/room/RoomAction.class.php index 6549e20..764dddf 100644 --- a/file/lib/data/chat/room/ChatRoomAction.class.php +++ b/file/lib/data/room/RoomAction.class.php @@ -1,31 +1,31 @@ - * @package be.bastelstu.wcf.chat - * @subpackage data.chat.room + * @package be.bastelstu.chat + * @subpackage data.room */ -class ChatRoomAction extends \wcf\data\AbstractDatabaseObjectAction implements \wcf\data\ISortableAction { +class RoomAction extends \wcf\data\AbstractDatabaseObjectAction implements \wcf\data\ISortableAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$className */ - protected $className = '\wcf\data\chat\room\ChatRoomEditor'; + protected $className = '\chat\data\room\RoomEditor'; /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete */ - protected $permissionsDelete = array('admin.content.chat.canDeleteRoom'); + protected $permissionsDelete = array('admin.chat.canDeleteRoom'); /** * @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate */ - protected $permissionsUpdate = array('admin.content.chat.canEditRoom'); + protected $permissionsUpdate = array('admin.chat.canEditRoom'); /** * Fixes create to append new rooms. @@ -40,7 +40,7 @@ public function create() { $stmt = WCF::getDB()->prepareStatement($sql); $stmt->execute(); - $editor = new ChatRoomEditor($room); + $editor = new RoomEditor($room); $editor->update(array('position' => ($stmt->fetchColumn() + 1))); WCF::getDB()->commitTransaction(); @@ -100,7 +100,7 @@ public function validateUpdatePosition() { * @see wcf\data\ISortableAction */ public function updatePosition() { - $roomList = new \wcf\data\chat\room\ChatRoomList(); + $roomList = new RoomList(); $roomList->sqlOrderBy = "chat_room.position"; $roomList->readObjects(); @@ -109,7 +109,7 @@ public function updatePosition() { foreach ($this->parameters['data']['structure'][0] as $roomID) { $room = $roomList->search($roomID); if ($room === null) continue; - $editor = new ChatRoomEditor($room); + $editor = new RoomEditor($room); $editor->update(array('position' => $i++)); } WCF::getDB()->commitTransaction(); diff --git a/file/lib/data/chat/room/ChatRoomEditor.class.php b/file/lib/data/room/RoomEditor.class.php similarity index 64% rename from file/lib/data/chat/room/ChatRoomEditor.class.php rename to file/lib/data/room/RoomEditor.class.php index 2dc5c4c..6b1e4ab 100644 --- a/file/lib/data/chat/room/ChatRoomEditor.class.php +++ b/file/lib/data/room/RoomEditor.class.php @@ -1,21 +1,21 @@ - * @package be.bastelstu.wcf.chat - * @subpackage data.chat.room + * @package be.bastelstu.chat + * @subpackage data.room */ -class ChatRoomEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data\IEditableCachedObject { +class RoomEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data\IEditableCachedObject { /** * @see \wcf\data\DatabaseObjectDecorator::$baseClass */ - protected static $baseClass = '\wcf\data\chat\room\ChatRoom'; + protected static $baseClass = '\chat\data\room\Room'; /** @@ -24,21 +24,21 @@ class ChatRoomEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data public static function deleteAll(array $objectIDs = array()) { WCF::getDB()->beginTransaction(); foreach ($objectIDs as $objectID) { - \wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.title'.$objectID); - \wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.topic'.$objectID); + \wcf\system\language\I18nHandler::getInstance()->remove('chat.room.title'.$objectID); + \wcf\system\language\I18nHandler::getInstance()->remove('chat.room.topic'.$objectID); } $sql = "SELECT position FROM - wcf".WCF_N."_chat_room + chat".WCF_N."_room WHERE roomID = ? FOR UPDATE"; $select = WCF::getDB()->prepareStatement($sql); $sql = "UPDATE - wcf".WCF_N."_chat_room + chat".WCF_N."_room SET position = position - 1 WHERE @@ -59,6 +59,6 @@ public static function deleteAll(array $objectIDs = array()) { * Clears the room cache. */ public static function resetCache() { - \wcf\system\cache\CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.chatrooms.php'); + \wcf\system\cache\CacheHandler::getInstance()->clear(CHAT_DIR.'cache', 'cache.rooms.php'); } } diff --git a/file/lib/data/chat/room/ChatRoomList.class.php b/file/lib/data/room/RoomList.class.php similarity index 58% rename from file/lib/data/chat/room/ChatRoomList.class.php rename to file/lib/data/room/RoomList.class.php index 161eed8..366b6c1 100644 --- a/file/lib/data/chat/room/ChatRoomList.class.php +++ b/file/lib/data/room/RoomList.class.php @@ -5,14 +5,14 @@ * Represents a list of chat rooms. * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat - * @subpackage data.chat.room + * @package be.bastelstu.chat + * @subpackage data.room */ -class ChatRoomList extends \wcf\data\DatabaseObjectList { +class RoomList extends \wcf\data\DatabaseObjectList { /** * @see \wcf\data\DatabaseObjectList::$className */ - public $className = 'wcf\data\chat\room\ChatRoom'; + public $className = 'chat\data\room\Room'; } diff --git a/file/lib/data/chat/suspension/ChatSuspension.class.php b/file/lib/data/suspension/Suspension.class.php similarity index 66% rename from file/lib/data/chat/suspension/ChatSuspension.class.php rename to file/lib/data/suspension/Suspension.class.php index 9dc5ec5..6f959d2 100644 --- a/file/lib/data/chat/suspension/ChatSuspension.class.php +++ b/file/lib/data/suspension/Suspension.class.php @@ -1,21 +1,21 @@ - * @package be.bastelstu.wcf.chat - * @subpackage data.chat.suspension + * @package be.bastelstu.chat + * @subpackage data.suspension */ -class ChatSuspension extends \wcf\data\DatabaseObject { +class Suspension extends \wcf\data\DatabaseObject { /** * @see \wcf\data\DatabaseObject::$databaseTableName */ - protected static $databaseTableName = 'chat_suspension'; + protected static $databaseTableName = 'suspension'; /** * @see \wcf\data\DatabaseObject::$databaseTableIndexName @@ -27,12 +27,12 @@ class ChatSuspension extends \wcf\data\DatabaseObject { public static function getSuspensionsForUser(\wcf\data\user\User $user = null) { if ($user === null) $user = WCF::getUser(); - $suspensions = \wcf\util\ChatUtil::readUserData('suspensions', $user); + $suspensions = \chat\util\ChatUtil::readUserData('suspensions', $user); if ($suspensions === null) { $sql = "SELECT * FROM - wcf".WCF_N."_chat_suspension + chat".WCF_N."_suspension WHERE userID = ? AND time > ?"; @@ -44,7 +44,7 @@ public static function getSuspensionsForUser(\wcf\data\user\User $user = null) { $suspensions[$row['roomID']][$row['type']] = $row; } - \wcf\util\ChatUtil::writeUserData(array('suspensions' => $suspensions), $user); + \chat\util\ChatUtil::writeUserData(array('suspensions' => $suspensions), $user); } return $suspensions; @@ -53,16 +53,16 @@ public static function getSuspensionsForUser(\wcf\data\user\User $user = null) { /** * Returns the appropriate suspension for user, room and type. * - * @param \wcf\data\user\User $user - * @param \wcf\data\chat\room\ChatRoom $room - * @param integer $type - * @return \wcf\data\chat\suspension\ChatSuspension + * @param \wcf\data\user\User $user + * @param \chat\data\room\Room $room + * @param integer $type + * @return \chat\data\suspension\Suspension */ - public static function getSuspensionByUserRoomAndType(\wcf\data\user\User $user, \wcf\data\chat\room\ChatRoom $room, $type) { + public static function getSuspensionByUserRoomAndType(\wcf\data\user\User $user, \chat\data\room\Room $room, $type) { $sql = "SELECT * FROM - wcf".WCF_N."_chat_suspension + chat".WCF_N."_suspension WHERE userID = ? AND roomID = ? diff --git a/file/lib/data/chat/suspension/ChatSuspensionAction.class.php b/file/lib/data/suspension/SuspensionAction.class.php similarity index 74% rename from file/lib/data/chat/suspension/ChatSuspensionAction.class.php rename to file/lib/data/suspension/SuspensionAction.class.php index 774aaa0..e68fa06 100644 --- a/file/lib/data/chat/suspension/ChatSuspensionAction.class.php +++ b/file/lib/data/suspension/SuspensionAction.class.php @@ -1,20 +1,20 @@ - * @package be.bastelstu.wcf.chat - * @subpackage data.chat.suspension + * @package be.bastelstu.chat + * @subpackage data.suspension */ -class ChatSuspensionAction extends \wcf\data\AbstractDatabaseObjectAction { +class SuspensionAction extends \wcf\data\AbstractDatabaseObjectAction { /** * @see \wcf\data\AbstractDatabaseObjectAction::$className */ - protected $className = '\wcf\data\chat\suspension\ChatSuspensionEditor'; + protected $className = '\chat\data\suspension\SuspensionEditor'; /** * Deletes expired suspensions. diff --git a/file/lib/data/chat/suspension/ChatSuspensionEditor.class.php b/file/lib/data/suspension/SuspensionEditor.class.php similarity index 64% rename from file/lib/data/chat/suspension/ChatSuspensionEditor.class.php rename to file/lib/data/suspension/SuspensionEditor.class.php index 382d8e2..e7df46a 100644 --- a/file/lib/data/chat/suspension/ChatSuspensionEditor.class.php +++ b/file/lib/data/suspension/SuspensionEditor.class.php @@ -1,21 +1,21 @@ - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage data.chat.suspension */ -class ChatSuspensionEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data\IEditableCachedObject { +class SuspensionEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data\IEditableCachedObject { /** * @see \wcf\data\DatabaseObjectDecorator::$baseClass */ - protected static $baseClass = '\wcf\data\chat\suspension\ChatSuspension'; + protected static $baseClass = '\chat\data\suspension\Suspension'; /** * Clears the suspension cache. diff --git a/file/lib/form/ChatForm.class.php b/file/lib/form/ChatForm.class.php index dc816c0..d5c8f87 100644 --- a/file/lib/form/ChatForm.class.php +++ b/file/lib/form/ChatForm.class.php @@ -1,6 +1,6 @@ - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage form */ class ChatForm extends AbstractForm { @@ -98,11 +98,11 @@ public function __run() { * @see \wcf\page\IPage::readData() */ public function readData() { - $this->userData['color'] = \wcf\util\ChatUtil::readUserData('color'); - $this->userData['roomID'] = \wcf\util\ChatUtil::readUserData('roomID'); - $this->userData['away'] = \wcf\util\ChatUtil::readUserData('away'); + $this->userData['color'] = \chat\util\ChatUtil::readUserData('color'); + $this->userData['roomID'] = \chat\util\ChatUtil::readUserData('roomID'); + $this->userData['away'] = \chat\util\ChatUtil::readUserData('away'); - $cache = chat\room\ChatRoom::getCache(); + $cache = data\room\Room::getCache(); if (!isset($cache[$this->userData['roomID']])) throw new \wcf\system\exception\IllegalLinkException(); $this->room = $cache[$this->userData['roomID']]; @@ -142,15 +142,15 @@ public function validate() { public function save() { parent::save(); - \wcf\util\ChatUtil::writeUserData(array('away' => null)); + \chat\util\ChatUtil::writeUserData(array('away' => null)); $commandHandler = new \wcf\system\chat\command\CommandHandler($this->message); if ($commandHandler->isCommand()) { try { $command = $commandHandler->loadCommand(); - if ($command->enableSmilies != \wcf\system\chat\command\ICommand::SETTING_USER) $this->enableSmilies = $command->enableSmilies; + if ($command->enableSmilies != \chat\system\command\ICommand::SETTING_USER) $this->enableSmilies = $command->enableSmilies; $this->enableHTML = $command->enableHTML; - if ($command->enableBBCodes != \wcf\system\chat\command\ICommand::SETTING_USER) $this->enableBBCodes = $command->enableBBCodes; + if ($command->enableBBCodes != \chat\system\command\ICommand::SETTING_USER) $this->enableBBCodes = $command->enableBBCodes; $type = $command->getType(); $this->message = $command->getMessage(); @@ -158,40 +158,40 @@ public function save() { } catch (\wcf\system\chat\command\NotFoundException $e) { $this->message = WCF::getLanguage()->get('wcf.chat.error.notFound'); - $type = chat\message\ChatMessage::TYPE_ERROR; + $type = data\message\Message::TYPE_ERROR; $receiver = WCF::getUser()->userID; } catch (\wcf\system\chat\command\UserNotFoundException $e) { $this->message = WCF::getLanguage()->getDynamicVariable('wcf.chat.error.userNotFound', array('username' => $e->getUsername())); - $type = chat\message\ChatMessage::TYPE_ERROR; + $type = data\message\Message::TYPE_ERROR; $receiver = WCF::getUser()->userID; $this->enableHTML = 1; } catch (\wcf\system\exception\PermissionDeniedException $e) { $this->message = WCF::getLanguage()->get('wcf.chat.error.permissionDenied'); - $type = chat\message\ChatMessage::TYPE_ERROR; + $type = data\message\Message::TYPE_ERROR; $receiver = WCF::getUser()->userID; } catch (\Exception $e) { $this->message = WCF::getLanguage()->get('wcf.chat.error.exception'); - $type = chat\message\ChatMessage::TYPE_ERROR; + $type = data\message\Message::TYPE_ERROR; $receiver = WCF::getUser()->userID; } } else { - $type = chat\message\ChatMessage::TYPE_NORMAL; + $type = data\message\Message::TYPE_NORMAL; $receiver = null; } // mark user as back if ($this->userData['away'] !== null) { - $messageAction = new chat\message\ChatMessageAction(array(), 'create', array( + $messageAction = new data\message\MessageAction(array(), 'create', array( 'data' => array( 'roomID' => $this->room->roomID, 'sender' => WCF::getUser()->userID, 'username' => WCF::getUser()->username, 'time' => TIME_NOW, - 'type' => chat\message\ChatMessage::TYPE_BACK, + 'type' => data\message\Message::TYPE_BACK, 'message' => '', 'color1' => $this->userData['color'][1], 'color2' => $this->userData['color'][2] @@ -200,7 +200,7 @@ public function save() { $messageAction->executeAction(); } - $this->objectAction = new chat\message\ChatMessageAction(array(), 'create', array( + $this->objectAction = new data\message\MessageAction(array(), 'create', array( 'data' => array( 'roomID' => $this->room->roomID, 'sender' => WCF::getUser()->userID, @@ -219,7 +219,7 @@ public function save() { $this->objectAction->executeAction(); // add activity points - \wcf\system\user\activity\point\UserActivityPointHandler::getInstance()->fireEvent('be.bastelstu.wcf.chat.activityPointEvent.message', TIME_NOW, WCF::getUser()->userID); + \wcf\system\user\activity\point\UserActivityPointHandler::getInstance()->fireEvent('be.bastelstu.chat.activityPointEvent.message', TIME_NOW, WCF::getUser()->userID); $this->saved(); } diff --git a/file/lib/page/ChatMessagePage.class.php b/file/lib/page/ChatMessagePage.class.php index f8d7150..f35c00c 100644 --- a/file/lib/page/ChatMessagePage.class.php +++ b/file/lib/page/ChatMessagePage.class.php @@ -1,6 +1,6 @@ - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage page */ -class ChatMessagePage extends AbstractPage { +class ChatMessagePage extends \wcf\page\AbstractPage { /** * @see wcf\page\AbstractPage::$loginRequired */ @@ -39,7 +39,7 @@ class ChatMessagePage extends AbstractPage { /** * The room the user joined. * - * @var \wcf\data\chat\room\ChatRoom + * @var \chat\data\room\Room */ public $room = null; @@ -82,15 +82,15 @@ public function readData() { $this->readMessages(); $this->users = $this->room->getUsers(); - $deadUsers = \wcf\util\ChatUtil::getDiedUsers(); + $deadUsers = \chat\util\ChatUtil::getDiedUsers(); foreach ($deadUsers as $deadUser) { if (!$deadUser) continue; $user = new \wcf\data\user\User($deadUser['userID']); if (CHAT_DISPLAY_JOIN_LEAVE) { - $userData['color'] = \wcf\util\ChatUtil::readUserData('color', $user); + $userData['color'] = \chat\util\ChatUtil::readUserData('color', $user); - $messageAction = new chat\message\ChatMessageAction(array(), 'create', array( + $messageAction = new data\message\MessageAction(array(), 'create', array( 'data' => array( 'roomID' => $deadUser['roomID'], 'sender' => $user->userID, @@ -104,7 +104,7 @@ public function readData() { )); $messageAction->executeAction(); } - \wcf\util\ChatUtil::writeUserData(array('roomID' => null), $user); + \chat\util\ChatUtil::writeUserData(array('roomID' => null), $user); } } @@ -112,7 +112,7 @@ public function readData() { * Fetches the new messages */ public function readMessages() { - $this->messages = chat\message\ChatMessageList::getMessagesSince($this->room, \wcf\util\ChatUtil::readUserData('lastSeen')); + $this->messages = data\message\MessageList::getMessagesSince($this->room, \chat\util\ChatUtil::readUserData('lastSeen')); // update last seen message $sql = "SELECT @@ -122,7 +122,7 @@ public function readMessages() { $stmt = WCF::getDB()->prepareStatement($sql); $stmt->execute(); - \wcf\util\ChatUtil::writeUserData(array( + \chat\util\ChatUtil::writeUserData(array( 'lastSeen' => $stmt->fetchColumn(), 'lastActivity' => TIME_NOW )); @@ -132,8 +132,8 @@ public function readMessages() { * Initializes the room databaseobject. */ public function readRoom() { - $roomID = \wcf\util\ChatUtil::readUserData('roomID'); - $cache = chat\room\ChatRoom::getCache(); + $roomID = \chat\util\ChatUtil::readUserData('roomID'); + $cache = data\room\Room::getCache(); if (!isset($cache[$roomID])) throw new IllegalLinkException(); $this->room = $cache[$roomID]; diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index f9b57ef..3176695 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -1,6 +1,6 @@ - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage page */ -class ChatPage extends AbstractPage { +class ChatPage extends \wcf\page\AbstractPage { /** * The version of this installation of Tims Chat 3. * @@ -39,14 +39,14 @@ class ChatPage extends AbstractPage { /** * The last X messages for the current room. * - * @var array<\wcf\data\chat\message\ChatMessage> + * @var array<\chat\data\message\Message> */ public $newestMessages = array(); /** * The current room. * - * @var \wcf\data\chat\room\ChatRoom + * @var \chat\data\room\Room */ public $room = null; @@ -60,7 +60,7 @@ class ChatPage extends AbstractPage { /** * List of accessible rooms. * - * @var \wcf\data\chat\room\ChatRoomList + * @var \chat\data\room\RoomList */ public $rooms = array(); @@ -108,8 +108,8 @@ public function assignVariables() { 'rooms' => $this->rooms, 'defaultSmilies' => $this->defaultSmilies, 'smileyCategories' => $this->smileyCategories, - 'sidebarCollapsed' => \wcf\system\user\collapsible\content\UserCollapsibleContentHandler::getInstance()->isCollapsed('com.woltlab.wcf.collapsibleSidebar', 'be.bastelstu.wcf.chat.ChatPage'), - 'sidebarName' => 'be.bastelstu.wcf.chat.ChatPage' + 'sidebarCollapsed' => \wcf\system\user\collapsible\content\UserCollapsibleContentHandler::getInstance()->isCollapsed('com.woltlab.wcf.collapsibleSidebar', 'be.bastelstu.chat.ChatPage'), + 'sidebarName' => 'be.bastelstu.chat.ChatPage' )); } @@ -117,7 +117,7 @@ public function assignVariables() { * Reads chat-version. Used to avoid caching of JS-File when Tims Chat is updated. */ public function readChatVersion() { - return $this->chatVersion = \wcf\data\package\PackageCache::getInstance()->getPackage(\wcf\util\ChatUtil::getPackageID())->packageVersion; + return $this->chatVersion = \wcf\data\package\PackageCache::getInstance()->getPackage(\chat\util\ChatUtil::getPackageID())->packageVersion; } /** @@ -127,15 +127,15 @@ public function readData() { parent::readData(); $this->readRoom(); - $this->userData['color'] = \wcf\util\ChatUtil::readUserData('color'); - \wcf\util\ChatUtil::writeUserData(array( + $this->userData['color'] = \chat\util\ChatUtil::readUserData('color'); + \chat\util\ChatUtil::writeUserData(array( 'roomID' => $this->room->roomID, 'away' => null, 'lastActivity' => TIME_NOW )); if (CHAT_DISPLAY_JOIN_LEAVE) { - $messageAction = new chat\message\ChatMessageAction(array(), 'create', array( + $messageAction = new data\message\MessageAction(array(), 'create', array( 'data' => array( 'roomID' => $this->room->roomID, 'sender' => WCF::getUser()->userID, @@ -151,12 +151,12 @@ public function readData() { $messageAction->getReturnValues(); } - $this->newestMessages = chat\message\ChatMessageList::getNewestMessages($this->room, CHAT_LASTMESSAGES); + $this->newestMessages = data\message\MessageList::getNewestMessages($this->room, CHAT_LASTMESSAGES); try { - \wcf\util\ChatUtil::writeUserData(array('lastSeen' => end($this->newestMessages)->messageID)); + \chat\util\ChatUtil::writeUserData(array('lastSeen' => end($this->newestMessages)->messageID)); } catch (\wcf\system\exception\SystemException $e) { - \wcf\util\ChatUtil::writeUserData(array('lastSeen' => 0)); + \chat\util\ChatUtil::writeUserData(array('lastSeen' => 0)); } $smileyCategories = \wcf\data\smiley\SmileyCache::getInstance()->getCategories(); @@ -182,23 +182,23 @@ public function readParameters() { $this->request->__run(); exit; case 'Log': - $this->request = new ChatLogPage(); + $this->request = new LogPage(); $this->request->__run(); exit; case 'RefreshRoomList': - $this->request = new ChatRefreshRoomListPage(); + $this->request = new RoomListPage(); $this->request->__run(); exit; case 'Send': - $this->request = new \wcf\form\ChatForm(); + $this->request = new \chat\form\ChatForm(); $this->request->__run(); exit; case 'Leave': - $this->request = new \wcf\action\ChatLeaveAction(); + $this->request = new \chat\action\LeaveAction(); $this->request->__run(); exit; case 'Copyright': - $this->request = new ChatCopyrightPage(); + $this->request = new CopyrightPage(); $this->request->__run(); exit; } @@ -211,7 +211,7 @@ public function readParameters() { * Reads room data. */ public function readRoom() { - $this->rooms = chat\room\ChatRoom::getCache(); + $this->rooms = data\room\Room::getCache(); if ($this->roomID === 0) { // no room given @@ -236,7 +236,7 @@ public function readRoom() { * @see \wcf\page\IPage::show() */ public function show() { - \wcf\system\menu\page\PageMenu::getInstance()->setActiveMenuItem('wcf.header.menu.chat'); + \wcf\system\menu\page\PageMenu::getInstance()->setActiveMenuItem('chat.header.menu.chat'); // remove index breadcrumb WCF::getBreadcrumbs()->remove(0); @@ -244,7 +244,7 @@ public function show() { parent::show(); // add activity points - \wcf\system\user\activity\point\UserActivityPointHandler::getInstance()->fireEvent('be.bastelstu.wcf.chat.activityPointEvent.join', TIME_NOW, WCF::getUser()->userID); + \wcf\system\user\activity\point\UserActivityPointHandler::getInstance()->fireEvent('be.bastelstu.chat.activityPointEvent.join', TIME_NOW, WCF::getUser()->userID); // break if not using ajax if ($this->useTemplate) exit; diff --git a/file/lib/page/ChatCopyrightPage.class.php b/file/lib/page/CopyrightPage.class.php similarity index 97% rename from file/lib/page/ChatCopyrightPage.class.php rename to file/lib/page/CopyrightPage.class.php index 4f5c9f4..79191f9 100644 --- a/file/lib/page/ChatCopyrightPage.class.php +++ b/file/lib/page/CopyrightPage.class.php @@ -1,5 +1,5 @@ - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage page */ -class ChatCopyrightPage extends AbstractPage { +class CopyrightPage extends \wcf\page\AbstractPage { /** * @see \wcf\page\AbstractPage::$neededModules */ diff --git a/file/lib/page/ChatLogPage.class.php b/file/lib/page/LogPage.class.php similarity index 78% rename from file/lib/page/ChatLogPage.class.php rename to file/lib/page/LogPage.class.php index 90fed7f..ec91805 100644 --- a/file/lib/page/ChatLogPage.class.php +++ b/file/lib/page/LogPage.class.php @@ -1,6 +1,6 @@ - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage page */ -class ChatLogPage extends AbstractPage { +class LogPage extends \wcf\page\AbstractPage { /** * @see wcf\page\AbstractPage::$loginRequired */ @@ -45,13 +45,13 @@ class ChatLogPage extends AbstractPage { /** * given room - * @var \wcf\data\chat\room\ChatRoom + * @var \chat\data\room\Chat */ public $room = null; /** * all rooms in the current installation - * @var array<\wcf\data\chat\room\ChatRoom> + * @var array<\chat\data\room\Room> */ public $rooms = array(); @@ -82,9 +82,7 @@ public function assignVariables() { 'messages' => $this->messages, 'room' => $this->room, 'roomID' => $this->roomID, - 'rooms' => $this->rooms, - 'sidebarCollapsed' => \wcf\system\user\collapsible\content\UserCollapsibleContentHandler::getInstance()->isCollapsed('com.woltlab.wcf.collapsibleSidebar', 'be.bastelstu.wcf.chat.ChatLogPage'), - 'sidebarName' => 'be.bastelstu.wcf.chat.ChatLogPage' + 'rooms' => $this->rooms )); } @@ -103,7 +101,7 @@ public function readParameters() { public function readData() { parent::readData(); - $cache = chat\room\ChatRoom::getCache(); + $cache = data\room\Room::getCache(); if (!isset($cache[$this->roomID])) throw new IllegalLinkException(); $this->room = $cache[$this->roomID]; @@ -112,6 +110,6 @@ public function readData() { if (!$ph->getPermission($this->room, 'mod.canReadLog')) throw new \wcf\system\exception\PermissionDeniedException(); // TODO: actually read the correct messages - $this->messages = chat\message\ChatMessageList::getNewestMessages($this->room, 150); + $this->messages = data\message\MessageList::getNewestMessages($this->room, 150); } } diff --git a/file/lib/page/ChatRefreshRoomListPage.class.php b/file/lib/page/RoomListPage.class.php similarity index 82% rename from file/lib/page/ChatRefreshRoomListPage.class.php rename to file/lib/page/RoomListPage.class.php index d53ad5a..a5c5f12 100644 --- a/file/lib/page/ChatRefreshRoomListPage.class.php +++ b/file/lib/page/RoomListPage.class.php @@ -1,20 +1,20 @@ - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage page */ -class ChatRefreshRoomListPage extends AbstractPage { +class RoomListPage extends \wcf\page\AbstractPage { /** * @see wcf\page\AbstractPage::$loginRequired */ @@ -32,13 +32,13 @@ class ChatRefreshRoomListPage extends AbstractPage { /** * the room the user current is in - * @var \wcf\data\chat\room\ChatRoom + * @var \chat\data\room\Room */ public $room = null; /** * all rooms in the current installation - * @var array<\wcf\data\chat\room\ChatRoom> + * @var array<\chat\data\room\Room> */ public $rooms = array(); @@ -70,9 +70,9 @@ public function __run() { public function readData() { parent::readData(); - $this->rooms = chat\room\ChatRoom::getCache(); + $this->rooms = data\room\Room::getCache(); - $roomID = \wcf\util\ChatUtil::readUserData('roomID'); + $roomID = \chat\util\ChatUtil::readUserData('roomID'); if (!isset($this->rooms[$roomID])) throw new IllegalLinkException(); $this->room = $this->rooms[$roomID]; } @@ -91,6 +91,7 @@ public function show() { $json[] = array( 'title' => WCF::getLanguage()->get($room->title), 'link' => \wcf\system\request\LinkHandler::getInstance()->getLink('Chat', array( + 'application' => 'chat', 'object' => $room )), 'active' => $room->roomID == $this->room->roomID diff --git a/file/lib/system/ChatCore.class.php b/file/lib/system/ChatCore.class.php new file mode 100644 index 0000000..6601759 --- /dev/null +++ b/file/lib/system/ChatCore.class.php @@ -0,0 +1,23 @@ + + * @package be.bastelstu.chat + * @subpackage system + */ +class ChatCore extends \wcf\system\application\AbstractApplication { + /** + * @see wcf\system\application\AbstractApplication::$abbreviation + */ + protected $abbreviation = 'chat'; + + /** + * @see wcf\system\application\IApplication::__run() + */ + public function __run() {} +} diff --git a/file/lib/system/cache/builder/ChatPermissionCacheBuilder.class.php b/file/lib/system/cache/builder/PermissionCacheBuilder.class.php similarity index 88% rename from file/lib/system/cache/builder/ChatPermissionCacheBuilder.class.php rename to file/lib/system/cache/builder/PermissionCacheBuilder.class.php index dce4ffb..0417dc2 100644 --- a/file/lib/system/cache/builder/ChatPermissionCacheBuilder.class.php +++ b/file/lib/system/cache/builder/PermissionCacheBuilder.class.php @@ -1,17 +1,17 @@ - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.cache.builder */ -class ChatPermissionCacheBuilder implements ICacheBuilder { +class PermissionCacheBuilder implements \wcf\system\cache\builder\ICacheBuilder { /** * @see wcf\system\cache\ICacheBuilder::getData() */ @@ -22,7 +22,7 @@ public function getData(array $cacheResource) { if (count($groupIDs)) { $conditionBuilder = new \wcf\system\database\util\PreparedStatementConditionBuilder(); - $conditionBuilder->add('acl_option.objectTypeID = ?', array(\wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.wcf.chat.room'))); + $conditionBuilder->add('acl_option.objectTypeID = ?', array(\wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.chat.room'))); $conditionBuilder->add('option_to_group.optionID = acl_option.optionID'); $conditionBuilder->add('option_to_group.groupID IN (?)', array($groupIDs)); $sql = "SELECT option_to_group.groupID, option_to_group.objectID AS roomID, option_to_group.optionValue, diff --git a/file/lib/system/cache/builder/ChatRoomCacheBuilder.class.php b/file/lib/system/cache/builder/RoomCacheBuilder.class.php similarity index 68% rename from file/lib/system/cache/builder/ChatRoomCacheBuilder.class.php rename to file/lib/system/cache/builder/RoomCacheBuilder.class.php index d8232c4..ddb4f71 100644 --- a/file/lib/system/cache/builder/ChatRoomCacheBuilder.class.php +++ b/file/lib/system/cache/builder/RoomCacheBuilder.class.php @@ -1,22 +1,22 @@ - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.cache.builder */ -class ChatRoomCacheBuilder implements ICacheBuilder { +class RoomCacheBuilder implements \wcf\system\cache\builder\ICacheBuilder { /** * @see \wcf\system\cache\ICacheBuilder::getData() */ public function getData(array $cacheResource) { // get all chat rooms - $roomList = new \wcf\data\chat\room\ChatRoomList(); + $roomList = new \chat\data\room\RoomList(); $roomList->sqlOrderBy = "chat_room.position"; $roomList->readObjects(); diff --git a/file/lib/system/chat/command/AbstractCommand.class.php b/file/lib/system/chat/command/AbstractCommand.class.php index 8c2ab35..37c9074 100644 --- a/file/lib/system/chat/command/AbstractCommand.class.php +++ b/file/lib/system/chat/command/AbstractCommand.class.php @@ -6,9 +6,9 @@ * Default implementation for commands. * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.chat.command */ abstract class AbstractCommand implements ICommand { diff --git a/file/lib/system/chat/command/AbstractRestrictedCommand.class.php b/file/lib/system/chat/command/AbstractRestrictedCommand.class.php index c82d67a..ee85983 100644 --- a/file/lib/system/chat/command/AbstractRestrictedCommand.class.php +++ b/file/lib/system/chat/command/AbstractRestrictedCommand.class.php @@ -6,9 +6,9 @@ * Default implementation for restricted commands * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.chat.command */ abstract class AbstractRestrictedCommand extends AbstractCommand implements IRestrictedCommand { diff --git a/file/lib/system/chat/command/CommandHandler.class.php b/file/lib/system/chat/command/CommandHandler.class.php index 567cc4b..b7e2a78 100644 --- a/file/lib/system/chat/command/CommandHandler.class.php +++ b/file/lib/system/chat/command/CommandHandler.class.php @@ -6,9 +6,9 @@ * Handles commands * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.chat.command */ final class CommandHandler { diff --git a/file/lib/system/chat/command/ICommand.class.php b/file/lib/system/chat/command/ICommand.class.php index 41d5025..df3d7dd 100644 --- a/file/lib/system/chat/command/ICommand.class.php +++ b/file/lib/system/chat/command/ICommand.class.php @@ -5,9 +5,9 @@ * Interface for chat-commands. * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.chat.command */ interface ICommand { diff --git a/file/lib/system/chat/command/IRestrictedCommand.class.php b/file/lib/system/chat/command/IRestrictedCommand.class.php index 9faab4b..07016d0 100644 --- a/file/lib/system/chat/command/IRestrictedCommand.class.php +++ b/file/lib/system/chat/command/IRestrictedCommand.class.php @@ -5,9 +5,9 @@ * Interface for Restricted commands. * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.chat.command */ interface IRestrictedCommand { diff --git a/file/lib/system/chat/command/NotFoundException.class.php b/file/lib/system/chat/command/NotFoundException.class.php index e267ea5..82f4a82 100644 --- a/file/lib/system/chat/command/NotFoundException.class.php +++ b/file/lib/system/chat/command/NotFoundException.class.php @@ -5,9 +5,9 @@ * Thrown when a command is not found. * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.chat.command */ class NotFoundException extends \Exception { } diff --git a/file/lib/system/chat/command/UserNotFoundException.class.php b/file/lib/system/chat/command/UserNotFoundException.class.php index e199cd9..058236d 100644 --- a/file/lib/system/chat/command/UserNotFoundException.class.php +++ b/file/lib/system/chat/command/UserNotFoundException.class.php @@ -5,9 +5,9 @@ * Thrown when a user is not found. * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.chat.command */ class UserNotFoundException extends \Exception { diff --git a/file/lib/system/chat/command/commands/AwayCommand.class.php b/file/lib/system/chat/command/commands/AwayCommand.class.php index 95ac18b..156a69f 100644 --- a/file/lib/system/chat/command/commands/AwayCommand.class.php +++ b/file/lib/system/chat/command/commands/AwayCommand.class.php @@ -6,16 +6,16 @@ * Marks the user as away. * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.chat.command.commands */ class AwayCommand extends \wcf\system\chat\command\AbstractCommand { public function __construct(\wcf\system\chat\command\CommandHandler $commandHandler) { parent::__construct($commandHandler); - \wcf\util\ChatUtil::writeUserData(array('away' => $commandHandler->getParameters())); + \chat\util\ChatUtil::writeUserData(array('away' => $commandHandler->getParameters())); $this->didInit(); } diff --git a/file/lib/system/chat/command/commands/BanCommand.class.php b/file/lib/system/chat/command/commands/BanCommand.class.php index b3fae84..37e2e12 100644 --- a/file/lib/system/chat/command/commands/BanCommand.class.php +++ b/file/lib/system/chat/command/commands/BanCommand.class.php @@ -9,9 +9,9 @@ * Bans a user. * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.chat.command.commands */ class BanCommand extends MuteCommand { diff --git a/file/lib/system/chat/command/commands/ColorCommand.class.php b/file/lib/system/chat/command/commands/ColorCommand.class.php index 0479b3e..2bff44f 100644 --- a/file/lib/system/chat/command/commands/ColorCommand.class.php +++ b/file/lib/system/chat/command/commands/ColorCommand.class.php @@ -6,9 +6,9 @@ * Changes the color of the username * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.chat.command.commands */ class ColorCommand extends \wcf\system\chat\command\AbstractCommand { @@ -56,7 +56,7 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand $color[$key] = hexdec($val); } } - \wcf\util\ChatUtil::writeUserData(array('color' => $color)); + \chat\util\ChatUtil::writeUserData(array('color' => $color)); $this->didInit(); } diff --git a/file/lib/system/chat/command/commands/FreeCommand.class.php b/file/lib/system/chat/command/commands/FreeCommand.class.php index e462c78..884c65f 100644 --- a/file/lib/system/chat/command/commands/FreeCommand.class.php +++ b/file/lib/system/chat/command/commands/FreeCommand.class.php @@ -5,9 +5,9 @@ * Informs everyone that the fish was freed. OH A NOEZ. * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.chat.command.commands */ class FreeCommand extends MeCommand { diff --git a/file/lib/system/chat/command/commands/InfoCommand.class.php b/file/lib/system/chat/command/commands/InfoCommand.class.php index b553369..872364a 100644 --- a/file/lib/system/chat/command/commands/InfoCommand.class.php +++ b/file/lib/system/chat/command/commands/InfoCommand.class.php @@ -9,9 +9,9 @@ * Shows information about the specified user. * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.chat.command.commands */ class InfoCommand extends \wcf\system\chat\command\AbstractCommand { diff --git a/file/lib/system/chat/command/commands/MeCommand.class.php b/file/lib/system/chat/command/commands/MeCommand.class.php index 8c003d3..586181b 100644 --- a/file/lib/system/chat/command/commands/MeCommand.class.php +++ b/file/lib/system/chat/command/commands/MeCommand.class.php @@ -6,9 +6,9 @@ * Indicates an action. The message is shown without the colon. * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.chat.command.commands */ class MeCommand extends \wcf\system\chat\command\AbstractCommand { diff --git a/file/lib/system/chat/command/commands/MuteCommand.class.php b/file/lib/system/chat/command/commands/MuteCommand.class.php index 04fa340..3201961 100644 --- a/file/lib/system/chat/command/commands/MuteCommand.class.php +++ b/file/lib/system/chat/command/commands/MuteCommand.class.php @@ -9,9 +9,9 @@ * Mutes a user. * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.chat.command.commands */ class MuteCommand extends \wcf\system\chat\command\AbstractRestrictedCommand { diff --git a/file/lib/system/chat/command/commands/PlainCommand.class.php b/file/lib/system/chat/command/commands/PlainCommand.class.php index 8e94a33..03974ff 100644 --- a/file/lib/system/chat/command/commands/PlainCommand.class.php +++ b/file/lib/system/chat/command/commands/PlainCommand.class.php @@ -5,9 +5,9 @@ * Sends a message that starts with a slash. * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.chat.command.commands */ class PlainCommand extends \wcf\system\chat\command\AbstractCommand { diff --git a/file/lib/system/chat/command/commands/RestoreCommand.class.php b/file/lib/system/chat/command/commands/RestoreCommand.class.php index 54c6415..6598b77 100644 --- a/file/lib/system/chat/command/commands/RestoreCommand.class.php +++ b/file/lib/system/chat/command/commands/RestoreCommand.class.php @@ -8,9 +8,9 @@ * Resets the color of a user * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.chat.command.commands */ class RestoreCommand extends \wcf\system\chat\command\AbstractRestrictedCommand { diff --git a/file/lib/system/chat/command/commands/TemproomCommand.class.php b/file/lib/system/chat/command/commands/TemproomCommand.class.php index 308d8c5..1047fa6 100644 --- a/file/lib/system/chat/command/commands/TemproomCommand.class.php +++ b/file/lib/system/chat/command/commands/TemproomCommand.class.php @@ -7,9 +7,9 @@ * Creates a temporary room * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.chat.command.commands */ class TemproomCommand extends \wcf\system\chat\command\AbstractRestrictedCommand { @@ -37,7 +37,7 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand )); // set permissions - $options = \wcf\data\acl\option\ACLOption::getOptions(\wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.wcf.chat.room'))->getObjects(); + $options = \wcf\data\acl\option\ACLOption::getOptions(\wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.chat.room'))->getObjects(); $_POST['aclValues'] = array( 'user' => array( // creators may do everything @@ -49,7 +49,7 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand ) ); - \wcf\system\acl\ACLHandler::getInstance()->save($roomID, \wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.wcf.chat.room')); + \wcf\system\acl\ACLHandler::getInstance()->save($roomID, \wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.chat.room')); \wcf\system\chat\permission\ChatPermissionHandler::clearCache(); $this->didInit(); } diff --git a/file/lib/system/chat/command/commands/WhereCommand.class.php b/file/lib/system/chat/command/commands/WhereCommand.class.php index 7c643a0..439cbd7 100644 --- a/file/lib/system/chat/command/commands/WhereCommand.class.php +++ b/file/lib/system/chat/command/commands/WhereCommand.class.php @@ -5,9 +5,9 @@ * Shows the users that are online * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.chat.command.commands */ class WhereCommand extends \wcf\system\chat\command\AbstractCommand { diff --git a/file/lib/system/chat/command/commands/WhisperCommand.class.php b/file/lib/system/chat/command/commands/WhisperCommand.class.php index 0da5283..4d3ad8f 100644 --- a/file/lib/system/chat/command/commands/WhisperCommand.class.php +++ b/file/lib/system/chat/command/commands/WhisperCommand.class.php @@ -6,9 +6,9 @@ * Whispers a message. * * @author Tim Düsterhus - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.chat.command.commands */ class WhisperCommand extends \wcf\system\chat\command\AbstractCommand { diff --git a/file/lib/system/cronjob/ChatCleanupCronjob.class.php b/file/lib/system/cronjob/CleanupCronjob.class.php similarity index 57% rename from file/lib/system/cronjob/ChatCleanupCronjob.class.php rename to file/lib/system/cronjob/CleanupCronjob.class.php index 00a436c..9ee07f2 100644 --- a/file/lib/system/cronjob/ChatCleanupCronjob.class.php +++ b/file/lib/system/cronjob/CleanupCronjob.class.php @@ -1,44 +1,44 @@ - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.cronjob */ -class ChatCleanupCronjob implements ICronjob { +class ChatCleanupCronjob implements \wcf\system\cronjob\ICronjob { /** * @see wcf\system\ICronjob::execute() */ public function execute(\wcf\data\cronjob\Cronjob $cronjob) { - $messageAction = new chat\message\ChatMessageAction(array(), 'prune'); + $messageAction = new data\message\MessageAction(array(), 'prune'); $messageAction->executeAction(); - $roomAction = new chat\room\ChatRoomAction(array(), 'prune'); + $roomAction = new data\room\RoomAction(array(), 'prune'); $roomAction->executeAction(); - $suspensionAction = new chat\suspension\ChatSuspensionAction(array(), 'prune'); + $suspensionAction = new data\suspension\SuspensionAction(array(), 'prune'); $suspensionAction->executeAction(); // kill dead users - $deadUsers = \wcf\util\ChatUtil::getDiedUsers(); + $deadUsers = \chat\util\ChatUtil::getDiedUsers(); foreach ($deadUsers as $deadUser) { if (!$deadUser) continue; $user = new \wcf\data\user\User($deadUser['userID']); if (CHAT_DISPLAY_JOIN_LEAVE) { - $userData['color'] = \wcf\util\ChatUtil::readUserData('color', $user); + $userData['color'] = \chat\util\ChatUtil::readUserData('color', $user); - $messageAction = new chat\message\ChatMessageAction(array(), 'create', array( + $messageAction = new data\message\MessageAction(array(), 'create', array( 'data' => array( 'roomID' => $deadUser['roomID'], 'sender' => $user->userID, 'username' => $user->username, 'time' => TIME_NOW, - 'type' => chat\message\ChatMessage::TYPE_LEAVE, + 'type' => data\message\Message::TYPE_LEAVE, 'message' => '', 'color1' => $userData['color'][1], 'color2' => $userData['color'][2] @@ -46,7 +46,7 @@ public function execute(\wcf\data\cronjob\Cronjob $cronjob) { )); $messageAction->executeAction(); } - \wcf\util\ChatUtil::writeUserData(array('roomID' => null), $user); + \chat\util\ChatUtil::writeUserData(array('roomID' => null), $user); } } } diff --git a/file/lib/system/event/listener/ChatRouteListener.class.php b/file/lib/system/event/listener/RouteHandlerListener.class.php similarity index 80% rename from file/lib/system/event/listener/ChatRouteListener.class.php rename to file/lib/system/event/listener/RouteHandlerListener.class.php index 0da8e8c..d0f14d2 100644 --- a/file/lib/system/event/listener/ChatRouteListener.class.php +++ b/file/lib/system/event/listener/RouteHandlerListener.class.php @@ -1,16 +1,16 @@ - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.event.listener */ -class ChatRouteListener implements \wcf\system\event\IEventListener { +class RouteHandlerListener implements \wcf\system\event\IEventListener { /** * @see \wcf\system\event\IEventListener::execute() */ diff --git a/file/lib/system/menu/page/ChatPageMenuItemProvider.class.php b/file/lib/system/menu/page/ChatPageMenuItemProvider.class.php index 776e239..a769528 100644 --- a/file/lib/system/menu/page/ChatPageMenuItemProvider.class.php +++ b/file/lib/system/menu/page/ChatPageMenuItemProvider.class.php @@ -1,17 +1,16 @@ - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.menu.page */ -class ChatPageMenuItemProvider extends DefaultPageMenuItemProvider { +class ChatPageMenuItemProvider extends \wcf\system\menu\page\DefaultPageMenuItemProvider { protected $room = null; /** @@ -23,7 +22,7 @@ public function isVisible() { // guests are not supported if (!\wcf\system\WCF::getUser()->userID) return false; - $cache = ChatRoom::getCache(); + $cache = \chat\data\room\Room::getCache(); foreach ($cache as $this->room) { if ($this->room->canEnter()) { @@ -41,6 +40,7 @@ public function isVisible() { */ public function getLink() { return \wcf\system\request\LinkHandler::getInstance()->getLink('Chat', array( + 'application' => 'chat', 'object' => $this->room )); } diff --git a/file/lib/system/option/TimeIntervalOptionType.class.php b/file/lib/system/option/TimeIntervalOptionType.class.php index 259287f..0d6afb1 100644 --- a/file/lib/system/option/TimeIntervalOptionType.class.php +++ b/file/lib/system/option/TimeIntervalOptionType.class.php @@ -1,21 +1,21 @@ - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage system.option */ -class TimeIntervalOptionType extends TextOptionType { +class TimeIntervalOptionType extends \wcf\system\option\TextOptionType { /** * @see \wcf\system\option\IOptionType::getData() */ public function getData(\wcf\data\option\Option $option, $newValue) { - return \wcf\util\ChatUtil::timeModifier($newValue); + return \chat\util\ChatUtil::timeModifier($newValue); } /** diff --git a/file/lib/system/chat/permission/ChatPermissionHandler.class.php b/file/lib/system/permission/PermissionHandler.class.php similarity index 78% rename from file/lib/system/chat/permission/ChatPermissionHandler.class.php rename to file/lib/system/permission/PermissionHandler.class.php index 62b1eea..a47b84d 100644 --- a/file/lib/system/chat/permission/ChatPermissionHandler.class.php +++ b/file/lib/system/permission/PermissionHandler.class.php @@ -1,5 +1,5 @@ - * @package be.bastelstu.wcf.chat - * @subpackage system.chat.permissions + * @package be.bastelstu.chat + * @subpackage system.permission */ -class ChatPermissionHandler { +class PermissionHandler { /** * permissions set for the active user * @var array @@ -31,14 +31,14 @@ public function __construct(\wcf\data\user\User $user = null) { if ($user === null) $user = WCF::getUser(); $this->user = new \wcf\data\user\UserProfile($user); - $packageID = \wcf\util\ChatUtil::getPackageID(); + $packageID = \chat\util\ChatUtil::getPackageID(); $ush = \wcf\system\user\storage\UserStorageHandler::getInstance(); // get groups permissions $groups = implode(',', $user->getGroupIDs()); $groupsFileName = \wcf\util\StringUtil::getHash(implode('-', $user->getGroupIDs())); - CacheHandler::getInstance()->addResource('chatPermission-'.$groups, WCF_DIR.'cache/cache.chatPermission-'.$groupsFileName.'.php', '\wcf\system\cache\builder\ChatPermissionCacheBuilder'); - $this->chatPermissions = CacheHandler::getInstance()->get('chatPermission-'.$groups); + CacheHandler::getInstance()->addResource('permission-'.$groups, WCF_DIR.'cache/cache.permission-'.$groupsFileName.'.php', '\chat\system\cache\builder\PermissionCacheBuilder'); + $this->chatPermissions = CacheHandler::getInstance()->get('permission-'.$groups); // get user permissions if ($user->userID) { @@ -53,7 +53,7 @@ public function __construct(\wcf\data\user\User $user = null) { $userPermissions = array(); $conditionBuilder = new \wcf\system\database\util\PreparedStatementConditionBuilder(); - $conditionBuilder->add('acl_option.objectTypeID = ?', array(ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.wcf.chat.room'))); + $conditionBuilder->add('acl_option.objectTypeID = ?', array(ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.chat.room'))); $conditionBuilder->add('option_to_user.optionID = acl_option.optionID'); $conditionBuilder->add('option_to_user.userID = ?', array($user->userID)); $sql = "SELECT option_to_user.objectID AS roomID, option_to_user.optionValue, @@ -85,11 +85,11 @@ public function __construct(\wcf\data\user\User $user = null) { /** * Fetches the given permission for the given room * - * @param \wcf\data\chat\room\ChatRoom $room - * @param string $permission + * @param \chat\data\room\Room $room + * @param string $permission * @return boolean */ - public function getPermission(\wcf\data\chat\room\ChatRoom $room, $permission) { + public function getPermission(\chat\data\room\Room $room, $permission) { if (!isset($this->chatPermissions[$room->roomID][$permission])) { $permission = str_replace(array('user.', 'mod.'), array('user.chat.', 'mod.chat.'), $permission); @@ -102,10 +102,10 @@ public function getPermission(\wcf\data\chat\room\ChatRoom $room, $permission) { * Clears the cache. */ public static function clearCache() { - $packageID = \wcf\util\ChatUtil::getPackageID(); + $packageID = \chat\util\ChatUtil::getPackageID(); $ush = \wcf\system\user\storage\UserStorageHandler::getInstance(); $ush->resetAll('chatUserPermissions', $packageID); - \wcf\system\cache\CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.chatPermission-[a-f0-9]{40}.php'); + \wcf\system\cache\CacheHandler::getInstance()->clear(WCF_DIR.'cache', 'cache.permission-[a-f0-9]{40}.php'); } } diff --git a/file/lib/util/ChatUtil.class.php b/file/lib/util/ChatUtil.class.php index 59a71ea..7f3c1d2 100644 --- a/file/lib/util/ChatUtil.class.php +++ b/file/lib/util/ChatUtil.class.php @@ -1,5 +1,5 @@ - * @package be.bastelstu.wcf.chat + * @package be.bastelstu.chat * @subpackage util */ final class ChatUtil { @@ -18,7 +18,7 @@ final class ChatUtil { * Matches a time-interval with modifiers. * Each part may be optionally separated by a comma * - * @see \wcf\util\ChatUtil::timeModifier() + * @see \chat\util\ChatUtil::timeModifier() */ const TIME_MODIFIER_REGEX = '((?:[0-9]+[s|h|d|w|m|y|S|H|D|W|M|Y]?,?)+)'; @@ -27,7 +27,7 @@ final class ChatUtil { * * @var string */ - const PACKAGE_IDENTIFIER = 'be.bastelstu.wcf.chat'; + const PACKAGE_IDENTIFIER = 'be.bastelstu.chat'; /** * Which user-storage-keys need serialization. @@ -120,7 +120,7 @@ public static function gradient($string, $start, $end) { $result = ''; for ($i = 0, $max = count($string); $i < $max; $i++) { - $result .= ''.StringUtil::encodeHTML($string[$i]).''; + $result .= ''.\wcf\util\StringUtil::encodeHTML($string[$i]).''; } return $result; @@ -133,8 +133,8 @@ public static function gradient($string, $start, $end) { */ public static function nodePushRunning() { if (!CHAT_SOCKET_IO_PATH) return false; - if (!file_exists(WCF_DIR.'acp/be.bastelstu.wcf.chat.nodePush/data.sock')) return false; - if (!is_writable(WCF_DIR.'acp/be.bastelstu.wcf.chat.nodePush/data.sock')) return false; + if (!file_exists(CHAT_DIR.'acp/be.bastelstu.chat.nodePush/data.sock')) return false; + if (!is_writable(CHAT_DIR.'acp/be.bastelstu.chat.nodePush/data.sock')) return false; return true; } @@ -179,8 +179,8 @@ public static function readUserData($field, \wcf\data\user\User $user = null) { */ public static function str_split($string, $length = 1) { $result = array(); - for ($i = 0, $max = StringUtil::length($string); $i < $max; $i += $length) { - $result[] = StringUtil::substring($string, $i, $length); + for ($i = 0, $max = \wcf\util\StringUtil::length($string); $i < $max; $i += $length) { + $result[] = \wcf\util\StringUtil::substring($string, $i, $length); } return $result; } diff --git a/install.sql b/install.sql index 65edfbc..449aaa4 100644 --- a/install.sql +++ b/install.sql @@ -2,13 +2,13 @@ -- Database Structure for Tims Chat -- -- @author Tim Düsterhus --- @copyright 2010-2012 Tim Düsterhus +-- @copyright 2010-2013 Tim Düsterhus -- @license Creative Commons Attribution-NonCommercial-ShareAlike --- @package be.bastelstu.wcf.chat +-- @package be.bastelstu.chat -- -- -DROP TABLE IF EXISTS wcf1_chat_message; -CREATE TABLE wcf1_chat_message ( +DROP TABLE IF EXISTS chat1_message; +CREATE TABLE chat1_message ( messageID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, roomID INT(10) NOT NULL, sender INT(10) DEFAULT NULL, @@ -28,8 +28,8 @@ CREATE TABLE wcf1_chat_message ( KEY receiver (receiver) ); -DROP TABLE IF EXISTS wcf1_chat_room; -CREATE TABLE wcf1_chat_room ( +DROP TABLE IF EXISTS chat1_room; +CREATE TABLE chat1_room ( roomID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, title VARCHAR(255) NOT NULL, topic VARCHAR(255) NOT NULL, @@ -41,8 +41,8 @@ CREATE TABLE wcf1_chat_room ( KEY owner (owner) ); -DROP TABLE IF EXISTS wcf1_chat_suspension; -CREATE TABLE wcf1_chat_suspension ( +DROP TABLE IF EXISTS chat1_suspension; +CREATE TABLE chat1_suspension ( suspensionID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, userID INT(10) NOT NULL, roomID INT(10) DEFAULT NULL, @@ -55,16 +55,16 @@ CREATE TABLE wcf1_chat_suspension ( KEY time (time) ); -ALTER TABLE wcf1_chat_message ADD FOREIGN KEY (receiver) REFERENCES wcf1_user (userID) ON DELETE CASCADE; -ALTER TABLE wcf1_chat_message ADD FOREIGN KEY (roomID) REFERENCES wcf1_chat_room (roomID) ON DELETE CASCADE; -ALTER TABLE wcf1_chat_message ADD FOREIGN KEY (sender) REFERENCES wcf1_user (userID) ON DELETE SET NULL; +ALTER TABLE chat1_message ADD FOREIGN KEY (receiver) REFERENCES wcf1_user (userID) ON DELETE CASCADE; +ALTER TABLE chat1_message ADD FOREIGN KEY (roomID) REFERENCES chat1_room (roomID) ON DELETE CASCADE; +ALTER TABLE chat1_message ADD FOREIGN KEY (sender) REFERENCES wcf1_user (userID) ON DELETE SET NULL; -ALTER TABLE wcf1_chat_room ADD FOREIGN KEY (owner) REFERENCES wcf1_user (userID) ON DELETE SET NULL; +ALTER TABLE chat1_room ADD FOREIGN KEY (owner) REFERENCES wcf1_user (userID) ON DELETE SET NULL; -ALTER TABLE wcf1_chat_suspension ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE; -ALTER TABLE wcf1_chat_suspension ADD FOREIGN KEY (roomID) REFERENCES wcf1_chat_room (roomID) ON DELETE CASCADE; +ALTER TABLE chat1_suspension ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE; +ALTER TABLE chat1_suspension ADD FOREIGN KEY (roomID) REFERENCES chat1_room (roomID) ON DELETE CASCADE; -INSERT INTO wcf1_chat_room (title, topic, position) VALUES ('wcf.chat.room.title1', 'wcf.chat.room.topic1', 1); -INSERT INTO wcf1_chat_room (title, topic, position) VALUES ('Testroom 2', 'Topic of Testroom 2', 2); -INSERT INTO wcf1_chat_room (title, topic, position) VALUES ('Testroom with a very long', 'The topic of this room is rather loing as well!', 3); -INSERT INTO wcf1_chat_room (title, topic, position) VALUES ('Room w/o topic', '', 4); +INSERT INTO chat1_room (title, topic, position) VALUES ('wcf.chat.room.title1', 'wcf.chat.room.topic1', 1); +INSERT INTO chat1_room (title, topic, position) VALUES ('Testroom 2', 'Topic of Testroom 2', 2); +INSERT INTO chat1_room (title, topic, position) VALUES ('Testroom with a very long', 'The topic of this room is rather loing as well!', 3); +INSERT INTO chat1_room (title, topic, position) VALUES ('Room w/o topic', '', 4); diff --git a/language/de.xml b/language/de.xml index 6d30ac8..8eb27b8 100644 --- a/language/de.xml +++ b/language/de.xml @@ -1,20 +1,21 @@ - - - - - - - + + + + + + + - title|language}“ wirklich löschen?]]> + + title|language}“ wirklich löschen?]]> - - - - + + + + @@ -57,71 +58,73 @@ Hinweis: Setzen Sie diese Einstellung nur, wenn Sie wissen, was sie bewirkt. Die - - - + + + - - - + + + - Chat: Tims Chat{if CHAT_SHOW_VERSION && $chatVersion|isset} {$chatVersion}{/if}, entwickelt von TimWolla]]> - - - - - + Chat: Tims Chat{if CHAT_SHOW_VERSION && $chatVersion|isset} {$chatVersion}{/if}, entwickelt von TimWolla]]> + + + + + - - - - - - - - + + + + + + + + - - - - + + + + - - - - - - - - + + - + + + + + + + + + - + - + - + - + - - - + + + - + - - - - + + + + - - + + diff --git a/objectType.xml b/objectType.xml index 275c3d1..a02fb15 100644 --- a/objectType.xml +++ b/objectType.xml @@ -2,17 +2,17 @@ - be.bastelstu.wcf.chat.room + be.bastelstu.chat.room com.woltlab.wcf.acl - be.bastelstu.wcf.chat.activityPointEvent.join + be.bastelstu.chat.activityPointEvent.join com.woltlab.wcf.user.activityPointEvent 0 wcf\system\user\activity\point\DefaultUserActivityPointObjectProcessor - be.bastelstu.wcf.chat.activityPointEvent.message + be.bastelstu.chat.activityPointEvent.message com.woltlab.wcf.user.activityPointEvent 0 wcf\system\user\activity\point\DefaultUserActivityPointObjectProcessor diff --git a/package.xml b/package.xml index f5c62ce..1097358 100644 --- a/package.xml +++ b/package.xml @@ -1,10 +1,10 @@ - + - 0 + 1 3.0.0 Alpha 19 2011-11-26 @@ -35,7 +35,7 @@ acpMenu.xml userGroupOption.xml cronjob.xml - acp/be.bastelstu.wcf.chat.install.php + acp/be.bastelstu.chat.install.php @@ -51,6 +51,6 @@ acpMenu.xml userGroupOption.xml cronjob.xml - acp/be.bastelstu.wcf.chat.update.php + acp/be.bastelstu.chat.update.php diff --git a/pagemenu.xml b/pagemenu.xml index a9b0c76..6b60eb8 100755 --- a/pagemenu.xml +++ b/pagemenu.xml @@ -1,10 +1,10 @@ - - index.php/Chat + + header - \wcf\system\menu\page\ChatPageMenuItemProvider + \chat\system\menu\page\ChatPageMenuItemProvider \ No newline at end of file diff --git a/template/chat.tpl b/template/chat.tpl index d853775..7c3303b 100644 --- a/template/chat.tpl +++ b/template/chat.tpl @@ -6,10 +6,10 @@ {include file='headInclude' sandbox=false} -{capture assign='sidebar'}{include file='chatSidebar'}{/capture} -{capture assign='headerNavigation'}{include file='chatNavigationInclude'}{/capture} +{capture assign='sidebar'}{include application='chat' file='chatSidebar'}{/capture} +{capture assign='headerNavigation'}{include application='chat' file='chatNavigationInclude'}{/capture} {include file='header' sandbox=false sidebarOrientation='right'}
      @@ -50,7 +50,7 @@
      - + @@ -87,32 +87,32 @@ @@ -142,7 +142,7 @@ // Boot the chat WCF.TabMenu.init(); new WCF.Message.Smilies();{* - *}{capture assign='chatMessageTemplate'}{include file='chatMessage'}{/capture} + *}{capture assign='chatMessageTemplate'}{include application='chat' file='chatMessage'}{/capture} chat = new be.bastelstu.WCF.Chat({ @@ -165,7 +165,7 @@ event.preventDefault(); if ($.wcfIsset('timsChatCopyrightDialog')) return WCF.showDialog('timsChatCopyrightDialog', { title: 'Tims Chat{if CHAT_SHOW_VERSION && $chatVersion|isset} {$chatVersion}{/if}' }); var container = $('
      '); - container.load('{link controller='Chat' action='Copyright'}{/link}', function() { + container.load('{link application='chat' controller='Chat' action='Copyright'}{/link}', function() { $('body').append(container); WCF.showDialog('timsChatCopyrightDialog', { title: 'Tims Chat{if CHAT_SHOW_VERSION && $chatVersion|isset} {$chatVersion}{/if}' }); }); diff --git a/template/chatJavascriptInclude.tpl b/template/chatJavascriptInclude.tpl index 9745f56..7937bf3 100644 --- a/template/chatJavascriptInclude.tpl +++ b/template/chatJavascriptInclude.tpl @@ -1,5 +1,5 @@ - - + + {if CHAT_SOCKET_IO_PATH}{/if} - + {event name='javascript'} \ No newline at end of file diff --git a/template/chatNavigationInclude.tpl b/template/chatNavigationInclude.tpl index 32a611e..bb64514 100644 --- a/template/chatNavigationInclude.tpl +++ b/template/chatNavigationInclude.tpl @@ -1,5 +1,5 @@
    • - {lang}wcf.chat.protocol{/lang} + {lang}wcf.chat.protocol{/lang}
    • diff --git a/template/chatSidebar.tpl b/template/chatSidebar.tpl index 7635766..802bde4 100644 --- a/template/chatSidebar.tpl +++ b/template/chatSidebar.tpl @@ -2,7 +2,7 @@ @@ -15,7 +15,7 @@ {foreach from=$rooms item='roomListRoom'} {if $roomListRoom->canEnter()} roomID == $room->roomID} class="activeMenuItem"{/if}> - {$roomListRoom} + {$roomListRoom} {/if} {/foreach} diff --git a/userGroupOption.xml b/userGroupOption.xml index 14c09c2..9303986 100644 --- a/userGroupOption.xml +++ b/userGroupOption.xml @@ -8,8 +8,8 @@ mod - - admin.content + + admin @@ -80,20 +80,20 @@ 0 1 - - - diff --git a/package.xml b/package.xml index 1097358..d45cf32 100644 --- a/package.xml +++ b/package.xml @@ -4,7 +4,7 @@ - 1 + 1 3.0.0 Alpha 19 2011-11-26 @@ -16,9 +16,9 @@ com.woltlab.wcf - com.woltlab.wcf.bbcode - com.woltlab.wcf.message - com.woltlab.wcf.user + com.woltlab.wcf.bbcode + com.woltlab.wcf.message + com.woltlab.wcf.user From 66d3f4fb866593671d607dd9d7673f23cf486abc Mon Sep 17 00:00:00 2001 From: max-m Date: Fri, 25 Jan 2013 22:46:18 +0100 Subject: [PATCH 03/31] Fixed case --- file/lib/system/{ChatCore.class.php => CHATCore.class.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename file/lib/system/{ChatCore.class.php => CHATCore.class.php} (100%) diff --git a/file/lib/system/ChatCore.class.php b/file/lib/system/CHATCore.class.php similarity index 100% rename from file/lib/system/ChatCore.class.php rename to file/lib/system/CHATCore.class.php From 063a56bcb6db5a9a1c844c65578740a9fb7373db Mon Sep 17 00:00:00 2001 From: max-m Date: Sat, 26 Jan 2013 22:46:54 +0100 Subject: [PATCH 04/31] Various fixes (forgot to commit at different stages :P) --- ...og.coffee => be.bastelstu.Chat.Log.coffee} | 4 +- ...F.Chat.coffee => be.bastelstu.Chat.coffee} | 28 +++++---- file/lib/data/CHATDatabaseObject.class.php | 11 ++++ file/lib/data/message/Message.class.php | 2 +- file/lib/data/message/MessageList.class.php | 22 +++---- file/lib/data/room/Room.class.php | 2 +- file/lib/data/room/RoomAction.class.php | 2 +- file/lib/data/suspension/Suspension.class.php | 2 +- file/lib/form/ChatForm.class.php | 8 +-- file/lib/page/ChatMessagePage.class.php | 2 +- file/lib/page/ChatPage.class.php | 2 +- ...{ChatCore.class.php => CHATCore.class.php} | 0 .../cache/builder/RoomCacheBuilder.class.php | 2 +- .../command/AbstractCommand.class.php | 22 +++---- .../AbstractRestrictedCommand.class.php | 4 +- .../command/CommandHandler.class.php | 4 +- .../{chat => }/command/ICommand.class.php | 2 +- .../command/IRestrictedCommand.class.php | 2 +- .../command/NotFoundException.class.php | 2 +- .../command/UserNotFoundException.class.php | 2 +- .../command/commands/AwayCommand.class.php | 12 ++-- .../command/commands/BanCommand.class.php | 2 +- .../command/commands/ColorCommand.class.php | 14 ++--- .../command/commands/FreeCommand.class.php | 8 +-- .../command/commands/InfoCommand.class.php | 14 ++--- .../command/commands/MeCommand.class.php | 12 ++-- .../command/commands/MuteCommand.class.php | 22 +++---- .../command/commands/PlainCommand.class.php | 12 ++-- .../command/commands/RestoreCommand.class.php | 16 +++--- .../commands/TemproomCommand.class.php | 14 ++--- .../command/commands/WhereCommand.class.php | 10 ++-- .../command/commands/WhisperCommand.class.php | 18 +++--- file/style/be.bastelstu.wcf.chat.less | 10 ++-- template/chat.tpl | 57 +++++++++---------- template/chatNavigationInclude.tpl | 5 -- template/{chatCopyright.tpl => copyright.tpl} | 14 ++--- ...criptInclude.tpl => javascriptInclude.tpl} | 4 +- template/{chatLog.tpl => log.tpl} | 0 template/{chatMessage.tpl => message.tpl} | 0 template/navigationInclude.tpl | 5 ++ template/{chatSidebar.tpl => sidebar.tpl} | 6 +- 41 files changed, 193 insertions(+), 187 deletions(-) rename file/js/{be.bastelstu.WCF.Chat.Log.coffee => be.bastelstu.Chat.Log.coffee} (91%) rename file/js/{be.bastelstu.WCF.Chat.coffee => be.bastelstu.Chat.coffee} (94%) create mode 100644 file/lib/data/CHATDatabaseObject.class.php rename file/lib/system/{ChatCore.class.php => CHATCore.class.php} (100%) rename file/lib/system/{chat => }/command/AbstractCommand.class.php (68%) rename file/lib/system/{chat => }/command/AbstractRestrictedCommand.class.php (89%) rename file/lib/system/{chat => }/command/CommandHandler.class.php (92%) rename file/lib/system/{chat => }/command/ICommand.class.php (96%) rename file/lib/system/{chat => }/command/IRestrictedCommand.class.php (94%) rename file/lib/system/{chat => }/command/NotFoundException.class.php (91%) rename file/lib/system/{chat => }/command/UserNotFoundException.class.php (94%) rename file/lib/system/{chat => }/command/commands/AwayCommand.class.php (68%) rename file/lib/system/{chat => }/command/commands/BanCommand.class.php (96%) rename file/lib/system/{chat => }/command/commands/ColorCommand.class.php (80%) rename file/lib/system/{chat => }/command/commands/FreeCommand.class.php (71%) rename file/lib/system/{chat => }/command/commands/InfoCommand.class.php (83%) rename file/lib/system/{chat => }/command/commands/MeCommand.class.php (62%) rename file/lib/system/{chat => }/command/commands/MuteCommand.class.php (76%) rename file/lib/system/{chat => }/command/commands/PlainCommand.class.php (63%) rename file/lib/system/{chat => }/command/commands/RestoreCommand.class.php (62%) rename file/lib/system/{chat => }/command/commands/TemproomCommand.class.php (83%) rename file/lib/system/{chat => }/command/commands/WhereCommand.class.php (78%) rename file/lib/system/{chat => }/command/commands/WhisperCommand.class.php (62%) delete mode 100644 template/chatNavigationInclude.tpl rename template/{chatCopyright.tpl => copyright.tpl} (72%) rename template/{chatJavascriptInclude.tpl => javascriptInclude.tpl} (70%) rename template/{chatLog.tpl => log.tpl} (100%) rename template/{chatMessage.tpl => message.tpl} (100%) create mode 100644 template/navigationInclude.tpl rename template/{chatSidebar.tpl => sidebar.tpl} (54%) diff --git a/file/js/be.bastelstu.WCF.Chat.Log.coffee b/file/js/be.bastelstu.Chat.Log.coffee similarity index 91% rename from file/js/be.bastelstu.WCF.Chat.Log.coffee rename to file/js/be.bastelstu.Chat.Log.coffee index 13d77e6..b3bc858 100644 --- a/file/js/be.bastelstu.WCF.Chat.Log.coffee +++ b/file/js/be.bastelstu.Chat.Log.coffee @@ -8,7 +8,7 @@ ### (($, window) -> - be.bastelstu.WCF.Chat.Log = be.bastelstu.Chat.extend + be.bastelstu.Chat.Log = be.bastelstu.Chat.extend init: (@chat) -> handleMessages: (messages) -> # Insert the messages @@ -23,7 +23,7 @@ li.appendTo $ '#timsChatLog .timsChatMessageContainer > ul' - be.bastelstu.WCF.Chat.Log.loadOverlay = () -> + be.bastelstu.Chat.Log.loadOverlay = () -> if !$.wcfIsset 'timsChatLogDialog' container = $ '
      ' $('#content').append container diff --git a/file/js/be.bastelstu.WCF.Chat.coffee b/file/js/be.bastelstu.Chat.coffee similarity index 94% rename from file/js/be.bastelstu.WCF.Chat.coffee rename to file/js/be.bastelstu.Chat.coffee index b5c1023..17f8018 100644 --- a/file/js/be.bastelstu.WCF.Chat.coffee +++ b/file/js/be.bastelstu.Chat.coffee @@ -188,14 +188,14 @@ window.console ?= # Toggle Buttons $('.timsChatToggle').click (event) -> element = $ @ - icon = element.find 'img' + icon = element.find 'span.icon' if element.data('status') is 1 element.data 'status', 0 - icon.attr 'src', icon.attr('src').replace /enabled(.*).svg$/, 'disabled$1.svg' + icon.removeClass('icon-circle-blank').addClass('icon-off') element.attr 'title', element.data 'enableMessage' else element.data 'status', 1 - icon.attr 'src', icon.attr('src').replace /disabled(.*).svg$/, 'enabled$1.svg' + icon.removeClass('icon-off').addClass('icon-circle-blank') element.attr 'title', element.data 'disableMessage' $('#timsChatInput').focus() @@ -235,7 +235,7 @@ window.console ?= type: 'POST' success: $.proxy((data, textStatus, jqXHR) -> @loading = false - target.parent().removeClass 'ajaxLoad' + target.parent().removeClass 'loading' # Mark as active $('.activeMenuItem .timsChatRoom').parent().removeClass 'activeMenuItem' @@ -260,10 +260,10 @@ window.console ?= # inclusive the error-message :) window.location.reload true beforeSend: $.proxy(() -> - return false if target.parent().hasClass('ajaxLoad') or target.parent().hasClass 'activeMenuItem' + return false if target.parent().hasClass('loading') or target.parent().hasClass 'activeMenuItem' @loading = true - target.parent().addClass 'ajaxLoad' + target.parent().addClass 'loading' , @) ### # Frees the fish @@ -412,11 +412,11 @@ window.console ?= menu = $ '
        ' #menu.addClass 'timsChatUserMenu' menu.addClass 'dropdownMenu' - menu.append $ '
      • ' + WCF.Language.get('chat.query') + '
      • ' - menu.append $ '
      • ' + WCF.Language.get('chat.kick') + '
      • ' - menu.append $ '
      • ' + WCF.Language.get('chat.ban') + '
      • ' + menu.append $ '
      • ' + WCF.Language.get('chat.general.query') + '
      • ' + menu.append $ '
      • ' + WCF.Language.get('chat.general.kick') + '
      • ' + menu.append $ '
      • ' + WCF.Language.get('chat.general.ban') + '
      • ' # TODO: SID and co - menu.append $ '
      • ' + WCF.Language.get('wcf.chat.profile') + '
      • ' + menu.append $ '
      • ' + WCF.Language.get('chat.general.profile') + '
      • ' @events.userMenu.fire user, menu li.append menu @@ -485,7 +485,7 @@ window.console ?= # Desktop Notifications if typeof window.webkitNotifications isnt 'undefined' if window.webkitNotifications.checkPermission() is 0 - title = WCF.Language.get 'chat.notify.title' + title = WCF.Language.get 'chat.general.notify.title' icon = WCF.Icon.get 'be.bastelstu.chat.chat' content = message.username + message.separator + (if message.separator is ' ' then '' else ' ') + message.message notification = window.webkitNotifications.createNotification icon, title, content @@ -500,14 +500,14 @@ window.console ?= ### refreshRoomList: () -> console.log 'Refreshing the roomlist' - $('#toggleRooms a').addClass 'ajaxLoad' + $('#toggleRooms .ajaxLoad').show() $.ajax $('#toggleRooms a').data('refreshUrl'), dataType: 'json' type: 'POST' success: $.proxy((data, textStatus, jqXHR) -> $('#timsChatRoomList li').remove() - $('#toggleRooms a').removeClass 'ajaxLoad' + $('#toggleRooms .ajaxLoad').hide() $('#toggleRooms .badge').text data.length for room in data @@ -549,12 +549,10 @@ window.console ?= smilies: $('#timsChatSmilies').data 'status' type: 'POST', beforeSend: (jqXHR) -> - $('#timsChatInput').addClass 'ajaxLoad' success: $.proxy((data, textStatus, jqXHR) -> @getMessages() , @) complete: () -> - $('#timsChatInput').removeClass 'ajaxLoad' ### # Toggles between user- and room-list. # diff --git a/file/lib/data/CHATDatabaseObject.class.php b/file/lib/data/CHATDatabaseObject.class.php new file mode 100644 index 0000000..ea369fd --- /dev/null +++ b/file/lib/data/CHATDatabaseObject.class.php @@ -0,0 +1,11 @@ +sqlOrderBy = "chat_message.messageID DESC"; + $messageList->sqlOrderBy = "message.messageID DESC"; $messageList->sqlLimit = $number; $messageList->getConditionBuilder()->add(' (( - chat_message.receiver IS NULL - AND chat_message.roomID = ? + message.receiver IS NULL + AND message.roomID = ? ) - OR chat_message.receiver = ? - OR chat_message.sender = ?)', array($room->roomID, \wcf\system\WCF::getUser()->userID, \wcf\system\WCF::getUser()->userID)); + OR message.receiver = ? + OR message.sender = ?)', array($room->roomID, \wcf\system\WCF::getUser()->userID, \wcf\system\WCF::getUser()->userID)); $messageList->readObjects(); return array_reverse($messageList->getObjects()); @@ -48,15 +48,15 @@ public static function getNewestMessages(\chat\data\room\Room $room, $number = C */ public static function getMessagesSince(\chat\data\room\Room $room, $since) { $messageList = new static(); - $messageList->sqlOrderBy = "chat_message.messageID ASC"; - $messageList->getConditionBuilder()->add('chat_message.messageID > ?', array($since)); + $messageList->sqlOrderBy = "message.messageID ASC"; + $messageList->getConditionBuilder()->add('message.messageID > ?', array($since)); $messageList->getConditionBuilder()->add(' (( - chat_message.receiver IS NULL - AND chat_message.roomID = ? + message.receiver IS NULL + AND message.roomID = ? ) - OR chat_message.receiver = ? - OR chat_message.sender = ?)', array($room->roomID, \wcf\system\WCF::getUser()->userID, \wcf\system\WCF::getUser()->userID)); + OR message.receiver = ? + OR message.sender = ?)', array($room->roomID, \wcf\system\WCF::getUser()->userID, \wcf\system\WCF::getUser()->userID)); $messageList->readObjects(); return $messageList->getObjects(); diff --git a/file/lib/data/room/Room.class.php b/file/lib/data/room/Room.class.php index 91ff38f..ed864c6 100644 --- a/file/lib/data/room/Room.class.php +++ b/file/lib/data/room/Room.class.php @@ -13,7 +13,7 @@ * @package be.bastelstu.chat * @subpackage data.room */ -class Room extends \wcf\data\DatabaseObject implements \wcf\system\request\IRouteController { +class Room extends \chat\data\CHATDatabaseObject implements \wcf\system\request\IRouteController { /** * @see \wcf\data\DatabaseObject::$databaseTableName */ diff --git a/file/lib/data/room/RoomAction.class.php b/file/lib/data/room/RoomAction.class.php index 764dddf..98b997e 100644 --- a/file/lib/data/room/RoomAction.class.php +++ b/file/lib/data/room/RoomAction.class.php @@ -101,7 +101,7 @@ public function validateUpdatePosition() { */ public function updatePosition() { $roomList = new RoomList(); - $roomList->sqlOrderBy = "chat_room.position"; + $roomList->sqlOrderBy = "room.position"; $roomList->readObjects(); $i = $this->parameters['data']['offset']; diff --git a/file/lib/data/suspension/Suspension.class.php b/file/lib/data/suspension/Suspension.class.php index 6f959d2..2f2d140 100644 --- a/file/lib/data/suspension/Suspension.class.php +++ b/file/lib/data/suspension/Suspension.class.php @@ -11,7 +11,7 @@ * @package be.bastelstu.chat * @subpackage data.suspension */ -class Suspension extends \wcf\data\DatabaseObject { +class Suspension extends \chat\data\CHATDatabaseObject { /** * @see \wcf\data\DatabaseObject::$databaseTableName */ diff --git a/file/lib/form/ChatForm.class.php b/file/lib/form/ChatForm.class.php index d5c8f87..634462b 100644 --- a/file/lib/form/ChatForm.class.php +++ b/file/lib/form/ChatForm.class.php @@ -14,7 +14,7 @@ * @package be.bastelstu.chat * @subpackage form */ -class ChatForm extends AbstractForm { +class ChatForm extends \wcf\form\AbstractForm { /** * Should HTML be enabled for this message. * @@ -143,7 +143,7 @@ public function save() { parent::save(); \chat\util\ChatUtil::writeUserData(array('away' => null)); - $commandHandler = new \wcf\system\chat\command\CommandHandler($this->message); + $commandHandler = new \chat\system\command\CommandHandler($this->message); if ($commandHandler->isCommand()) { try { $command = $commandHandler->loadCommand(); @@ -156,12 +156,12 @@ public function save() { $this->message = $command->getMessage(); $receiver = $command->getReceiver(); } - catch (\wcf\system\chat\command\NotFoundException $e) { + catch (\chat\system\command\NotFoundException $e) { $this->message = WCF::getLanguage()->get('wcf.chat.error.notFound'); $type = data\message\Message::TYPE_ERROR; $receiver = WCF::getUser()->userID; } - catch (\wcf\system\chat\command\UserNotFoundException $e) { + catch (\chat\system\command\UserNotFoundException $e) { $this->message = WCF::getLanguage()->getDynamicVariable('wcf.chat.error.userNotFound', array('username' => $e->getUsername())); $type = data\message\Message::TYPE_ERROR; $receiver = WCF::getUser()->userID; diff --git a/file/lib/page/ChatMessagePage.class.php b/file/lib/page/ChatMessagePage.class.php index f35c00c..98acf95 100644 --- a/file/lib/page/ChatMessagePage.class.php +++ b/file/lib/page/ChatMessagePage.class.php @@ -118,7 +118,7 @@ public function readMessages() { $sql = "SELECT MAX(messageID) FROM - wcf".WCF_N."_chat_message"; + chat".WCF_N."_message"; $stmt = WCF::getDB()->prepareStatement($sql); $stmt->execute(); diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index 3176695..1fdde3c 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -141,7 +141,7 @@ public function readData() { 'sender' => WCF::getUser()->userID, 'username' => WCF::getUser()->username, 'time' => TIME_NOW, - 'type' => chat\message\ChatMessage::TYPE_JOIN, + 'type' => \chat\data\message\Message::TYPE_JOIN, 'message' => serialize(array('ipAddress' => \wcf\util\UserUtil::convertIPv6To4(\wcf\util\UserUtil::getIpAddress()))), 'color1' => $this->userData['color'][1], 'color2' => $this->userData['color'][2] diff --git a/file/lib/system/ChatCore.class.php b/file/lib/system/CHATCore.class.php similarity index 100% rename from file/lib/system/ChatCore.class.php rename to file/lib/system/CHATCore.class.php diff --git a/file/lib/system/cache/builder/RoomCacheBuilder.class.php b/file/lib/system/cache/builder/RoomCacheBuilder.class.php index ddb4f71..47f7f3d 100644 --- a/file/lib/system/cache/builder/RoomCacheBuilder.class.php +++ b/file/lib/system/cache/builder/RoomCacheBuilder.class.php @@ -17,7 +17,7 @@ class RoomCacheBuilder implements \wcf\system\cache\builder\ICacheBuilder { public function getData(array $cacheResource) { // get all chat rooms $roomList = new \chat\data\room\RoomList(); - $roomList->sqlOrderBy = "chat_room.position"; + $roomList->sqlOrderBy = "room.position"; $roomList->readObjects(); return $roomList->getObjects(); diff --git a/file/lib/system/chat/command/AbstractCommand.class.php b/file/lib/system/command/AbstractCommand.class.php similarity index 68% rename from file/lib/system/chat/command/AbstractCommand.class.php rename to file/lib/system/command/AbstractCommand.class.php index 37c9074..940fa25 100644 --- a/file/lib/system/chat/command/AbstractCommand.class.php +++ b/file/lib/system/command/AbstractCommand.class.php @@ -1,5 +1,5 @@ fireAction($this, 'checkPermission'); diff --git a/file/lib/system/chat/command/CommandHandler.class.php b/file/lib/system/command/CommandHandler.class.php similarity index 92% rename from file/lib/system/chat/command/CommandHandler.class.php rename to file/lib/system/command/CommandHandler.class.php index b7e2a78..baa92bc 100644 --- a/file/lib/system/chat/command/CommandHandler.class.php +++ b/file/lib/system/command/CommandHandler.class.php @@ -1,5 +1,5 @@ $commandHandler->getParameters())); @@ -20,21 +20,21 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand } /** - * @see \wcf\system\chat\command\ICommand::getType() + * @see \chat\system\command\ICommand::getType() */ public function getType() { return \wcf\data\chat\message\ChatMessage::TYPE_AWAY; } /** - * @see \wcf\system\chat\command\ICommand::getMessage() + * @see \chat\system\command\ICommand::getMessage() */ public function getMessage() { return serialize(array('message' => $this->commandHandler->getParameters())); } /** - * @see \wcf\system\chat\command\ICommand::getReceiver() + * @see \chat\system\command\ICommand::getReceiver() */ public function getReceiver() { return \wcf\system\WCF::getUser()->userID; diff --git a/file/lib/system/chat/command/commands/BanCommand.class.php b/file/lib/system/command/commands/BanCommand.class.php similarity index 96% rename from file/lib/system/chat/command/commands/BanCommand.class.php rename to file/lib/system/command/commands/BanCommand.class.php index 37e2e12..ed204fc 100644 --- a/file/lib/system/chat/command/commands/BanCommand.class.php +++ b/file/lib/system/command/commands/BanCommand.class.php @@ -1,5 +1,5 @@ 0xFF0000, 'blue' => 0x0000FF, @@ -36,7 +36,7 @@ class ColorCommand extends \wcf\system\chat\command\AbstractCommand { 'oxford' => 0xF02D // looks like green ); - public function __construct(\wcf\system\chat\command\CommandHandler $commandHandler) { + public function __construct(\chat\system\command\CommandHandler $commandHandler) { parent::__construct($commandHandler); try { list($color[1], $color[2]) = explode(' ', $commandHandler->getParameters()); @@ -49,7 +49,7 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand foreach ($color as $key => $val) { if (isset(self::$colors[$val])) $color[$key] = self::$colors[$val]; else { - if (!$regex->match($val)) throw new \wcf\system\chat\command\NotFoundException(); + if (!$regex->match($val)) throw new \chat\system\command\NotFoundException(); $matches = $regex->getMatches(); $val = $matches[1]; if (strlen($val) == 3) $val = $val[0].$val[0].$val[1].$val[1].$val[2].$val[2]; @@ -61,21 +61,21 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand } /** - * @see \wcf\system\chat\command\ICommand::getType() + * @see \chat\system\command\ICommand::getType() */ public function getType() { return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION; } /** - * @see \wcf\system\chat\command\ICommand::getMessage() + * @see \chat\system\command\ICommand::getMessage() */ public function getMessage() { return 'color changed'; } /** - * @see \wcf\system\chat\command\ICommand::getReceiver() + * @see \chat\system\command\ICommand::getReceiver() */ public function getReceiver() { return \wcf\system\WCF::getUser()->userID; diff --git a/file/lib/system/chat/command/commands/FreeCommand.class.php b/file/lib/system/command/commands/FreeCommand.class.php similarity index 71% rename from file/lib/system/chat/command/commands/FreeCommand.class.php rename to file/lib/system/command/commands/FreeCommand.class.php index 884c65f..833473f 100644 --- a/file/lib/system/chat/command/commands/FreeCommand.class.php +++ b/file/lib/system/command/commands/FreeCommand.class.php @@ -1,5 +1,5 @@ commandHandler->getParameters()) != 'the fish') { - throw new \wcf\system\chat\command\NotFoundException(); + throw new \chat\system\command\NotFoundException(); } $this->didInit(); } /** - * @see \wcf\system\chat\command\ICommand::getMessage() + * @see \chat\system\command\ICommand::getMessage() */ public function getMessage() { return 'freed the fish. OH A NOEZ'; diff --git a/file/lib/system/chat/command/commands/InfoCommand.class.php b/file/lib/system/command/commands/InfoCommand.class.php similarity index 83% rename from file/lib/system/chat/command/commands/InfoCommand.class.php rename to file/lib/system/command/commands/InfoCommand.class.php index 872364a..c1e0066 100644 --- a/file/lib/system/chat/command/commands/InfoCommand.class.php +++ b/file/lib/system/command/commands/InfoCommand.class.php @@ -1,5 +1,5 @@ user = User::getUserByUsername(rtrim($commandHandler->getParameters(), ',')); - if (!$this->user->userID) throw new \wcf\system\chat\command\UserNotFoundException(rtrim($commandHandler->getParameters(), ',')); + if (!$this->user->userID) throw new \chat\system\command\UserNotFoundException(rtrim($commandHandler->getParameters(), ',')); // Username + link to profile $color = ChatUtil::readUserData('color', $this->user); @@ -75,14 +75,14 @@ public function fetchSession() { } /** - * @see \wcf\system\chat\command\ICommand::getType() + * @see \chat\system\command\ICommand::getType() */ public function getType() { return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION; } /** - * @see \wcf\system\chat\command\ICommand::getMessage() + * @see \chat\system\command\ICommand::getMessage() */ public function getMessage() { $lines = array(); @@ -93,7 +93,7 @@ public function getMessage() { } /** - * @see \wcf\system\chat\command\ICommand::getReceiver() + * @see \chat\system\command\ICommand::getReceiver() */ public function getReceiver() { return \wcf\system\WCF::getUser()->userID; diff --git a/file/lib/system/chat/command/commands/MeCommand.class.php b/file/lib/system/command/commands/MeCommand.class.php similarity index 62% rename from file/lib/system/chat/command/commands/MeCommand.class.php rename to file/lib/system/command/commands/MeCommand.class.php index 586181b..bfab7cb 100644 --- a/file/lib/system/chat/command/commands/MeCommand.class.php +++ b/file/lib/system/command/commands/MeCommand.class.php @@ -1,5 +1,5 @@ didInit(); } /** - * @see \wcf\system\chat\command\ICommand::getType() + * @see \chat\system\command\ICommand::getType() */ public function getType() { return \wcf\data\chat\message\ChatMessage::TYPE_ME; } /** - * @see \wcf\system\chat\command\ICommand::getMessage() + * @see \chat\system\command\ICommand::getMessage() */ public function getMessage() { return $this->commandHandler->getParameters(); diff --git a/file/lib/system/chat/command/commands/MuteCommand.class.php b/file/lib/system/command/commands/MuteCommand.class.php similarity index 76% rename from file/lib/system/chat/command/commands/MuteCommand.class.php rename to file/lib/system/command/commands/MuteCommand.class.php index 3201961..65c301f 100644 --- a/file/lib/system/chat/command/commands/MuteCommand.class.php +++ b/file/lib/system/command/commands/MuteCommand.class.php @@ -1,5 +1,5 @@ getParameters(); @@ -31,11 +31,11 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand $this->time = ChatUtil::timeModifier(substr($parameters, $comma + 1)); } else { - throw new \wcf\system\chat\command\NotFoundException(); + throw new \chat\system\command\NotFoundException(); } $this->user = User::getUserByUsername($username); - if (!$this->user->userID) throw new \wcf\system\chat\command\UserNotFoundException($username); + if (!$this->user->userID) throw new \chat\system\command\UserNotFoundException($username); $color = ChatUtil::readUserData('color', $this->user); $profile = \wcf\system\request\LinkHandler::getInstance()->getLink('User', array( @@ -71,18 +71,18 @@ public function executeAction() { } /** - * @see \wcf\system\chat\command\IRestrictedChatCommand::checkPermission() + * @see \chat\system\command\IRestrictedChatCommand::checkPermission() */ public function checkPermission() { parent::checkPermission(); $this->room = \wcf\system\request\RequestHandler::getInstance()->getActiveRequest()->getRequestObject()->request->room; $ph = new \wcf\system\chat\permission\ChatPermissionHandler(); - if (!$ph->getPermission($this->room, 'mod.can'.str_replace(array('wcf\system\chat\command\commands\\', 'Command'), '', get_class($this)))) throw new \wcf\system\exception\PermissionDeniedException(); + if (!$ph->getPermission($this->room, 'mod.can'.str_replace(array('chat\system\command\commands\\', 'Command'), '', get_class($this)))) throw new \wcf\system\exception\PermissionDeniedException(); } /** - * @see wcf\system\chat\command\ICommand::getReceiver() + * @see chat\system\command\ICommand::getReceiver() */ public function getReceiver() { if ($this->fail) return WCF::getUser()->userID; @@ -91,7 +91,7 @@ public function getReceiver() { } /** - * @see \wcf\system\chat\command\ICommand::getType() + * @see \chat\system\command\ICommand::getType() */ public function getType() { if ($this->fail) return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION; @@ -99,7 +99,7 @@ public function getType() { } /** - * @see \wcf\system\chat\command\ICommand::getMessage() + * @see \chat\system\command\ICommand::getMessage() */ public function getMessage() { if ($this->fail) return WCF::getLanguage()->get('wcf.chat.suspension.exists'); @@ -107,7 +107,7 @@ public function getMessage() { return serialize(array( 'link' => $this->link, 'until' => TIME_NOW + $this->time, - 'type' => str_replace(array('wcf\system\chat\command\commands\\', 'command'), '', strtolower(get_class($this))) + 'type' => str_replace(array('chat\system\command\commands\\', 'command'), '', strtolower(get_class($this))) )); } } diff --git a/file/lib/system/chat/command/commands/PlainCommand.class.php b/file/lib/system/command/commands/PlainCommand.class.php similarity index 63% rename from file/lib/system/chat/command/commands/PlainCommand.class.php rename to file/lib/system/command/commands/PlainCommand.class.php index 03974ff..bda4ed3 100644 --- a/file/lib/system/chat/command/commands/PlainCommand.class.php +++ b/file/lib/system/command/commands/PlainCommand.class.php @@ -1,5 +1,5 @@ commandHandler->getText(), 1); } /** - * @see \wcf\system\chat\command\ICommand::getReceiver() + * @see \chat\system\command\ICommand::getReceiver() */ public function getReceiver() { return null; diff --git a/file/lib/system/chat/command/commands/RestoreCommand.class.php b/file/lib/system/command/commands/RestoreCommand.class.php similarity index 62% rename from file/lib/system/chat/command/commands/RestoreCommand.class.php rename to file/lib/system/command/commands/RestoreCommand.class.php index 6598b77..b9a9246 100644 --- a/file/lib/system/chat/command/commands/RestoreCommand.class.php +++ b/file/lib/system/command/commands/RestoreCommand.class.php @@ -1,5 +1,5 @@ user = User::getUserByUsername(rtrim($commandHandler->getParameters(), ',')); - if (!$this->user->userID) throw new \wcf\system\chat\command\UserNotFoundException(rtrim($commandHandler->getParameters(), ',')); + if (!$this->user->userID) throw new \chat\system\command\UserNotFoundException(rtrim($commandHandler->getParameters(), ',')); $this->link = ''; @@ -30,7 +30,7 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand } /** - * @see \wcf\system\chat\command\IRestrictedChatCommand::checkPermission() + * @see \chat\system\command\IRestrictedChatCommand::checkPermission() */ public function checkPermission() { parent::checkPermission(); @@ -39,19 +39,19 @@ public function checkPermission() { } /** - * @see \wcf\system\chat\command\ICommand::getType() + * @see \chat\system\command\ICommand::getType() */ public function getType() { return \wcf\data\chat\message\ChatMessage::TYPE_MODERATE; } /** - * @see \wcf\system\chat\command\ICommand::getMessage() + * @see \chat\system\command\ICommand::getMessage() */ public function getMessage() { return serialize(array( 'link' => $this->link, - 'type' => str_replace(array('wcf\system\chat\command\commands\\', 'command'), '', strtolower(get_class($this))) + 'type' => str_replace(array('chat\system\command\commands\\', 'command'), '', strtolower(get_class($this))) )); } } diff --git a/file/lib/system/chat/command/commands/TemproomCommand.class.php b/file/lib/system/command/commands/TemproomCommand.class.php similarity index 83% rename from file/lib/system/chat/command/commands/TemproomCommand.class.php rename to file/lib/system/command/commands/TemproomCommand.class.php index 1047fa6..4b8e192 100644 --- a/file/lib/system/chat/command/commands/TemproomCommand.class.php +++ b/file/lib/system/command/commands/TemproomCommand.class.php @@ -1,5 +1,5 @@ roomName; } /** - * @see \wcf\system\chat\command\ICommand::getReceiver() + * @see \chat\system\command\ICommand::getReceiver() */ public function getReceiver() { return \wcf\system\WCF::getUser()->userID; diff --git a/file/lib/system/chat/command/commands/WhereCommand.class.php b/file/lib/system/command/commands/WhereCommand.class.php similarity index 78% rename from file/lib/system/chat/command/commands/WhereCommand.class.php rename to file/lib/system/command/commands/WhereCommand.class.php index 439cbd7..de3fc4a 100644 --- a/file/lib/system/chat/command/commands/WhereCommand.class.php +++ b/file/lib/system/command/commands/WhereCommand.class.php @@ -1,5 +1,5 @@ userID; diff --git a/file/lib/system/chat/command/commands/WhisperCommand.class.php b/file/lib/system/command/commands/WhisperCommand.class.php similarity index 62% rename from file/lib/system/chat/command/commands/WhisperCommand.class.php rename to file/lib/system/command/commands/WhisperCommand.class.php index 4d3ad8f..07120b3 100644 --- a/file/lib/system/chat/command/commands/WhisperCommand.class.php +++ b/file/lib/system/command/commands/WhisperCommand.class.php @@ -1,5 +1,5 @@ getParameters(); @@ -24,30 +24,30 @@ public function __construct(\wcf\system\chat\command\CommandHandler $commandHand $username = substr($parameters, 0, $comma); $this->message = substr($parameters, $comma + 1); } - else throw new \wcf\system\chat\command\NotFoundException(); + else throw new \chat\system\command\NotFoundException(); $this->user = User::getUserByUsername($username); - if (!$this->user->userID) throw new \wcf\system\chat\command\UserNotFoundException($username); + if (!$this->user->userID) throw new \chat\system\command\UserNotFoundException($username); $this->didInit(); } /** - * @see \wcf\system\chat\command\ICommand::getType() + * @see \chat\system\command\ICommand::getType() */ public function getType() { return \wcf\data\chat\message\ChatMessage::TYPE_WHISPER; } /** - * @see \wcf\system\chat\command\ICommand::getMessage() + * @see \chat\system\command\ICommand::getMessage() */ public function getMessage() { return serialize(array('message' => $this->message, 'username' => $this->user->username)); } /** - * @see \wcf\system\chat\command\ICommand::getReceiver() + * @see \chat\system\command\ICommand::getReceiver() */ public function getReceiver() { return $this->user->userID; diff --git a/file/style/be.bastelstu.wcf.chat.less b/file/style/be.bastelstu.wcf.chat.less index 3d608d1..00e7efe 100644 --- a/file/style/be.bastelstu.wcf.chat.less +++ b/file/style/be.bastelstu.wcf.chat.less @@ -290,11 +290,11 @@ } } - .ajaxLoad { - background-position: right center; - background-repeat: no-repeat; - background-size: auto 100%; - background-image: url("../icon/spinner.svg"); + #toggleRooms .ajaxLoad { + position: absolute; + right: 5px; + top: 3px; + display: none; } #timsChatCopyright { diff --git a/template/chat.tpl b/template/chat.tpl index 7c3303b..682e12e 100644 --- a/template/chat.tpl +++ b/template/chat.tpl @@ -1,7 +1,7 @@ {include file='documentHeader'} - {$room} - {lang}wcf.chat.title{/lang} - {PAGE_TITLE|language} + {$room} - {lang}chat.general.title{/lang} - {PAGE_TITLE|language} {include file='headInclude' sandbox=false} -{capture assign='sidebar'}{include application='chat' file='chatSidebar'}{/capture} -{capture assign='headerNavigation'}{include application='chat' file='chatNavigationInclude'}{/capture} +{capture assign='sidebar'}{include application='chat' file='sidebar'}{/capture} +{capture assign='headerNavigation'}{include application='chat' file='navigationInclude'}{/capture} {include file='header' sandbox=false sidebarOrientation='right'} -{include file='chatJavascriptInclude'} +{include file='javascriptInclude'} + {if CHAT_SOCKET_IO_PATH}{/if} - + {event name='javascript'} \ No newline at end of file diff --git a/template/chatLog.tpl b/template/log.tpl similarity index 100% rename from template/chatLog.tpl rename to template/log.tpl diff --git a/template/chatMessage.tpl b/template/message.tpl similarity index 100% rename from template/chatMessage.tpl rename to template/message.tpl diff --git a/template/navigationInclude.tpl b/template/navigationInclude.tpl new file mode 100644 index 0000000..52e1f28 --- /dev/null +++ b/template/navigationInclude.tpl @@ -0,0 +1,5 @@ +
      • + + {lang}chat.general.protocol{/lang} + +
      • diff --git a/template/chatSidebar.tpl b/template/sidebar.tpl similarity index 54% rename from template/chatSidebar.tpl rename to template/sidebar.tpl index 802bde4..8c798ff 100644 --- a/template/chatSidebar.tpl +++ b/template/sidebar.tpl @@ -1,8 +1,8 @@
        @@ -20,7 +20,7 @@ {/if} {/foreach} -
        +
        From dc75c38b3f14c50663a76273ad12b1feed9e3d51 Mon Sep 17 00:00:00 2001 From: max-m Date: Sun, 27 Jan 2013 15:16:29 +0100 Subject: [PATCH 05/31] Edited copyright, moved JavaScript to head, fixed logPage --- file/lib/page/CopyrightPage.class.php | 2 + file/lib/page/LogPage.class.php | 2 +- file/style/be.bastelstu.wcf.chat.less | 2 +- language/de.xml | 2 +- package.xml | 2 + template/__copyright.tpl | 47 +++++++++++ template/chat.tpl | 117 +++++++++++++------------- template/copyright.tpl | 50 ----------- template/log.tpl | 2 +- templateListener.xml | 11 +++ 10 files changed, 124 insertions(+), 113 deletions(-) create mode 100644 template/__copyright.tpl delete mode 100644 template/copyright.tpl create mode 100644 templateListener.xml diff --git a/file/lib/page/CopyrightPage.class.php b/file/lib/page/CopyrightPage.class.php index 79191f9..904379d 100644 --- a/file/lib/page/CopyrightPage.class.php +++ b/file/lib/page/CopyrightPage.class.php @@ -29,6 +29,8 @@ class CopyrightPage extends \wcf\page\AbstractPage { */ public $request = null; + public $templateName = '__copyright'; + /** * Disallows direct access. * diff --git a/file/lib/page/LogPage.class.php b/file/lib/page/LogPage.class.php index ec91805..3ac05bb 100644 --- a/file/lib/page/LogPage.class.php +++ b/file/lib/page/LogPage.class.php @@ -106,7 +106,7 @@ public function readData() { $this->room = $cache[$this->roomID]; if (!$this->room->canEnter()) throw new \wcf\system\exception\PermissionDeniedException(); - $ph = new \wcf\system\chat\permission\ChatPermissionHandler(); + $ph = new \chat\system\permission\PermissionHandler(); if (!$ph->getPermission($this->room, 'mod.canReadLog')) throw new \wcf\system\exception\PermissionDeniedException(); // TODO: actually read the correct messages diff --git a/file/style/be.bastelstu.wcf.chat.less b/file/style/be.bastelstu.wcf.chat.less index 00e7efe..3409f3a 100644 --- a/file/style/be.bastelstu.wcf.chat.less +++ b/file/style/be.bastelstu.wcf.chat.less @@ -302,7 +302,7 @@ } #timsChatCopyrightDialog { - background-position: right 45px; + background-position: right center; background-repeat: no-repeat; min-height: 50%; } diff --git a/language/de.xml b/language/de.xml index 8eb27b8..7956a30 100644 --- a/language/de.xml +++ b/language/de.xml @@ -66,7 +66,7 @@ Hinweis: Setzen Sie diese Einstellung nur, wenn Sie wissen, was sie bewirkt. Die - Chat: Tims Chat{if CHAT_SHOW_VERSION && $chatVersion|isset} {$chatVersion}{/if}, entwickelt von TimWolla]]> + Tims Chat{if CHAT_SHOW_VERSION && $chatVersion|isset} {$chatVersion}{/if}, entwickelt in Tims Bastelstube]]> diff --git a/package.xml b/package.xml index d45cf32..1818c26 100644 --- a/package.xml +++ b/package.xml @@ -29,6 +29,7 @@ install.sql objectType.xml option.xml + templateListener.xml pagemenu.xml eventListener.xml acloptions.xml @@ -45,6 +46,7 @@ acptemplate.tar objectType.xml option.xml + templateListener.xml pagemenu.xml eventListener.xml acloptions.xml diff --git a/template/__copyright.tpl b/template/__copyright.tpl new file mode 100644 index 0000000..8c99c05 --- /dev/null +++ b/template/__copyright.tpl @@ -0,0 +1,47 @@ +{if $__chat->isActiveApplication()} + {if $templateName != '__copyright'} + {elseif $templateName == '__copyright'} +
        +
        {lang}chat.general.copyright.leader{/lang}
        +
        + +
        +
        +
        +
        {lang}chat.general.copyright.developer{/lang}
        +
        + +
        +
        +
        +
        {lang}chat.general.copyright.graphics{/lang}
        +
        + +
        +
        + {*
        +
        {lang}chat.general.copyright.translation{/lang}
        +
        + +
        +
        *} +
        +
        {lang}chat.general.copyright.thanks{/lang}
        +
        + +
        +
        + {/if} +{/if} \ No newline at end of file diff --git a/template/chat.tpl b/template/chat.tpl index 682e12e..bd64cb6 100644 --- a/template/chat.tpl +++ b/template/chat.tpl @@ -4,6 +4,63 @@ {$room} - {lang}chat.general.title{/lang} - {PAGE_TITLE|language} {include file='headInclude' sandbox=false} + {include file='javascriptInclude'} + + From 8770affe56790596739adbb9432b4d52ae33d0c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 27 Jan 2013 21:58:10 +0100 Subject: [PATCH 17/31] Fix several class references and check permission in InfoCommand --- file/acp/be.bastelstu.chat.update.php | 6 +++--- file/lib/data/message/Message.class.php | 2 +- .../command/commands/AwayCommand.class.php | 2 +- .../command/commands/BanCommand.class.php | 12 ++++++------ .../command/commands/ColorCommand.class.php | 2 +- .../command/commands/InfoCommand.class.php | 17 +++++++++-------- .../command/commands/MeCommand.class.php | 2 +- .../command/commands/MuteCommand.class.php | 18 +++++++++--------- .../command/commands/PlainCommand.class.php | 2 +- .../command/commands/RestoreCommand.class.php | 2 +- .../command/commands/TemproomCommand.class.php | 8 ++++---- .../command/commands/WhereCommand.class.php | 4 ++-- .../command/commands/WhisperCommand.class.php | 2 +- 13 files changed, 40 insertions(+), 39 deletions(-) diff --git a/file/acp/be.bastelstu.chat.update.php b/file/acp/be.bastelstu.chat.update.php index ced5b0e..a55cbf0 100644 --- a/file/acp/be.bastelstu.chat.update.php +++ b/file/acp/be.bastelstu.chat.update.php @@ -26,7 +26,7 @@ final class Update { private $styles = null; public function __construct() { - $this->rooms = \wcf\data\chat\room\ChatRoom::getCache(); + $this->rooms = \chat\data\room\Room::getCache(); $this->styles = \wcf\system\style\StyleHandler::getInstance()->getAvailableStyles(); } @@ -36,11 +36,11 @@ public function __construct() { */ public function execute() { foreach ($this->rooms as $room) { - $messageAction = new \wcf\data\chat\message\ChatMessageAction(array(), 'create', array( + $messageAction = new \chat\data\message\MessageAction(array(), 'create', array( 'data' => array( 'roomID' => $room->roomID, 'time' => TIME_NOW, - 'type' => \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION, + 'type' => \chat\data\message\Message::TYPE_INFORMATION, 'message' => \wcf\system\WCF::getLanguage()->get('wcf.chat.information.chatUpdate') ) )); diff --git a/file/lib/data/message/Message.class.php b/file/lib/data/message/Message.class.php index d70fbfa..e6d45b4 100644 --- a/file/lib/data/message/Message.class.php +++ b/file/lib/data/message/Message.class.php @@ -1,8 +1,8 @@ user, $this->room, suspension\ChatSuspension::TYPE_BAN)) { + if ($suspension = suspension\Suspension::getSuspensionByUserRoomAndType($this->user, $this->room, suspension\Suspension::TYPE_BAN)) { if ($suspension->time > TIME_NOW + $this->time) { $this->fail = true; return; } - $editor = new suspension\ChatSuspensionEditor($suspension); + $editor = new suspension\SuspensionEditor($suspension); $editor->delete(); } - $this->suspensionAction = new suspension\ChatSuspensionAction(array(), 'create', array( + $this->suspensionAction = new suspension\SuspensionAction(array(), 'create', array( 'data' => array( 'userID' => $this->user->userID, 'roomID' => ChatUtil::readUserData('roomID'), - 'type' => suspension\ChatSuspension::TYPE_BAN, + 'type' => suspension\Suspension::TYPE_BAN, 'time' => TIME_NOW + $this->time ) )); diff --git a/file/lib/system/command/commands/ColorCommand.class.php b/file/lib/system/command/commands/ColorCommand.class.php index 8fb8359..bec0839 100644 --- a/file/lib/system/command/commands/ColorCommand.class.php +++ b/file/lib/system/command/commands/ColorCommand.class.php @@ -64,7 +64,7 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler) * @see \chat\system\command\ICommand::getType() */ public function getType() { - return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION; + return \chat\data\message\Message::TYPE_INFORMATION; } /** diff --git a/file/lib/system/command/commands/InfoCommand.class.php b/file/lib/system/command/commands/InfoCommand.class.php index c1e0066..4f01ce0 100644 --- a/file/lib/system/command/commands/InfoCommand.class.php +++ b/file/lib/system/command/commands/InfoCommand.class.php @@ -1,8 +1,8 @@ user)); + $room = new \chat\data\room\Room(ChatUtil::readUserData('roomID', $this->user)); if ($room->roomID && $room->canEnter()) { $this->lines[WCF::getLanguage()->get('wcf.chat.room')] = $room->getTitle(); } - // IP-Address - $session = $this->fetchSession(); - if ($session) { - // TODO: Check permission - $this->lines[WCF::getLanguage()->get('wcf.user.ipAddress')] = $session->ipAddress; + // ip address + if (WCF::getSession()->getPermission('admin.user.canViewIpAddress')) { + $session = $this->fetchSession(); + if ($session) { + $this->lines[WCF::getLanguage()->get('wcf.user.ipAddress')] = $session->ipAddress; + } } $this->didInit(); @@ -78,7 +79,7 @@ public function fetchSession() { * @see \chat\system\command\ICommand::getType() */ public function getType() { - return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION; + return \chat\data\message\Message::TYPE_INFORMATION; } /** diff --git a/file/lib/system/command/commands/MeCommand.class.php b/file/lib/system/command/commands/MeCommand.class.php index bfab7cb..68fe91d 100644 --- a/file/lib/system/command/commands/MeCommand.class.php +++ b/file/lib/system/command/commands/MeCommand.class.php @@ -24,7 +24,7 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler) * @see \chat\system\command\ICommand::getType() */ public function getType() { - return \wcf\data\chat\message\ChatMessage::TYPE_ME; + return \chat\data\message\Message::TYPE_ME; } /** diff --git a/file/lib/system/command/commands/MuteCommand.class.php b/file/lib/system/command/commands/MuteCommand.class.php index 65c301f..2c767f5 100644 --- a/file/lib/system/command/commands/MuteCommand.class.php +++ b/file/lib/system/command/commands/MuteCommand.class.php @@ -1,9 +1,9 @@ user, $this->room, suspension\ChatSuspension::TYPE_MUTE)) { + if ($suspension = suspension\Suspension::getSuspensionByUserRoomAndType($this->user, $this->room, suspension\Suspension::TYPE_MUTE)) { if ($suspension->time > TIME_NOW + $this->time) { $this->fail = true; return; } - $editor = new suspension\ChatSuspensionEditor($suspension); + $editor = new suspension\SuspensionEditor($suspension); $editor->delete(); } - $this->suspensionAction = new suspension\ChatSuspensionAction(array(), 'create', array( + $this->suspensionAction = new suspension\SuspensionAction(array(), 'create', array( 'data' => array( 'userID' => $this->user->userID, 'roomID' => ChatUtil::readUserData('roomID'), - 'type' => suspension\ChatSuspension::TYPE_MUTE, + 'type' => suspension\Suspension::TYPE_MUTE, 'time' => TIME_NOW + $this->time ) )); @@ -77,7 +77,7 @@ public function checkPermission() { parent::checkPermission(); $this->room = \wcf\system\request\RequestHandler::getInstance()->getActiveRequest()->getRequestObject()->request->room; - $ph = new \wcf\system\chat\permission\ChatPermissionHandler(); + $ph = new \chat\system\permission\PermissionHandler(); if (!$ph->getPermission($this->room, 'mod.can'.str_replace(array('chat\system\command\commands\\', 'Command'), '', get_class($this)))) throw new \wcf\system\exception\PermissionDeniedException(); } @@ -94,8 +94,8 @@ public function getReceiver() { * @see \chat\system\command\ICommand::getType() */ public function getType() { - if ($this->fail) return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION; - return \wcf\data\chat\message\ChatMessage::TYPE_MODERATE; + if ($this->fail) return \chat\data\message\Message::TYPE_INFORMATION; + return \chat\data\message\Message::TYPE_MODERATE; } /** diff --git a/file/lib/system/command/commands/PlainCommand.class.php b/file/lib/system/command/commands/PlainCommand.class.php index bda4ed3..4c037c5 100644 --- a/file/lib/system/command/commands/PlainCommand.class.php +++ b/file/lib/system/command/commands/PlainCommand.class.php @@ -17,7 +17,7 @@ class PlainCommand extends \chat\system\command\AbstractCommand { * @see \chat\system\command\ICommand::getType() */ public function getType() { - return \wcf\data\chat\message\ChatMessage::TYPE_NORMAL; + return \chat\data\message\Message::TYPE_NORMAL; } /** diff --git a/file/lib/system/command/commands/RestoreCommand.class.php b/file/lib/system/command/commands/RestoreCommand.class.php index b9a9246..f49f061 100644 --- a/file/lib/system/command/commands/RestoreCommand.class.php +++ b/file/lib/system/command/commands/RestoreCommand.class.php @@ -42,7 +42,7 @@ public function checkPermission() { * @see \chat\system\command\ICommand::getType() */ public function getType() { - return \wcf\data\chat\message\ChatMessage::TYPE_MODERATE; + return \chat\data\message\Message::TYPE_MODERATE; } /** diff --git a/file/lib/system/command/commands/TemproomCommand.class.php b/file/lib/system/command/commands/TemproomCommand.class.php index 4b8e192..8fd8eb8 100644 --- a/file/lib/system/command/commands/TemproomCommand.class.php +++ b/file/lib/system/command/commands/TemproomCommand.class.php @@ -19,7 +19,7 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler) parent::__construct($commandHandler); // create room - $this->objectAction = new \wcf\data\chat\room\ChatRoomAction(array(), 'create', array('data' => array( + $this->objectAction = new \chat\data\room\RoomAction(array(), 'create', array('data' => array( 'title' => 'Temproom', 'topic' => '', 'permanent' => 0, @@ -27,7 +27,7 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler) ))); $this->objectAction->executeAction(); $returnValues = $this->objectAction->getReturnValues(); - $chatRoomEditor = new \wcf\data\chat\room\ChatRoomEditor($returnValues['returnValues']); + $chatRoomEditor = new \chat\data\room\RoomEditor($returnValues['returnValues']); $roomID = $returnValues['returnValues']->roomID; $this->roomName = WCF::getLanguage()->getDynamicVariable('wcf.chat.room.titleTemp', array('roomID' => $roomID)); @@ -50,7 +50,7 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler) ); \wcf\system\acl\ACLHandler::getInstance()->save($roomID, \wcf\system\acl\ACLHandler::getInstance()->getObjectTypeID('be.bastelstu.chat.room')); - \wcf\system\chat\permission\ChatPermissionHandler::clearCache(); + \chat\system\permission\PermissionHandler::clearCache(); $this->didInit(); } @@ -67,7 +67,7 @@ public function checkPermission() { * @see \chat\system\command\ICommand::getType() */ public function getType() { - return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION; + return \chat\data\message\Message::TYPE_INFORMATION; } /** diff --git a/file/lib/system/command/commands/WhereCommand.class.php b/file/lib/system/command/commands/WhereCommand.class.php index de3fc4a..dcf4792 100644 --- a/file/lib/system/command/commands/WhereCommand.class.php +++ b/file/lib/system/command/commands/WhereCommand.class.php @@ -18,14 +18,14 @@ class WhereCommand extends \chat\system\command\AbstractCommand { * @see \chat\system\command\ICommand::getType() */ public function getType() { - return \wcf\data\chat\message\ChatMessage::TYPE_INFORMATION; + return \chat\data\message\Message::TYPE_INFORMATION; } /** * @see \chat\system\command\ICommand::getMessage() */ public function getMessage() { - $rooms = \wcf\data\chat\room\ChatRoom::getCache(); + $rooms = \chat\data\room\Room::getCache(); foreach ($rooms as $room) { $users = $room->getUsers(); diff --git a/file/lib/system/command/commands/WhisperCommand.class.php b/file/lib/system/command/commands/WhisperCommand.class.php index 07120b3..f635104 100644 --- a/file/lib/system/command/commands/WhisperCommand.class.php +++ b/file/lib/system/command/commands/WhisperCommand.class.php @@ -36,7 +36,7 @@ public function __construct(\chat\system\command\CommandHandler $commandHandler) * @see \chat\system\command\ICommand::getType() */ public function getType() { - return \wcf\data\chat\message\ChatMessage::TYPE_WHISPER; + return \chat\data\message\Message::TYPE_WHISPER; } /** From 71936e14d6cc8f5f9cbb88a802aca2d53536834c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 27 Jan 2013 22:10:37 +0100 Subject: [PATCH 18/31] Use PACKAGE_VERSION --- file/lib/page/ChatPage.class.php | 15 --------------- language/de.xml | 2 +- template/chat.tpl | 8 +++----- template/javascriptInclude.tpl | 4 ++-- 4 files changed, 6 insertions(+), 23 deletions(-) diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index 1fdde3c..5929d3d 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -14,13 +14,6 @@ * @subpackage page */ class ChatPage extends \wcf\page\AbstractPage { - /** - * The version of this installation of Tims Chat 3. - * - * @var string - */ - public $chatVersion = ''; - /** * @see wcf\page\AbstractPage::$loginRequired */ @@ -101,7 +94,6 @@ public function assignVariables() { parent::assignVariables(); WCF::getTPL()->assign(array( - 'chatVersion' => $this->chatVersion, 'newestMessages' => $this->newestMessages, 'room' => $this->room, 'roomID' => $this->roomID, @@ -113,13 +105,6 @@ public function assignVariables() { )); } - /** - * Reads chat-version. Used to avoid caching of JS-File when Tims Chat is updated. - */ - public function readChatVersion() { - return $this->chatVersion = \wcf\data\package\PackageCache::getInstance()->getPackage(\chat\util\ChatUtil::getPackageID())->packageVersion; - } - /** * @see \wcf\page\IPage::readData() */ diff --git a/language/de.xml b/language/de.xml index 3782994..5ac9154 100644 --- a/language/de.xml +++ b/language/de.xml @@ -66,7 +66,7 @@ Hinweis: Setzen Sie diese Einstellung nur, wenn Sie wissen, was sie bewirkt. Die - Tims Chat{if CHAT_SHOW_VERSION && $chatVersion|isset} {$chatVersion}{/if}, entwickelt in Tims Bastelstube]]> + Tims Chat{if SHOW_VERSION_NUMBER} {PACKAGE_VERSION}{/if}, entwickelt in Tims Bastelstube]]> diff --git a/template/chat.tpl b/template/chat.tpl index 56b6d21..0f4c40c 100644 --- a/template/chat.tpl +++ b/template/chat.tpl @@ -43,11 +43,9 @@ $('#timsChatCopyright').click(function (event) { event.preventDefault(); - if ($.wcfIsset('timsChatCopyrightDialog')) return WCF.showDialog('timsChatCopyrightDialog', { title: 'Tims Chat{if CHAT_SHOW_VERSION && $chatVersion|isset} {$chatVersion}{/if}' }); - var container = $('
        '); - container.load('{link application='chat' controller='Chat' action='Copyright'}{/link}', function() { - $('body').append(container); - WCF.showDialog('timsChatCopyrightDialog', { title: 'Tims Chat{if CHAT_SHOW_VERSION && $chatVersion|isset} {$chatVersion}{/if}' }); + if (!$.wcfIsset('timsChatCopyrightDialog')) $('
        ').appendTo('body'); + $('#timsChatCopyrightDialog').load('{link application='chat' controller='Chat' action='Copyright'}{/link}', function() { + WCF.showDialog('timsChatCopyrightDialog', { title: 'Tims Chat{if SHOW_VERSION_NUMBER} {PACKAGE_VERSION}{/if}' }); }); }); diff --git a/template/javascriptInclude.tpl b/template/javascriptInclude.tpl index 4c85af0..db03a05 100644 --- a/template/javascriptInclude.tpl +++ b/template/javascriptInclude.tpl @@ -1,5 +1,5 @@ - + {if CHAT_SOCKET_IO_PATH}{/if} - + {event name='javascript'} \ No newline at end of file From 98943f93090f0ae0c26e3f39ea87b3bb811c00ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 27 Jan 2013 22:41:36 +0100 Subject: [PATCH 19/31] Remove proxying of pages, remove deliver copyright background in own request --- file/lib/action/LeaveAction.class.php | 17 ---- file/lib/page/ChatPage.class.php | 16 ---- file/lib/page/CopyrightPage.class.php | 62 ++++---------- ...ge.class.php => NewMessagesPage.class.php} | 19 +---- file/lib/page/RoomListPage.class.php | 19 +---- .../listener/RouteHandlerListener.class.php | 2 +- file/style/be.bastelstu.wcf.chat.less | 7 +- template/__copyright.tpl | 84 ++++++++++--------- template/chat.tpl | 10 +-- template/sidebar.tpl | 2 +- 10 files changed, 69 insertions(+), 169 deletions(-) rename file/lib/page/{ChatMessagePage.class.php => NewMessagesPage.class.php} (90%) diff --git a/file/lib/action/LeaveAction.class.php b/file/lib/action/LeaveAction.class.php index 778f1e3..cedb813 100644 --- a/file/lib/action/LeaveAction.class.php +++ b/file/lib/action/LeaveAction.class.php @@ -43,23 +43,6 @@ class LeaveAction extends \wcf\action\AbstractAction { */ public $userData = array(); - /** - * shortcut for the active request - * @see wcf\system\request\Request::getRequestObject() - */ - public $request = null; - - /** - * Disallows direct access. - * - * @see wcf\page\IPage::__run() - */ - public function __run() { - if (($this->request = \wcf\system\request\RequestHandler::getInstance()->getActiveRequest()->getRequestObject()) === $this) throw new IllegalLinkException(); - - parent::__run(); - } - /** * @see \wcf\action\IAction::execute() */ diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index 5929d3d..719169e 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -162,30 +162,14 @@ public function readParameters() { $this->request = $this; switch ($this->action) { - case 'Message': - $this->request = new ChatMessagePage(); - $this->request->__run(); - exit; case 'Log': $this->request = new LogPage(); $this->request->__run(); exit; - case 'RefreshRoomList': - $this->request = new RoomListPage(); - $this->request->__run(); - exit; case 'Send': $this->request = new \chat\form\ChatForm(); $this->request->__run(); exit; - case 'Leave': - $this->request = new \chat\action\LeaveAction(); - $this->request->__run(); - exit; - case 'Copyright': - $this->request = new CopyrightPage(); - $this->request->__run(); - exit; } if (isset($_REQUEST['id'])) $this->roomID = (int) $_REQUEST['id']; diff --git a/file/lib/page/CopyrightPage.class.php b/file/lib/page/CopyrightPage.class.php index 904379d..7600081 100644 --- a/file/lib/page/CopyrightPage.class.php +++ b/file/lib/page/CopyrightPage.class.php @@ -13,6 +13,11 @@ * @subpackage page */ class CopyrightPage extends \wcf\page\AbstractPage { + /** + * @see wcf\page\AbstractPage::$loginRequired + */ + public $loginRequired = true; + /** * @see \wcf\page\AbstractPage::$neededModules */ @@ -25,61 +30,26 @@ class CopyrightPage extends \wcf\page\AbstractPage { /** * shortcut for the active request - * @see wcf\system\request\Request::getRequestObject() + * @see \wcf\system\request\Request::getRequestObject() */ public $request = null; + /** + * @see \wcf\page\AbstractPage::$templateName + */ public $templateName = '__copyright'; /** - * Disallows direct access. - * - * @see wcf\page\IPage::__run() + * @see \wcf\page\IPage::assignVariables() */ - public function __run() { - if (($this->request = \wcf\system\request\RequestHandler::getInstance()->getActiveRequest()->getRequestObject()) === $this) throw new IllegalLinkException(); + public function assignVariables() { + parent::assignVariables(); - parent::__run(); - } - - /** - * @see \wcf\page\IPage::readParameters() - */ - public function readParameters() { - // ### - // ## ## - // # # - // # ##### # - // # # # # - // # # * * # # - // # # # # - // # # # # - // # ### # - // # # - // ####### - // # # # # - // # # # # - // # # # # - - if (isset($_GET['sheep'])) $this->useTemplate = false; - } - - /** - * @see \wcf\page\IPage::show() - */ - public function show() { - // guests are not supported - if (!WCF::getUser()->userID) { - throw new \wcf\system\exception\PermissionDeniedException(); - } - - parent::show(); - if ($this->useTemplate) exit; - @header('Content-type: image/png'); - \wcf\util\HeaderUtil::sendNoCacheHeaders(); $images = explode("\n\n", file_get_contents(__FILE__, null, null, __COMPILER_HALT_OFFSET__+2)); - echo base64_decode($images[array_rand($images)]); - exit; + + WCF::getTPL()->assign(array( + 'background' => str_replace("\n", '', $images[array_rand($images)]) + )); } } // @codingStandardsIgnoreStart diff --git a/file/lib/page/ChatMessagePage.class.php b/file/lib/page/NewMessagesPage.class.php similarity index 90% rename from file/lib/page/ChatMessagePage.class.php rename to file/lib/page/NewMessagesPage.class.php index 49ebcd6..34f7db7 100644 --- a/file/lib/page/ChatMessagePage.class.php +++ b/file/lib/page/NewMessagesPage.class.php @@ -13,7 +13,7 @@ * @package be.bastelstu.chat * @subpackage page */ -class ChatMessagePage extends \wcf\page\AbstractPage { +class NewMessagesPage extends \wcf\page\AbstractPage { /** * @see wcf\page\AbstractPage::$loginRequired */ @@ -55,23 +55,6 @@ class ChatMessagePage extends \wcf\page\AbstractPage { */ public $useTemplate = false; - /** - * shortcut for the active request - * @see wcf\system\request\Request::getRequestObject() - */ - public $request = null; - - /** - * Disallows direct access. - * - * @see wcf\page\IPage::__run() - */ - public function __run() { - if (($this->request = \wcf\system\request\RequestHandler::getInstance()->getActiveRequest()->getRequestObject()) === $this) throw new IllegalLinkException(); - - parent::__run(); - } - /** * @see \wcf\page\Page::readData() */ diff --git a/file/lib/page/RoomListPage.class.php b/file/lib/page/RoomListPage.class.php index a5c5f12..12fbe24 100644 --- a/file/lib/page/RoomListPage.class.php +++ b/file/lib/page/RoomListPage.class.php @@ -6,7 +6,7 @@ use \wcf\system\WCF; /** - * Outputs roomlist + * Outputs roomlist. * * @author Tim Düsterhus * @copyright 2010-2013 Tim Düsterhus @@ -47,23 +47,6 @@ class RoomListPage extends \wcf\page\AbstractPage { */ public $useTemplate = false; - /** - * shortcut for the active request - * @see wcf\system\request\Request::getRequestObject() - */ - public $request = null; - - /** - * Disallows direct access. - * - * @see wcf\page\IPage::__run() - */ - public function __run() { - if (($this->request = \wcf\system\request\RequestHandler::getInstance()->getActiveRequest()->getRequestObject()) === $this) throw new IllegalLinkException(); - - parent::__run(); - } - /** * @see \wcf\page\IPage::readData() */ diff --git a/file/lib/system/event/listener/RouteHandlerListener.class.php b/file/lib/system/event/listener/RouteHandlerListener.class.php index d0f14d2..f9322bb 100644 --- a/file/lib/system/event/listener/RouteHandlerListener.class.php +++ b/file/lib/system/event/listener/RouteHandlerListener.class.php @@ -18,7 +18,7 @@ public function execute($eventObj, $className, $eventName) { $route = new \wcf\system\request\Route('chatAction'); $route->setSchema('/{controller}/{action}/{id}'); $route->setParameterOption('controller', null, 'Chat'); - $route->setParameterOption('action', null, '(Message|Log|Send|RefreshRoomList|Copyright|Leave)'); + $route->setParameterOption('action', null, '(Log|Send)'); $route->setParameterOption('id', null, '\d+', true); $eventObj->addRoute($route); } diff --git a/file/style/be.bastelstu.wcf.chat.less b/file/style/be.bastelstu.wcf.chat.less index 3409f3a..b3fe953 100644 --- a/file/style/be.bastelstu.wcf.chat.less +++ b/file/style/be.bastelstu.wcf.chat.less @@ -2,11 +2,10 @@ * Styles for Tims Chat * * @author Tim Düsterhus, Maximilian Mader - * @copyright 2010-2012 Tim Düsterhus + * @copyright 2010-2013 Tim Düsterhus * @license Creative Commons Attribution-NonCommercial-ShareAlike * @package be.bastelstu.wcf.chat */ - #tplChat { #content { #timsChatRoomContent { @@ -301,10 +300,10 @@ .textShadow(@wcfContentBackgroundColor); } - #timsChatCopyrightDialog { + #timsChatCopyrightDialog > div { background-position: right center; background-repeat: no-repeat; - min-height: 50%; + min-height: 150px; } .badgeBG(@backgroundColor) when (lightness(@backgroundColor) < 50%) { diff --git a/template/__copyright.tpl b/template/__copyright.tpl index 8c99c05..4210f19 100644 --- a/template/__copyright.tpl +++ b/template/__copyright.tpl @@ -1,47 +1,49 @@ {if $__chat->isActiveApplication()} {if $templateName != '__copyright'} {elseif $templateName == '__copyright'} -
        -
        {lang}chat.general.copyright.leader{/lang}
        -
        - -
        -
        -
        -
        {lang}chat.general.copyright.developer{/lang}
        -
        - -
        -
        -
        -
        {lang}chat.general.copyright.graphics{/lang}
        -
        - -
        -
        - {*
        -
        {lang}chat.general.copyright.translation{/lang}
        -
        +
        +
        +
        {lang}chat.general.copyright.leader{/lang}
        +
        + +
        +
        +
        +
        {lang}chat.general.copyright.developer{/lang}
        +
        + +
        +
        +
        +
        {lang}chat.general.copyright.graphics{/lang}
        +
        + +
        +
        + {*
        +
        {lang}chat.general.copyright.translation{/lang}
        +
        -
        -
        *} -
        -
        {lang}chat.general.copyright.thanks{/lang}
        -
        - -
        -
        +
        +
        *} +
        +
        {lang}chat.general.copyright.thanks{/lang}
        +
        + +
        +
        + {/if} {/if} \ No newline at end of file diff --git a/template/chat.tpl b/template/chat.tpl index 0f4c40c..5af5af3 100644 --- a/template/chat.tpl +++ b/template/chat.tpl @@ -27,8 +27,8 @@ chat = new be.bastelstu.Chat({ reloadTime: {@CHAT_RELOADTIME}, - unloadURL: '{link controller="Chat" action="Leave"}{/link}', - messageURL: '{link controller="Chat" action="Message"}{/link}', + unloadURL: '{link application="chat" controller="Leave"}{/link}', + messageURL: '{link application="chat" controller="NewMessages"}{/link}', socketIOPath: '{@CHAT_SOCKET_IO_PATH|encodeJS}' }, (new WCF.Template('{ldelim}$title} - {'chat.general.title'|language|encodeJS} - {PAGE_TITLE|language|encodeJS}')).compile(), (new WCF.Template('{@$messageTemplate|encodeJS}')).compile()); {event name='didInit'} @@ -44,7 +44,7 @@ $('#timsChatCopyright').click(function (event) { event.preventDefault(); if (!$.wcfIsset('timsChatCopyrightDialog')) $('
        ').appendTo('body'); - $('#timsChatCopyrightDialog').load('{link application='chat' controller='Chat' action='Copyright'}{/link}', function() { + $('#timsChatCopyrightDialog').load('{link application='chat' controller='Copyright'}{/link}', function() { WCF.showDialog('timsChatCopyrightDialog', { title: 'Tims Chat{if SHOW_VERSION_NUMBER} {PACKAGE_VERSION}{/if}' }); }); }); @@ -60,10 +60,6 @@ From 7528cdf7f6b7459ed2a80f6de34199c29d3a34d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 28 Jan 2013 22:26:24 +0100 Subject: [PATCH 21/31] Remove method call to remove method --- file/lib/page/ChatPage.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index 719169e..b3316ec 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -151,7 +151,6 @@ public function readData() { } $this->defaultSmilies = \wcf\data\smiley\SmileyCache::getInstance()->getCategorySmilies(); - $this->readChatVersion(); } /** From 513ef766b67d24ff155658681978ef22463cdf89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 28 Jan 2013 22:26:36 +0100 Subject: [PATCH 22/31] Fix syntax in javascriptInclude --- template/javascriptInclude.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/javascriptInclude.tpl b/template/javascriptInclude.tpl index db03a05..c2297ab 100644 --- a/template/javascriptInclude.tpl +++ b/template/javascriptInclude.tpl @@ -1,4 +1,4 @@ - + {if CHAT_SOCKET_IO_PATH}{/if} From 8d26f5dc1163fd46b6e7a3a3b5a1f9a47663322f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 28 Jan 2013 22:28:22 +0100 Subject: [PATCH 23/31] Fix roomname and topic in install.sql --- install.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sql b/install.sql index 449aaa4..4c21a92 100644 --- a/install.sql +++ b/install.sql @@ -64,7 +64,7 @@ ALTER TABLE chat1_room ADD FOREIGN KEY (owner) REFERENCES wcf1_user (userID) ON ALTER TABLE chat1_suspension ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE; ALTER TABLE chat1_suspension ADD FOREIGN KEY (roomID) REFERENCES chat1_room (roomID) ON DELETE CASCADE; -INSERT INTO chat1_room (title, topic, position) VALUES ('wcf.chat.room.title1', 'wcf.chat.room.topic1', 1); +INSERT INTO chat1_room (title, topic, position) VALUES ('chat.room.title1', 'chat.room.topic1', 1); INSERT INTO chat1_room (title, topic, position) VALUES ('Testroom 2', 'Topic of Testroom 2', 2); INSERT INTO chat1_room (title, topic, position) VALUES ('Testroom with a very long', 'The topic of this room is rather loing as well!', 3); INSERT INTO chat1_room (title, topic, position) VALUES ('Room w/o topic', '', 4); From 98f5e1bee36e9ec0c6712fdcb4767f784adebf59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 29 Jan 2013 21:33:30 +0100 Subject: [PATCH 24/31] Fix desktop notifications --- file/js/be.bastelstu.Chat.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/file/js/be.bastelstu.Chat.coffee b/file/js/be.bastelstu.Chat.coffee index 17f8018..884f195 100644 --- a/file/js/be.bastelstu.Chat.coffee +++ b/file/js/be.bastelstu.Chat.coffee @@ -486,7 +486,7 @@ window.console ?= if typeof window.webkitNotifications isnt 'undefined' if window.webkitNotifications.checkPermission() is 0 title = WCF.Language.get 'chat.general.notify.title' - icon = WCF.Icon.get 'be.bastelstu.chat.chat' + icon = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D" # empty gif content = message.username + message.separator + (if message.separator is ' ' then '' else ' ') + message.message notification = window.webkitNotifications.createNotification icon, title, content notification.show() From cad8fee417fc24ec882164db5f778b6f16777537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 29 Jan 2013 21:41:02 +0100 Subject: [PATCH 25/31] Clean up javascript --- file/js/be.bastelstu.Chat.coffee | 40 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/file/js/be.bastelstu.Chat.coffee b/file/js/be.bastelstu.Chat.coffee index 884f195..606d6ac 100644 --- a/file/js/be.bastelstu.Chat.coffee +++ b/file/js/be.bastelstu.Chat.coffee @@ -18,11 +18,11 @@ window.console ?= console = log: (message) -> - _console.log '[be.bastelstu.Chat] '+message + _console.log "[be.bastelstu.Chat] #{message}" warn: (message) -> - _console.warn '[be.bastelstu.Chat] '+message + _console.warn "[be.bastelstu.Chat] #{message}" error: (message) -> - _console.error '[be.bastelstu.Chat] '+message + _console.error "[be.bastelstu.Chat] #{message}" be.bastelstu.Chat = Class.extend @@ -155,13 +155,13 @@ window.console ?= toComplete = toComplete.substring 0, nextSpace return if toComplete.length is 0 - console.log 'Autocompleting "' + toComplete + '"' + console.log "Autocompleting '#{toComplete}'" # Insert name and increment offset name = @autocomplete toComplete - $('#timsChatInput').val beforeComplete + name + ' ' + afterComplete - $('#timsChatInput').setCaret((beforeComplete + name).length + 1); + $('#timsChatInput').val "#{beforeComplete}#{name} #{afterComplete}" + $('#timsChatInput').setCaret (beforeComplete + name).length + 1 @autocompleteOffset++ else @autocompleteOffset = 0 @@ -176,7 +176,7 @@ window.console ?= , @ # Refreshes the roomlist - $('#timsChatRoomList button').click $.proxy(@refreshRoomList, @) + $('#timsChatRoomList button').click $.proxy @refreshRoomList, @ # Clears the stream $('#timsChatClear').click (event) -> @@ -213,7 +213,7 @@ window.console ?= if $(@).data 'status' $('#timsChatMessageContainer').scrollTop $('#timsChatMessageContainer ul').height() @oldScrollTop = $('.timsChatMessageContainer').scrollTop() - + # Desktop Notifications unless typeof window.webkitNotifications is 'undefined' $('#timsChatNotify').click (event) -> @@ -233,7 +233,7 @@ window.console ?= data: ajax: 1 type: 'POST' - success: $.proxy((data, textStatus, jqXHR) -> + success: $.proxy (data, textStatus, jqXHR) -> @loading = false target.parent().removeClass 'loading' @@ -249,12 +249,12 @@ window.console ?= $(@).text '' else $('#timsChatTopic').text data.topic - $('#timsChatTopic').wcfBlindIn() if $('#timsChatTopic').text().trim() isnt '' and $('#timsChatTopic').is(':hidden') + $('#timsChatTopic').wcfBlindIn() if $('#timsChatTopic').text().trim() isnt '' and $('#timsChatTopic').is ':hidden' $('.timsChatMessage').addClass 'unloaded', 800 @handleMessages data.messages document.title = @titleTemplate.fetch data - , @) + , @ error: () -> # Reload the page to change the room the old fashion-way # inclusive the error-message :) @@ -443,13 +443,13 @@ window.console ?= console.log 'Connected to nodePush' @pe.getMessages.stop() , @) - @socket.on 'disconnect', $.proxy((data) -> + @socket.on 'disconnect', $.proxy (data) -> console.log 'Lost connection to nodePush' @pe.getMessages = new WCF.PeriodicalExecuter $.proxy(@getMessages, @), @config.reloadTime * 1e3 - , @) - @socket.on 'newMessage', $.proxy((data) -> + , @ + @socket.on 'newMessage', $.proxy (data) -> @getMessages() - , @) + , @ ### # Inserts text into our input. # @@ -505,7 +505,7 @@ window.console ?= $.ajax $('#toggleRooms a').data('refreshUrl'), dataType: 'json' type: 'POST' - success: $.proxy((data, textStatus, jqXHR) -> + success: $.proxy (data, textStatus, jqXHR) -> $('#timsChatRoomList li').remove() $('#toggleRooms .ajaxLoad').hide() $('#toggleRooms .badge').text data.length @@ -522,8 +522,8 @@ window.console ?= @changeRoom $ event.target , @ - console.log 'Found ' + data.length + ' rooms' - , @) + console.log "Found #{data.length} rooms" + , @ ### # Handles submitting of messages. # @@ -549,9 +549,9 @@ window.console ?= smilies: $('#timsChatSmilies').data 'status' type: 'POST', beforeSend: (jqXHR) -> - success: $.proxy((data, textStatus, jqXHR) -> + success: $.proxy (data, textStatus, jqXHR) -> @getMessages() - , @) + , @ complete: () -> ### # Toggles between user- and room-list. From 8772981d92c7281feb553492f6aa35115416111d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 29 Jan 2013 22:15:20 +0100 Subject: [PATCH 26/31] Use proper coffeescript for jCounter --- file/js/jCounter.jQuery.coffee | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/file/js/jCounter.jQuery.coffee b/file/js/jCounter.jQuery.coffee index 6927f83..ccc9ce0 100644 --- a/file/js/jCounter.jQuery.coffee +++ b/file/js/jCounter.jQuery.coffee @@ -15,44 +15,36 @@ width: '100%' , options - if @.attr('maxlength') - max = @.attr('maxlength') - else max = options.max + max = if @.attr('maxlength')? then @.attr 'maxlength' else options.max - if !container - if !@.hasClass('jCounterInput') - @.addClass('jCounterInput') - @.wrap('
        ').parent().append('
        ' + max + '
        '); - jCounterContainer = $(@).parent().children('.' + options.counterClass) + if not container? + @.addClass 'jCounterInput' + + @.wrap("""
        """).parent().append """
        #{max}
        """ + jCounterContainer = $(@).parent().children ".#{options.counterClass}" else - if typeof container is 'object' - jCounterContainer = container - else - jCounterContainer = $ container + jCounterContainer = if typeof container is 'object' then container else $ container @.on 'keypress keyup', $.proxy () -> - if options.countUp - length = @.val().length - else - length = max - @.val().length + length = if options.countUp then @.val().length else max - @.val().length if options.countUp && max > 0 if length < max / 2 color = 1 - else if length >= max / 2 and length <= max / 1.2 + else if max / 2 < length <= max / 1.2 color = 2 else color = 3 else if options.countUp color = 1 else - if length > max / 2 + if max / 2 < length color = 1 - else if length <= max / 2 and length >= max / 6 + else if max / 6 <= length <= max / 2 color = 2 else color = 3 - jCounterContainer.text(length).attr('class', '').addClass(options.counterClass + ' color-'+color) + jCounterContainer.text(length).removeClass().addClass "#{options.counterClass} color-#{color}" , @ )(jQuery) \ No newline at end of file From 26ac9b8626013e16e683f6d2d15200379c8e3e1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 30 Jan 2013 16:34:02 +0100 Subject: [PATCH 27/31] Improve message design with CSS tables --- file/style/be.bastelstu.wcf.chat.less | 64 ++++++++++++++++----------- template/chat.tpl | 4 ++ template/message.tpl | 2 +- 3 files changed, 43 insertions(+), 27 deletions(-) diff --git a/file/style/be.bastelstu.wcf.chat.less b/file/style/be.bastelstu.wcf.chat.less index a88cc3d..b4f26a6 100644 --- a/file/style/be.bastelstu.wcf.chat.less +++ b/file/style/be.bastelstu.wcf.chat.less @@ -23,34 +23,46 @@ overflow-x: hidden; padding-left: 7px !important; - .timsChatMessage { - padding-left: 16px; - min-height: 16px; - clear: both; - position: relative; - - time:first-child { + ul { + display: table; + + .timsChatMessage { + min-height: 16px; + display: table-row; + + time:first-child { + &::before { + content: "["; + } + &::after { + content: "]"; + } + } + + .username { + font-weight: bold; + } + + > { + time, .usernameContainer, .text { + display: table-cell; + } + + .usernameContainer { + text-align: right; + min-width: 100px; + padding: 0px 5px; + } + } + + &.unloaded { + opacity: 0.4; + } + &::before { - content: "["; + .icon; + .icon16; } - &::after { - content: "]"; - } - } - - .username { - font-weight: bold; - } - - &.unloaded { - opacity: 0.4; - } - - &::before { - .icon; - .icon16; - position: absolute; - left: 0px; } } } diff --git a/template/chat.tpl b/template/chat.tpl index 66e8067..9fec948 100644 --- a/template/chat.tpl +++ b/template/chat.tpl @@ -60,6 +60,10 @@