|
| 1 | +enum DccSessionType { chat, send, unknown } |
| 2 | + |
| 3 | +enum DccSessionStatus { pending, offering, connecting, connected, closed, failed } |
| 4 | + |
| 5 | +class DccSession { |
| 6 | + const DccSession({ |
| 7 | + required this.id, |
| 8 | + required this.tabId, |
| 9 | + required this.peerNick, |
| 10 | + required this.type, |
| 11 | + required this.status, |
| 12 | + required this.direction, |
| 13 | + this.filename, |
| 14 | + this.host, |
| 15 | + this.port, |
| 16 | + this.size, |
| 17 | + this.token, |
| 18 | + this.filePath, |
| 19 | + this.bytesTransferred = 0, |
| 20 | + this.error, |
| 21 | + }); |
| 22 | + |
| 23 | + final String id; |
| 24 | + final String tabId; |
| 25 | + final String peerNick; |
| 26 | + final DccSessionType type; |
| 27 | + final DccSessionStatus status; |
| 28 | + final String direction; |
| 29 | + final String? filename; |
| 30 | + final String? host; |
| 31 | + final int? port; |
| 32 | + final int? size; |
| 33 | + final String? token; |
| 34 | + final String? filePath; |
| 35 | + final int bytesTransferred; |
| 36 | + final String? error; |
| 37 | + |
| 38 | + DccSession copyWith({ |
| 39 | + String? id, |
| 40 | + String? tabId, |
| 41 | + String? peerNick, |
| 42 | + DccSessionType? type, |
| 43 | + DccSessionStatus? status, |
| 44 | + String? direction, |
| 45 | + String? filename, |
| 46 | + String? host, |
| 47 | + int? port, |
| 48 | + int? size, |
| 49 | + String? token, |
| 50 | + String? filePath, |
| 51 | + int? bytesTransferred, |
| 52 | + String? error, |
| 53 | + }) { |
| 54 | + return DccSession( |
| 55 | + id: id ?? this.id, |
| 56 | + tabId: tabId ?? this.tabId, |
| 57 | + peerNick: peerNick ?? this.peerNick, |
| 58 | + type: type ?? this.type, |
| 59 | + status: status ?? this.status, |
| 60 | + direction: direction ?? this.direction, |
| 61 | + filename: filename ?? this.filename, |
| 62 | + host: host ?? this.host, |
| 63 | + port: port ?? this.port, |
| 64 | + size: size ?? this.size, |
| 65 | + token: token ?? this.token, |
| 66 | + filePath: filePath ?? this.filePath, |
| 67 | + bytesTransferred: bytesTransferred ?? this.bytesTransferred, |
| 68 | + error: error ?? this.error, |
| 69 | + ); |
| 70 | + } |
| 71 | +} |
0 commit comments