mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
Add --delete-account argument to completely delete an account
This commit is contained in:
parent
c79860b493
commit
0091c1cf26
3 changed files with 21 additions and 1 deletions
|
@ -406,6 +406,11 @@ public class Manager implements Closeable {
|
||||||
// If this is the master device, other users can't send messages to this number anymore.
|
// If this is the master device, other users can't send messages to this number anymore.
|
||||||
// If this is a linked device, other users can still send messages, but this device doesn't receive them anymore.
|
// If this is a linked device, other users can still send messages, but this device doesn't receive them anymore.
|
||||||
accountManager.setGcmId(Optional.absent());
|
accountManager.setGcmId(Optional.absent());
|
||||||
|
|
||||||
|
account.setRegistered(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteAccount() throws IOException {
|
||||||
accountManager.deleteAccount();
|
accountManager.deleteAccount();
|
||||||
|
|
||||||
account.setRegistered(false);
|
account.setRegistered(false);
|
||||||
|
|
|
@ -92,6 +92,12 @@ If this is the master device, other users can't send messages to this number any
|
||||||
Use "updateAccount" to undo this.
|
Use "updateAccount" to undo this.
|
||||||
To remove a linked device, use "removeDevice" from the master device.
|
To remove a linked device, use "removeDevice" from the master device.
|
||||||
|
|
||||||
|
*--delete-account*::
|
||||||
|
Delete account completely from server. Cannot be undone without loss. You will
|
||||||
|
have to be readded to each group.
|
||||||
|
|
||||||
|
CAUTION: Only delete your account if you won't use this number again!
|
||||||
|
|
||||||
=== updateAccount
|
=== updateAccount
|
||||||
|
|
||||||
Update the account attributes on the signal server.
|
Update the account attributes on the signal server.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.asamk.signal.commands;
|
package org.asamk.signal.commands;
|
||||||
|
|
||||||
|
import net.sourceforge.argparse4j.impl.Arguments;
|
||||||
import net.sourceforge.argparse4j.inf.Namespace;
|
import net.sourceforge.argparse4j.inf.Namespace;
|
||||||
import net.sourceforge.argparse4j.inf.Subparser;
|
import net.sourceforge.argparse4j.inf.Subparser;
|
||||||
|
|
||||||
|
@ -14,13 +15,21 @@ public class UnregisterCommand implements LocalCommand {
|
||||||
@Override
|
@Override
|
||||||
public void attachToSubparser(final Subparser subparser) {
|
public void attachToSubparser(final Subparser subparser) {
|
||||||
subparser.help("Unregister the current device from the signal server.");
|
subparser.help("Unregister the current device from the signal server.");
|
||||||
|
subparser.addArgument("--delete-account")
|
||||||
|
.help("Delete account completely from server. CAUTION: Only do this if you won't use this number again!")
|
||||||
|
.action(Arguments.storeTrue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleCommand(final Namespace ns, final Manager m) throws CommandException {
|
public void handleCommand(final Namespace ns, final Manager m) throws CommandException {
|
||||||
try {
|
try {
|
||||||
m.unregister();
|
if (ns.getBoolean("delete_account")) {
|
||||||
|
m.deleteAccount();
|
||||||
|
} else {
|
||||||
|
m.unregister();
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
throw new IOErrorException("Unregister error: " + e.getMessage());
|
throw new IOErrorException("Unregister error: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue