Files
JustAMassenger/client/lib/models/message.dart
T
SashegDev 096c4d0a2d Initial commit: JustAMessenger v0.1.0
Серверная часть (Go):
- WebSocket сервер с бинарным протоколом
- XChaCha20-Poly1305 шифрование
- zstd сжатие с дедупликацией (64KB чанки)
- SQLite хранилище (WAL режим)
- Управление гильдиями, каналами, ролями
- Федерация между серверами (ed25519)
- REST API + WebSocket endpoints

Клиентская часть (Flutter):
- Material Design 3 тёмная тема (Discord-like)
- WebSocket соединение с сервером
- Экраны: сплэш, логин, домашний, гильдии, чат
- Модели: пользователи, гильдии, каналы, сообщения, роли
- Сервисы: соединение, API, криптография, тема
- Виджеты: иконки гильдий, сообщения, ввод чата
- Web сборка (PWA)

Документация:
- AGENTS.md — контекст для ИИ ассистентов
- docs/protocol.md — спецификация протокола
2026-06-06 22:39:14 +00:00

58 lines
1.6 KiB
Dart

class Message {
final String id;
final String channelId;
final String authorId;
String? authorUsername;
List<int>? content;
bool encrypted;
List<int>? nonce;
String messageType;
String? replyTo;
bool pinned;
DateTime? editedAt;
final DateTime createdAt;
bool sending;
bool failed;
List<String>? attachments;
Message({
required this.id,
required this.channelId,
required this.authorId,
this.authorUsername,
this.content,
this.encrypted = false,
this.nonce,
this.messageType = 'text',
this.replyTo,
this.pinned = false,
this.editedAt,
DateTime? createdAt,
this.sending = false,
this.failed = false,
this.attachments,
}) : createdAt = createdAt ?? DateTime.now();
factory Message.fromJson(Map<String, dynamic> json) {
return Message(
id: json['id'] as String,
channelId: json['channel_id'] as String,
authorId: json['author_id'] as String,
authorUsername: json['username'] as String?,
content: (json['content'] as List<dynamic>?)?.cast<int>(),
encrypted: json['encrypted'] as bool? ?? false,
nonce: (json['nonce'] as List<dynamic>?)?.cast<int>(),
messageType: json['message_type'] as String? ?? 'text',
replyTo: json['reply_to'] as String?,
pinned: json['pinned'] as bool? ?? false,
editedAt: json['edited_at'] != null
? DateTime.parse(json['edited_at'] as String)
: null,
createdAt: json['created_at'] != null
? DateTime.parse(json['created_at'] as String)
: DateTime.now(),
attachments: (json['attachments'] as List<dynamic>?)?.cast<String>(),
);
}
}