]>
nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/signal/commands/ListDevicesCommand.java
a03b078fa1189d0a4fc75c38558671a46070d6af
1 package org
.asamk
.signal
.commands
;
3 import net
.sourceforge
.argparse4j
.inf
.Namespace
;
4 import net
.sourceforge
.argparse4j
.inf
.Subparser
;
6 import org
.asamk
.signal
.manager
.Manager
;
7 import org
.asamk
.signal
.util
.DateUtils
;
8 import org
.whispersystems
.signalservice
.api
.messages
.multidevice
.DeviceInfo
;
10 import java
.io
.IOException
;
11 import java
.util
.List
;
13 public class ListDevicesCommand
implements LocalCommand
{
16 public void attachToSubparser(final Subparser subparser
) {
20 public int handleCommand(final Namespace ns
, final Manager m
) {
22 List
<DeviceInfo
> devices
= m
.getLinkedDevices();
23 for (DeviceInfo d
: devices
) {
24 System
.out
.println("Device "
26 + (d
.getId() == m
.getDeviceId() ?
" (this device)" : "")
28 System
.out
.println(" Name: " + d
.getName());
29 System
.out
.println(" Created: " + DateUtils
.formatTimestamp(d
.getCreated()));
30 System
.out
.println(" Last seen: " + DateUtils
.formatTimestamp(d
.getLastSeen()));
33 } catch (IOException e
) {