mirror of https://github.com/dani/patrix.git
Compare commits
14 Commits
patrix-0.1
...
master
Author | SHA1 | Date |
---|---|---|
Daniel Berteaud | 0c3d8eb501 | |
Daniel Berteaud | 5eceadb587 | |
Daniel Berteaud | 90f43a6ce6 | |
Allegiance Zone pusher | 0fb7bf849e | |
Daniel Berteaud | 2ea3589c4c | |
Daniel Berteaud | 8fad3895b1 | |
Daniel Berteaud | 63152190a8 | |
Daniel Berteaud | 1fc700a56e | |
Daniel Berteaud | 5aec50e85e | |
Daniel Berteaud | d757280823 | |
Daniel Berteaud | 27581dec38 | |
Daniel Berteaud | 75131a5222 | |
Daniel Berteaud | f79d98b75c | |
Daniel Berteaud | cb688ca984 |
|
@ -1 +1 @@
|
|||
0.1.9-1 ./
|
||||
0.1.16-1 ./
|
||||
|
|
27
patrix.spec
27
patrix.spec
|
@ -1,5 +1,5 @@
|
|||
Name: patrix
|
||||
Version: 0.1.9
|
||||
Version: 0.1.16
|
||||
Release: 1%{?dist}
|
||||
Summary: Command line client for Matrix
|
||||
|
||||
|
@ -23,6 +23,7 @@ Requires: perl(URI::Escape)
|
|||
Requires: perl(Term::ReadKey)
|
||||
Requires: perl(Hash::Merge::Simple)
|
||||
Requires: perl(Scalar::Util)
|
||||
Requires: perl(HTML::Strip)
|
||||
|
||||
%description
|
||||
Patrix is a simple (and quite limited) client for the Matrix communication network
|
||||
|
@ -52,6 +53,30 @@ room via the command line.
|
|||
%{_bindir}/patrix
|
||||
|
||||
%changelog
|
||||
* Mon Feb 13 2023 Daniel Berteaud <dbd@ehtrace.com> 0.1.16-1
|
||||
- Add HTML::Strip to Required (dbd@ehtrace.com)
|
||||
- Add HTML::Strip and always support HTML messages (imagotrigger@gmail.com)
|
||||
|
||||
* Tue Jul 26 2022 Daniel Berteaud <dbd@ehtrace.com> 0.1.15-1
|
||||
- Resign with new key
|
||||
|
||||
* Tue Jan 11 2022 Daniel Berteaud <dbd@ehtrace.com> 0.1.14-1
|
||||
- Release bump for rebuild
|
||||
|
||||
* Mon Jan 03 2022 Daniel Berteaud <dbd@ehtrace.com> 0.1.13-1
|
||||
- Check config readability and global /etc/patrixrc (dbd@ehtrace.com)
|
||||
|
||||
* Thu Dec 09 2021 Daniel Berteaud <dani@lapiole.org> 0.1.12-1
|
||||
- Revert requiring LWP::Protocol::connect (dani@lapiole.org)
|
||||
|
||||
* Wed Dec 08 2021 Daniel Berteaud <dani@lapiole.org> 0.1.11-1
|
||||
- Rebuild with new key
|
||||
|
||||
* Wed Nov 28 2018 Daniel Berteaud <daniel@firewall-services.com> 0.1.10-1
|
||||
- Require LWP::Protocol::connect for EL distro (daniel@firewall-services.com)
|
||||
- USe LWP::Protocol::connect to handle https proxy if available
|
||||
(daniel@firewall-services.com)
|
||||
|
||||
* Thu Feb 22 2018 Daniel Berteaud <daniel@firewall-services.com> 0.1.9-1
|
||||
- Support using an HTTP proxy (daniel@firewall-services.com)
|
||||
|
||||
|
|
|
@ -15,8 +15,10 @@ use URI::Escape;
|
|||
use Term::ReadKey;
|
||||
use Hash::Merge::Simple qw(merge);
|
||||
use Scalar::Util qw(looks_like_number);
|
||||
use HTML::Strip;
|
||||
|
||||
our $opt;
|
||||
our $hs = HTML::Strip->new();
|
||||
|
||||
GetOptions(
|
||||
"user=s" => \$opt->{user},
|
||||
|
@ -52,13 +54,29 @@ GetOptions(
|
|||
"perm_reset|reset-permission" => \$opt->{perm_reset}
|
||||
);
|
||||
|
||||
if (-e File::HomeDir->my_home . "/.patrixrc" && !$opt->{conf}){
|
||||
$opt->{conf} = File::HomeDir->my_home . "/.patrixrc";
|
||||
debug("Using default config file $opt->{conf}");
|
||||
if (!$opt->{conf}){
|
||||
# Read global config if it exists and is readable
|
||||
if (-f '/etc/patrixrc' && open(CONFIG, '<', '/etc/patrixrc')){
|
||||
$opt->{conf} = '/etc/patrixrc';
|
||||
close CONFIG;
|
||||
debug("Using global config file $opt->{conf}");
|
||||
}
|
||||
|
||||
# If there's a user defined config, use it instead
|
||||
if (-f File::HomeDir->my_home . "/.patrixrc" && open(CONFIG, '<', File::HomeDir->my_home . "/.patrixrc")){
|
||||
$opt->{conf} = File::HomeDir->my_home . "/.patrixrc";
|
||||
close CONFIG;
|
||||
debug("Using default config file $opt->{conf}");
|
||||
}
|
||||
}
|
||||
|
||||
if ($opt->{conf} && -e $opt->{conf}){
|
||||
read_conf();
|
||||
}
|
||||
else {
|
||||
die "No configuration found.\nYou should either create one in ~/.patrixrc " .
|
||||
"or give the path of a custom config with --config /path/to/patrixrc";
|
||||
}
|
||||
|
||||
# alias for --action=foo is --foo
|
||||
my @actions = qw(
|
||||
|
@ -83,13 +101,16 @@ foreach my $action (@actions){
|
|||
|
||||
my $lwp = LWP::UserAgent->new;
|
||||
|
||||
if (not $opt->{proxy} and defined $ENV{https_proxy}){
|
||||
$opt->{proxy} = $ENV{https_proxy};
|
||||
}
|
||||
# If a proxy is specified then use it. Else, try to get global one
|
||||
if ($opt->{proxy}){
|
||||
if (eval { require LWP::Protocol::connect; }){
|
||||
$opt->{proxy} =~ s|^http://(.*)|connect://$1|;
|
||||
}
|
||||
$lwp->proxy(['https'], $opt->{proxy});
|
||||
}
|
||||
else{
|
||||
$lwp->env_proxy;
|
||||
}
|
||||
|
||||
my $stdin = 0;
|
||||
if (!-t STDIN){
|
||||
|
@ -237,8 +258,12 @@ sub send_msg {
|
|||
}
|
||||
my $json = {
|
||||
msgtype => ($opt->{action} eq 'send-notice') ? 'm.notice' : 'm.text',
|
||||
body => $opt->{message}
|
||||
body => $hs->parse($opt->{message}),
|
||||
formatted_body => $opt->{message},
|
||||
format => "org.matrix.custom.html",
|
||||
};
|
||||
$hs->eof();
|
||||
|
||||
# If we send code, we have to format it correctly
|
||||
if ($opt->{action} eq 'send-code'){
|
||||
$json->{formatted_body} = '<pre><code>' . $opt->{message} . '</code></pre>';
|
||||
|
|
Loading…
Reference in New Issue