Add some debug statements in modify_room

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

@ -252,6 +252,7 @@ sub modify_room {
my ($uri,$req,$json,$resp); my ($uri,$req,$json,$resp);
# A new alias should be added # A new alias should be added
if ($opt->{alias}){ if ($opt->{alias}){
debug('Adding ' . $opt->{alias} . ' as a room alias');
$uri = $opt->{server} . '/_matrix/client/r0/directory/room/' . uri_escape($opt->{alias}) . '?access_token=' . $opt->{access_token}; $uri = $opt->{server} . '/_matrix/client/r0/directory/room/' . uri_escape($opt->{alias}) . '?access_token=' . $opt->{access_token};
$json = { $json = {
room_id => $opt->{room} room_id => $opt->{room}
@ -266,6 +267,7 @@ sub modify_room {
} }
# The name of the room is being updated # The name of the room is being updated
if ($opt->{name}){ if ($opt->{name}){
debug('Changing the room name to ' . $opt->{name});
$uri = $opt->{server} . '/_matrix/client/r0/rooms/' . $opt->{room} . '/state/m.room.name?access_token=' . $opt->{access_token}; $uri = $opt->{server} . '/_matrix/client/r0/rooms/' . $opt->{room} . '/state/m.room.name?access_token=' . $opt->{access_token};
$json = { $json = {
name => $opt->{name} name => $opt->{name}
@ -280,6 +282,7 @@ sub modify_room {
} }
# The topic is being updated # The topic is being updated
if ($opt->{topic}){ if ($opt->{topic}){
debug('Changing the room topic to ' . $opt->{topic});
$uri = $opt->{server} . '/_matrix/client/r0/rooms/' . $opt->{room} . '/state/m.room.topic?access_token=' . $opt->{access_token}; $uri = $opt->{server} . '/_matrix/client/r0/rooms/' . $opt->{room} . '/state/m.room.topic?access_token=' . $opt->{access_token};
$json = { $json = {
topic => $opt->{topic} topic => $opt->{topic}
@ -294,6 +297,7 @@ sub modify_room {
} }
# Changing joining rules # Changing joining rules
if ($opt->{join_rules}){ if ($opt->{join_rules}){
debug('Changing the joining rules to '. $opt->{join_rules});
$uri = $opt->{server} . '/_matrix/client/r0/rooms/' . $opt->{room} . '/state/m.room.join_rules?access_token=' . $opt->{access_token}; $uri = $opt->{server} . '/_matrix/client/r0/rooms/' . $opt->{room} . '/state/m.room.join_rules?access_token=' . $opt->{access_token};
$json = { $json = {
join_rules => $opt->{join_rules} join_rules => $opt->{join_rules}
@ -308,6 +312,7 @@ sub modify_room {
} }
# New invitees should be added # New invitees should be added
if ($opt->{invite}){ if ($opt->{invite}){
debug('Inviting ' . join(',', @{$opt->{invite}}) . ' to join the room');
$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};
foreach my $invite (@{$opt->{invite}}){ foreach my $invite (@{$opt->{invite}}){
$json = { $json = {

Loading…
Cancel
Save