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 #36 from rpasing/master
Browse files Browse the repository at this point in the history
Added support to send a MODE command without mode
  • Loading branch information
elazar committed Jul 16, 2015
2 parents 9c2e1d0 + a843d57 commit 29fd291
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public function __construct()
'SQUIT' => "/^(?:(?P<server>$middle)(?P<comment>$trailing))$/",
'JOIN' => "/^(?:(?P<channels>$middle|$trailing)(?P<keys>$trailing)?)$/",
'PART' => "/^(?:(?P<channels>$middle|$trailing)(?P<message>$trailing)?)$/",
'MODE' => "/^(?:(?P<target>$middle)(?P<mode>$middle|$trailing)(?P<params>$trailing)?)$/",
'MODE' => "/^(?:(?P<target>$middle|$trailing)(?P<mode>$middle|$trailing)?(?P<params>$trailing)?)$/",
'TOPIC' => "/^(?:(?P<channel>$middle|$trailing)(?P<topic>$trailing)?)$/",
'NAMES' => "/^(?:(?P<channels>$trailing))$/",
'LIST' => "/^(?:(?:(?P<channels>$trailing)|$middle)?(?P<server>$trailing)?)$/",
Expand Down Expand Up @@ -367,7 +367,7 @@ public function parse($message)
* only one channel mode is being set.
* This functionality is DEPRECATED, and will not occur if more than one
* channel mode is being set. Use $params['params'] instead. */
if (strlen($params['mode']) == 2 && isset($params['params'])) {
if (isset($params['mode']) && strlen($params['mode']) == 2 && isset($params['params'])) {
switch ($params['mode']{1}) {
case 'l':
$params['limit'] = $params['params'];
Expand Down
12 changes: 12 additions & 0 deletions tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,18 @@ public function dataProviderTestParse()
),
),

array(
"MODE :#channel\r\n",
array(
'command' => 'MODE',
'params' => array(
'channel' => '#channel',
'all' => ':#channel',
),
'targets' => array('#channel'),
),
),

// TOPIC (RFC 1459 Section 4.2.4)
array(
":Wiz TOPIC #test :New topic\r\n",
Expand Down

0 comments on commit 29fd291

Please sign in to comment.