Don't die if we try to invite a user which has already been invited

tags/patrix-0.1.4-1
Daniel Berteaud 7 years ago
parent a6b917b34f
commit 7a6899489e
  1. 12
      scripts/patrix

@ -302,9 +302,15 @@ sub modify_room {
uri => $uri, uri => $uri,
content => to_json($json) content => to_json($json)
}); });
# TODO: just warn if already invited unless ($resp->is_success){
die "Error inviting user $invite in room $opt->{room}\n" my $error = from_json($resp->decoded_content);
unless ($resp->is_success); if ($error->{error} eq $invite . ' is already in the room.' && $error->{errcode} eq 'M_FORBIDDEN'){
debug($invite . 'has already been invited in this room, ignoring');
}
else{
die "Error inviting user $invite in room $opt->{room}\n";
}
}
} }
} }
} }

Loading…
Cancel
Save