implement DBus submitRateLimitChallenge method (#763)

update documentation
This commit is contained in:
John Freed 2021-10-07 07:46:15 +02:00 committed by GitHub
parent 26594dd0ee
commit d4838bd646
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 1 deletions

View file

@ -1,5 +1,7 @@
package org.asamk;
import org.asamk.signal.commands.exceptions.IOErrorException;
import org.freedesktop.dbus.DBusPath;
import org.freedesktop.dbus.annotations.DBusProperty;
import org.freedesktop.dbus.exceptions.DBusException;
@ -141,6 +143,8 @@ public interface Signal extends DBusInterface {
String uploadStickerPack(String stickerPackPath) throws Error.Failure;
void submitRateLimitChallenge(String challenge, String captchaString) throws IOErrorException;
class MessageReceived extends DBusSignal {
private final long timestamp;

View file

@ -1,7 +1,9 @@
package org.asamk.signal.dbus;
import org.asamk.Signal;
import org.asamk.Signal.Error;
import org.asamk.signal.BaseConfig;
import org.asamk.signal.commands.exceptions.IOErrorException;
import org.asamk.signal.manager.AttachmentInvalidException;
import org.asamk.signal.manager.Manager;
import org.asamk.signal.manager.NotMasterDeviceException;
@ -81,6 +83,18 @@ public class DbusSignalImpl implements Signal {
return m.getSelfNumber();
}
@Override
public void submitRateLimitChallenge(String challenge, String captchaString) throws IOErrorException {
final var captcha = captchaString == null ? null : captchaString.replace("signalcaptcha://", "");
try {
m.submitRateLimitRecaptchaChallenge(challenge, captcha);
} catch (IOException e) {
throw new IOErrorException("Submit challenge error: " + e.getMessage(), e);
}
}
@Override
public void addDevice(String uri) {
try {