+
+ public static String getCaptchaRequiredMessage(final CaptchaRequiredException e, final boolean captchaProvided) {
+ String message;
+ if (!captchaProvided) {
+ message = """
+ Captcha required for verification, use --captcha CAPTCHA
+ To get the token, go to https://signalcaptchas.org/registration/generate.html
+ After solving the captcha, right-click on the "Open Signal" link and copy the link.""";
+ } else {
+ message = "Invalid captcha given.";
+ }
+ if (e.getNextAttemptTimestamp() > 0) {
+ message += "\nNext Captcha may be provided at " + DateUtils.formatTimestamp(e.getNextAttemptTimestamp());
+ }
+ return message;
+ }
+
+ public static String getRateLimitMessage(final RateLimitException e) {
+ String message = "Rate limit reached";
+ if (e.getNextAttemptTimestamp() > 0) {
+ message += "\nNext attempt may be tried at " + DateUtils.formatTimestamp(e.getNextAttemptTimestamp());
+ }
+ return message;
+ }
+
+ public static ReceiveConfig getReceiveConfig(final Namespace ns) {
+ final var ignoreAttachments = Boolean.TRUE.equals(ns.getBoolean("ignore-attachments"));
+ final var ignoreStories = Boolean.TRUE.equals(ns.getBoolean("ignore-stories"));
+ final var sendReadReceipts = Boolean.TRUE.equals(ns.getBoolean("send-read-receipts"));
+
+ return new ReceiveConfig(ignoreAttachments, ignoreStories, sendReadReceipts);
+ }