Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Commit

Permalink
Merge pull request #42 from iwalkalone69/master
Browse files Browse the repository at this point in the history
Allowing ~ character in nicks. It is allowed in some networks.
  • Loading branch information
svpernova09 committed Mar 7, 2016
2 parents cec7ec2 + b80e6c1 commit 2bf9e62
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public function __construct()
$crlf = "\r\n";
$letter = 'a-zA-Z';
$number = '0-9';
$special = preg_quote('[]\`_^{|}');
$special = preg_quote('[]\`_^{|}~');
$null = '\\x00';
$command = "(?P<command>[$letter]+|[$number]{3})";
$middle = "(?: [^ $null$crlf:][^ $null$crlf]*)";
Expand Down
45 changes: 45 additions & 0 deletions tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,19 @@ public function dataProviderTestParse()
'targets' => array('Wiz_'),
),
),

// Nick with ~ character allowed
array(
"NICK :Incredible~\r\n",
array(
'command' => 'NICK',
'params' => array(
'nickname' => 'Incredible~',
'all' => ':Incredible~',
),
'targets' => array('Incredible~'),
),
),

array(
"NICK Wiz :1\r\n",
Expand Down Expand Up @@ -525,6 +538,22 @@ public function dataProviderTestParse()
),
),

// Testing nicks with ~
array(
"MODE #Finnish +o :Kilroy~\r\n",
array(
'command' => 'MODE',
'params' => array(
'channel' => '#Finnish',
'mode' => '+o',
'params' => 'Kilroy~',
'user' => 'Kilroy~',
'all' => '#Finnish +o :Kilroy~',
),
'targets' => array('#Finnish'),
),
),

array(
"MODE #Finnish +v :Wiz\r\n",
array(
Expand Down Expand Up @@ -1165,6 +1194,22 @@ public function dataProviderTestParse()
),
),

// Test nicks with ~
array(
":Angel~ PRIVMSG Wiz~ :Hello are you receiving this message ?\r\n",
array(
'prefix' => ':Angel~',
'nick' => 'Angel~',
'command' => 'PRIVMSG',
'params' => array(
'receivers' => 'Wiz~',
'text' => 'Hello are you receiving this message ?',
'all' => 'Wiz~ :Hello are you receiving this message ?',
),
'targets' => array('Wiz~'),
),
),

array(
"PRIVMSG Angel :yes I'm receiving it !receiving it !'u>(768u+1n) .br\r\n",
array(
Expand Down

0 comments on commit 2bf9e62

Please sign in to comment.