Support changing join_rules

tags/patrix-0.1.4-1
Daniel Berteaud 7 years ago
parent 7a6899489e
commit 4785d79710
  1. 15
      scripts/patrix

@ -30,6 +30,7 @@ GetOptions(
"name=s" => \$opt->{name}, "name=s" => \$opt->{name},
"alias=s" => \$opt->{alias}, "alias=s" => \$opt->{alias},
"topic=s" => \$opt->{topic}, "topic=s" => \$opt->{topic},
"join_rules=s" => \$opt->{join_rules},
"federation!" => \$opt->{federation} "federation!" => \$opt->{federation}
); );
@ -291,6 +292,20 @@ sub modify_room {
die "Error changing topic of room $opt->{room}\n" die "Error changing topic of room $opt->{room}\n"
unless ($resp->is_success); unless ($resp->is_success);
} }
# Changing joining rules
if ($opt->{join_rules}){
$uri = $opt->{server} . '/_matrix/client/r0/rooms/' . $opt->{room} . '/state/m.room.join_rules?access_token=' . $opt->{access_token};
$json = {
join_rules => $opt->{join_rules}
};
$resp = send_request({
method => 'PUT',
uri => $uri,
content => to_json($json)
});
die "Error changing joining rules of room $opt->{room}\n"
unless ($resp->is_success);
}
# New invitees should be added # New invitees should be added
if ($opt->{invite}){ if ($opt->{invite}){
$uri = $opt->{server} . '/_matrix/client/r0/rooms/' . $opt->{room} . '/invite?access_token=' . $opt->{access_token}; $uri = $opt->{server} . '/_matrix/client/r0/rooms/' . $opt->{room} . '/invite?access_token=' . $opt->{access_token};

Loading…
Cancel
Save