1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2025-01-02 23:20:08 +00:00

Merge branch 'master' into protocol

This commit is contained in:
Maximilian Mader 2013-09-05 20:35:07 +02:00
commit dcfc8a94cd
33 changed files with 266 additions and 148 deletions

View File

@ -0,0 +1 @@
{if $__chat->isActiveApplication()}<img src="{$__wcf->getPath('chat')}images/chatLogo.png" style="width: 246px; height: 90px;" alt="" />{/if}

View File

@ -0,0 +1,4 @@
<dl>
<dt>{lang}wcf.acp.index.system.software.chatVersion{/lang}</dt>
<dd>{$__chat->getPackage()->packageVersion}</dd>
</dl>

View File

@ -1,6 +1,6 @@
{include file='header' pageTitle='chat.acp.suspension.list'} {include file='header' pageTitle='chat.acp.suspension.list'}
<script> <script data-relocate="true">
//<![CDATA[ //<![CDATA[
$(function() { $(function() {
new WCF.Search.User('#username', null, false, [ ], false); new WCF.Search.User('#username', null, false, [ ], false);

View File

@ -1,7 +1,7 @@
{include file='header' pageTitle='chat.acp.room.'|concat:$action} {include file='header' pageTitle='chat.acp.room.'|concat:$action}
<script src="{@$__wcf->getPath('wcf')}js/WCF.ACL.js"></script> <script data-relocate="true" src="{@$__wcf->getPath('wcf')}js/WCF.ACL.js"></script>
<script> <script data-relocate="true">
//<![CDATA[ //<![CDATA[
$(function() { $(function() {
new WCF.ACL.List($('#groupPermissions'), {@$objectTypeID}, ''{if $roomID|isset}, {@$roomID}{/if}); new WCF.ACL.List($('#groupPermissions'), {@$objectTypeID}, ''{if $roomID|isset}, {@$roomID}{/if});
@ -18,7 +18,7 @@
{/if} {/if}
{if $success|isset} {if $success|isset}
<p class="success">{lang}wcf.global.form.{$action}.success{/lang}</p> <p class="success">{lang}wcf.global.success.{$action}{/lang}</p>
{/if} {/if}
<div class="contentNavigation"> <div class="contentNavigation">
@ -87,4 +87,4 @@
</div> </div>
</form> </form>
{include file='footer'} {include file='footer'}

View File

@ -1,6 +1,6 @@
{include file='header' pageTitle='chat.acp.room.list'} {include file='header' pageTitle='chat.acp.room.list'}
<script> <script data-relocate="true">
//<![CDATA[ //<![CDATA[
$(function() { $(function() {
new WCF.Action.Delete('\\chat\\data\\room\\RoomAction', $('.chatRoomRow')); new WCF.Action.Delete('\\chat\\data\\room\\RoomAction', $('.chatRoomRow'));

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/cronjob.xsd">
<import>
<cronjob>
<classname>chat\system\cronjob\CleanupCronjob</classname>
<description>Cleans up Tims Chat</description>
<startminute>*/15</startminute>
<starthour>*</starthour>
<startdom>*</startdom>
<startmonth>*</startmonth>
<startdow>*</startdow>
<active>1</active>
<canbeedited>1</canbeedited>
<canbedisabled>0</canbedisabled>
</cronjob>
</import>
</data>

17
eventListener.xml Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/maelstrom/eventListener.xsd">
<import>
<eventlistener>
<eventclassname>wcf\system\cronjob\HourlyCleanUpCronjob</eventclassname>
<eventname>execute</eventname>
<listenerclassname>chat\system\event\listener\HourlyCleanUpCronjobExecuteChatCleanUpListener</listenerclassname>
<environment>user</environment>
</eventlistener>
<eventlistener>
<eventclassname>wcf\system\cronjob\HourlyCleanUpCronjob</eventclassname>
<eventname>execute</eventname>
<listenerclassname>chat\system\event\listener\HourlyCleanUpCronjobExecuteChatCleanUpListener</listenerclassname>
<environment>admin</environment>
</eventlistener>
</import>
</data>

View File

@ -86,8 +86,7 @@ Initialize **Tims Chat**. Bind needed DOM events and initialize data structures.
When **Tims Chat** becomes focused mark the chat as active and remove the number of new messages from the title. When **Tims Chat** becomes focused mark the chat as active and remove the number of new messages from the title.
$(window).focus -> $(window).focus ->
document.title = v.titleTemplate.fetch document.title = v.titleTemplate.fetch currentRoom
title: $('#timsChatRoomList .active a').text()
newMessageCount = 0 newMessageCount = 0
isActive = true isActive = true
@ -391,9 +390,9 @@ Free the fish.
fish = $ """<div id="fish">#{WCF.String.escapeHTML('><((((\u00B0>')}</div>""" fish = $ """<div id="fish">#{WCF.String.escapeHTML('><((((\u00B0>')}</div>"""
fish.css fish.css
position: 'absolute' position: 'fixed'
top: '150px' top: '50%'
left: '400px' left: '50%'
color: 'black' color: 'black'
textShadow: '1px 1px white' textShadow: '1px 1px white'
zIndex: 9999 zIndex: 9999
@ -404,8 +403,8 @@ Free the fish.
top = Math.random() * 100 - 50 top = Math.random() * 100 - 50
fish = $ '#fish' fish = $ '#fish'
left *= -1 unless fish.width() < (fish.position().left + left) < ($(document).width() - fish.width()) left *= -1 unless fish.width() < (fish.position().left + left) < ($(window).width() - fish.width())
top *= -1 unless fish.height() < (fish.position().top + top) < ($(document).height() - fish.height()) top *= -1 unless fish.height() < (fish.position().top + top) < ($(window).height() - fish.height())
if left > 0 if left > 0
fish.text '><((((\u00B0>' if left > 0 fish.text '><((((\u00B0>' if left > 0
@ -413,8 +412,8 @@ Free the fish.
fish.text '<\u00B0))))><' fish.text '<\u00B0))))><'
fish.animate fish.animate
top: "+=#{top}" top: (fish.position().top + top)
left: "+=#{left}" left: (fish.position().left + left)
, 1e3 , 1e3
, 1.5e3 , 1.5e3
@ -572,6 +571,7 @@ Remove all users that left the chat.
$('.timsChatUser').each -> $('.timsChatUser').each ->
unless foundUsers[$(@).attr('id')]? unless foundUsers[$(@).attr('id')]?
console.log "Removing User: '#{$(@).data('username')}'" console.log "Removing User: '#{$(@).data('username')}'"
WCF.Dropdown.removeDropdown $(@).attr 'id'
do $(@).remove do $(@).remove
@ -614,9 +614,8 @@ Send out notifications for the given `message`. The number of unread messages wi
return if isActive or $('#timsChatNotify').data('status') is 0 return if isActive or $('#timsChatNotify').data('status') is 0
document.title = v.titleTemplate.fetch document.title = v.titleTemplate.fetch $.extend {}, currentRoom,
title: $('#timsChatRoomList .active a').text() newMessageCount: ++newMessageCount
newMessageCount: ++newMessageCount
title = WCF.Language.get 'chat.general.notify.title' title = WCF.Language.get 'chat.general.notify.title'
content = "#{message.username}#{message.separator} #{message.message}" content = "#{message.username}#{message.separator} #{message.message}"
@ -650,7 +649,7 @@ Fetch the roomlist from the server and update it in the GUI.
for room in data.returnValues for room in data.returnValues
li = $ '<li></li>' li = $ '<li></li>'
li.addClass 'active' if room.active li.addClass 'active' if room.active
$("""<a href="#{room.link}">#{room.title}</a>""").addClass('timsChatRoom').data('roomID', room.roomID).appendTo li $("""<a href="#{room.link}">#{room.title} <span class="badge">#{WCF.String.formatNumeric room.userCount}</span></a>""").addClass('timsChatRoom').data('roomID', room.roomID).appendTo li
$('#timsChatRoomList ul').append li $('#timsChatRoomList ul').append li
if window.history?.replaceState? if window.history?.replaceState?
@ -825,8 +824,6 @@ And finally export the public methods and variables.
insertText: insertText insertText: insertText
freeTheFish: freeTheFish freeTheFish: freeTheFish
join: join join: join
closePrivateChannel: closePrivateChannel # TODO: REMOVE AFTER DEBUGGING
openPrivateChannel: openPrivateChannel # TODO: REMOVE AFTER DEBUGGING
listener: listener:
add: addListener add: addListener
remove: removeListener remove: removeListener

View File

@ -35,7 +35,7 @@ public function prune() {
WHERE WHERE
time < ?"; time < ?";
$stmt = \wcf\system\WCF::getDB()->prepareStatement($sql); $stmt = \wcf\system\WCF::getDB()->prepareStatement($sql);
$stmt->execute(array(TIME_NOW - CHAT_LOG_ARCHIVETIME)); $stmt->execute(array(TIME_NOW - CHAT_LOG_ARCHIVETIME * 60));
$objectIDs = array(); $objectIDs = array();
while ($objectID = $stmt->fetchColumn()) $objectIDs[] = $objectID; while ($objectID = $stmt->fetchColumn()) $objectIDs[] = $objectID;
@ -66,7 +66,7 @@ public function validateSend() {
$this->parameters['enableHTML'] = false; $this->parameters['enableHTML'] = false;
// validate text // validate text
if (\wcf\util\StringUtil::length($this->parameters['text']) > CHAT_MAX_LENGTH) throw new UserInputException('text', 'tooLong'); if (mb_strlen($this->parameters['text']) > CHAT_MAX_LENGTH) throw new UserInputException('text', 'tooLong');
// search for disallowed bbcodes // search for disallowed bbcodes
$disallowedBBCodes = \wcf\system\bbcode\BBCodeParser::getInstance()->validateBBCodes($this->parameters['text'], explode(',', WCF::getSession()->getPermission('user.chat.allowedBBCodes'))); $disallowedBBCodes = \wcf\system\bbcode\BBCodeParser::getInstance()->validateBBCodes($this->parameters['text'], explode(',', WCF::getSession()->getPermission('user.chat.allowedBBCodes')));

View File

@ -23,6 +23,13 @@ class Room extends \chat\data\CHATDatabaseObject implements \wcf\system\request\
*/ */
protected static $databaseTableIndexName = 'roomID'; protected static $databaseTableIndexName = 'roomID';
/**
* cached users
*
* @var array<\wcf\data\user\UserProfile>
*/
protected static $users = null;
/** /**
* @see \wcf\data\chat\room\ChatRoom::getTitle(); * @see \wcf\data\chat\room\ChatRoom::getTitle();
*/ */
@ -133,36 +140,27 @@ public function getTopic() {
return \wcf\system\WCF::getLanguage()->get($this->topic); return \wcf\system\WCF::getLanguage()->get($this->topic);
} }
/**
* Returns the number of users currently active in this room.
*
* @return integer
*/
public function countUsers() {
$sql = "SELECT
COUNT(*)
FROM
wcf".WCF_N."_user
WHERE
chatRoomID = ?";
$stmt = WCF::getDB()->prepareStatement($sql);
$stmt->execute(array($this->roomID));
return $stmt->fetchColumn();
}
/** /**
* Returns the users that are currently active in this room. * Returns the users that are currently active in this room.
* *
* @return \wcf\data\user\UserProfileList * @return array<\wcf\data\user\UserProfile>
*/ */
public function getUsers() { public function getUsers() {
$userList = new \wcf\data\user\UserProfileList(); if (self::$users === null) {
$userList->getConditionBuilder()->add('user_table.chatRoomID = ?', array($this->roomID)); $userList = new \wcf\data\user\UserProfileList();
$userList->getConditionBuilder()->add('user_table.chatRoomID IS NOT NULL', array());
$userList->readObjects();
$users = $userList->getObjects();
foreach ($users as $user) {
if (!isset(self::$users[$user->chatRoomID])) self::$users[$user->chatRoomID] = array();
self::$users[$user->chatRoomID][] = $user;
}
}
if (!isset(self::$users[$this->roomID])) self::$users[$this->roomID] = array();
$userList->readObjects(); return self::$users[$this->roomID];
return $userList;
} }
/** /**

View File

@ -149,7 +149,8 @@ public function getRoomList() {
'object' => $room 'object' => $room
)), )),
'roomID' => $room->roomID, 'roomID' => $room->roomID,
'active' => $room->roomID == $this->parameters['room']->roomID 'active' => $room->roomID == $this->parameters['room']->roomID,
'userCount' => count($room->getUsers())
); );
} }

View File

@ -147,7 +147,7 @@ public function readCommands() {
foreach ($files as $file) { foreach ($files as $file) {
$command = $regex->replace(basename($file), ''); $command = $regex->replace(basename($file), '');
if ($command == 'Plain') continue; if ($command == 'Plain') continue;
$this->commands[] = \wcf\util\StringUtil::toLowerCase($command); $this->commands[] = mb_strtolower($command);
} }
$this->commands = array_merge($this->commands, array_keys(\chat\system\command\CommandHandler::getAliasMap())); $this->commands = array_merge($this->commands, array_keys(\chat\system\command\CommandHandler::getAliasMap()));

View File

@ -46,7 +46,7 @@ class NewMessagesPage extends \wcf\page\AbstractPage {
/** /**
* All the users that are currently in the room $this->room. * All the users that are currently in the room $this->room.
* *
* @var array<\wcf\data\user\User> * @var array<\wcf\data\user\UserProfile>
*/ */
public $users = array(); public $users = array();
@ -114,7 +114,7 @@ public function show() {
$json['messages'][] = $message->jsonify(true); $json['messages'][] = $message->jsonify(true);
} }
\wcf\system\user\storage\UserStorageHandler::getInstance()->loadStorage(array_keys($this->users->getObjects())); \wcf\system\user\storage\UserStorageHandler::getInstance()->loadStorage(array_keys($this->users));
foreach ($this->users as $user) { foreach ($this->users as $user) {
$json['users'][] = array( $json['users'][] = array(

View File

@ -15,9 +15,4 @@ class CHATCore extends \wcf\system\application\AbstractApplication {
* @see wcf\system\application\AbstractApplication::$abbreviation * @see wcf\system\application\AbstractApplication::$abbreviation
*/ */
protected $abbreviation = 'chat'; protected $abbreviation = 'chat';
/**
* @see wcf\system\application\IApplication::__run()
*/
public function __run() {}
} }

View File

@ -97,7 +97,7 @@ public function getRoom() {
* @return string * @return string
*/ */
public function getParameters() { public function getParameters() {
$parts = explode(' ', StringUtil::substring($this->text, StringUtil::length(static::COMMAND_CHAR)), 2); $parts = explode(' ', mb_substr($this->text, mb_strlen(static::COMMAND_CHAR)), 2);
if (!isset($parts[1])) return ''; if (!isset($parts[1])) return '';
return $parts[1]; return $parts[1];
@ -107,7 +107,7 @@ public function getParameters() {
* Loads the command. * Loads the command.
*/ */
public function loadCommand() { public function loadCommand() {
$parts = explode(' ', StringUtil::substring($this->text, StringUtil::length(static::COMMAND_CHAR)), 2); $parts = explode(' ', mb_substr($this->text, mb_strlen(static::COMMAND_CHAR)), 2);
$class = '\chat\system\command\commands\\'.ucfirst(strtolower($parts[0])).'Command'; $class = '\chat\system\command\commands\\'.ucfirst(strtolower($parts[0])).'Command';
if (!class_exists($class)) { if (!class_exists($class)) {

View File

@ -1,7 +1,6 @@
<?php <?php
namespace chat\system\command\commands; namespace chat\system\command\commands;
use \wcf\system\WCF; use \wcf\system\WCF;
use \wcf\util\StringUtil;
/** /**
* Marks the user as away. * Marks the user as away.

View File

@ -1,6 +1,5 @@
<?php <?php
namespace chat\system\command\commands; namespace chat\system\command\commands;
use \wcf\util\StringUtil;
/** /**
* Changes the color of the username * Changes the color of the username
@ -18,27 +17,156 @@ class ColorCommand extends \chat\system\command\AbstractCommand {
* @var array<integer> * @var array<integer>
*/ */
public static $colors = array( public static $colors = array(
'red' => 0xFF0000, 'aliceblue' => 0xF0F8FF,
'blue' => 0x0000FF, 'antiquewhite' => 0xFAEBD7,
'green' => 0x00FF00, 'aqua' => 0x00FFFF,
'yellow' => 0xFFFF00, 'aquamarine' => 0x7FFFD4,
'black' => 0x000000, 'azure' => 0xF0FFFF,
'white' => 0xFFFFFF, 'beige' => 0xF5F5DC,
'orange' => 0xFFA500, 'bisque' => 0xFFE4C4,
'purple' => 0xA020F0, 'black' => 0x000000,
'weed' => 0xF5DEB3, 'blanchedalmond' => 0xFFEBCD,
'pink' => 0xFFC0CB, 'blue' => 0x0000FF,
'grey' => 0xBEBEBE, 'bluescreenblue' => 0x0000AA,
'khaki' => 0xF0E68C, 'blueviolet' => 0x8A2BE2,
'lavender' => 0xE6E6FA, 'brown' => 0xA52A2A,
'maroon' => 0xB03060, 'burlywood' => 0xDEB887,
'gold' => 0xFFD700, 'cadetblue' => 0x5F9EA0,
'navyblue' => 0x000080, 'chartreuse' => 0x7FFF00,
'royalblue' => 0x4169E1, 'chocolate' => 0xD2691E,
'aquamarine' => 0x7FFFD4, 'coral' => 0xFF7F50,
'cyan' => 0x00FFFF, 'cornflowerblue' => 0x6495ED,
'magenta' => 0x00FFFF, 'cornsilk' => 0xFFF8DC,
'oxford' => 0xF02D // looks like green 'crimson' => 0xDC143C,
'cyan' => 0x00FFFF,
'darkblue' => 0x00008B,
'darkcyan' => 0x008B8B,
'darkgoldenrod' => 0xB8860B,
'darkgray' => 0xA9A9A9,
'darkgrey' => 0xA9A9A9,
'darkgreen' => 0x006400,
'darkkhaki' => 0xBDB76B,
'darkmagenta' => 0x8B008B,
'darkolivegreen' => 0x556B2F,
'darkorange' => 0xFF8C00,
'darkorchid' => 0x9932CC,
'darkred' => 0x8B0000,
'darksalmon' => 0xE9967A,
'darkseagreen' => 0x8FBC8F,
'darkslateblue' => 0x483D8B,
'darkslategray' => 0x2F4F4F,
'darkslategrey' => 0x2F4F4F,
'darkturquoise' => 0x00CED1,
'darkviolet' => 0x9400D3,
'deeppink' => 0xFF1493,
'deepskyblue' => 0x00BFFF,
'dimgray' => 0x696969,
'dimgrey' => 0x696969,
'dodgerblue' => 0x1E90FF,
'firebrick' => 0xB22222,
'floralwhite' => 0xFFFAF0,
'forestgreen' => 0x228B22,
'fuchsia' => 0xFF00FF,
'gainsboro' => 0xDCDCDC,
'ghostwhite' => 0xF8F8FF,
'gold' => 0xFFD700,
'goldenrod' => 0xDAA520,
'gray' => 0x808080,
'grey' => 0x808080,
'green' => 0x008000,
'greenyellow' => 0xADFF2F,
'honeydew' => 0xF0FFF0,
'hotpink' => 0xFF69B4,
'indianred' => 0xCD5C5C,
'indigo' => 0x4B0082,
'ivory' => 0xFFFFF0,
'khaki' => 0xF0E68C,
'lavender' => 0xE6E6FA,
'lavenderblush' => 0xFFF0F5,
'lawngreen' => 0x7CFC00,
'lemonchiffon' => 0xFFFACD,
'lightblue' => 0xADD8E6,
'lightcoral' => 0xF08080,
'lightcyan' => 0xE0FFFF,
'lightgoldenrodyellow' => 0xFAFAD2,
'lightgray' => 0xD3D3D3,
'lightgrey' => 0xD3D3D3,
'lightgreen' => 0x90EE90,
'lightpink' => 0xFFB6C1,
'lightsalmon' => 0xFFA07A,
'lightseagreen' => 0x20B2AA,
'lightskyblue' => 0x87CEFA,
'lightslategray' => 0x778899,
'lightslategrey' => 0x778899,
'lightsteelblue' => 0xB0C4DE,
'lightyellow' => 0xFFFFE0,
'lime' => 0x00FF00,
'limegreen' => 0x32CD32,
'linen' => 0xFAF0E6,
'magenta' => 0xFF00FF,
'maroon' => 0x800000,
'mediumaquamarine' => 0x66CDAA,
'mediumblue' => 0x0000CD,
'mediumorchid' => 0xBA55D3,
'mediumpurple' => 0x9370D8,
'mediumseagreen' => 0x3CB371,
'mediumslateblue' => 0x7B68EE,
'mediumspringgreen' => 0x00FA9A,
'mediumturquoise' => 0x48D1CC,
'mediumvioletred' => 0xC71585,
'midnightblue' => 0x191970,
'mintcream' => 0xF5FFFA,
'mistyrose' => 0xFFE4E1,
'moccasin' => 0xFFE4B5,
'navajowhite' => 0xFFDEAD,
'navy' => 0x000080,
'oldlace' => 0xFDF5E6,
'olive' => 0x808000,
'olivedrab' => 0x6B8E23,
'orange' => 0xFFA500,
'orangered' => 0xFF4500,
'orchid' => 0xDA70D6,
'oxford' => 0xF02D, // looks like green
'palegoldenrod' => 0xEEE8AA,
'palegreen' => 0x98FB98,
'paleturquoise' => 0xAFEEEE,
'palevioletred' => 0xD87093,
'papayawhip' => 0xFFEFD5,
'peachpuff' => 0xFFDAB9,
'peru' => 0xCD853F,
'pink' => 0xFFC0CB,
'plum' => 0xDDA0DD,
'powderblue' => 0xB0E0E6,
'purple' => 0x800080,
'red' => 0xFF0000,
'rosybrown' => 0xBC8F8F,
'royalblue' => 0x4169E1,
'saddlebrown' => 0x8B4513,
'sadwin' => 0x2067B2,
'salmon' => 0xFA8072,
'sandybrown' => 0xF4A460,
'seagreen' => 0x2E8B57,
'seashell' => 0xFFF5EE,
'sienna' => 0xA0522D,
'silver' => 0xC0C0C0,
'skyblue' => 0x87CEEB,
'slateblue' => 0x6A5ACD,
'slategray' => 0x708090,
'slategrey' => 0x708090,
'snow' => 0xFFFAFA,
'springgreen' => 0x00FF7F,
'steelblue' => 0x4682B4,
'tan' => 0xD2B48C,
'teal' => 0x008080,
'thistle' => 0xD8BFD8,
'tomato' => 0xFF6347,
'turquoise' => 0x40E0D0,
'violet' => 0xEE82EE,
'wheat' => 0xF5DEB3,
'white' => 0xFFFFFF,
'whitesmoke' => 0xF5F5F5,
'yellow' => 0xFFFF00,
'yellowgreen' => 0x9ACD32
); );
public function __construct(\chat\system\command\CommandHandler $commandHandler) { public function __construct(\chat\system\command\CommandHandler $commandHandler) {

View File

@ -14,7 +14,7 @@ class FreeCommand extends MeCommand {
public function __construct(\chat\system\command\CommandHandler $commandHandler) { public function __construct(\chat\system\command\CommandHandler $commandHandler) {
parent::__construct($commandHandler); parent::__construct($commandHandler);
if (\wcf\util\StringUtil::toLowerCase($this->commandHandler->getParameters()) != 'the fish') { if (mb_strtolower($this->commandHandler->getParameters()) != 'the fish') {
throw new \InvalidArgumentException(); throw new \InvalidArgumentException();
} }

View File

@ -4,7 +4,6 @@
use \wcf\data\user\User; use \wcf\data\user\User;
use \wcf\system\WCF; use \wcf\system\WCF;
use \wcf\util\DateUtil; use \wcf\util\DateUtil;
use \wcf\util\StringUtil;
/** /**
* Shows information about the specified user. * Shows information about the specified user.

View File

@ -1,6 +1,5 @@
<?php <?php
namespace chat\system\command\commands; namespace chat\system\command\commands;
use \wcf\util\StringUtil;
/** /**
* Indicates an action. The message is shown without the colon. * Indicates an action. The message is shown without the colon.

View File

@ -1,7 +1,6 @@
<?php <?php
namespace chat\system\command\commands; namespace chat\system\command\commands;
use \wcf\system\WCF; use \wcf\system\WCF;
use \wcf\util\StringUtil;
/** /**
* Creates a temporary room * Creates a temporary room

View File

@ -1,5 +1,5 @@
<?php <?php
namespace chat\system\cronjob; namespace chat\system\event\listener;
use \chat\data; use \chat\data;
/** /**
@ -9,13 +9,13 @@
* @copyright 2010-2013 Tim Düsterhus * @copyright 2010-2013 Tim Düsterhus
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package be.bastelstu.chat * @package be.bastelstu.chat
* @subpackage system.cronjob * @subpackage system.event.listener
*/ */
class CleanupCronjob implements \wcf\system\cronjob\ICronjob { class HourlyCleanUpCronjobExecuteChatCleanUpListener implements \wcf\system\event\IEventListener {
/** /**
* @see wcf\system\ICronjob::execute() * @see \wcf\system\event\IEventListener::execute()
*/ */
public function execute(\wcf\data\cronjob\Cronjob $cronjob) { public function execute($eventObj, $className, $eventName) {
$messageAction = new data\message\MessageAction(array(), 'prune'); $messageAction = new data\message\MessageAction(array(), 'prune');
$messageAction->executeAction(); $messageAction->executeAction();
$roomAction = new data\room\RoomAction(array(), 'prune'); $roomAction = new data\room\RoomAction(array(), 'prune');

View File

@ -58,7 +58,7 @@ public static function getPackageID() {
* @return string * @return string
*/ */
public static function gradient($string, $start, $end) { public static function gradient($string, $start, $end) {
if (($length = \wcf\util\StringUtil::length($string)) === 0) return ''; if (($length = mb_strlen($string)) === 0) return '';
if ($start === $end) { if ($start === $end) {
return '<span style="color:rgb('.($start >> 16 & 255).','.($start >> 8 & 255).','.($start & 255).')">'.\wcf\util\StringUtil::encodeHTML($string).'</span>'; return '<span style="color:rgb('.($start >> 16 & 255).','.($start >> 8 & 255).','.($start & 255).')">'.\wcf\util\StringUtil::encodeHTML($string).'</span>';
@ -87,8 +87,8 @@ public static function gradient($string, $start, $end) {
*/ */
public static function str_split($string, $length = 1) { public static function str_split($string, $length = 1) {
$result = array(); $result = array();
for ($i = 0, $max = \wcf\util\StringUtil::length($string); $i < $max; $i += $length) { for ($i = 0, $max = mb_strlen($string); $i < $max; $i += $length) {
$result[] = \wcf\util\StringUtil::substring($string, $i, $length); $result[] = mb_substr($string, $i, $length);
} }
return $result; return $result;
} }

View File

@ -180,12 +180,9 @@
} }
ul { ul {
display: table;
width: 100%;
.timsChatMessage { .timsChatMessage {
display: table-row; min-height: 20px;
height: 20px; clear: both;
.transition(opacity, .2s); .transition(opacity, .2s);
&.unloaded { &.unloaded {
@ -227,8 +224,9 @@
> .text { > .text {
img { img {
max-width: 480px; max-width: 100%;
max-height: 320px; height: auto;
width: auto;
} }
} }
} }
@ -427,18 +425,8 @@
} }
@media only screen and (max-width: 800px) { @media only screen and (max-width: 800px) {
#timsChatMessageContainer { .timsChatMessage .text li > time, #smilies {
overflow: auto; display: none !important;
.timsChatMessage {
> time {
display: none !important;
}
> .usernameContainer {
min-width: 0px !important;
}
}
} }
} }

View File

@ -15,7 +15,7 @@ CREATE TABLE chat1_message (
username VARCHAR(255) DEFAULT NULL, username VARCHAR(255) DEFAULT NULL,
receiver INT(10) DEFAULT NULL, receiver INT(10) DEFAULT NULL,
time INT(10) NOT NULL, time INT(10) NOT NULL,
type TINYINT(3) NOT NULL DEFAULT 1, type TINYINT(3) NOT NULL DEFAULT 0,
message MEDIUMTEXT NOT NULL, message MEDIUMTEXT NOT NULL,
enableSmilies TINYINT(1) NOT NULL DEFAULT 1, enableSmilies TINYINT(1) NOT NULL DEFAULT 1,
enableHTML TINYINT(1) NOT NULL DEFAULT 0, enableHTML TINYINT(1) NOT NULL DEFAULT 0,

View File

@ -85,6 +85,8 @@
<item name="wcf.acp.option.chat_display_join_leave"><![CDATA[Join- und Leave-Nachrichten anzeigen]]></item> <item name="wcf.acp.option.chat_display_join_leave"><![CDATA[Join- und Leave-Nachrichten anzeigen]]></item>
<item name="wcf.acp.option.chat_display_join_leave.description"><![CDATA[Soll eine Nachricht angezeigt werden, wenn ein Nutzer den Chat betritt oder verlässt?]]></item> <item name="wcf.acp.option.chat_display_join_leave.description"><![CDATA[Soll eine Nachricht angezeigt werden, wenn ein Nutzer den Chat betritt oder verlässt?]]></item>
<item name="wcf.acp.option.chat_max_length"><![CDATA[Maximale Textlänge]]></item> <item name="wcf.acp.option.chat_max_length"><![CDATA[Maximale Textlänge]]></item>
<item name="wcf.acp.option.chat_command_aliases"><![CDATA[Befehls-Aliase]]></item>
<item name="wcf.acp.option.chat_command_aliases.description"><![CDATA[Geben Sie zeilenweise eine Kombination aus Alias und Zielbefehl an. Alias und Zielbefehl werden durch einen Doppelpunkt voneinander getrennt.]]></item>
<item name="wcf.acp.option.category.chat.log"><![CDATA[Protokoll]]></item> <item name="wcf.acp.option.category.chat.log"><![CDATA[Protokoll]]></item>
<item name="wcf.acp.option.chat_log_active"><![CDATA[Protokoll aktivieren]]></item> <item name="wcf.acp.option.chat_log_active"><![CDATA[Protokoll aktivieren]]></item>
@ -104,8 +106,16 @@
<item name="chat.error.notFound"><![CDATA[Der Befehl „{$exception->getCommand()}“ wurde nicht gefunden.]]></item> <item name="chat.error.notFound"><![CDATA[Der Befehl „{$exception->getCommand()}“ wurde nicht gefunden.]]></item>
<item name="chat.error.userNotFound"><![CDATA[Der Benutzer „{$exception->getUsername()}“ wurde nicht gefunden.]]></item> <item name="chat.error.userNotFound"><![CDATA[Der Benutzer „{$exception->getUsername()}“ wurde nicht gefunden.]]></item>
<item name="chat.error.permissionDenied"><![CDATA[Sie dürfen diesen Befehl nicht verwenden.]]></item> <item name="chat.error.permissionDenied"><![CDATA[Sie dürfen diesen Befehl nicht verwenden.]]></item>
<item name="chat.error.duplicateTab"><![CDATA[Der Chat wurde in einem weiteren Tab geöffnet.]]></item> <item name="chat.error.duplicateTab"><![CDATA[Sie haben den Chat in einem weiteren Browserfenster geöffnet. Diese Instanz wurde daher zur Vermeidung von Problemen deaktiviert.]]></item>
<item name="chat.error.join"><![CDATA[Der Chatraum konnte nicht betreten werden.]]></item> <item name="chat.error.join"><![CDATA[Es gibt Probleme den gewählten Chatraum zu betreten.]]></item>
<item name="chat.error.onMessageLoad"><![CDATA[Es gibt Probleme beim Laden neuer Nachrichten. Folgende Gründe können zu dieser Meldung führen:
<ul class="nativeList">
<li>Ihnen wurden die Zugriffsrechte auf den Raum genommen</li>
<li>Es gibt Probleme mit Ihrer Internetkonnektivität, die dazu führen, dass die Anfragen nicht durchgeführt werden können</li>
<li>Sie haben den Chat mehrmals geöffnet</li>
<li>Es gibt Probleme auf Seiten des Servers</li>
</ul>
Probieren Sie den Chat neu zu laden<!-- , bei Risiken und Nebenwirkungen fragen Sie ihren Arzt oder Administrator -->.]]></item>
<item name="chat.error.reload"><![CDATA[Neu laden]]></item> <item name="chat.error.reload"><![CDATA[Neu laden]]></item>
</category> </category>
@ -166,10 +176,10 @@
<item name="chat.message.4"><![CDATA[ist jetzt wieder da.]]></item> <item name="chat.message.4"><![CDATA[ist jetzt wieder da.]]></item>
<!-- 5 = TYPE_MODERATE --> <!-- 5 = TYPE_MODERATE -->
<item name="chat.message.5.restore"><![CDATA[hat {@$link} zurückgesetzt.]]></item> <item name="chat.message.5.restore"><![CDATA[hat {@$link} zurückgesetzt.]]></item>
<item name="chat.message.5.mute"><![CDATA[hat {@$link} bis {@$expires|plainTime} geknebelt{if !$reason|empty}: {$reason}{else}.{/if}]]></item> <item name="chat.message.5.mute"><![CDATA[hat {@$link} bis {@$expires|plainTime} geknebelt{if !$reason|empty}: {@$reason}{else}.{/if}]]></item>
<item name="chat.message.5.ban"><![CDATA[hat {@$link} bis {@$expires|plainTime} gebannt{if !$reason|empty}: {$reason}{else}.{/if}]]></item> <item name="chat.message.5.ban"><![CDATA[hat {@$link} bis {@$expires|plainTime} gebannt{if !$reason|empty}: {@$reason}{else}.{/if}]]></item>
<item name="chat.message.5.gmute"><![CDATA[hat {@$link} bis {@$expires|plainTime} global geknebelt{if !$reason|empty}: {$reason}{else}.{/if}]]></item> <item name="chat.message.5.gmute"><![CDATA[hat {@$link} bis {@$expires|plainTime} global geknebelt{if !$reason|empty}: {@$reason}{else}.{/if}]]></item>
<item name="chat.message.5.gban"><![CDATA[hat {@$link} bis {@$expires|plainTime} global gebannt{if !$reason|empty}: {$reason}{else}.{/if}]]></item> <item name="chat.message.5.gban"><![CDATA[hat {@$link} bis {@$expires|plainTime} global gebannt{if !$reason|empty}: {@$reason}{else}.{/if}]]></item>
<item name="chat.message.5.unmute"><![CDATA[hat {@$link} entknebelt.]]></item> <item name="chat.message.5.unmute"><![CDATA[hat {@$link} entknebelt.]]></item>
<item name="chat.message.5.unban"><![CDATA[hat {@$link} entbannt.]]></item> <item name="chat.message.5.unban"><![CDATA[hat {@$link} entbannt.]]></item>
<item name="chat.message.5.ungmute"><![CDATA[hat {@$link} global entknebelt.]]></item> <item name="chat.message.5.ungmute"><![CDATA[hat {@$link} global entknebelt.]]></item>

View File

@ -34,7 +34,7 @@
<instruction type="aclOption">aclOption.xml</instruction> <instruction type="aclOption">aclOption.xml</instruction>
<instruction type="acpMenu">acpMenu.xml</instruction> <instruction type="acpMenu">acpMenu.xml</instruction>
<instruction type="userGroupOption">userGroupOption.xml</instruction> <instruction type="userGroupOption">userGroupOption.xml</instruction>
<instruction type="cronjob">cronjob.xml</instruction> <instruction type="eventListener">eventListener.xml</instruction>
<instruction type="dashboardBox">dashboardBox.xml</instruction> <instruction type="dashboardBox">dashboardBox.xml</instruction>
<instruction type="script" run="standalone">acp/be.bastelstu.chat.install.php</instruction> <instruction type="script" run="standalone">acp/be.bastelstu.chat.install.php</instruction>
</instructions> </instructions>
@ -51,6 +51,7 @@
<instruction type="aclOption">aclOption.xml</instruction> <instruction type="aclOption">aclOption.xml</instruction>
<instruction type="acpMenu">acpMenu.xml</instruction> <instruction type="acpMenu">acpMenu.xml</instruction>
<instruction type="userGroupOption">userGroupOption.xml</instruction> <instruction type="userGroupOption">userGroupOption.xml</instruction>
<instruction type="eventListener">eventListener.xml</instruction>
<instruction type="dashboardBox">dashboardBox.xml</instruction> <instruction type="dashboardBox">dashboardBox.xml</instruction>
<instruction type="script" run="standalone">acp/be.bastelstu.chat.update.php</instruction> <instruction type="script" run="standalone">acp/be.bastelstu.chat.update.php</instruction>
</instructions> </instructions>

View File

@ -39,6 +39,7 @@
<ul> <ul>
<li><a href="http://www.wbbaddons.de/user/2020-noone/"{if EXTERNAL_LINK_TARGET_BLANK} target="_blank"{/if}>-noone-</a></li> <li><a href="http://www.wbbaddons.de/user/2020-noone/"{if EXTERNAL_LINK_TARGET_BLANK} target="_blank"{/if}>-noone-</a></li>
<li><a href="https://github.com/Gabbid"{if EXTERNAL_LINK_TARGET_BLANK} target="_blank"{/if}>Gabi</a></li> <li><a href="https://github.com/Gabbid"{if EXTERNAL_LINK_TARGET_BLANK} target="_blank"{/if}>Gabi</a></li>
<li>Alexandra Glass</li>
<li><a href="https://github.com/Leon-"{if EXTERNAL_LINK_TARGET_BLANK} target="_blank"{/if}>Stefan Hahn</a></li> <li><a href="https://github.com/Leon-"{if EXTERNAL_LINK_TARGET_BLANK} target="_blank"{/if}>Stefan Hahn</a></li>
<li><a href="http://www.wbbaddons.de"{if EXTERNAL_LINK_TARGET_BLANK} target="_blank"{/if}>Martin Schwendowius</a></li> <li><a href="http://www.wbbaddons.de"{if EXTERNAL_LINK_TARGET_BLANK} target="_blank"{/if}>Martin Schwendowius</a></li>
</ul> </ul>
@ -46,4 +47,4 @@
</dl> </dl>
</div> </div>
{/if} {/if}
{/if} {/if}

View File

@ -0,0 +1 @@
{if $__chat->isActiveApplication()}{if !$__wcf->getStyleHandler()->getStyle()->getPageLogo()}<img src="{$__wcf->getPath('chat')}images/chatLogo.png" style="width: 246px; height: 90px;" alt="" />{/if}{/if}

View File

@ -5,7 +5,7 @@
{include file='headInclude' sandbox=false} {include file='headInclude' sandbox=false}
{include file='javascriptInclude' application='chat'} {include file='javascriptInclude' application='chat'}
<script> <script data-relocate="true">
//<![CDATA[ //<![CDATA[
(function ($, window) { (function ($, window) {
$(function(){ $(function(){
@ -18,7 +18,7 @@
'chat.general.privateChannelTopic': '{lang}chat.general.privateChannelTopic{/lang}', 'chat.general.privateChannelTopic': '{lang}chat.general.privateChannelTopic{/lang}',
'chat.general.closePrivateChannel': '{lang}chat.general.closePrivateChannel{/lang}', 'chat.general.closePrivateChannel': '{lang}chat.general.closePrivateChannel{/lang}',
'chat.general.closeTopic': '{lang}chat.general.closeTopic{/lang}', 'chat.general.closeTopic': '{lang}chat.general.closeTopic{/lang}',
'chat.error.onMessageLoad': '{lang}chat.error.onMessageLoad{/lang}', 'chat.error.onMessageLoad': '{@"chat.error.onMessageLoad"|language|encodeJS}',
'chat.error.duplicateTab': '{lang}chat.error.duplicateTab{/lang}', 'chat.error.duplicateTab': '{lang}chat.error.duplicateTab{/lang}',
'chat.error.join': '{lang}chat.error.join{/lang}', 'chat.error.join': '{lang}chat.error.join{/lang}',
'chat.error.reload': '{lang}chat.error.reload{/lang}' 'chat.error.reload': '{lang}chat.error.reload{/lang}'

View File

@ -35,7 +35,7 @@
{@$roomList} {@$roomList}
</ul> </ul>
</div> </div>
<script> <script data-relocate="true">
//<![CDATA[ //<![CDATA[
(function($, window, undefined) { (function($, window, undefined) {
proxy = new WCF.Action.Proxy({ proxy = new WCF.Action.Proxy({

View File

@ -1,3 +1,3 @@
<script src="{$__wcf->getPath('chat')}js/be.bastelstu.Chat{if !ENABLE_DEBUG_MODE}.min{/if}.js?version={PACKAGE_VERSION|rawurlencode}"></script> <script data-relocate="true" src="{$__wcf->getPath('chat')}js/be.bastelstu.Chat{if !ENABLE_DEBUG_MODE}.min{/if}.js?version={PACKAGE_VERSION|rawurlencode}"></script>
<!--script src="{$__wcf->getPath('chat')}js/be.bastelstu.Chat.Log{if !ENABLE_DEBUG_MODE}.min{/if}.js?version={PACKAGE_VERSION|rawurlencode}"></script--> <!--script src="{$__wcf->getPath('chat')}js/be.bastelstu.Chat.Log{if !ENABLE_DEBUG_MODE}.min{/if}.js?version={PACKAGE_VERSION|rawurlencode}"></script-->
{event name='javascript'} {event name='javascript'}

View File

@ -12,24 +12,21 @@
<environment>user</environment> <environment>user</environment>
<templatename>header</templatename> <templatename>header</templatename>
<eventname>headerLogo</eventname> <eventname>headerLogo</eventname>
<templatecode><![CDATA[{if $__chat->isActiveApplication()}{if !$__wcf->getStyleHandler()->getStyle()->getPageLogo()}<img src="{$__wcf->getPath('chat')}images/chatLogo.png" style="width: 246px; height: 90px;" alt="" />{/if}{/if}]]></templatecode> <templatecode><![CDATA[{include file='__headerLogo' application='chat'}]]></templatecode>
</templatelistener> </templatelistener>
<templatelistener name="headerLogo"> <templatelistener name="headerLogo">
<environment>admin</environment> <environment>admin</environment>
<templatename>header</templatename> <templatename>header</templatename>
<eventname>headerLogo</eventname> <eventname>headerLogo</eventname>
<templatecode><![CDATA[{if $__chat->isActiveApplication()}<img src="{$__wcf->getPath('chat')}images/chatLogo.png" style="width: 246px; height: 90px;" alt="" />{/if}]]></templatecode> <templatecode><![CDATA[{include file='__headerLogo' application='chat'}]]></templatecode>
</templatelistener> </templatelistener>
<templatelistener name="softwareVersions"> <templatelistener name="softwareVersions">
<environment>admin</environment> <environment>admin</environment>
<templatename>index</templatename> <templatename>index</templatename>
<eventname>softwareVersions</eventname> <eventname>softwareVersions</eventname>
<templatecode><![CDATA[<dl> <templatecode><![CDATA[{include file='__softwareVersions' application='chat'}]]></templatecode>
<dt>{lang}wcf.acp.index.system.software.chatVersion{/lang}</dt>
<dd>{$__chat->getPackage()->packageVersion}</dd>
</dl>]]></templatecode>
</templatelistener> </templatelistener>
</import> </import>
</data> </data>