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

@ -363,8 +363,14 @@ uploadStickerPack(stickerPackPath<s>) -> url<s>::
Exception: Failure Exception: Failure
== Signals submitRateLimitChallenge(challenge<s>, captcha<s>) -> <>::
* challenge : The challenge token taken from the proof required error.
* captcha : The captcha token from the solved captcha on the Signal website..
Can be used to lift some rate-limits by solving a captcha.
Exception: IOErrorException
== Signalss
SyncMessageReceived (timestamp<x>, sender<s>, destination<s>, groupId<ay>,message<s>, attachments<as>):: SyncMessageReceived (timestamp<x>, sender<s>, destination<s>, groupId<ay>,message<s>, attachments<as>)::
The sync message is received when the user sends a message from a linked device. The sync message is received when the user sends a message from a linked device.

View file

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

View file

@ -1,7 +1,9 @@
package org.asamk.signal.dbus; package org.asamk.signal.dbus;
import org.asamk.Signal; import org.asamk.Signal;
import org.asamk.Signal.Error;
import org.asamk.signal.BaseConfig; import org.asamk.signal.BaseConfig;
import org.asamk.signal.commands.exceptions.IOErrorException;
import org.asamk.signal.manager.AttachmentInvalidException; import org.asamk.signal.manager.AttachmentInvalidException;
import org.asamk.signal.manager.Manager; import org.asamk.signal.manager.Manager;
import org.asamk.signal.manager.NotMasterDeviceException; import org.asamk.signal.manager.NotMasterDeviceException;
@ -81,6 +83,18 @@ public class DbusSignalImpl implements Signal {
return m.getSelfNumber(); 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 @Override
public void addDevice(String uri) { public void addDevice(String uri) {
try { try {