Изменение домена с rosetta-im.com на rosetta.im

This commit is contained in:
RoyceDa
2026-02-12 14:20:29 +02:00
parent e229b2d61f
commit fe5bf2bd04
114 changed files with 435 additions and 435 deletions

View File

@@ -0,0 +1,62 @@
package im.rosetta.packet;
import java.util.List;
import im.rosetta.packet.runtime.DeviceSolution;
import im.rosetta.packet.runtime.NetworkDevice;
import im.rosetta.packet.runtime.NetworkStatus;
import io.orprotocol.Stream;
import io.orprotocol.packet.Packet;
/**
* Пакет, который содержит список устройств, с которых был произведен вход в систему.
* Этот пакет может быть отправлен сервером в ответ на запрос клиента о получении списка устройств,
* или может быть отправлен сервером при обнаружении нового входа в систему с нового устройства, чтобы уведомить клиента о новом устройстве.
*/
public class Packet23DeviceList extends Packet {
private List<NetworkDevice> devices;
@Override
public void read(Stream stream) {
int deviceCount = stream.readInt16();
this.devices = new java.util.ArrayList<>();
for(int i = 0; i < deviceCount; i++) {
NetworkDevice netDevice = new NetworkDevice();
netDevice.setDeviceId(stream.readString());
netDevice.setDeviceName(stream.readString());
netDevice.setDeviceOs(stream.readString());
/**
* TODO: Использовать boolean для обозначения статуса сети, а не int8.
*/
netDevice.setNetworkStatus(NetworkStatus.fromCode(stream.readInt8()));
netDevice.setDeviceSolution(DeviceSolution.fromCode(stream.readInt8()));
this.devices.add(netDevice);
}
}
@Override
public Stream write() {
Stream stream = new Stream();
stream.writeInt16(this.packetId);
stream.writeInt16(this.devices.size());
for(NetworkDevice device : this.devices) {
stream.writeString(device.getDeviceId());
stream.writeString(device.getDeviceName());
stream.writeString(device.getDeviceOs());
stream.writeInt8(device.getNetworkStatus().getCode());
stream.writeInt8(device.getDeviceSolution().getCode());
}
return stream;
}
public List<NetworkDevice> getDevices() {
return devices;
}
public void setDevices(List<NetworkDevice> devices) {
this.devices = devices;
}
}