Class OmemoCachedDeviceList
java.lang.Object
org.jivesoftware.smackx.omemo.internal.OmemoCachedDeviceList
- All Implemented Interfaces:
Serializable
This class is used to represent device lists of contacts.
There are active devices (a set of device ids, which was published with the last device list update)
and inactive devices (set of devices that once were active, but are not included in recent list updates).
Both kinds are cached by the client. When a device that was active in the last update is not included in
a new update, it becomes an inactive device. Vice versa, inactive devices can also become active again, by
being included in the latest device list update.
The client ensures, that his own device id is on the list of active devices, as soon as he gets online.
- See Also:
-
Constructor Summary
ConstructorDescriptionOmemoCachedDeviceList
(Set<Integer> activeDevices, Set<Integer> inactiveDevices) OmemoCachedDeviceList
(OmemoCachedDeviceList original) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDevice
(int deviceId) Add a device to the list of active devices and remove it from inactive.void
addInactiveDevice
(int deviceId) boolean
contains
(int deviceId) Returns true if deviceId is either in the list of active or inactive devices.Returns all active devices.Returns an OmemoDeviceListElement containing all devices (active and inactive).Return all inactive devices.boolean
isActive
(int deviceId) void
Merge a device list update into the CachedDeviceList.toString()
-
Constructor Details
-
OmemoCachedDeviceList
public OmemoCachedDeviceList() -
OmemoCachedDeviceList
-
OmemoCachedDeviceList
-
-
Method Details
-
getActiveDevices
Returns all active devices. Active devices are all devices that were in the latest DeviceList update.- Returns:
- active devices
-
getInactiveDevices
Return all inactive devices. Inactive devices are devices which were in a past DeviceList update once, but were not included in the latest update.- Returns:
- inactive devices
-
getAllDevices
Returns an OmemoDeviceListElement containing all devices (active and inactive).- Returns:
- all devices
-
merge
Merge a device list update into the CachedDeviceList. The source code should be self explanatory.- Parameters:
deviceListUpdate
- received device list update
-
addDevice
Add a device to the list of active devices and remove it from inactive.- Parameters:
deviceId
- deviceId that will be added
-
addInactiveDevice
-
contains
Returns true if deviceId is either in the list of active or inactive devices.- Parameters:
deviceId
- id- Returns:
- true or false
-
isActive
-
toString
-