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

Commit

Permalink
Parse PRIVMSGs sent from nicks containing an underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
unlobito committed Feb 5, 2013
1 parent 8658c0a commit a1d2359
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Phergie/Irc/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public function __construct()
$params = "(?P<params>$trailing?|(?:$middle{0,14}$trailing)|(?:$middle{0,15}))";
$name = "[$letter](?:[$letter$number\\-]*[$letter$number])?";
$host = "$name(?:\\.$name)+";
$nick = "(?:[$letter][$letter$number\\-\\[\\]\\\\`^{}]*)";
$nick = "(?:[$letter][$letter$number\\-\\[\\]\\\\`^{}\\_]*)";
$user = "(?:[^ $null$crlf]+)";
$prefix = "(?:(?P<servername>$host)|(?P<nick>$nick)(?:!(?P<user>$user))?(?:@$host)?)";
$message = "(?P<prefix>:$prefix )?$command$params$crlf";
Expand Down
13 changes: 13 additions & 0 deletions tests/Phergie/Irc/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,18 @@ public function dataProviderTestParse()
'targets' => array('Wiz'),
),
),

array(
"NICK :Wiz_\r\n",
array(
'command' => 'NICK',
'params' => array(
'nickname' => 'Wiz_',
'all' => 'Wiz_',
),
'targets' => array('Wiz_'),
),
),

array(
"NICK Wiz :1\r\n",
Expand Down Expand Up @@ -2161,6 +2173,7 @@ public function dataProviderTestParse()
),
),

// ACTION (CTCP Specification)
array(
":john!~jsmith@example.com PRIVMSG #test :\001ACTION test\001\r\n",
array(
Expand Down

0 comments on commit a1d2359

Please sign in to comment.