diff --git a/src/main/java/org/asamk/signal/Main.java b/src/main/java/org/asamk/signal/Main.java index 8aede3d6..4e0fc3b8 100644 --- a/src/main/java/org/asamk/signal/Main.java +++ b/src/main/java/org/asamk/signal/Main.java @@ -403,7 +403,7 @@ public class Main { if (ns.getString("group") != null) { groupId = decodeGroupId(ns.getString("group")); } - byte[] newGroupId = m.sendUpdateGroupMessage(groupId, ns.getString("name"), ns.getList("member"), ns.getString("avatar")); + byte[] newGroupId = m.sendUpdateGroupMessage(groupId, ns.getString("name"), ns.getList("member"), ns.getString("avatar"), ns.getString("quit")!=null); if (groupId == null) { System.out.println("Creating new group \"" + Base64.encodeBytes(newGroupId) + "\" …"); } @@ -504,7 +504,7 @@ public class Main { .help("Show package version.") .action(Arguments.version()); parser.addArgument("--config") - .help("Set the path, where to store the config (Default: $HOME/.config/signal-cli)."); + .help("Set the path, where to store the config (Default: $HOME/.config/signal)."); MutuallyExclusiveGroup mut = parser.addMutuallyExclusiveGroup(); mut.addArgument("-u", "--username") @@ -550,7 +550,7 @@ public class Main { Subparser parserSend = subparsers.addParser("send"); parserSend.addArgument("-g", "--group") - .help("Specify the recipient group ID."); + .help("Specify the recipient group ID. If '-m' parameter is not present the messag is read from STDIN and yuo have to type CTRL+D (aka EOF) in order to stop reading and sending the content"); parserSend.addArgument("recipient") .help("Specify the recipients' phone number.") .nargs("*"); @@ -575,6 +575,9 @@ public class Main { .help("Specify the new group name."); parserUpdateGroup.addArgument("-a", "--avatar") .help("Specify a new group avatar image file"); + parserUpdateGroup.addArgument("-q", "--quit") + .help("Quit from the group") + .action(Arguments.storeTrue()); parserUpdateGroup.addArgument("-m", "--member") .nargs("*") .help("Specify one or more members to add to the group"); diff --git a/src/main/java/org/asamk/signal/Manager.java b/src/main/java/org/asamk/signal/Manager.java index 6295f730..456fd84a 100644 --- a/src/main/java/org/asamk/signal/Manager.java +++ b/src/main/java/org/asamk/signal/Manager.java @@ -63,8 +63,16 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; class Manager implements Signal { - private final static String URL = "https://textsecure-service.whispersystems.org"; - private final static TrustStore TRUST_STORE = new WhisperTrustStore(); + // private final static String URL = "https://10.1.4.252:8080"; + // private final static TrustStore TRUST_STORE = new TenOneFourTwohundredfiftyfourTrustStore(); + + // private final static String URL = "https://127.0.0.1:8080"; + // private final static TrustStore TRUST_STORE = new LoopbackTrustStore(); + + private final static String URL = "https://signal.sinesy.it:8080"; + private final static TrustStore TRUST_STORE = new SinesyTrustStore(); + //private final static String URL = "https://textsecure-service.whispersystems.org"; + //private final static TrustStore TRUST_STORE = new WhisperTrustStore(); public final static String PROJECT_NAME = Manager.class.getPackage().getImplementationTitle(); public final static String PROJECT_VERSION = Manager.class.getPackage().getImplementationVersion(); @@ -456,7 +464,7 @@ class Manager implements Signal { sendMessage(message, g.members); } - public byte[] sendUpdateGroupMessage(byte[] groupId, String name, Collection members, String avatarFile) throws IOException, EncapsulatedExceptions, GroupNotFoundException, AttachmentInvalidException, UntrustedIdentityException { + public byte[] sendUpdateGroupMessage(byte[] groupId, String name, Collection members, String avatarFile, boolean quit) throws IOException, EncapsulatedExceptions, GroupNotFoundException, AttachmentInvalidException, UntrustedIdentityException { GroupInfo g; if (groupId == null) { // Create new group @@ -482,11 +490,12 @@ class Manager implements Signal { } } - SignalServiceGroup.Builder group = SignalServiceGroup.newBuilder(SignalServiceGroup.Type.UPDATE) + SignalServiceGroup.Builder group = SignalServiceGroup.newBuilder(quit?SignalServiceGroup.Type.QUIT:SignalServiceGroup.Type.UPDATE) .withId(g.groupId) .withName(g.name) .withMembers(new ArrayList<>(g.members)); + if (avatarFile != null) { try { group.withAvatar(createAttachment(avatarFile));