diff --git a/src/controller/room.php b/src/controller/room.php index f6432d2..4b420ef 100644 --- a/src/controller/room.php +++ b/src/controller/room.php @@ -536,20 +536,22 @@ class Room return null; } + // Set timestamp + $time = isset($transaction['time']) ? $transaction['time'] : time(); + + // Set default username + $user = $this->_config->kevachat->user->name->guest; + // Detect username (key @postfix) if (preg_match('/@([^@]+)$/', $data['key'], $match)) { - $user = $match[1]; - } - - else - { - $user = $this->_config->kevachat->user->name->guest; + // Set username on match node settings + if (preg_match($this->_config->kevachat->user->name->regex, $match[1])) + { + $user = $match[1]; + } } - // Return timestamp - $time = isset($transaction['time']) ? $transaction['time'] : time(); - // Is raw field request if ($field) {