App-MatrixClient
view release on metacpan or search on metacpan
NAME
`App::MatrixClient' - a `Tickit'-based terminal UI client for Matrix
EMITTED SIGNALS
* start()
do_upload( file => $file, content_type => $type )
do_get_displayname( ?$user_id ) => $displayname
do_set_displayname( $displayname )
do_set_presence( $state, ?$msg )
do_add_alias( $alias, $room_id )
do_del_alias( $alias )
do_room_create( $name ) => $event
lib/App/MatrixClient.pm view on Meta::CPAN
use App::MatrixClient::Matrix;
=head1 NAME
C<App::MatrixClient> - a C<Tickit>-based terminal UI client for F<Matrix>
=head1 EMITTED SIGNALS
* start()
do_upload( file => $file, content_type => $type )
do_get_displayname( ?$user_id ) => $displayname
do_set_displayname( $displayname )
do_set_presence( $state, ?$msg )
do_add_alias( $alias, $room_id )
do_del_alias( $alias )
do_room_create( $name ) => $event
lib/App/MatrixClient/Matrix.pm view on Meta::CPAN
* on_user_displayname( $user, $oldname )
* on_user_presence( $user )
* on_room_new( $room )
* on_room_del( $room )
=head1 CONSUMED SIGNALS
start
* do_upload( file => $file, content_type => $type )
* do_get_displayname( ?$user_id ) => $displayname
* do_set_displayname( $displayname )
* do_set_presence( $state, ?$msg )
* do_add_alias( $alias, $room_id )
* do_del_alias( $alias )
* do_room_create( $name ) => $event
lib/App/MatrixClient/Matrix.pm view on Meta::CPAN
loop => $loop,
dist => $dist,
( map { $_ => $args{$_} } qw( user_id password ) ),
}, $class;
$dist->declare_signal( $_ ) for
qw( on_invite on_user_displayname on_user_presence on_room_new on_room_del );
$dist->declare_action( $_ ) for qw(
do_upload do_get_displayname do_set_displayname do_set_presence
do_add_alias do_del_alias
do_room_create do_room_join do_room_leave do_room_msg
);
$dist->subscribe_async( $_ => $self->${\"curry::$_"} ) for qw(
start
do_upload do_get_displayname do_set_displayname do_set_presence
do_add_alias do_del_alias
do_room_create do_room_join do_room_leave do_room_msg
);
$self->{matrix} = Net::Async::Matrix->new(
server => $args{server},
( $args{ssl} ? (
SSL => 1,
SSL_verify_mode => 0,
) : () ),
lib/App/MatrixClient/Matrix.pm view on Meta::CPAN
defined $self->{user_id} or
return Future->done;
print STDERR "Logging in as $self->{user_id}...\n";
$self->{matrix}->login(
map { $_ => $self->{$_} } qw( user_id password )
);
}
sub do_upload
{
my $self = shift;
my ( undef, %args ) = @_;
$self->{matrix}->upload(
file => $args{file},
content_type => $args{content_type},
);
}
sub do_get_displayname
{
my $self = shift;
my ( undef, $user_id ) = @_;
lib/App/MatrixClient/RoomTab.pm view on Meta::CPAN
$self->append_line( "File $file not found!" );
return Future->done;
}
my $exifTool = Image::ExifTool->new;
$exifTool->ImageInfo( $file );
my $content_type = $exifTool->GetValue( 'MIMEType' ) //
"application/octet-stream";
$dist->fire_async( do_upload => file => $file, content_type => $content_type )->then( sub {
my ( $uri ) = @_;
$room->send_message( type => "m.image", body => "image attachment",
url => $uri,
filename => $file,
info => {
size => $exifTool->GetValue( "FileSize", "ValueConv" ),
w => $exifTool->GetValue( "ImageWidth" ),
h => $exifTool->GetValue( "ImageHeight" ),
mimetype => $content_type,
lib/App/MatrixClient/RoomTab.pm view on Meta::CPAN
$self->append_line( "File $file not found!" );
return Future->done;
}
my $exifTool = Image::ExifTool->new;
$exifTool->ImageInfo( $file );
my $content_type = $exifTool->GetValue( "MIMEType" ) //
"application/octet-stream";
$dist->fire_async( do_upload => file => $file, content_type => $content_type )->then( sub {
my ( $uri ) = @_;
$room->send_message( type => "m.audio", body => "audio attachment",
url => $uri,
filename => $file,
info => {
size => $exifTool->GetValue( "FileSize", "ValueConv" ),
duration => int( $exifTool->GetValue( "Duration", "ValueConv" ) * 1000 ), # msec
mimetype => $content_type,
},
lib/App/MatrixClient/RoomTab.pm view on Meta::CPAN
$self->append_line( "File $file not found!" );
return Future->done;
}
my $exifTool = Image::ExifTool->new;
$exifTool->ImageInfo($file);
my $content_type = $exifTool->GetValue( "MIMEType" ) //
"application/octet-stream";
$dist->fire_async( do_upload => file => $file, content_type => $content_type )->then( sub {
my ( $uri ) = @_;
$room->send_message( type => "m.video", body => "video attachment",
url => $uri,
filename => $file,
info => {
size => $exifTool->GetValue( "FileSize", "ValueConv" ),
duration => int( $exifTool->GetValue( "Duration", "ValueConv" ) * 1000 ), # msec
w => $exifTool->GetValue( "ImageWidth" ),
h => $exifTool->GetValue( "ImageHeight" ),
lib/App/MatrixClient/RoomTab.pm view on Meta::CPAN
$self->append_line( "File $file not found!" );
return Future->done;
}
my $exifTool = Image::ExifTool->new;
$exifTool->ImageInfo($file);
my $content_type = $exifTool->GetValue( "MIMEType" ) //
"application/octet-stream";
$dist->fire_async( do_upload => file => $file, content_type => $content_type )->then( sub {
my ( $uri ) = @_;
$room->send_message( type => "m.file", body => "file attachment",
url => $uri,
filename => $file,
info => {
size => $exifTool->GetValue( "FileSize", "ValueConv" ),
mimetype => $content_type,
},
);
( run in 0.752 second using v1.01-cache-2.11-cpan-b16cb0d3907 )