mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-04-25 17:49:18 -04:00
301 lines
8.7 KiB
Dart
301 lines
8.7 KiB
Dart
import 'package:veilid_support/veilid_support.dart';
|
|
import 'veilidchat.pb.dart' as vcproto;
|
|
|
|
export 'package:veilid_support/dht_support/proto/proto.dart';
|
|
export 'package:veilid_support/proto/proto.dart';
|
|
|
|
export 'extensions.dart';
|
|
export 'veilidchat.pb.dart';
|
|
export 'veilidchat.pbenum.dart';
|
|
export 'veilidchat.pbjson.dart';
|
|
export 'veilidchat.pbserver.dart';
|
|
|
|
void registerVeilidchatProtoToDebug() {
|
|
dynamic toDebug(dynamic obj) {
|
|
if (obj is vcproto.DHTDataReference) {
|
|
return {
|
|
'dhtData': obj.dhtData,
|
|
'hash': obj.hash,
|
|
};
|
|
}
|
|
if (obj is vcproto.BlockStoreDataReference) {
|
|
return {
|
|
'block': obj.block,
|
|
};
|
|
}
|
|
if (obj is vcproto.DataReference) {
|
|
return {
|
|
'kind': obj.whichKind(),
|
|
if (obj.whichKind() == vcproto.DataReference_Kind.dhtData)
|
|
'dhtData': obj.dhtData,
|
|
if (obj.whichKind() == vcproto.DataReference_Kind.blockStoreData)
|
|
'blockStoreData': obj.blockStoreData,
|
|
};
|
|
}
|
|
if (obj is vcproto.Attachment) {
|
|
return {
|
|
'kind': obj.whichKind(),
|
|
if (obj.whichKind() == vcproto.Attachment_Kind.media)
|
|
'media': obj.media,
|
|
'signature': obj.signature,
|
|
};
|
|
}
|
|
if (obj is vcproto.AttachmentMedia) {
|
|
return {
|
|
'mime': obj.mime,
|
|
'name': obj.name,
|
|
'content': obj.content,
|
|
};
|
|
}
|
|
if (obj is vcproto.Permissions) {
|
|
return {
|
|
'canAddMembers': obj.canAddMembers,
|
|
'canEditInfo': obj.canEditInfo,
|
|
'moderated': obj.moderated,
|
|
};
|
|
}
|
|
if (obj is vcproto.Membership) {
|
|
return {
|
|
'watchers': obj.watchers,
|
|
'moderated': obj.moderated,
|
|
'talkers': obj.talkers,
|
|
'moderators': obj.moderators,
|
|
'admins': obj.admins,
|
|
};
|
|
}
|
|
if (obj is vcproto.ChatSettings) {
|
|
return {
|
|
'title': obj.title,
|
|
'description': obj.description,
|
|
'icon': obj.icon,
|
|
'defaultExpiration': obj.defaultExpiration,
|
|
};
|
|
}
|
|
if (obj is vcproto.ChatSettings) {
|
|
return {
|
|
'title': obj.title,
|
|
'description': obj.description,
|
|
'icon': obj.icon,
|
|
'defaultExpiration': obj.defaultExpiration,
|
|
};
|
|
}
|
|
if (obj is vcproto.Message) {
|
|
return {
|
|
'id': obj.id,
|
|
'author': obj.author,
|
|
'timestamp': obj.timestamp,
|
|
'kind': obj.whichKind(),
|
|
if (obj.whichKind() == vcproto.Message_Kind.text) 'text': obj.text,
|
|
if (obj.whichKind() == vcproto.Message_Kind.secret)
|
|
'secret': obj.secret,
|
|
if (obj.whichKind() == vcproto.Message_Kind.delete)
|
|
'delete': obj.delete,
|
|
if (obj.whichKind() == vcproto.Message_Kind.erase) 'erase': obj.erase,
|
|
if (obj.whichKind() == vcproto.Message_Kind.settings)
|
|
'settings': obj.settings,
|
|
if (obj.whichKind() == vcproto.Message_Kind.permissions)
|
|
'permissions': obj.permissions,
|
|
if (obj.whichKind() == vcproto.Message_Kind.membership)
|
|
'membership': obj.membership,
|
|
if (obj.whichKind() == vcproto.Message_Kind.moderation)
|
|
'moderation': obj.moderation,
|
|
'signature': obj.signature,
|
|
};
|
|
}
|
|
if (obj is vcproto.Message_Text) {
|
|
return {
|
|
'text': obj.text,
|
|
'topic': obj.topic,
|
|
'replyId': obj.replyId,
|
|
'expiration': obj.expiration,
|
|
'viewLimit': obj.viewLimit,
|
|
'attachments': obj.attachments,
|
|
};
|
|
}
|
|
if (obj is vcproto.Message_Secret) {
|
|
return {
|
|
'ciphertext': obj.ciphertext,
|
|
'expiration': obj.expiration,
|
|
};
|
|
}
|
|
if (obj is vcproto.Message_ControlDelete) {
|
|
return {
|
|
'ids': obj.ids,
|
|
};
|
|
}
|
|
if (obj is vcproto.Message_ControlErase) {
|
|
return {
|
|
'timestamp': obj.timestamp,
|
|
};
|
|
}
|
|
if (obj is vcproto.Message_ControlSettings) {
|
|
return {
|
|
'settings': obj.settings,
|
|
};
|
|
}
|
|
if (obj is vcproto.Message_ControlPermissions) {
|
|
return {
|
|
'permissions': obj.permissions,
|
|
};
|
|
}
|
|
if (obj is vcproto.Message_ControlMembership) {
|
|
return {
|
|
'membership': obj.membership,
|
|
};
|
|
}
|
|
if (obj is vcproto.Message_ControlModeration) {
|
|
return {
|
|
'acceptedIds': obj.acceptedIds,
|
|
'rejectdIds': obj.rejectedIds,
|
|
};
|
|
}
|
|
if (obj is vcproto.Message_ControlModeration) {
|
|
return {
|
|
'acceptedIds': obj.acceptedIds,
|
|
'rejectdIds': obj.rejectedIds,
|
|
};
|
|
}
|
|
if (obj is vcproto.Message_ControlReadReceipt) {
|
|
return {
|
|
'readIds': obj.readIds,
|
|
};
|
|
}
|
|
if (obj is vcproto.ReconciledMessage) {
|
|
return {
|
|
'content': obj.content,
|
|
'reconciledTime': obj.reconciledTime,
|
|
};
|
|
}
|
|
if (obj is vcproto.Conversation) {
|
|
return {
|
|
'profile': obj.profile,
|
|
'superIdentityJson': obj.superIdentityJson,
|
|
'messages': obj.messages
|
|
};
|
|
}
|
|
if (obj is vcproto.ChatMember) {
|
|
return {
|
|
'remoteIdentityPublicKey': obj.remoteIdentityPublicKey,
|
|
'remoteConversationRecordKey': obj.remoteConversationRecordKey,
|
|
};
|
|
}
|
|
if (obj is vcproto.DirectChat) {
|
|
return {
|
|
'settings': obj.settings,
|
|
'localConversationRecordKey': obj.localConversationRecordKey,
|
|
'remoteMember': obj.remoteMember,
|
|
};
|
|
}
|
|
if (obj is vcproto.GroupChat) {
|
|
return {
|
|
'settings': obj.settings,
|
|
'membership': obj.membership,
|
|
'permissions': obj.permissions,
|
|
'localConversationRecordKey': obj.localConversationRecordKey,
|
|
'remoteMembers': obj.remoteMembers,
|
|
};
|
|
}
|
|
if (obj is vcproto.Chat) {
|
|
return {
|
|
'kind': obj.whichKind(),
|
|
if (obj.whichKind() == vcproto.Chat_Kind.direct) 'direct': obj.direct,
|
|
if (obj.whichKind() == vcproto.Chat_Kind.group) 'group': obj.group,
|
|
};
|
|
}
|
|
if (obj is vcproto.Profile) {
|
|
return {
|
|
'name': obj.name,
|
|
'pronouns': obj.pronouns,
|
|
'about': obj.about,
|
|
'status': obj.status,
|
|
'availability': obj.availability,
|
|
'avatar': obj.avatar,
|
|
'timestamp': obj.timestamp,
|
|
};
|
|
}
|
|
if (obj is vcproto.Account) {
|
|
return {
|
|
'profile': obj.profile,
|
|
'invisible': obj.invisible,
|
|
'autoAwayTimeoutMin': obj.autoAwayTimeoutMin,
|
|
'contact_list': obj.contactList,
|
|
'contactInvitationRecords': obj.contactInvitationRecords,
|
|
'chatList': obj.chatList,
|
|
'groupChatList': obj.groupChatList,
|
|
'freeMessage': obj.freeMessage,
|
|
'busyMessage': obj.busyMessage,
|
|
'awayMessage': obj.awayMessage,
|
|
'autodetectAway': obj.autodetectAway,
|
|
};
|
|
}
|
|
if (obj is vcproto.Contact) {
|
|
return {
|
|
'nickname': obj.nickname,
|
|
'profile': obj.profile,
|
|
'superIdentityJson': obj.superIdentityJson,
|
|
'identityPublicKey': obj.identityPublicKey,
|
|
'remoteConversationRecordKey': obj.remoteConversationRecordKey,
|
|
'localConversationRecordKey': obj.localConversationRecordKey,
|
|
'showAvailability': obj.showAvailability,
|
|
'notes': obj.notes,
|
|
};
|
|
}
|
|
if (obj is vcproto.ContactInvitation) {
|
|
return {
|
|
'contactRequestInboxKey': obj.contactRequestInboxKey,
|
|
'writerSecret': obj.writerSecret,
|
|
};
|
|
}
|
|
if (obj is vcproto.SignedContactInvitation) {
|
|
return {
|
|
'contactInvitation': obj.contactInvitation,
|
|
'identitySignature': obj.identitySignature,
|
|
};
|
|
}
|
|
if (obj is vcproto.ContactRequest) {
|
|
return {
|
|
'encryptionKeyType': obj.encryptionKeyType,
|
|
'private': obj.private,
|
|
};
|
|
}
|
|
if (obj is vcproto.ContactRequestPrivate) {
|
|
return {
|
|
'writerKey': obj.writerKey,
|
|
'profile': obj.profile,
|
|
'superIdentityRecordKey': obj.superIdentityRecordKey,
|
|
'chatRecordKey': obj.chatRecordKey,
|
|
'expiration': obj.expiration,
|
|
};
|
|
}
|
|
if (obj is vcproto.ContactResponse) {
|
|
return {
|
|
'accept': obj.accept,
|
|
'superIdentityRecordKey': obj.superIdentityRecordKey,
|
|
'remoteConversationRecordKey': obj.remoteConversationRecordKey,
|
|
};
|
|
}
|
|
if (obj is vcproto.SignedContactResponse) {
|
|
return {
|
|
'contactResponse': obj.contactResponse,
|
|
'identitySignature': obj.identitySignature,
|
|
};
|
|
}
|
|
if (obj is vcproto.ContactInvitationRecord) {
|
|
return {
|
|
'contactRequestInbox': obj.contactRequestInbox,
|
|
'writerKey': obj.writerKey,
|
|
'writerSecret': obj.writerSecret,
|
|
'localConversationRecordKey': obj.localConversationRecordKey,
|
|
'expiration': obj.expiration,
|
|
'invitation': obj.invitation,
|
|
'message': obj.message,
|
|
'recipient': obj.recipient,
|
|
};
|
|
}
|
|
|
|
return obj;
|
|
}
|
|
|
|
DynamicDebug.registerToDebug(toDebug);
|
|
}
|