handleCommand is supposed to be void now; put back accidentally removed groupInfo

This commit is contained in:
technillogue 2021-04-25 20:00:20 -04:00
parent aef4115f1f
commit a803967920
3 changed files with 6 additions and 9 deletions

View file

@ -136,12 +136,10 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.security.SignatureException;

View file

@ -68,7 +68,7 @@ class InputReader implements Runnable {
// verbosity flag? better yet, json acknowledgement with timestamp or message id?
System.out.println("sentMessage '" + command.content + "' to " + command.recipient);
this.m.sendMessage(command.content, attachments, recipients);
} catch (AssertionError | EncapsulatedExceptions | AttachmentInvalidException | InvalidNumberException e) {
} catch (AssertionError | AttachmentInvalidException | InvalidNumberException e) {
System.err.println("error in sending message");
e.printStackTrace(System.out);
}
@ -99,7 +99,7 @@ public class StdioCommand implements LocalCommand {
}
@Override
public int handleCommand(final Namespace ns, final Manager m) {
public void handleCommand(final Namespace ns, final Manager m) {
boolean ignoreAttachments = ns.getBoolean("ignore_attachments");
InputReader reader = new InputReader(m);
Thread readerThread = new Thread(reader);
@ -111,16 +111,12 @@ public class StdioCommand implements LocalCommand {
ignoreAttachments,
ns.getBoolean("json") ? new JsonReceiveMessageHandler(m) : new ReceiveMessageHandler(m)
/*true*/);
return 0;
} catch (IOException e) {
System.err.println("Error while receiving messages: " + e.getMessage());
return 3;
} catch (AssertionError e) {
handleAssertionError(e);
return 1;
} finally {
reader.terminate();
}
}
}

View file

@ -72,6 +72,9 @@ class JsonDataMessage {
@JsonInclude(JsonInclude.Include.NON_NULL)
final List<JsonSharedContact> contacts;
@JsonProperty
@JsonInclude(JsonInclude.Include.NON_NULL)
final JsonGroupInfo groupInfo;
JsonDataMessage(SignalServiceDataMessage dataMessage, Manager m) {
this.timestamp = dataMessage.getTimestamp();
@ -116,7 +119,7 @@ class JsonDataMessage {
} else {
this.attachments = List.of();
}
/*if (dataMessage.getReaction().isPresent()) { // not sure if json reactions have been implemented elsewhere
/*if (dataMessage.getReaction().isPresent()) { // not sure if json reactions have been properly implemented elsewhere
final SignalServiceDataMessage.Reaction reaction = dataMessage.getReaction().get();
this.reaction = new JsonReaction(reaction);
this.emoji = reaction.getEmoji();