-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Can negotiate IRCv3 capabilities #444
- Loading branch information
Jan Henning Thorsen
committed
Nov 21, 2020
1 parent
0956428
commit 66875fb
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!perl | ||
BEGIN { $ENV{CONVOS_SKIP_CONNECT} = 1 } | ||
use lib '.'; | ||
use t::Helper; | ||
use t::Server::Irc; | ||
use Convos::Core; | ||
use Convos::Core::Backend::File; | ||
|
||
my $server = t::Server::Irc->new->start; | ||
my $core = Convos::Core->new; | ||
my $user = $core->user({email => '[email protected]'}); | ||
$user->save_p->$wait_success; | ||
|
||
note 'external'; | ||
my $connection = $user->connection({name => 'example', protocol => 'irc'}); | ||
$connection->url->userinfo('superwoman:superduper'); | ||
$connection->save_p->$wait_success; | ||
|
||
$server->client($connection)->server_event_ok('_irc_event_cap')->server_event_ok('_irc_event_nick') | ||
->server_write_ok(":example CAP * LS * :account-notify away-notify chghost extended-join\r\n") | ||
->server_write_ok(":example CAP * LS :invite-notify multi-prefix sasl userhost-in-names\r\n") | ||
->client_event_ok('_irc_event_cap')->server_event_ok('_irc_event_cap') | ||
->server_write_ok( | ||
"example 900 superwoman superwoman!superwoman\@localhost superwoman :You are now logged in as superwoman\r\n" | ||
)->server_write_ok(['welcome.irc'])->client_event_ok('_irc_event_rpl_welcome') | ||
->process_ok('capabilities handshake'); | ||
|
||
is_deeply $connection->TO_JSON->{me}, | ||
{ | ||
nick => 'superman', | ||
capabilities => { | ||
'account-notify' => true, | ||
'away-notify' => true, | ||
'chghost' => true, | ||
'extended-join' => true, | ||
'invite-notify' => true, | ||
'multi-prefix' => true, | ||
'sasl' => true, | ||
'userhost-in-names' => true, | ||
}, | ||
}, | ||
'got capabilities'; | ||
|
||
done_testing; |