mirror of
https://github.com/AsamK/signal-cli
synced 2025-09-01 20:10:39 +00:00
Merge e33e3ba8f4
into 32beb8a0bd
This commit is contained in:
commit
327d43ad2d
3 changed files with 14 additions and 5 deletions
|
@ -45,6 +45,10 @@ usage: signal-cli [-h] [-v] [--config CONFIG] [-u USERNAME | --dbus | --dbus-sys
|
|||
|
||||
signal-cli -u USERNAME send -m "This is a message" -g GROUP_ID
|
||||
|
||||
* Leave a group
|
||||
|
||||
signal-cli -u USERNAME updateGroup -g GROUP_ID -q
|
||||
|
||||
* Linking other devices (Provisioning)
|
||||
|
||||
* Connect to another device
|
||||
|
|
|
@ -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.<String>getList("member"), ns.getString("avatar"));
|
||||
byte[] newGroupId = m.sendUpdateGroupMessage(groupId, ns.getString("name"), ns.<String>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 there is no '-m', use <CR>CTRL+D<CR> (aka EOF) in order to stop reading from STDIN and send 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");
|
||||
|
|
|
@ -63,6 +63,7 @@ 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();
|
||||
|
||||
|
@ -456,7 +457,7 @@ class Manager implements Signal {
|
|||
sendMessage(message, g.members);
|
||||
}
|
||||
|
||||
public byte[] sendUpdateGroupMessage(byte[] groupId, String name, Collection<String> members, String avatarFile) throws IOException, EncapsulatedExceptions, GroupNotFoundException, AttachmentInvalidException, UntrustedIdentityException {
|
||||
public byte[] sendUpdateGroupMessage(byte[] groupId, String name, Collection<String> members, String avatarFile, boolean quit) throws IOException, EncapsulatedExceptions, GroupNotFoundException, AttachmentInvalidException, UntrustedIdentityException {
|
||||
GroupInfo g;
|
||||
if (groupId == null) {
|
||||
// Create new group
|
||||
|
@ -482,11 +483,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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue