mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Canonicalize number before getting/setting contact info
This commit is contained in:
parent
eca1737d28
commit
cfd1e5544d
3 changed files with 18 additions and 10 deletions
|
@ -4,6 +4,7 @@ import net.sourceforge.argparse4j.inf.Namespace;
|
|||
import net.sourceforge.argparse4j.inf.Subparser;
|
||||
|
||||
import org.asamk.signal.manager.Manager;
|
||||
import org.whispersystems.signalservice.api.util.InvalidNumberException;
|
||||
|
||||
public class UpdateContactCommand implements LocalCommand {
|
||||
|
||||
|
@ -27,7 +28,11 @@ public class UpdateContactCommand implements LocalCommand {
|
|||
String number = ns.getString("number");
|
||||
String name = ns.getString("name");
|
||||
|
||||
m.setContactName(number, name);
|
||||
try {
|
||||
m.setContactName(number, name);
|
||||
} catch (InvalidNumberException e) {
|
||||
System.out.println("Invalid contact number: " + e.getMessage());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue